Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / soltools / mkdepend / ifparser.h
blob5c3c0dbb6b791e0c84489f5d19d6a5cfd671d70c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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.
25 * Author: Jim Fulton
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:
33 * EXPRESSION := VALUE
34 * | VALUE BINOP EXPRESSION
36 * VALUE := '(' EXPRESSION ')'
37 * | '!' VALUE
38 * | '-' VALUE
39 * | 'defined' '(' variable ')'
40 * | variable
41 * | number
43 * BINOP := '*' | '/' | '%'
44 * | '+' | '-'
45 * | '<<' | '>>'
46 * | '<' | '>' | '<=' | '>='
47 * | '==' | '!='
48 * | '&' | '|'
49 * | '&&' | '||'
51 * The normal C order of precidence is supported.
54 * External Entry Points:
56 * ParseIfExpression parse a string for #if
59 #include <stdio.h>
61 typedef int Bool;
62 #define False 0
63 #define True 1
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);
70 } funcs;
71 } IfParser;
73 const char *ParseIfExpression (IfParser *, const char *, int *);
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */