comparison src/ccl.c @ 17728:25d58ba29c1b

(Fccl_execute_on_string): Add 4th optional arg CONTINUE.
author Kenichi Handa <handa@m17n.org>
date Sat, 10 May 1997 03:37:01 +0000
parents 6db43d8c9dfc
children db443ea8cb36
comparison
equal deleted inserted replaced
17727:9d39361ce928 17728:25d58ba29c1b
1006 XSETINT (XVECTOR (reg)->contents[i], ccl.reg[i]); 1006 XSETINT (XVECTOR (reg)->contents[i], ccl.reg[i]);
1007 return Qnil; 1007 return Qnil;
1008 } 1008 }
1009 1009
1010 DEFUN ("ccl-execute-on-string", Fccl_execute_on_string, Sccl_execute_on_string, 1010 DEFUN ("ccl-execute-on-string", Fccl_execute_on_string, Sccl_execute_on_string,
1011 3, 3, 0, 1011 3, 4, 0,
1012 "Execute CCL-PROGRAM with initial STATUS on STRING.\n\ 1012 "Execute CCL-PROGRAM with initial STATUS on STRING.\n\
1013 CCL-PROGRAM is a compiled code generated by `ccl-compile'.\n\ 1013 CCL-PROGRAM is a compiled code generated by `ccl-compile'.\n\
1014 Read buffer is set to STRING, and write buffer is allocated automatically.\n\ 1014 Read buffer is set to STRING, and write buffer is allocated automatically.\n\
1015 STATUS is a vector of [R0 R1 ... R7 IC], where\n\ 1015 STATUS is a vector of [R0 R1 ... R7 IC], where\n\
1016 R0..R7 are initial values of corresponding registers,\n\ 1016 R0..R7 are initial values of corresponding registers,\n\
1017 IC is the instruction counter specifying from where to start the program.\n\ 1017 IC is the instruction counter specifying from where to start the program.\n\
1018 If R0..R7 are nil, they are initialized to 0.\n\ 1018 If R0..R7 are nil, they are initialized to 0.\n\
1019 If IC is nil, it is initialized to head of the CCL program.\n\ 1019 If IC is nil, it is initialized to head of the CCL program.\n\
1020 Returns the contents of write buffer as a string,\n\ 1020 Returns the contents of write buffer as a string,\n\
1021 and as side effect, STATUS is updated.") 1021 and as side effect, STATUS is updated.\n\
1022 (ccl_prog, status, str) 1022 If optional 4th arg CONTINUE is non-nil, keep IC on read operation\n\
1023 Lisp_Object ccl_prog, status, str; 1023 when read buffer is exausted, else, IC is always set to the end of\n\
1024 CCL-PROGRAM on exit.")
1025 (ccl_prog, status, str, contin)
1026 Lisp_Object ccl_prog, status, str, contin;
1024 { 1027 {
1025 Lisp_Object val; 1028 Lisp_Object val;
1026 struct ccl_program ccl; 1029 struct ccl_program ccl;
1027 int i, produced; 1030 int i, produced;
1028 int outbufsize; 1031 int outbufsize;
1052 } 1055 }
1053 outbufsize = XSTRING (str)->size * ccl.buf_magnification + 256; 1056 outbufsize = XSTRING (str)->size * ccl.buf_magnification + 256;
1054 outbuf = (char *) xmalloc (outbufsize); 1057 outbuf = (char *) xmalloc (outbufsize);
1055 if (!outbuf) 1058 if (!outbuf)
1056 error ("Not enough memory"); 1059 error ("Not enough memory");
1057 ccl.last_block = 1; 1060 ccl.last_block = NILP (contin);
1058 produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf, 1061 produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf,
1059 XSTRING (str)->size, outbufsize, (int *)0); 1062 XSTRING (str)->size, outbufsize, (int *)0);
1060 for (i = 0; i < 8; i++) 1063 for (i = 0; i < 8; i++)
1061 XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]); 1064 XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]);
1062 XSETINT (XVECTOR (status)->contents[8], ccl.ic); 1065 XSETINT (XVECTOR (status)->contents[8], ccl.ic);