aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorKenichi Handa1997-02-27 07:48:21 +0000
committerKenichi Handa1997-02-27 07:48:21 +0000
commitc758053843c970f6728f5168bcd5c866b6a0d0e5 (patch)
tree1c473e15afdfdae30d7456d3f88e212984d21843 /src/process.c
parent908b7fea57959f6ff21ffc05935640daac6c155a (diff)
downloademacs-c758053843c970f6728f5168bcd5c866b6a0d0e5.tar.gz
emacs-c758053843c970f6728f5168bcd5c866b6a0d0e5.zip
(Fstart_process, Fopen_network_stream): Do not perform
character code conversion if enable-multibyte-characters is nil.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c180
1 files changed, 104 insertions, 76 deletions
diff --git a/src/process.c b/src/process.c
index 489627eb1ac..fe1cd20c1c0 100644
--- a/src/process.c
+++ b/src/process.c
@@ -249,8 +249,8 @@ Lisp_Object Vprocess_alist;
249int proc_buffered_char[MAXDESC]; 249int proc_buffered_char[MAXDESC];
250 250
251/* Table of `struct coding-system' for each process. */ 251/* Table of `struct coding-system' for each process. */
252static struct coding_system proc_decode_coding_system[MAXDESC]; 252static struct coding_system *proc_decode_coding_system[MAXDESC];
253static struct coding_system proc_encode_coding_system[MAXDESC]; 253static struct coding_system *proc_encode_coding_system[MAXDESC];
254 254
255static Lisp_Object get_process (); 255static Lisp_Object get_process ();
256 256
@@ -1154,42 +1154,49 @@ Remaining arguments are strings to give program as arguments.")
1154 Fset_marker (XPROCESS (proc)->mark, 1154 Fset_marker (XPROCESS (proc)->mark,
1155 make_number (BUF_ZV (XBUFFER (buffer))), buffer); 1155 make_number (BUF_ZV (XBUFFER (buffer))), buffer);
1156 1156
1157 /* Setup coding systems for communicating with the process. */ 1157 if (!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)
1158 { 1158 || NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))
1159 /* Qt denotes that we have not yet called Ffind_coding_system. */ 1159 {
1160 Lisp_Object coding_systems = Qt; 1160 XPROCESS (proc)->decode_coding_system = Qnil;
1161 Lisp_Object val, *args2; 1161 XPROCESS (proc)->encode_coding_system = Qnil;
1162 struct gcpro gcpro1; 1162 }
1163 else
1164 {
1165 /* Setup coding systems for communicating with the process. */
1166 /* Qt denotes that we have not yet called Ffind_coding_system. */
1167 Lisp_Object coding_systems = Qt;
1168 Lisp_Object val, *args2;
1169 struct gcpro gcpro1;
1163 1170
1164 if (NILP (val = Vcoding_system_for_read)) 1171 if (NILP (val = Vcoding_system_for_read))
1165 { 1172 {
1166 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 1173 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
1167 args2[0] = Qstart_process; 1174 args2[0] = Qstart_process;
1168 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 1175 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
1169 GCPRO1 (proc); 1176 GCPRO1 (proc);
1170 coding_systems = Ffind_coding_system (nargs + 1, args2); 1177 coding_systems = Ffind_coding_system (nargs + 1, args2);
1171 UNGCPRO; 1178 UNGCPRO;
1172 if (CONSP (coding_systems)) 1179 if (CONSP (coding_systems))
1173 val = XCONS (coding_systems)->car; 1180 val = XCONS (coding_systems)->car;
1174 } 1181 }
1175 XPROCESS (proc)->decode_coding_system = val; 1182 XPROCESS (proc)->decode_coding_system = val;
1176 1183
1177 if (NILP (val = Vcoding_system_for_write)) 1184 if (NILP (val = Vcoding_system_for_write))
1178 { 1185 {
1179 if (EQ (coding_systems, Qt)) 1186 if (EQ (coding_systems, Qt))
1180 { 1187 {
1181 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof args2); 1188 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof args2);
1182 args2[0] = Qstart_process; 1189 args2[0] = Qstart_process;
1183 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 1190 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
1184 GCPRO1 (proc); 1191 GCPRO1 (proc);
1185 coding_systems = Ffind_coding_system (nargs + 1, args2); 1192 coding_systems = Ffind_coding_system (nargs + 1, args2);
1186 UNGCPRO; 1193 UNGCPRO;
1187 } 1194 }
1188 if (CONSP (coding_systems)) 1195 if (CONSP (coding_systems))
1189 val = XCONS (coding_systems)->cdr; 1196 val = XCONS (coding_systems)->cdr;
1190 } 1197 }
1191 XPROCESS (proc)->encode_coding_system = val; 1198 XPROCESS (proc)->encode_coding_system = val;
1192 } 1199 }
1193 1200
1194 XPROCESS (proc)->decoding_buf = make_uninit_string (0); 1201 XPROCESS (proc)->decoding_buf = make_uninit_string (0);
1195 XPROCESS (proc)->encoding_buf = make_uninit_string (0); 1202 XPROCESS (proc)->encoding_buf = make_uninit_string (0);
@@ -1356,10 +1363,16 @@ create_process (process, new_argv, current_dir)
1356 XSETFASTINT (XPROCESS (process)->subtty, forkin); 1363 XSETFASTINT (XPROCESS (process)->subtty, forkin);
1357 XPROCESS (process)->pty_flag = (pty_flag ? Qt : Qnil); 1364 XPROCESS (process)->pty_flag = (pty_flag ? Qt : Qnil);
1358 XPROCESS (process)->status = Qrun; 1365 XPROCESS (process)->status = Qrun;
1366 if (!proc_decode_coding_system[inchannel])
1367 proc_decode_coding_system[inchannel]
1368 = (struct coding_system *) xmalloc (sizeof (struct coding_system));
1359 setup_coding_system (XPROCESS (process)->decode_coding_system, 1369 setup_coding_system (XPROCESS (process)->decode_coding_system,
1360 &proc_decode_coding_system[inchannel]); 1370 proc_decode_coding_system[inchannel]);
1371 if (!proc_encode_coding_system[outchannel])
1372 proc_encode_coding_system[outchannel]
1373 = (struct coding_system *) xmalloc (sizeof (struct coding_system));
1361 setup_coding_system (XPROCESS (process)->encode_coding_system, 1374 setup_coding_system (XPROCESS (process)->encode_coding_system,
1362 &proc_encode_coding_system[outchannel]); 1375 proc_encode_coding_system[outchannel]);
1363 1376
1364 /* Delay interrupts until we have a chance to store 1377 /* Delay interrupts until we have a chance to store
1365 the new fork's pid in its process structure */ 1378 the new fork's pid in its process structure */
@@ -1871,43 +1884,56 @@ Fourth arg SERVICE is name of the service desired, or an integer\n\
1871 if (inch > max_process_desc) 1884 if (inch > max_process_desc)
1872 max_process_desc = inch; 1885 max_process_desc = inch;
1873 1886
1874 /* Setup coding systems for communicating with the network stream. */ 1887 if (!NILP (buffer) && NILP (XBUFFER (buffer)->enable_multibyte_characters)
1875 { 1888 || NILP (buffer) && NILP (buffer_defaults.enable_multibyte_characters))
1876 struct gcpro gcpro1; 1889 {
1877 /* Qt denotes that we have not yet called Ffind_coding_system. */ 1890 XPROCESS (proc)->decode_coding_system = Qnil;
1878 Lisp_Object coding_systems = Qt; 1891 XPROCESS (proc)->encode_coding_system = Qnil;
1879 Lisp_Object args[5], val; 1892 }
1893 else
1894 {
1895 /* Setup coding systems for communicating with the network stream. */
1896 struct gcpro gcpro1;
1897 /* Qt denotes that we have not yet called Ffind_coding_system. */
1898 Lisp_Object coding_systems = Qt;
1899 Lisp_Object args[5], val;
1880 1900
1881 if (NILP (val = Vcoding_system_for_read)) 1901 if (NILP (val = Vcoding_system_for_read))
1882 { 1902 {
1883 args[0] = Qopen_network_stream, args[1] = name, 1903 args[0] = Qopen_network_stream, args[1] = name,
1884 args[2] = buffer, args[3] = host, args[4] = service; 1904 args[2] = buffer, args[3] = host, args[4] = service;
1885 GCPRO1 (proc); 1905 GCPRO1 (proc);
1886 coding_systems = Ffind_coding_system (5, args); 1906 coding_systems = Ffind_coding_system (5, args);
1887 UNGCPRO; 1907 UNGCPRO;
1888 val = (CONSP (coding_systems) ? XCONS (coding_systems)->car : Qnil); 1908 val = (CONSP (coding_systems) ? XCONS (coding_systems)->car : Qnil);
1889 } 1909 }
1890 XPROCESS (proc)->decode_coding_system = val; 1910 XPROCESS (proc)->decode_coding_system = val;
1891 1911
1892 if (NILP (val = Vcoding_system_for_write)) 1912 if (NILP (val = Vcoding_system_for_write))
1893 { 1913 {
1894 if (EQ (coding_systems, Qt)) 1914 if (EQ (coding_systems, Qt))
1895 { 1915 {
1896 args[0] = Qopen_network_stream, args[1] = name, 1916 args[0] = Qopen_network_stream, args[1] = name,
1897 args[2] = buffer, args[3] = host, args[4] = service; 1917 args[2] = buffer, args[3] = host, args[4] = service;
1898 GCPRO1 (proc); 1918 GCPRO1 (proc);
1899 coding_systems = Ffind_coding_system (5, args); 1919 coding_systems = Ffind_coding_system (5, args);
1900 UNGCPRO; 1920 UNGCPRO;
1901 } 1921 }
1902 val = (CONSP (coding_systems) ? XCONS (coding_systems)->cdr : Qnil); 1922 val = (CONSP (coding_systems) ? XCONS (coding_systems)->cdr : Qnil);
1903 } 1923 }
1904 XPROCESS (proc)->encode_coding_system = val; 1924 XPROCESS (proc)->encode_coding_system = val;
1905 } 1925 }
1906 1926
1927 if (!proc_decode_coding_system[inch])
1928 proc_decode_coding_system[inch]
1929 = (struct coding_system *) xmalloc (sizeof (struct coding_system));
1907 setup_coding_system (XPROCESS (proc)->decode_coding_system, 1930 setup_coding_system (XPROCESS (proc)->decode_coding_system,
1908 &proc_decode_coding_system[inch]); 1931 proc_decode_coding_system[inch]);
1932 if (!proc_encode_coding_system[outch])
1933 proc_encode_coding_system[outch]
1934 = (struct coding_system *) xmalloc (sizeof (struct coding_system));
1909 setup_coding_system (XPROCESS (proc)->encode_coding_system, 1935 setup_coding_system (XPROCESS (proc)->encode_coding_system,
1910 &proc_encode_coding_system[outch]); 1936 proc_encode_coding_system[outch]);
1911 1937
1912 XPROCESS (proc)->decoding_buf = make_uninit_string (0); 1938 XPROCESS (proc)->decoding_buf = make_uninit_string (0);
1913 XPROCESS (proc)->encoding_buf = make_uninit_string (0); 1939 XPROCESS (proc)->encoding_buf = make_uninit_string (0);
@@ -2570,7 +2596,7 @@ read_process_output (proc, channel)
2570 register struct buffer *old = current_buffer; 2596 register struct buffer *old = current_buffer;
2571 register struct Lisp_Process *p = XPROCESS (proc); 2597 register struct Lisp_Process *p = XPROCESS (proc);
2572 register int opoint; 2598 register int opoint;
2573 struct coding_system *coding = &proc_decode_coding_system[channel]; 2599 struct coding_system *coding = proc_decode_coding_system[channel];
2574 int chars_in_decoding_buf = 0; /* If 1, `chars' points 2600 int chars_in_decoding_buf = 0; /* If 1, `chars' points
2575 XSTRING (p->decoding_buf)->data. */ 2601 XSTRING (p->decoding_buf)->data. */
2576 2602
@@ -2652,14 +2678,14 @@ read_process_output (proc, channel)
2652 { 2678 {
2653 p->decode_coding_system = coding->symbol; 2679 p->decode_coding_system = coding->symbol;
2654 setup_coding_system (coding->symbol, 2680 setup_coding_system (coding->symbol,
2655 &proc_decode_coding_system[channel]); 2681 proc_decode_coding_system[channel]);
2656 /* If coding-system for encoding is not yet decided, we set it 2682 /* If coding-system for encoding is not yet decided, we set it
2657 as the same as coding-system for decoding. */ 2683 as the same as coding-system for decoding. */
2658 if (NILP (p->encode_coding_system)) 2684 if (NILP (p->encode_coding_system))
2659 { 2685 {
2660 p->encode_coding_system = coding->symbol; 2686 p->encode_coding_system = coding->symbol;
2661 setup_coding_system (coding->symbol, 2687 setup_coding_system (coding->symbol,
2662 &proc_encode_coding_system[channel]); 2688 proc_encode_coding_system[channel]);
2663 } 2689 }
2664 } 2690 }
2665#ifdef VMS 2691#ifdef VMS
@@ -2888,7 +2914,7 @@ send_process (proc, buf, len, object)
2888 if (XINT (XPROCESS (proc)->outfd) < 0) 2914 if (XINT (XPROCESS (proc)->outfd) < 0)
2889 error ("Output file descriptor of %s is closed", procname); 2915 error ("Output file descriptor of %s is closed", procname);
2890 2916
2891 coding = &proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; 2917 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)];
2892 if (CODING_REQUIRE_CONVERSION (coding)) 2918 if (CODING_REQUIRE_CONVERSION (coding))
2893 { 2919 {
2894 int require = encoding_buffer_size (coding, len); 2920 int require = encoding_buffer_size (coding, len);
@@ -3982,9 +4008,9 @@ ENCODING (output to the process).")
3982 p->decode_coding_system = Fcheck_coding_system (decoding); 4008 p->decode_coding_system = Fcheck_coding_system (decoding);
3983 p->encode_coding_system = Fcheck_coding_system (encoding); 4009 p->encode_coding_system = Fcheck_coding_system (encoding);
3984 setup_coding_system (decoding, 4010 setup_coding_system (decoding,
3985 &proc_decode_coding_system[XINT (p->infd)]); 4011 proc_decode_coding_system[XINT (p->infd)]);
3986 setup_coding_system (encoding, 4012 setup_coding_system (encoding,
3987 &proc_encode_coding_system[XINT (p->outfd)]); 4013 proc_encode_coding_system[XINT (p->outfd)]);
3988 4014
3989 return Qnil; 4015 return Qnil;
3990} 4016}
@@ -4077,6 +4103,8 @@ init_process ()
4077 chan_process[i] = Qnil; 4103 chan_process[i] = Qnil;
4078 proc_buffered_char[i] = -1; 4104 proc_buffered_char[i] = -1;
4079 } 4105 }
4106 bzero (proc_decode_coding_system, sizeof proc_decode_coding_system);
4107 bzero (proc_encode_coding_system, sizeof proc_encode_coding_system);
4080} 4108}
4081 4109
4082syms_of_process () 4110syms_of_process ()