ifparser.h

Go to the documentation of this file.
00001 /*
00002  * $XConsortium: ifparser.h /main/4 1996/09/28 16:15:24 rws $
00003  *
00004  * Copyright 1992 Network Computing Devices, Inc.
00005  *
00006  * Permission to use, copy, modify, and distribute this software and its
00007  * documentation for any purpose and without fee is hereby granted, provided
00008  * that the above copyright notice appear in all copies and that both that
00009  * copyright notice and this permission notice appear in supporting
00010  * documentation, and that the name of Network Computing Devices may not be
00011  * used in advertising or publicity pertaining to distribution of the software
00012  * without specific, written prior permission.  Network Computing Devices makes
00013  * no representations about the suitability of this software for any purpose.
00014  * It is provided ``as is'' without express or implied warranty.
00015  *
00016  * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
00017  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
00018  * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
00019  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00020  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00021  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00022  * PERFORMANCE OF THIS SOFTWARE.
00023  *
00024  * Author:  Jim Fulton
00025  *          Network Computing Devices, Inc.
00026  *
00027  * Simple if statement processor
00028  *
00029  * This module can be used to evaluate string representations of C language
00030  * if constructs.  It accepts the following grammar:
00031  *
00032  *     EXPRESSION := VALUE
00033  *        | VALUE  BINOP EXPRESSION
00034  *        | VALUE '?' EXPRESSION ':' EXPRESSION
00035  *
00036  *     VALUE  := '('  EXPRESSION  ')'
00037  *        | '!'  VALUE
00038  *        | '-'  VALUE
00039  *        | '~'  VALUE
00040  *        | 'defined'  '('  variable  ')'
00041  *        | variable
00042  *        | number
00043  *
00044  *     BINOP  := '*' |  '/' |  '%'
00045  *        | '+' |  '-'
00046  *        | '<<' |  '>>'
00047  *        | '<' |  '>' |  '<='  |  '>='
00048  *        | '==' |  '!='
00049  *        | '&' |  '^'  |  '|'
00050  *        | '&&' |  '||'
00051  *
00052  * The normal C order of precedence is supported.
00053  *
00054  *
00055  * External Entry Points:
00056  *
00057  *     ParseIfExpression  parse a string for #if
00058  */
00059 
00060 /* $XFree86: xc/config/makedepend/ifparser.h,v 3.2 1996/12/30 13:57:56 dawes Exp $ */
00061 
00062 #include <stdio.h>
00063 
00064 #ifdef const
00065 #undef const
00066 #endif
00067 #define const /**/
00068 typedef int Bool;
00069 #define False 0
00070 #define True 1
00071 
00072 typedef struct _if_parser {
00073    struct {    /* functions */
00074       char *(*handle_error)(/* struct _if_parser *, const char *,
00075      const char * */);
00076       long(*eval_variable)(/* struct _if_parser *, const char *, int */);
00077       int (*eval_defined)(/* struct _if_parser *, const char *, int */);
00078    } funcs;
00079    char *data;
00080 } IfParser;
00081 
00082 char *ParseIfExpression(
00083 #ifdef __STDC__
00084    IfParser *,
00085    const char *,
00086    long *
00087 #endif
00088 );

Generated on Tue Jul 5 14:10:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1