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