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