(Fcall_process): Sync with HEAD.
[bpt/emacs.git] / src / ccl.h
CommitLineData
4ed46869 1/* Header for CCL (Code Conversion Language) interpreter.
ce03bf76
KH
2 Copyright (C) 1995, 1998, 2000
3 National Institute of Advanced Industrial Science and Technology (AIST)
4 Registration Number H14PRO021
8f924df7 5 Copyright (C) 2003
d2bc5a70
KH
6 National Institute of Advanced Industrial Science and Technology (AIST)
7 Registration Number H13PRO009
4ed46869 8
369314dc
KH
9This file is part of GNU Emacs.
10
11GNU Emacs is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2, or (at your option)
14any later version.
4ed46869 15
369314dc
KH
16GNU Emacs is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
4ed46869 20
369314dc
KH
21You should have received a copy of the GNU General Public License
22along with GNU Emacs; see the file COPYING. If not, write to
4fc5845f
LK
23the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24Boston, MA 02110-1301, USA. */
4ed46869 25
265702b7
KH
26#ifndef EMACS_CCL_H
27#define EMACS_CCL_H
4ed46869 28
eacba247
KH
29/* Macros for exit status of CCL program. */
30#define CCL_STAT_SUCCESS 0 /* Terminated successfully. */
31#define CCL_STAT_SUSPEND_BY_SRC 1 /* Terminated by empty input. */
32#define CCL_STAT_SUSPEND_BY_DST 2 /* Terminated by output buffer full. */
33#define CCL_STAT_INVALID_CMD 3 /* Terminated because of invalid
34 command. */
35#define CCL_STAT_QUIT 4 /* Terminated because of quit. */
36
4ed46869
KH
37/* Structure to hold information about running CCL code. Read
38 comments in the file ccl.c for the detail of each field. */
39struct ccl_program {
7cf49add
KH
40 int idx; /* Index number of the CCL program.
41 -1 means that the program was given
42 by a vector, not by a program
43 name. */
4ed46869
KH
44 int size; /* Size of the compiled code. */
45 Lisp_Object *prog; /* Pointer into the compiled code. */
46 int ic; /* Instruction Counter (index for PROG). */
47 int eof_ic; /* Instruction Counter for end-of-file
48 processing code. */
49 int reg[8]; /* CCL registers, reg[7] is used for
50 condition flag of relational
51 operations. */
eacba247 52 int private_state; /* CCL instruction may use this
975ddbf5
KH
53 for private use, mainly for saving
54 internal states on suspending.
177c0ea7 55 This variable is set to 0 when ccl is
eacba247 56 set up. */
4ed46869
KH
57 int last_block; /* Set to 1 while processing the last
58 block. */
59 int status; /* Exit status of the CCL program. */
60 int buf_magnification; /* Output buffer magnification. How
61 many times bigger the output buffer
62 should be than the input buffer. */
e05645ee 63 int stack_idx; /* How deep the call of CCL_Call is nested. */
d2bc5a70
KH
64 int src_multibyte; /* 1 if the input buffer is multibyte. */
65 int dst_multibyte; /* 1 if the output buffer is multibyte. */
f455f068
KH
66 int cr_consumed; /* Flag for encoding DOS-like EOL
67 format when the CCL program is used
68 for encoding by a coding
69 system. */
d2bc5a70
KH
70 int consumed;
71 int produced;
64068fbf
KH
72 int suppress_error; /* If nonzero, don't insert error
73 message in the output. */
034060e4
KH
74 int eight_bit_control; /* If nonzero, ccl_driver counts all
75 eight-bit-control bytes written by
76 CCL_WRITE_CHAR. After execution,
77 if no such byte is written, set
78 this value to zero. */
4ed46869
KH
79};
80
81/* This data type is used for the spec field of the structure
82 coding_system. */
83
84struct ccl_spec {
d2bc5a70 85 struct ccl_program ccl;
8538ed9a 86 int cr_carryover; /* CR carryover flag. */
898f3312 87 unsigned char eight_bit_carryover[MAX_MULTIBYTE_LENGTH];
4ed46869
KH
88};
89
d2bc5a70
KH
90#define CODING_SPEC_CCL_PROGRAM(coding) ((coding)->spec.ccl.ccl)
91
4ed46869
KH
92/* Alist of fontname patterns vs corresponding CCL program. */
93extern Lisp_Object Vfont_ccl_encoder_alist;
94
58068210 95/* Setup fields of the structure pointed by CCL appropriately for the
e5e6d6fb
KH
96 execution of ccl program CCL_PROG (symbol or vector). */
97extern int setup_ccl_program P_ ((struct ccl_program *, Lisp_Object));
58068210 98
7cf49add
KH
99/* Check if CCL is updated or not. If not, re-setup members of CCL. */
100extern int check_ccl_update P_ ((struct ccl_program *));
101
5cac9fd6
KH
102extern void ccl_driver P_ ((struct ccl_program *, int *, int *, int, int,
103 Lisp_Object));
58068210 104
1cfae2bf
KH
105/* Vector of CCL program names vs corresponding program data. */
106extern Lisp_Object Vccl_program_table;
107
108/* Symbols of ccl program have this property, a value of the property
109 is an index for Vccl_protram_table. */
110extern Lisp_Object Qccl_program_idx;
111
d2bc5a70
KH
112extern Lisp_Object Qccl, Qcclp;
113
114EXFUN (Fccl_program_p, 1);
115
116#define CHECK_CCL_PROGRAM(x) \
117 do { \
118 if (NILP (Fccl_program_p (x))) \
119 x = wrong_type_argument (Qcclp, (x)); \
120 } while (0);
121
265702b7 122#endif /* EMACS_CCL_H */
6b61353c
KH
123
124/* arch-tag: 14681df7-876d-43de-bc71-6b78e23a4e3c
125 (do not change this comment) */