Back to index

enigmail  1.4.3
ifparser.h
Go to the documentation of this file.
00001 /*
00002  * $Xorg: ifparser.h,v 1.3 2000/08/17 19:41:51 cpqbld Exp $
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.5 2001/07/25 15:04:40 dawes Exp $ */
00061 
00062 #include <stdio.h>
00063 
00064 typedef int Bool;
00065 #define False 0
00066 #define True 1
00067 
00068 typedef struct _if_parser {
00069     struct {                       /* functions */
00070        const char *(*handle_error) (struct _if_parser *, const char *,
00071                                  const char *);
00072        long (*eval_variable) (struct _if_parser *, const char *, int);
00073        int (*eval_defined) (struct _if_parser *, const char *, int);
00074     } funcs;
00075     char *data;
00076 } IfParser;
00077 
00078 const char *ParseIfExpression (
00079     IfParser *, 
00080     const char *, 
00081     long *
00082 );
00083