diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:48:20 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:48:20 +0000 |
commit | a15b8ac6912cef59d7e1ba7a80e58466e2c9fcba (patch) | |
tree | 26b5e2d5670359b095209d199c53d8a099d11e31 /cppsetup.c | |
parent | ac5d447a2f18bdd07d5f97bb27cd9d065e30f683 (diff) |
XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1
Diffstat (limited to 'cppsetup.c')
-rw-r--r-- | cppsetup.c | 49 |
1 files changed, 19 insertions, 30 deletions
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/config/makedepend/cppsetup.c,v 3.11 2001/12/17 20:52:22 dawes Exp $ */ #include "def.h" @@ -39,7 +40,7 @@ in this Software without prior written authorization from The Open Group. #define QB 16 #define WB 32 #define SALT '#' -#if pdp11 | vax | ns16000 | mc68000 | ibm032 +#if defined(pdp11) || defined(vax) || defined(ns16000) || defined(mc68000) || defined(ibm032) #define COFF 128 #else #define COFF 0 @@ -58,12 +59,10 @@ extern char slotab[]; struct filepointer *currentfile; struct inclist *currentinc; -cppsetup(line, filep, inc) - register char *line; - register struct filepointer *filep; - register struct inclist *inc; +int +cppsetup(char *line, struct filepointer *filep, struct inclist *inc) { - register char *p, savec; + char *p, savec; static boolean setupdone = FALSE; boolean value; @@ -132,10 +131,7 @@ struct _parse_data { }; static const char * -my_if_errors (ip, cp, expecting) - IfParser *ip; - const char *cp; - const char *expecting; +my_if_errors (IfParser *ip, const char *cp, const char *expecting) { struct _parse_data *pd = (struct _parse_data *) ip->data; int lineno = pd->filep->f_line; @@ -162,10 +158,7 @@ my_if_errors (ip, cp, expecting) #define MAXNAMELEN 256 static struct symtab ** -lookup_variable (ip, var, len) - IfParser *ip; - const char *var; - int len; +lookup_variable (IfParser *ip, const char *var, int len) { char tmpbuf[MAXNAMELEN + 1]; struct _parse_data *pd = (struct _parse_data *) ip->data; @@ -180,10 +173,7 @@ lookup_variable (ip, var, len) static int -my_eval_defined (ip, var, len) - IfParser *ip; - const char *var; - int len; +my_eval_defined (IfParser *ip, const char *var, int len) { if (lookup_variable (ip, var, len)) return 1; @@ -194,11 +184,9 @@ my_eval_defined (ip, var, len) #define isvarfirstletter(ccc) (isalpha(ccc) || (ccc) == '_') static long -my_eval_variable (ip, var, len) - IfParser *ip; - const char *var; - int len; +my_eval_variable (IfParser *ip, const char *var, int len) { + long val; struct symtab **s; s = lookup_variable (ip, var, len); @@ -206,20 +194,21 @@ my_eval_variable (ip, var, len) return 0; do { var = (*s)->s_value; - if (!isvarfirstletter(*var)) + if (!isvarfirstletter(*var) || !strcmp((*s)->s_name, var)) break; s = lookup_variable (ip, var, strlen(var)); } while (s); - return strtol(var, NULL, 0); + var = ParseIfExpression(ip, var, &val); + if (var && *var) debug(4, ("extraneous: '%s'\n", var)); + return val; } - -cppsetup(filename, line, filep, inc) - register char *filename; - register char *line; - register struct filepointer *filep; - register struct inclist *inc; +int +cppsetup(char *filename, + char *line, + struct filepointer *filep, + struct inclist *inc) { IfParser ip; struct _parse_data pd; |