2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * $XConsortium: ifparser.h /main/4 1996/09/28 16:15:24 rws $
26 * Copyright 1992 Network Computing Devices, Inc.
28 * Permission to use, copy, modify, and distribute this software and its
29 * documentation for any purpose and without fee is hereby granted, provided
30 * that the above copyright notice appear in all copies and that both that
31 * copyright notice and this permission notice appear in supporting
32 * documentation, and that the name of Network Computing Devices may not be
33 * used in advertising or publicity pertaining to distribution of the software
34 * without specific, written prior permission. Network Computing Devices makes
35 * no representations about the suitability of this software for any purpose.
36 * It is provided ``as is'' without express or implied warranty.
38 * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
39 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
40 * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
41 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
43 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44 * PERFORMANCE OF THIS SOFTWARE.
47 * Network Computing Devices, Inc.
49 * Simple if statement processor
51 * This module can be used to evaluate string representations of C language
52 * if constructs. It accepts the following grammar:
55 * | VALUE BINOP EXPRESSION
57 * VALUE := '(' EXPRESSION ')'
60 * | 'defined' '(' variable ')'
64 * BINOP := '*' | '/' | '%'
67 * | '<' | '>' | '<=' | '>='
72 * The normal C order of precidence is supported.
75 * External Entry Points:
77 * ParseIfExpression parse a string for #if
88 typedef struct _if_parser {
89 struct { /* functions */
90 char *(*handle_error) (/* struct _if_parser *, const char *,
92 long (*eval_variable) (/* struct _if_parser *, const char *, int */);
93 int (*eval_defined) (/* struct _if_parser *, const char *, int */);
98 char *ParseIfExpression (