comparison src/process.c @ 4729:428d7c571110

Fix issue145: accept nil in default-process-coding-system.
author Stephen J. Turnbull <stephen@xemacs.org>
date Mon, 02 Nov 2009 12:09:13 +0900
parents 80cd90837ac5
children aa5ed11f473b
comparison
equal deleted inserted replaced
4727:90dbf8e772b6 4729:428d7c571110
110 110
111 /* Hash table which maps USIDs as returned by create_io_streams_cb to 111 /* Hash table which maps USIDs as returned by create_io_streams_cb to
112 process objects. Processes are not GC-protected through this! */ 112 process objects. Processes are not GC-protected through this! */
113 struct hash_table *usid_to_process; 113 struct hash_table *usid_to_process;
114 114
115 /* List of process objects. */ 115 /* Read-only to Lisp. See DEFUN Fprocess_list. */
116 Lisp_Object Vprocess_list; 116 Lisp_Object Vprocess_list;
117 117
118 /* Lisp variables; see docstrings below. */
118 Lisp_Object Vnull_device; 119 Lisp_Object Vnull_device;
119
120 /* Cons of coding systems used to initialize process I/O on a newly-
121 created process. */
122 Lisp_Object Vdefault_process_coding_system; 120 Lisp_Object Vdefault_process_coding_system;
123 /* Same for a network connection. */
124 Lisp_Object Vdefault_network_coding_system; 121 Lisp_Object Vdefault_network_coding_system;
125
126 Lisp_Object Qprocess_error; 122 Lisp_Object Qprocess_error;
127 Lisp_Object Qnetwork_error; 123 Lisp_Object Qnetwork_error;
128
129 Fixnum debug_process_io; 124 Fixnum debug_process_io;
130
131 Lisp_Object Vshell_file_name; 125 Lisp_Object Vshell_file_name;
132
133 /* The environment to pass to all subprocesses when they are started.
134 This is in the semi-bogus format of ("VAR=VAL" "VAR2=VAL2" ... )
135 */
136 Lisp_Object Vprocess_environment; 126 Lisp_Object Vprocess_environment;
137 127
138 /* Make sure egetenv() not called too soon */ 128 /* Make sure egetenv() not called too soon */
139 int env_initted; 129 int env_initted;
140 130
131 /* Internal Lisp variable. */
141 Lisp_Object Vlisp_EXEC_SUFFIXES; 132 Lisp_Object Vlisp_EXEC_SUFFIXES;
142 133
143 134
144 135
145 static const struct memory_description process_description [] = { 136 static const struct memory_description process_description [] = {
521 USID in_usid, err_usid; 512 USID in_usid, err_usid;
522 Lisp_Object incode, outcode; 513 Lisp_Object incode, outcode;
523 514
524 if (flags & STREAM_NETWORK_CONNECTION) 515 if (flags & STREAM_NETWORK_CONNECTION)
525 { 516 {
526 if (!CONSP (Vdefault_network_coding_system) || 517 if (!LISTP (Vdefault_network_coding_system) ||
527 NILP (incode = (find_coding_system_for_text_file 518 NILP (incode = (find_coding_system_for_text_file
528 (Fcar (Vdefault_network_coding_system), 1))) || 519 (Fcar (Vdefault_network_coding_system), 1))) ||
529 NILP (outcode = (find_coding_system_for_text_file 520 NILP (outcode = (find_coding_system_for_text_file
530 (Fcdr (Vdefault_network_coding_system), 0)))) 521 (Fcdr (Vdefault_network_coding_system), 0))))
531 signal_error (Qinvalid_state, 522 signal_error (Qinvalid_state,
532 "Bogus value for `default-network-coding-system'", 523 "Bogus value for `default-network-coding-system'",
533 Vdefault_network_coding_system); 524 Vdefault_network_coding_system);
534 } 525 }
535 else 526 else
536 { 527 {
537 if (!CONSP (Vdefault_process_coding_system) || 528 if (!LISTP (Vdefault_process_coding_system) ||
538 NILP (incode = (find_coding_system_for_text_file 529 NILP (incode = (find_coding_system_for_text_file
539 (Fcar (Vdefault_process_coding_system), 1))) || 530 (Fcar (Vdefault_process_coding_system), 1))) ||
540 NILP (outcode = (find_coding_system_for_text_file 531 NILP (outcode = (find_coding_system_for_text_file
541 (Fcdr (Vdefault_process_coding_system), 0)))) 532 (Fcdr (Vdefault_process_coding_system), 0))))
542 signal_error (Qinvalid_state, 533 signal_error (Qinvalid_state,
2654 debug_process_io = 0; 2645 debug_process_io = 0;
2655 2646
2656 DEFVAR_LISP ("default-process-coding-system", 2647 DEFVAR_LISP ("default-process-coding-system",
2657 &Vdefault_process_coding_system /* 2648 &Vdefault_process_coding_system /*
2658 Cons of coding systems used for process I/O by default. 2649 Cons of coding systems used for process I/O by default.
2650 May also be nil, interpreted as (nil . nil).
2659 The car part is used for reading (decoding) data from a process, and 2651 The car part is used for reading (decoding) data from a process, and
2660 the cdr part is used for writing (encoding) data to a process. 2652 the cdr part is used for writing (encoding) data to a process.
2661 */ ); 2653 */ );
2662 /* This below will get its default set correctly in code-init.el. */ 2654 /* Better, system-dependent defaults are set in code-init.el. */
2663 Vdefault_process_coding_system = Fcons (Qundecided, Qnil); 2655 Vdefault_process_coding_system = Fcons (Qundecided, Qnil);
2664 2656
2665 DEFVAR_LISP ("default-network-coding-system", 2657 DEFVAR_LISP ("default-network-coding-system",
2666 &Vdefault_network_coding_system /* 2658 &Vdefault_network_coding_system /*
2667 Cons of coding systems used for network I/O by default. 2659 Cons of coding systems used for network I/O by default.
2660 May also be nil, interpreted as (nil . nil).
2668 The car part is used for reading (decoding) data from a process, and 2661 The car part is used for reading (decoding) data from a process, and
2669 the cdr part is used for writing (encoding) data to a process. 2662 the cdr part is used for writing (encoding) data to a process.
2670 */ ); 2663 */ );
2671 Vdefault_network_coding_system = Fcons (Qundecided, Qnil); 2664 Vdefault_network_coding_system = Fcons (Qundecided, Qnil);
2672 2665
2683 DEFVAR_LISP ("shell-file-name", &Vshell_file_name /* 2676 DEFVAR_LISP ("shell-file-name", &Vshell_file_name /*
2684 *File name to load inferior shells from. 2677 *File name to load inferior shells from.
2685 Initialized from the SHELL environment variable. 2678 Initialized from the SHELL environment variable.
2686 */ ); 2679 */ );
2687 2680
2681 /* ben? thinks the format of this variable is "semi-bogus".
2682 sjt doesn't agree, since it captures a restriction that is
2683 present in POSIX shells, after all. */
2688 DEFVAR_LISP ("process-environment", &Vprocess_environment /* 2684 DEFVAR_LISP ("process-environment", &Vprocess_environment /*
2689 List of environment variables for subprocesses to inherit. 2685 List of environment variables for subprocesses to inherit.
2690 Each element should be a string of the form ENVVARNAME=VALUE. 2686 Each element should be a string of the form ENVVARNAME=VALUE.
2691 The environment which Emacs inherits is placed in this variable 2687 The environment which Emacs inherits is placed in this variable
2692 when Emacs starts. 2688 when Emacs starts.