xref: /illumos-gate/usr/src/cmd/mdb/common/mdb/mdb_lex.h (revision 2a8bcb4e)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_MDB_LEX_H
28 #define	_MDB_LEX_H
29 
30 #include <mdb/mdb_argvec.h>
31 #include <mdb/mdb_nv.h>
32 #include <mdb/mdb_types.h>
33 #include <mdb/mdb_module.h>
34 #include <stdio.h>
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #ifdef _MDB
41 
42 extern void mdb_lex_debug(int);
43 extern void mdb_lex_reset(void);
44 
45 extern void yyerror(const char *, ...);
46 extern void yyperror(const char *, ...);
47 extern void yydiscard(void);
48 
49 extern int yyparse(void);
50 extern int yywrap(void);
51 
52 
53 struct mdb_lex_state;
54 struct mdb_frame;
55 
56 void mdb_lex_state_save(struct mdb_lex_state *);
57 void mdb_lex_state_restore(struct mdb_lex_state *);
58 void mdb_lex_state_create(struct mdb_frame *);
59 void mdb_lex_state_destroy(struct mdb_frame *);
60 
61 /*
62  * The lex and yacc debugging code as generated uses printf and fprintf
63  * for debugging output.  We redefine these to refer to our yyprintf
64  * and yyfprintf routines, which are wrappers around mdb_iob_vprintf.
65  */
66 
67 #define	printf	(void) yyprintf
68 #define	fprintf	(void) yyfprintf
69 
70 extern int yyprintf(const char *, ...);
71 extern int yyfprintf(FILE *, const char *, ...);
72 
73 extern int yylineno;
74 
75 /*
76  * Maximum depth we can have in our yacc state stack.  The yacc default is 150,
77  * but this should be more than enough for our simple mdb expressions.
78  */
79 #define	YYMAXDEPTH	100
80 /*
81  * Maximum size of our lex yytext buffer.
82  */
83 #define	YYLMAX		BUFSIZ
84 
85 #endif /* _MDB */
86 
87 #ifdef	__cplusplus
88 }
89 #endif
90 
91 #endif	/* _MDB_LEX_H */
92