Mercurial > hg > xemacs-beta
comparison src/process.c @ 4990:8f0cf4fd3d2c
Automatic merge
| author | Ben Wing <ben@xemacs.org> |
|---|---|
| date | Sat, 06 Feb 2010 04:01:46 -0600 |
| parents | 16112448d484 |
| children | ae48681c47fa |
comparison
equal
deleted
inserted
replaced
| 4989:d2ec55325515 | 4990:8f0cf4fd3d2c |
|---|---|
| 157 print_internal (process->name, printcharfun, 0); | 157 print_internal (process->name, printcharfun, 0); |
| 158 } | 158 } |
| 159 else | 159 else |
| 160 { | 160 { |
| 161 int netp = network_connection_p (obj); | 161 int netp = network_connection_p (obj); |
| 162 write_c_string (printcharfun, | 162 write_ascstring (printcharfun, |
| 163 netp ? GETTEXT ("#<network connection ") : | 163 netp ? GETTEXT ("#<network connection ") : |
| 164 GETTEXT ("#<process ")); | 164 GETTEXT ("#<process ")); |
| 165 print_internal (process->name, printcharfun, 1); | 165 print_internal (process->name, printcharfun, 1); |
| 166 write_c_string (printcharfun, (netp ? " " : " pid ")); | 166 write_ascstring (printcharfun, (netp ? " " : " pid ")); |
| 167 print_internal (process->pid, printcharfun, 1); | 167 print_internal (process->pid, printcharfun, 1); |
| 168 write_fmt_string_lisp (printcharfun, " state:%S", 1, process->status_symbol); | 168 write_fmt_string_lisp (printcharfun, " state:%S", 1, process->status_symbol); |
| 169 MAYBE_PROCMETH (print_process_data, (process, printcharfun)); | 169 MAYBE_PROCMETH (print_process_data, (process, printcharfun)); |
| 170 write_c_string (printcharfun, ">"); | 170 write_ascstring (printcharfun, ">"); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 #ifdef HAVE_WINDOW_SYSTEM | 174 #ifdef HAVE_WINDOW_SYSTEM |
| 175 extern void debug_process_finalization (Lisp_Process *p); | 175 extern void debug_process_finalization (Lisp_Process *p); |
| 190 | 190 |
| 191 if (p->process_data) | 191 if (p->process_data) |
| 192 { | 192 { |
| 193 MAYBE_PROCMETH (finalize_process_data, (p, for_disksave)); | 193 MAYBE_PROCMETH (finalize_process_data, (p, for_disksave)); |
| 194 if (!for_disksave) | 194 if (!for_disksave) |
| 195 xfree (p->process_data, void *); | 195 xfree (p->process_data); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 DEFINE_LRECORD_IMPLEMENTATION ("process", process, | 199 DEFINE_LRECORD_IMPLEMENTATION ("process", process, |
| 200 0, /*dumpable-flag*/ | 200 0, /*dumpable-flag*/ |
| 452 /************************************************************************/ | 452 /************************************************************************/ |
| 453 /* creating a process */ | 453 /* creating a process */ |
| 454 /************************************************************************/ | 454 /************************************************************************/ |
| 455 | 455 |
| 456 DOESNT_RETURN | 456 DOESNT_RETURN |
| 457 report_process_error (const char *string, Lisp_Object data) | 457 report_process_error (const Ascbyte *reason, Lisp_Object data) |
| 458 { | 458 { |
| 459 report_error_with_errno (Qprocess_error, string, data); | 459 report_error_with_errno (Qprocess_error, reason, data); |
| 460 } | 460 } |
| 461 | 461 |
| 462 DOESNT_RETURN | 462 DOESNT_RETURN |
| 463 report_network_error (const char *string, Lisp_Object data) | 463 report_network_error (const Ascbyte *reason, Lisp_Object data) |
| 464 { | 464 { |
| 465 report_error_with_errno (Qnetwork_error, string, data); | 465 report_error_with_errno (Qnetwork_error, reason, data); |
| 466 } | 466 } |
| 467 | 467 |
| 468 Lisp_Object | 468 Lisp_Object |
| 469 make_process_internal (Lisp_Object name) | 469 make_process_internal (Lisp_Object name) |
| 470 { | 470 { |
| 477 | 477 |
| 478 /* If name is already in use, modify it until it is unused. */ | 478 /* If name is already in use, modify it until it is unused. */ |
| 479 name1 = name; | 479 name1 = name; |
| 480 for (i = 1; ; i++) | 480 for (i = 1; ; i++) |
| 481 { | 481 { |
| 482 char suffix[10]; | 482 Ascbyte suffix[10]; |
| 483 Lisp_Object tem = Fget_process (name1); | 483 Lisp_Object tem = Fget_process (name1); |
| 484 if (NILP (tem)) | 484 if (NILP (tem)) |
| 485 break; | 485 break; |
| 486 sprintf (suffix, "<%d>", i); | 486 sprintf (suffix, "<%d>", i); |
| 487 name1 = concat2 (name, build_string (suffix)); | 487 name1 = concat2 (name, build_ascstring (suffix)); |
| 488 } | 488 } |
| 489 name = name1; | 489 name = name1; |
| 490 p->name = name; | 490 p->name = name; |
| 491 | 491 |
| 492 p->mark = Fmake_marker (); | 492 p->mark = Fmake_marker (); |
| 744 ending, e.g. .exe */ | 744 ending, e.g. .exe */ |
| 745 struct gcpro ngcpro1; | 745 struct gcpro ngcpro1; |
| 746 | 746 |
| 747 tem = Qnil; | 747 tem = Qnil; |
| 748 NGCPRO1 (tem); | 748 NGCPRO1 (tem); |
| 749 locate_file (list1 (build_string ("")), program, Vlisp_EXEC_SUFFIXES, | 749 locate_file (list1 (build_ascstring ("")), program, Vlisp_EXEC_SUFFIXES, |
| 750 &tem, X_OK); | 750 &tem, X_OK); |
| 751 if (NILP (tem)) | 751 if (NILP (tem)) |
| 752 signal_error (Qprocess_error, "Searching for program", program); | 752 signal_error (Qprocess_error, "Searching for program", program); |
| 753 program = tem; | 753 program = tem; |
| 754 NUNGCPRO; | 754 NUNGCPRO; |
| 1568 int coredump = p->core_dumped; | 1568 int coredump = p->core_dumped; |
| 1569 Lisp_Object string, string2; | 1569 Lisp_Object string, string2; |
| 1570 | 1570 |
| 1571 if (EQ (symbol, Qsignal) || EQ (symbol, Qstop)) | 1571 if (EQ (symbol, Qsignal) || EQ (symbol, Qstop)) |
| 1572 { | 1572 { |
| 1573 string = build_string (signal_name (code)); | 1573 string = build_cistring (signal_name (code)); |
| 1574 if (coredump) | 1574 if (coredump) |
| 1575 string2 = build_msg_string (" (core dumped)\n"); | 1575 string2 = build_msg_string (" (core dumped)\n"); |
| 1576 else | 1576 else |
| 1577 string2 = build_string ("\n"); | 1577 string2 = build_ascstring ("\n"); |
| 1578 set_string_char (string, 0, | 1578 set_string_char (string, 0, |
| 1579 DOWNCASE (0, string_ichar (string, 0))); | 1579 DOWNCASE (0, string_ichar (string, 0))); |
| 1580 return concat2 (string, string2); | 1580 return concat2 (string, string2); |
| 1581 } | 1581 } |
| 1582 else if (EQ (symbol, Qexit)) | 1582 else if (EQ (symbol, Qexit)) |
| 1585 return build_msg_string ("finished\n"); | 1585 return build_msg_string ("finished\n"); |
| 1586 string = Fnumber_to_string (make_int (code)); | 1586 string = Fnumber_to_string (make_int (code)); |
| 1587 if (coredump) | 1587 if (coredump) |
| 1588 string2 = build_msg_string (" (core dumped)\n"); | 1588 string2 = build_msg_string (" (core dumped)\n"); |
| 1589 else | 1589 else |
| 1590 string2 = build_string ("\n"); | 1590 string2 = build_ascstring ("\n"); |
| 1591 return concat2 (build_msg_string ("exited abnormally with code "), | 1591 return concat2 (build_msg_string ("exited abnormally with code "), |
| 1592 concat2 (string, string2)); | 1592 concat2 (string, string2)); |
| 1593 } | 1593 } |
| 1594 else | 1594 else |
| 1595 return Fcopy_sequence (Fsymbol_name (symbol)); | 1595 return Fcopy_sequence (Fsymbol_name (symbol)); |
| 1694 { | 1694 { |
| 1695 struct gcpro ngcpro1; | 1695 struct gcpro ngcpro1; |
| 1696 int spec = process_setup_for_insertion (process, 0); | 1696 int spec = process_setup_for_insertion (process, 0); |
| 1697 | 1697 |
| 1698 NGCPRO1 (process); | 1698 NGCPRO1 (process); |
| 1699 buffer_insert_c_string (current_buffer, "\nProcess "); | 1699 buffer_insert_ascstring (current_buffer, "\nProcess "); |
| 1700 Finsert (1, &p->name); | 1700 Finsert (1, &p->name); |
| 1701 buffer_insert_c_string (current_buffer, " "); | 1701 buffer_insert_ascstring (current_buffer, " "); |
| 1702 Finsert (1, &msg); | 1702 Finsert (1, &msg); |
| 1703 Fset_marker (p->mark, make_int (BUF_PT (current_buffer)), | 1703 Fset_marker (p->mark, make_int (BUF_PT (current_buffer)), |
| 1704 p->buffer); | 1704 p->buffer); |
| 1705 | 1705 |
| 1706 unbind_to (spec); | 1706 unbind_to (spec); |
| 2306 && ! memcmp (XSTRING_DATA (entry), var, varlen) | 2306 && ! memcmp (XSTRING_DATA (entry), var, varlen) |
| 2307 #endif /* not WIN32_NATIVE */ | 2307 #endif /* not WIN32_NATIVE */ |
| 2308 ) | 2308 ) |
| 2309 { | 2309 { |
| 2310 XCAR (scan) = concat3 (make_string (var, varlen), | 2310 XCAR (scan) = concat3 (make_string (var, varlen), |
| 2311 build_string ("="), | 2311 build_ascstring ("="), |
| 2312 make_string (value, valuelen)); | 2312 make_string (value, valuelen)); |
| 2313 return; | 2313 return; |
| 2314 } | 2314 } |
| 2315 } | 2315 } |
| 2316 | 2316 |
| 2317 Vprocess_environment = Fcons (concat3 (make_string (var, varlen), | 2317 Vprocess_environment = Fcons (concat3 (make_string (var, varlen), |
| 2318 build_string ("="), | 2318 build_ascstring ("="), |
| 2319 make_string (value, valuelen)), | 2319 make_string (value, valuelen)), |
| 2320 Vprocess_environment); | 2320 Vprocess_environment); |
| 2321 } | 2321 } |
| 2322 | 2322 |
| 2323 /* NOTE: | 2323 /* NOTE: |
| 2346 VAR is a string, the name of the variable. | 2346 VAR is a string, the name of the variable. |
| 2347 When invoked interactively, prints the value in the echo area. | 2347 When invoked interactively, prints the value in the echo area. |
| 2348 */ | 2348 */ |
| 2349 (var, interactivep)) | 2349 (var, interactivep)) |
| 2350 { | 2350 { |
| 2351 Ibyte *value; | 2351 Ibyte *value = NULL; |
| 2352 Bytecount valuelen; | 2352 Bytecount valuelen; |
| 2353 Lisp_Object v = Qnil; | 2353 Lisp_Object v = Qnil; |
| 2354 struct gcpro gcpro1; | 2354 struct gcpro gcpro1; |
| 2355 | 2355 |
| 2356 CHECK_STRING (var); | 2356 CHECK_STRING (var); |
| 2432 Vprocess_environment = Qnil; | 2432 Vprocess_environment = Qnil; |
| 2433 #ifdef WIN32_NATIVE | 2433 #ifdef WIN32_NATIVE |
| 2434 _wgetenv (L""); /* force initialization of _wenviron */ | 2434 _wgetenv (L""); /* force initialization of _wenviron */ |
| 2435 for (envp = (Extbyte **) _wenviron; envp && *envp; envp++) | 2435 for (envp = (Extbyte **) _wenviron; envp && *envp; envp++) |
| 2436 Vprocess_environment = | 2436 Vprocess_environment = |
| 2437 Fcons (build_ext_string (*envp, Qmswindows_unicode), | 2437 Fcons (build_extstring (*envp, Qmswindows_unicode), |
| 2438 Vprocess_environment); | 2438 Vprocess_environment); |
| 2439 #else | 2439 #else |
| 2440 for (envp = environ; envp && *envp; envp++) | 2440 for (envp = environ; envp && *envp; envp++) |
| 2441 Vprocess_environment = | 2441 Vprocess_environment = |
| 2442 Fcons (build_ext_string (*envp, Qenvironment_variable_encoding), | 2442 Fcons (build_extstring (*envp, Qenvironment_variable_encoding), |
| 2443 Vprocess_environment); | 2443 Vprocess_environment); |
| 2444 #endif | 2444 #endif |
| 2445 /* This gets set back to 0 in disksave_object_finalization() */ | 2445 /* This gets set back to 0 in disksave_object_finalization() */ |
| 2446 env_initted = 1; | 2446 env_initted = 1; |
| 2447 } | 2447 } |
| 2477 | 2477 |
| 2478 if (!egetenv ("SHELL")) | 2478 if (!egetenv ("SHELL")) |
| 2479 { | 2479 { |
| 2480 Ibyte *faux_var = alloca_ibytes (7 + qxestrlen (shell)); | 2480 Ibyte *faux_var = alloca_ibytes (7 + qxestrlen (shell)); |
| 2481 qxesprintf (faux_var, "SHELL=%s", shell); | 2481 qxesprintf (faux_var, "SHELL=%s", shell); |
| 2482 Vprocess_environment = Fcons (build_intstring (faux_var), | 2482 Vprocess_environment = Fcons (build_istring (faux_var), |
| 2483 Vprocess_environment); | 2483 Vprocess_environment); |
| 2484 } | 2484 } |
| 2485 #endif /* 0 */ | 2485 #endif /* 0 */ |
| 2486 | 2486 |
| 2487 Vshell_file_name = build_intstring (shell); | 2487 Vshell_file_name = build_istring (shell); |
| 2488 } | 2488 } |
| 2489 } | 2489 } |
| 2490 | 2490 |
| 2491 void | 2491 void |
| 2492 syms_of_process (void) | 2492 syms_of_process (void) |
| 2603 it sends a non-ending stream of zero bytes. It's used most often along | 2603 it sends a non-ending stream of zero bytes. It's used most often along |
| 2604 with memory-mapping. We don't provide a Lisp variable for this because | 2604 with memory-mapping. We don't provide a Lisp variable for this because |
| 2605 the operations needing this are lower level than what ELisp programs | 2605 the operations needing this are lower level than what ELisp programs |
| 2606 typically do, and in any case no equivalent exists under native MS Windows. | 2606 typically do, and in any case no equivalent exists under native MS Windows. |
| 2607 */ ); | 2607 */ ); |
| 2608 Vnull_device = build_string (NULL_DEVICE); | 2608 Vnull_device = build_ascstring (NULL_DEVICE); |
| 2609 | 2609 |
| 2610 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type /* | 2610 DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type /* |
| 2611 Control type of device used to communicate with subprocesses. | 2611 Control type of device used to communicate with subprocesses. |
| 2612 Values are nil to use a pipe, or t or `pty' to use a pty. | 2612 Values are nil to use a pipe, or t or `pty' to use a pty. |
| 2613 The value has no effect if the system has no ptys or if all ptys are busy: | 2613 The value has no effect if the system has no ptys or if all ptys are busy: |
| 2683 Each element should be a string of the form ENVVARNAME=VALUE. | 2683 Each element should be a string of the form ENVVARNAME=VALUE. |
| 2684 The environment which Emacs inherits is placed in this variable | 2684 The environment which Emacs inherits is placed in this variable |
| 2685 when Emacs starts. | 2685 when Emacs starts. |
| 2686 */ ); | 2686 */ ); |
| 2687 | 2687 |
| 2688 Vlisp_EXEC_SUFFIXES = build_string (EXEC_SUFFIXES); | 2688 Vlisp_EXEC_SUFFIXES = build_ascstring (EXEC_SUFFIXES); |
| 2689 staticpro (&Vlisp_EXEC_SUFFIXES); | 2689 staticpro (&Vlisp_EXEC_SUFFIXES); |
| 2690 } | 2690 } |
