changeset 23885:b08de5b1299c

Include "ccl.h". (Fcall_process): Doc-string modified. Set CODING_MODE_LAST_BLOCK bit in argument_coding.mode to tell encoding procedure to flush data. While encoding arguments, if argument_coding uses CCL program, initialize it again after encoding. (Fcall_process_region): Doc-string modified. Handle the case that NARGS is 3.
author Kenichi Handa <handa@m17n.org>
date Tue, 15 Dec 1998 04:35:38 +0000
parents 179bcb86f12f
children 6402c89c30c3
files src/callproc.c
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/callproc.c	Tue Dec 15 04:35:38 1998 +0000
+++ b/src/callproc.c	Tue Dec 15 04:35:38 1998 +0000
@@ -71,6 +71,7 @@
 #include "commands.h"
 #include "buffer.h"
 #include "charset.h"
+#include "ccl.h"
 #include "coding.h"
 #include <paths.h>
 #include "process.h"
@@ -176,6 +177,7 @@
 
 DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0,
   "Call PROGRAM synchronously in separate process.\n\
+The remaining arguments are optional.\n\
 The program's input comes from file INFILE (nil means `/dev/null').\n\
 Insert output in BUFFER before point; t means current buffer;\n\
  nil for BUFFER means discard it; 0 means discard and don't wait.\n\
@@ -424,12 +426,16 @@
 
 	      /* The Irix 4.0 compiler barfs if we eliminate dummy.  */
 	      new_argv[i - 3] = dummy1;
+	      argument_coding.mode |= CODING_MODE_LAST_BLOCK;
 	      encode_coding (&argument_coding,
 			     XSTRING (args[i])->data,
 			     new_argv[i - 3],
 			     STRING_BYTES (XSTRING (args[i])),
 			     size);
 	      new_argv[i - 3][argument_coding.produced] = 0;
+	      /* We have to initialize CCL program status again.  */
+	      if (argument_coding.type == coding_type_ccl)
+		setup_ccl_program (&(argument_coding.spec.ccl.encoder), Qnil);
 	    }
 	  UNGCPRO;
 	}
@@ -778,6 +784,7 @@
 DEFUN ("call-process-region", Fcall_process_region, Scall_process_region,
   3, MANY, 0,
   "Send text from START to END to a synchronous process running PROGRAM.\n\
+The remaining arguments are optional.\n\
 Delete the text if fourth arg DELETE is non-nil.\n\
 \n\
 Insert output in BUFFER before point; t means current buffer;\n\
@@ -876,12 +883,22 @@
 
   record_unwind_protect (delete_temp_file, filename_string);
 
-  if (!NILP (args[3]))
+  if (nargs > 3 && !NILP (args[3]))
     Fdelete_region (start, end);
 
-  args[3] = filename_string;
+  if (nargs > 3)
+    {
+      args += 2;
+      nargs -= 2;
+    }
+  else
+    {
+      args[0] = args[2];
+      nargs = 2;
+    }
+  args[1] = filename_string;
 
-  RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs - 2, args + 2)));
+  RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args)));
 }
 
 #ifndef VMS /* VMS version is in vmsproc.c.  */