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