]> code.delx.au - gnu-emacs/blob - src/ccl.h
*** empty log message ***
[gnu-emacs] / src / ccl.h
1 /* Header for CCL (Code Conversion Language) interpreter.
2 Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
3 Licensed to the Free Software Foundation.
4 Copyright (C) 2001, 2002
5 National Institute of Advanced Industrial Science and Technology (AIST)
6 Registration Number H13PRO009
7
8 This file is part of GNU Emacs.
9
10 GNU Emacs is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14
15 GNU Emacs is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with GNU Emacs; see the file COPYING. If not, write to
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA. */
24
25 #ifndef EMACS_CCL_H
26 #define EMACS_CCL_H
27
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
36 /* Structure to hold information about running CCL code. Read
37 comments in the file ccl.c for the detail of each field. */
38 struct 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. */
47 int private_state; /* CCL instruction may use this
48 for private use, mainly for saving
49 internal states on suspending.
50 This variable is set to 0 when ccl is
51 set up. */
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. */
58 int stack_idx; /* How deep the call of CCL_Call is nested. */
59 int src_multibyte; /* 1 if the input buffer is multibyte. */
60 int dst_multibyte; /* 1 if the output buffer is multibyte. */
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. */
65 int consumed;
66 int produced;
67 int suppress_error; /* If nonzero, don't insert error
68 message in the output. */
69 int eight_bit_control; /* Set to nonzero if CCL_WRITE_CHAR
70 writes eight-bit-control char. */
71 };
72
73 /* This data type is used for the spec field of the structure
74 coding_system. */
75
76 struct ccl_spec {
77 struct ccl_program ccl;
78 int cr_carryover; /* CR carryover flag. */
79 unsigned char eight_bit_carryover[MAX_MULTIBYTE_LENGTH];
80 };
81
82 #define CODING_SPEC_CCL_PROGRAM(coding) ((coding)->spec.ccl.ccl)
83
84 /* Alist of fontname patterns vs corresponding CCL program. */
85 extern Lisp_Object Vfont_ccl_encoder_alist;
86
87 /* Setup fields of the structure pointed by CCL appropriately for the
88 execution of ccl program CCL_PROG (symbol or vector). */
89 extern int setup_ccl_program P_ ((struct ccl_program *, Lisp_Object));
90
91 extern void ccl_driver P_ ((struct ccl_program *, int *, int *, int, int,
92 Lisp_Object));
93
94 /* Vector of CCL program names vs corresponding program data. */
95 extern Lisp_Object Vccl_program_table;
96
97 /* Symbols of ccl program have this property, a value of the property
98 is an index for Vccl_protram_table. */
99 extern Lisp_Object Qccl_program_idx;
100
101 extern Lisp_Object Qccl, Qcclp;
102
103 EXFUN (Fccl_program_p, 1);
104
105 #define CHECK_CCL_PROGRAM(x) \
106 do { \
107 if (NILP (Fccl_program_p (x))) \
108 x = wrong_type_argument (Qcclp, (x)); \
109 } while (0);
110
111 #endif /* EMACS_CCL_H */