comparison src/process.c @ 18648:5deb269b970f

(Fstart_process): If enable-multibyte-characters is nil, set coding system for decoding output of process to emacs-mule, and set coding system for encoding to nil. (Fopen_network_stream): If enable-multibyte-characters is nil, set coding systems for decoding and encoding to nil.
author Kenichi Handa <handa@m17n.org>
date Mon, 07 Jul 1997 00:59:44 +0000
parents 64184009811b
children 965c5ee65d86
comparison
equal deleted inserted replaced
18647:72b27986e71d 18648:5deb269b970f
1172 /* Qt denotes we have not yet called Ffind_operation_coding_system. */ 1172 /* Qt denotes we have not yet called Ffind_operation_coding_system. */
1173 Lisp_Object coding_systems = Qt; 1173 Lisp_Object coding_systems = Qt;
1174 Lisp_Object val, *args2; 1174 Lisp_Object val, *args2;
1175 struct gcpro gcpro1; 1175 struct gcpro gcpro1;
1176 1176
1177 if (NILP (val = Vcoding_system_for_read)) 1177 if (!NILP (Vcoding_system_for_read))
1178 val = Vcoding_system_for_read;
1179 else if (NILP (current_buffer->enable_multibyte_characters))
1180 val = Qemacs_mule;
1181 else
1178 { 1182 {
1179 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 1183 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
1180 args2[0] = Qstart_process; 1184 args2[0] = Qstart_process;
1181 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 1185 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
1182 GCPRO1 (proc); 1186 GCPRO1 (proc);
1184 UNGCPRO; 1188 UNGCPRO;
1185 if (CONSP (coding_systems)) 1189 if (CONSP (coding_systems))
1186 val = XCONS (coding_systems)->car; 1190 val = XCONS (coding_systems)->car;
1187 else if (CONSP (Vdefault_process_coding_system)) 1191 else if (CONSP (Vdefault_process_coding_system))
1188 val = XCONS (Vdefault_process_coding_system)->car; 1192 val = XCONS (Vdefault_process_coding_system)->car;
1193 else
1194 val = Qnil;
1189 } 1195 }
1190 XPROCESS (proc)->decode_coding_system = val; 1196 XPROCESS (proc)->decode_coding_system = val;
1191 1197
1192 if (NILP (val = Vcoding_system_for_write)) 1198 if (!NILP (Vcoding_system_for_write))
1199 val = Vcoding_system_for_write;
1200 else if (NILP (current_buffer->enable_multibyte_characters))
1201 val = Qnil;
1202 else
1193 { 1203 {
1194 if (EQ (coding_systems, Qt)) 1204 if (EQ (coding_systems, Qt))
1195 { 1205 {
1196 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof args2); 1206 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof args2);
1197 args2[0] = Qstart_process; 1207 args2[0] = Qstart_process;
1203 } 1213 }
1204 if (CONSP (coding_systems)) 1214 if (CONSP (coding_systems))
1205 val = XCONS (coding_systems)->cdr; 1215 val = XCONS (coding_systems)->cdr;
1206 else if (CONSP (Vdefault_process_coding_system)) 1216 else if (CONSP (Vdefault_process_coding_system))
1207 val = XCONS (Vdefault_process_coding_system)->cdr; 1217 val = XCONS (Vdefault_process_coding_system)->cdr;
1218 else
1219 val = Qnil;
1208 } 1220 }
1209 XPROCESS (proc)->encode_coding_system = val; 1221 XPROCESS (proc)->encode_coding_system = val;
1210 } 1222 }
1211 1223
1212 XPROCESS (proc)->decoding_buf = make_uninit_string (0); 1224 XPROCESS (proc)->decoding_buf = make_uninit_string (0);
1905 struct gcpro gcpro1; 1917 struct gcpro gcpro1;
1906 /* Qt denotes we have not yet called Ffind_operation_coding_system. */ 1918 /* Qt denotes we have not yet called Ffind_operation_coding_system. */
1907 Lisp_Object coding_systems = Qt; 1919 Lisp_Object coding_systems = Qt;
1908 Lisp_Object args[5], val; 1920 Lisp_Object args[5], val;
1909 1921
1910 if (NILP (val = Vcoding_system_for_read)) 1922 if (!NILP (Vcoding_system_for_read))
1923 val = Vcoding_system_for_read;
1924 else if (NILP (current_buffer->enable_multibyte_characters))
1925 /* We dare not decode end-of-line format by setting VAL to
1926 Qemacs_mule, because the existing Emacs Lisp libraries
1927 assume that they receive bare code including a sequene of
1928 CR LF. */
1929 val = Qnil;
1930 else
1911 { 1931 {
1912 args[0] = Qopen_network_stream, args[1] = name, 1932 args[0] = Qopen_network_stream, args[1] = name,
1913 args[2] = buffer, args[3] = host, args[4] = service; 1933 args[2] = buffer, args[3] = host, args[4] = service;
1914 GCPRO1 (proc); 1934 GCPRO1 (proc);
1915 coding_systems = Ffind_operation_coding_system (5, args); 1935 coding_systems = Ffind_operation_coding_system (5, args);
1916 UNGCPRO; 1936 UNGCPRO;
1917 if (CONSP (coding_systems)) 1937 if (CONSP (coding_systems))
1918 val = XCONS (coding_systems)->car; 1938 val = XCONS (coding_systems)->car;
1919 else if (CONSP (Vdefault_process_coding_system)) 1939 else if (CONSP (Vdefault_process_coding_system))
1920 val = XCONS (Vdefault_process_coding_system)->car; 1940 val = XCONS (Vdefault_process_coding_system)->car;
1941 else
1942 val = Qnil;
1921 } 1943 }
1922 XPROCESS (proc)->decode_coding_system = val; 1944 XPROCESS (proc)->decode_coding_system = val;
1923 1945
1924 if (NILP (val = Vcoding_system_for_write)) 1946 if (!NILP (Vcoding_system_for_write))
1947 val = Vcoding_system_for_write;
1948 else if (NILP (current_buffer->enable_multibyte_characters))
1949 val = Qnil;
1950 else
1925 { 1951 {
1926 if (EQ (coding_systems, Qt)) 1952 if (EQ (coding_systems, Qt))
1927 { 1953 {
1928 args[0] = Qopen_network_stream, args[1] = name, 1954 args[0] = Qopen_network_stream, args[1] = name,
1929 args[2] = buffer, args[3] = host, args[4] = service; 1955 args[2] = buffer, args[3] = host, args[4] = service;
1933 } 1959 }
1934 if (CONSP (coding_systems)) 1960 if (CONSP (coding_systems))
1935 val = XCONS (coding_systems)->cdr; 1961 val = XCONS (coding_systems)->cdr;
1936 else if (CONSP (Vdefault_process_coding_system)) 1962 else if (CONSP (Vdefault_process_coding_system))
1937 val = XCONS (Vdefault_process_coding_system)->cdr; 1963 val = XCONS (Vdefault_process_coding_system)->cdr;
1964 else
1965 val = Qnil;
1938 } 1966 }
1939 XPROCESS (proc)->encode_coding_system = val; 1967 XPROCESS (proc)->encode_coding_system = val;
1940 } 1968 }
1941 1969
1942 if (!proc_decode_coding_system[inch]) 1970 if (!proc_decode_coding_system[inch])