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#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32#include <mdb/mdb_argvec.h>
33#include <mdb/mdb_nv.h>
34#include <mdb/mdb_types.h>
35#include <mdb/mdb_module.h>
36#include <stdio.h>
37
38#ifdef	__cplusplus
39extern "C" {
40#endif
41
42#ifdef _MDB
43
44extern void mdb_lex_debug(int);
45extern void mdb_lex_reset(void);
46
47extern void yyerror(const char *, ...);
48extern void yyperror(const char *, ...);
49extern void yydiscard(void);
50
51extern int yyparse(void);
52extern int yywrap(void);
53
54
55struct mdb_lex_state;
56struct mdb_frame;
57
58void mdb_lex_state_save(struct mdb_lex_state *);
59void mdb_lex_state_restore(struct mdb_lex_state *);
60void mdb_lex_state_create(struct mdb_frame *);
61void mdb_lex_state_destroy(struct mdb_frame *);
62
63/*
64 * The lex and yacc debugging code as generated uses printf and fprintf
65 * for debugging output.  We redefine these to refer to our yyprintf
66 * and yyfprintf routines, which are wrappers around mdb_iob_vprintf.
67 */
68
69#define	printf	(void) yyprintf
70#define	fprintf	(void) yyfprintf
71
72extern int yyprintf(const char *, ...);
73extern int yyfprintf(FILE *, const char *, ...);
74
75extern int yylineno;
76
77/*
78 * Maximum depth we can have in our yacc state stack.  The yacc default is 150,
79 * but this should be more than enough for our simple mdb expressions.
80 */
81#define	YYMAXDEPTH	100
82/*
83 * Maximum size of our lex yytext buffer.
84 */
85#define	YYLMAX		BUFSIZ
86
87#endif /* _MDB */
88
89#ifdef	__cplusplus
90}
91#endif
92
93#endif	/* _MDB_LEX_H */
94