1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * $XConsortium: ifparser.h,v 1.1 92/08/22 13:05:39 rws Exp $
5 * Copyright 1992 Network Computing Devices, Inc.
7 * Permission to use, copy, modify, and distribute this software and its
8 * documentation for any purpose and without fee is hereby granted, provided
9 * that the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Network Computing Devices may not be
12 * used in advertising or publicity pertaining to distribution of the software
13 * without specific, written prior permission. Network Computing Devices makes
14 * no representations about the suitability of this software for any purpose.
15 * It is provided ``as is'' without express or implied warranty.
17 * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
18 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
19 * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
20 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23 * PERFORMANCE OF THIS SOFTWARE.
26 * Network Computing Devices, Inc.
28 * Simple if statement processor
30 * This module can be used to evaluate string representations of C language
31 * if constructs. It accepts the following grammar:
34 * | VALUE BINOP EXPRESSION
36 * VALUE := '(' EXPRESSION ')'
39 * | 'defined' '(' variable ')'
43 * BINOP := '*' | '/' | '%'
46 * | '<' | '>' | '<=' | '>='
51 * The normal C order of precidence is supported.
54 * External Entry Points:
56 * ParseIfExpression parse a string for #if
65 typedef struct if_parser
{
66 struct { /* functions */
67 const char *(*handle_error
) (struct if_parser
*, const char *, const char *);
68 int (*eval_variable
) (struct if_parser
*, const char *, size_t);
69 int (*eval_defined
) (struct if_parser
*, const char *, size_t);
73 const char *ParseIfExpression (IfParser
*, const char *, int *);
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */