2
* $Xorg: ifparser.h,v 1.3 2000/08/17 19:41:51 cpqbld Exp $
4
* Copyright 1992 Network Computing Devices, Inc.
6
* Permission to use, copy, modify, and distribute this software and its
7
* documentation for any purpose and without fee is hereby granted, provided
8
* that the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of Network Computing Devices may not be
11
* used in advertising or publicity pertaining to distribution of the software
12
* without specific, written prior permission. Network Computing Devices makes
13
* no representations about the suitability of this software for any purpose.
14
* It is provided ``as is'' without express or implied warranty.
16
* NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
18
* IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
19
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
21
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
25
* Network Computing Devices, Inc.
27
* Simple if statement processor
29
* This module can be used to evaluate string representations of C language
30
* if constructs. It accepts the following grammar:
33
* | VALUE BINOP EXPRESSION
34
* | VALUE '?' EXPRESSION ':' EXPRESSION
36
* VALUE := '(' EXPRESSION ')'
40
* | 'defined' '(' variable ')'
44
* BINOP := '*' | '/' | '%'
47
* | '<' | '>' | '<=' | '>='
52
* The normal C order of precedence is supported.
55
* External Entry Points:
57
* ParseIfExpression parse a string for #if
60
/* $XFree86: xc/config/makedepend/ifparser.h,v 3.5 2001/07/25 15:04:40 dawes Exp $ */
68
typedef struct _if_parser {
69
struct { /* functions */
70
const char *(*handle_error) (struct _if_parser *, const char *,
72
long (*eval_variable) (struct _if_parser *, const char *, int);
73
int (*eval_defined) (struct _if_parser *, const char *, int);
78
const char *ParseIfExpression (