Blame config/makedepend/ifparser.h

Packit b099d7
/*
Packit b099d7
 * $XConsortium: ifparser.h /main/4 1996/09/28 16:15:24 rws $
Packit b099d7
 *
Packit b099d7
 * Copyright 1992 Network Computing Devices, Inc.
Packit b099d7
 * 
Packit b099d7
 * Permission to use, copy, modify, and distribute this software and its
Packit b099d7
 * documentation for any purpose and without fee is hereby granted, provided
Packit b099d7
 * that the above copyright notice appear in all copies and that both that
Packit b099d7
 * copyright notice and this permission notice appear in supporting
Packit b099d7
 * documentation, and that the name of Network Computing Devices may not be
Packit b099d7
 * used in advertising or publicity pertaining to distribution of the software
Packit b099d7
 * without specific, written prior permission.  Network Computing Devices makes
Packit b099d7
 * no representations about the suitability of this software for any purpose.
Packit b099d7
 * It is provided ``as is'' without express or implied warranty.
Packit b099d7
 * 
Packit b099d7
 * NETWORK COMPUTING DEVICES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
Packit b099d7
 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
Packit b099d7
 * IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE FOR ANY SPECIAL,
Packit b099d7
 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
Packit b099d7
 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
Packit b099d7
 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
Packit b099d7
 * PERFORMANCE OF THIS SOFTWARE.
Packit b099d7
 * 
Packit b099d7
 * Author:  Jim Fulton
Packit b099d7
 *          Network Computing Devices, Inc.
Packit b099d7
 * 
Packit b099d7
 * Simple if statement processor
Packit b099d7
 *
Packit b099d7
 * This module can be used to evaluate string representations of C language
Packit b099d7
 * if constructs.  It accepts the following grammar:
Packit b099d7
 * 
Packit b099d7
 *     EXPRESSION	:=	VALUE
Packit b099d7
 * 			 |	VALUE  BINOP	EXPRESSION
Packit b099d7
 *			 |	VALUE	'?'	EXPRESSION ':'	EXPRESSION
Packit b099d7
 * 
Packit b099d7
 *     VALUE		:=	'('  EXPRESSION  ')'
Packit b099d7
 * 			 |	'!'  VALUE
Packit b099d7
 * 			 |	'-'  VALUE
Packit b099d7
 *			 |	'~'  VALUE
Packit b099d7
 * 			 |	'defined'  '('  variable  ')'
Packit b099d7
 * 			 |	variable
Packit b099d7
 * 			 |	number
Packit b099d7
 * 
Packit b099d7
 *     BINOP		:=	'*'	|  '/'	|  '%'
Packit b099d7
 * 			 |	'+'	|  '-'
Packit b099d7
 * 			 |	'<<'	|  '>>'
Packit b099d7
 * 			 |	'<'	|  '>'	|  '<='  |  '>='
Packit b099d7
 * 			 |	'=='	|  '!='
Packit b099d7
 * 			 |	'&'	|  '^'  |  '|'
Packit b099d7
 * 			 |	'&&'	|  '||'
Packit b099d7
 * 
Packit b099d7
 * The normal C order of precedence is supported.
Packit b099d7
 * 
Packit b099d7
 * 
Packit b099d7
 * External Entry Points:
Packit b099d7
 * 
Packit b099d7
 *     ParseIfExpression		parse a string for #if
Packit b099d7
 */
Packit b099d7
Packit b099d7
/* $XFree86: xc/config/makedepend/ifparser.h,v 3.2 1996/12/30 13:57:56 dawes Exp $ */
Packit b099d7
Packit b099d7
#include <stdio.h>
Packit b099d7
Packit b099d7
#define const /**/
Packit b099d7
typedef int Bool;
Packit b099d7
#define False 0
Packit b099d7
#define True 1
Packit b099d7
Packit b099d7
typedef struct _if_parser {
Packit b099d7
    struct {				/* functions */
Packit b099d7
	char *(*handle_error) (/* struct _if_parser *, const char *,
Packit b099d7
				 const char * */);
Packit b099d7
	long (*eval_variable) (/* struct _if_parser *, const char *, int */);
Packit b099d7
	int (*eval_defined) (/* struct _if_parser *, const char *, int */);
Packit b099d7
    } funcs;
Packit b099d7
    char *data;
Packit b099d7
} IfParser;
Packit b099d7
Packit b099d7
char *ParseIfExpression (
Packit b099d7
#ifdef __STDC__
Packit b099d7
    IfParser *, 
Packit b099d7
    const char *, 
Packit b099d7
    long *
Packit b099d7
#endif
Packit b099d7
);
Packit b099d7