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