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