]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ddb/db_lex.h
xnu-792.21.3.tar.gz
[apple/xnu.git] / osfmk / ddb / db_lex.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_COPYRIGHT@
30 */
31 /*
32 * HISTORY
33 *
34 * Revision 1.1.1.1 1998/09/22 21:05:48 wsanchez
35 * Import of Mac OS X kernel (~semeria)
36 *
37 * Revision 1.1.1.1 1998/03/07 02:26:09 wsanchez
38 * Import of OSF Mach kernel (~mburg)
39 *
40 * Revision 1.1.11.2 1995/01/06 19:10:24 devrcs
41 * mk6 CR668 - 1.3b26 merge
42 * 64bit cleanup
43 * [1994/10/14 03:39:54 dwm]
44 *
45 * Revision 1.1.11.1 1994/09/23 01:20:10 ezf
46 * change marker to not FREE
47 * [1994/09/22 21:10:18 ezf]
48 *
49 * Revision 1.1.4.3 1993/07/27 18:27:40 elliston
50 * Add ANSI prototypes. CR #9523.
51 * [1993/07/27 18:12:19 elliston]
52 *
53 * Revision 1.1.4.2 1993/06/02 23:11:33 jeffc
54 * Added to OSF/1 R1.3 from NMK15.0.
55 * [1993/06/02 20:56:37 jeffc]
56 *
57 * Revision 1.1 1992/09/30 02:24:17 robert
58 * Initial revision
59 *
60 * $EndLog$
61 */
62 /* CMU_HIST */
63 /*
64 * Revision 2.5 91/10/09 16:00:48 af
65 * Revision 2.4.3.1 91/10/05 13:06:34 jeffreyh
66 * Added db_lex_context structure and some routine declarations
67 * for macro and conditinal command.
68 * Added relational operator tokens etc. for condition expression.
69 * Changed TOK_STRING_SIZE from 120 to 64, and defined
70 * DB_LEX_LINE_SIZE as 256 which was previously embedded
71 * in db_lex.c as 120.
72 * [91/08/29 tak]
73 * Revision 2.4.1 91/07/15 09:30:00 tak
74 * Added db_lex_context for macro support
75 * Added some lexical constants to support logical expression etc.
76 * [91/05/15 13:55:00 tak]
77 *
78 * Revision 2.4.3.1 91/10/05 13:06:34 jeffreyh
79 * Added db_lex_context structure and some routine declarations
80 * for macro and conditinal command.
81 * Added relational operator tokens etc. for condition expression.
82 * Changed TOK_STRING_SIZE from 120 to 64, and defined
83 * DB_LEX_LINE_SIZE as 256 which was previously embedded
84 * in db_lex.c as 120.
85 * [91/08/29 tak]
86 *
87 * Revision 2.4.1 91/07/15 09:30:00 tak
88 * Added db_lex_context for macro support
89 * Added some lexical constants to support logical expression etc.
90 * [91/05/15 13:55:00 tak]
91 *
92 * Revision 2.4 91/05/14 15:34:38 mrt
93 * Correcting copyright
94 *
95 * Revision 2.3 91/02/05 17:06:41 mrt
96 * Changed to new Mach copyright
97 * [91/01/31 16:18:28 mrt]
98 *
99 * Revision 2.2 90/08/27 21:51:16 dbg
100 * Add 'dotdot' token.
101 * [90/08/22 dbg]
102 * Export db_flush_lex.
103 * [90/08/07 dbg]
104 * Created.
105 * [90/07/25 dbg]
106 *
107 */
108 /* CMU_ENDHIST */
109 /*
110 * Mach Operating System
111 * Copyright (c) 1991,1990 Carnegie Mellon University
112 * All Rights Reserved.
113 *
114 * Permission to use, copy, modify and distribute this software and its
115 * documentation is hereby granted, provided that both the copyright
116 * notice and this permission notice appear in all copies of the
117 * software, derivative works or modified versions, and any portions
118 * thereof, and that both notices appear in supporting documentation.
119 *
120 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
121 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
122 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
123 *
124 * Carnegie Mellon requests users of this software to return to
125 *
126 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
127 * School of Computer Science
128 * Carnegie Mellon University
129 * Pittsburgh PA 15213-3890
130 *
131 * any improvements or extensions that they make and grant Carnegie Mellon
132 * the rights to redistribute these changes.
133 */
134 /*
135 */
136 /*
137 * Author: David B. Golub, Carnegie Mellon University
138 * Date: 7/90
139 */
140 /*
141 * Lexical analyzer.
142 */
143
144 #ifndef _DDB_DB_LEX_H_
145 #define _DDB_DB_LEX_H_
146
147 #include <machine/db_machdep.h> /* For db_expr_t */
148
149 #define TOK_STRING_SIZE 64
150 #define DB_LEX_LINE_SIZE 256
151
152 struct db_lex_context {
153 int l_char; /* peek char */
154 int l_token; /* peek token */
155 char *l_ptr; /* line pointer */
156 char *l_eptr; /* line end pointer */
157 };
158
159 extern db_expr_t db_tok_number;
160 extern char db_tok_string[TOK_STRING_SIZE];
161 extern db_expr_t db_radix;
162
163 #define tEOF (-1)
164 #define tEOL 1
165 #define tNUMBER 2
166 #define tIDENT 3
167 #define tPLUS 4
168 #define tMINUS 5
169 #define tDOT 6
170 #define tSTAR 7
171 #define tSLASH 8
172 #define tEQ 9
173 #define tLPAREN 10
174 #define tRPAREN 11
175 #define tPCT 12
176 #define tHASH 13
177 #define tCOMMA 14
178 #define tQUOTE 15
179 #define tDOLLAR 16
180 #define tEXCL 17
181 #define tSHIFT_L 18
182 #define tSHIFT_R 19
183 #define tDOTDOT 20
184 #define tSEMI_COLON 21
185 #define tLOG_EQ 22
186 #define tLOG_NOT_EQ 23
187 #define tLESS 24
188 #define tLESS_EQ 25
189 #define tGREATER 26
190 #define tGREATER_EQ 27
191 #define tBIT_AND 28
192 #define tBIT_OR 29
193 #define tLOG_AND 30
194 #define tLOG_OR 31
195 #define tSTRING 32
196 #define tQUESTION 33
197
198 /* Prototypes for functions exported by this module.
199 */
200 int db_read_line(char *repeat_last);
201
202 void db_switch_input(
203 char *buffer,
204 int size);
205
206 void db_save_lex_context(struct db_lex_context *lp);
207
208 void db_restore_lex_context(struct db_lex_context *lp);
209
210 int db_read_char(void);
211
212 void db_unread_token(int t);
213
214 int db_read_token(void);
215
216 void db_flush_lex(void);
217
218 void db_skip_to_eol(void);
219
220 int db_lex(void);
221
222 #endif /* !_DDB_DB_LEX_H_ */