summaryrefslogtreecommitdiff
path: root/cppsetup.c
diff options
context:
space:
mode:
Diffstat (limited to 'cppsetup.c')
-rw-r--r--cppsetup.c49
1 files changed, 19 insertions, 30 deletions
diff --git a/cppsetup.c b/cppsetup.c
index b25d2ce..49a746a 100644
--- a/cppsetup.c
+++ b/cppsetup.c
@@ -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;