VTparse.h revision 01037d57
1/* $XTermId: VTparse.h,v 1.65 2015/02/16 00:10:39 tom Exp $ */
2
3/*
4 * Copyright 2002-2014,2015 by Thomas E. Dickey
5 *
6 *                         All Rights Reserved
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
23 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 *
27 * Except as contained in this notice, the name(s) of the above copyright
28 * holders shall not be used in advertising or otherwise to promote the
29 * sale, use or other dealings in this Software without prior written
30 * authorization.
31 *
32 *
33 * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
34 *
35 *                         All Rights Reserved
36 *
37 * Permission to use, copy, modify, and distribute this software and its
38 * documentation for any purpose and without fee is hereby granted,
39 * provided that the above copyright notice appear in all copies and that
40 * both that copyright notice and this permission notice appear in
41 * supporting documentation, and that the name of Digital Equipment
42 * Corporation not be used in advertising or publicity pertaining to
43 * distribution of the software without specific, written prior permission.
44 *
45 *
46 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
47 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
48 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
49 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
50 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
51 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
52 * SOFTWARE.
53 */
54
55#ifndef included_VTparse_h
56#define included_VTparse_h 1
57
58#include <xterm.h>
59
60#ifndef Const
61# if defined(__STDC__) && !defined(__cplusplus)
62#  define Const const
63# else
64#  define Const	/**/
65# endif
66#endif
67
68/*
69 * PARSE_T has to be large enough to handle the number of cases enumerated here.
70 */
71typedef unsigned char PARSE_T;
72
73extern Const PARSE_T ansi_table[];
74extern Const PARSE_T cigtable[];
75extern Const PARSE_T csi2_table[];
76extern Const PARSE_T csi_ex_table[];
77extern Const PARSE_T csi_quo_table[];
78extern Const PARSE_T csi_sp_table[];
79extern Const PARSE_T csi_table[];
80extern Const PARSE_T dec2_table[];
81extern Const PARSE_T dec3_table[];
82extern Const PARSE_T dec_table[];
83extern Const PARSE_T eigtable[];
84extern Const PARSE_T esc_sp_table[];
85extern Const PARSE_T esc_table[];
86extern Const PARSE_T scrtable[];
87extern Const PARSE_T scs96table[];
88extern Const PARSE_T scstable[];
89extern Const PARSE_T sos_table[];
90extern Const PARSE_T csi_dec_dollar_table[];
91extern Const PARSE_T csi_tick_table[];
92
93#if OPT_DEC_RECTOPS
94extern Const PARSE_T csi_dollar_table[];
95extern Const PARSE_T csi_star_table[];
96#endif /* OPT_DEC_LOCATOR */
97
98#if OPT_VT52_MODE
99extern Const PARSE_T vt52_table[];
100extern Const PARSE_T vt52_esc_table[];
101extern Const PARSE_T vt52_ignore_table[];
102#endif
103
104#if OPT_WIDE_CHARS
105extern Const PARSE_T esc_pct_table[];
106extern Const PARSE_T scs_pct_table[];
107#endif
108
109/*
110 * The following list of definitions is generated from VTparse.def using the
111 * following command line:
112 *
113 *     grep '^CASE_' VTparse.def | awk '{printf "#define %s %d\n", $1, n++}'
114 *
115 * If you need to change something, change VTparse.def and regenerate the
116 * definitions.  This would have been automatic, but since this doesn't change
117 * very often, it isn't worth the makefile hassle.
118 */
119
120#define CASE_GROUND_STATE 0
121#define CASE_IGNORE 1
122#define CASE_BELL 2
123#define CASE_BS 3
124#define CASE_CR 4
125#define CASE_ESC 5
126#define CASE_VMOT 6
127#define CASE_TAB 7
128#define CASE_SI 8
129#define CASE_SO 9
130#define CASE_SCR_STATE 10
131#define CASE_SCS0_STATE 11
132#define CASE_SCS1_STATE 12
133#define CASE_SCS2_STATE 13
134#define CASE_SCS3_STATE 14
135#define CASE_ESC_IGNORE 15
136#define CASE_ESC_DIGIT 16
137#define CASE_ESC_SEMI 17
138#define CASE_DEC_STATE 18
139#define CASE_ICH 19
140#define CASE_CUU 20
141#define CASE_CUD 21
142#define CASE_CUF 22
143#define CASE_CUB 23
144#define CASE_CUP 24
145#define CASE_ED 25
146#define CASE_EL 26
147#define CASE_IL 27
148#define CASE_DL 28
149#define CASE_DCH 29
150#define CASE_DA1 30
151#define CASE_TRACK_MOUSE 31
152#define CASE_TBC 32
153#define CASE_SET 33
154#define CASE_RST 34
155#define CASE_SGR 35
156#define CASE_CPR 36
157#define CASE_DECSTBM 37
158#define CASE_DECREQTPARM 38
159#define CASE_DECSET 39
160#define CASE_DECRST 40
161#define CASE_DECALN 41
162#define CASE_GSETS 42
163#define CASE_DECSC 43
164#define CASE_DECRC 44
165#define CASE_DECKPAM 45
166#define CASE_DECKPNM 46
167#define CASE_IND 47
168#define CASE_NEL 48
169#define CASE_HTS 49
170#define CASE_RI 50
171#define CASE_SS2 51
172#define CASE_SS3 52
173#define CASE_CSI_STATE 53
174#define CASE_OSC 54
175#define CASE_RIS 55
176#define CASE_LS2 56
177#define CASE_LS3 57
178#define CASE_LS3R 58
179#define CASE_LS2R 59
180#define CASE_LS1R 60
181#define CASE_PRINT 61
182#define CASE_XTERM_SAVE 62
183#define CASE_XTERM_RESTORE 63
184#define CASE_XTERM_TITLE 64
185#define CASE_DECID 65
186#define CASE_HP_MEM_LOCK 66
187#define CASE_HP_MEM_UNLOCK 67
188#define CASE_HP_BUGGY_LL 68
189#define CASE_HPA 69
190#define CASE_VPA 70
191#define CASE_XTERM_WINOPS 71
192#define CASE_ECH 72
193#define CASE_CHT 73
194#define CASE_CPL 74
195#define CASE_CNL 75
196#define CASE_CBT 76
197#define CASE_SU 77
198#define CASE_SD 78
199#define CASE_S7C1T 79
200#define CASE_S8C1T 80
201#define CASE_ESC_SP_STATE 81
202#define CASE_ENQ 82
203#define CASE_DECSCL 83
204#define CASE_DECSCA 84
205#define CASE_DECSED 85
206#define CASE_DECSEL 86
207#define CASE_DCS 87
208#define CASE_PM 88
209#define CASE_SOS 89
210#define CASE_ST 90
211#define CASE_APC 91
212#define CASE_EPA 92
213#define CASE_SPA 93
214#define CASE_CSI_QUOTE_STATE 94
215#define CASE_DSR 95
216#define CASE_ANSI_LEVEL_1 96
217#define CASE_ANSI_LEVEL_2 97
218#define CASE_ANSI_LEVEL_3 98
219#define CASE_MC 99
220#define CASE_DEC2_STATE 100
221#define CASE_DA2 101
222#define CASE_DEC3_STATE 102
223#define CASE_DECRPTUI 103
224#define CASE_VT52_CUP 104
225#define CASE_REP 105
226#define CASE_CSI_EX_STATE 106
227#define CASE_DECSTR 107
228#define CASE_DECDHL 108
229#define CASE_DECSWL 109
230#define CASE_DECDWL 110
231#define CASE_DEC_MC 111
232#define CASE_ESC_PERCENT 112
233#define CASE_UTF8 113
234#define CASE_CSI_TICK_STATE 114
235#define CASE_DECELR 115
236#define CASE_DECRQLP 116
237#define CASE_DECEFR 117
238#define CASE_DECSLE 118
239#define CASE_CSI_IGNORE 119
240#define CASE_VT52_IGNORE 120
241#define CASE_VT52_FINISH 121
242#define CASE_CSI_DOLLAR_STATE 122
243#define CASE_DECCRA 123
244#define CASE_DECERA 124
245#define CASE_DECFRA 125
246#define CASE_DECSERA 126
247#define CASE_DECSACE 127
248#define CASE_DECCARA 128
249#define CASE_DECRARA 129
250#define CASE_CSI_STAR_STATE 130
251#define CASE_SET_MOD_FKEYS 131
252#define CASE_SET_MOD_FKEYS0 132
253#define CASE_HIDE_POINTER 133
254#define CASE_SCS1A_STATE 134
255#define CASE_SCS2A_STATE 135
256#define CASE_SCS3A_STATE 136
257#define CASE_CSI_SPACE_STATE 137
258#define CASE_DECSCUSR 138
259#define CASE_SM_TITLE 139
260#define CASE_RM_TITLE 140
261#define CASE_DECSMBV 141
262#define CASE_DECSWBV 142
263#define CASE_DECLL 143
264#define CASE_DECRQM 144
265#define CASE_RQM 145
266#define CASE_CSI_DEC_DOLLAR_STATE 146
267#define CASE_SL 147
268#define CASE_SR 148
269#define CASE_DECDC 149
270#define CASE_DECIC 150
271#define CASE_DECBI 151
272#define CASE_DECFI 152
273#define CASE_DECRQCRA 153
274#define CASE_HPR 154
275#define CASE_VPR 155
276#define CASE_ANSI_SC 156
277#define CASE_ANSI_RC 157
278#define CASE_ESC_COLON 158
279#define CASE_SCS_PERCENT 159
280#define CASE_GSETS_PERCENT 160
281#define CASE_GRAPHICS_ATTRIBUTES 161
282
283#endif /* included_VTparse_h */
284