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