version 1.9, 1999/12/16 16:52:11 |
version 1.10, 1999/12/16 16:58:15 |
|
|
* last two fields are stored in condInvert and condDefProc, respectively. |
* last two fields are stored in condInvert and condDefProc, respectively. |
*/ |
*/ |
static void CondPushBack __P((Token)); |
static void CondPushBack __P((Token)); |
static size_t CondGetArg __P((char **, char **, char *, Boolean)); |
static Boolean CondGetArg __P((char **, char **, size_t *, char *, Boolean)); |
static Boolean CondDoDefined __P((size_t, char *)); |
static Boolean CondDoDefined __P((size_t, char *)); |
static int CondStrMatch __P((ClientData, ClientData)); |
static int CondStrMatch __P((ClientData, ClientData)); |
static Boolean CondDoMake __P((size_t, char *)); |
static Boolean CondDoMake __P((size_t, char *)); |
|
|
* Find the argument of a built-in function. |
* Find the argument of a built-in function. |
* |
* |
* Results: |
* Results: |
* The length of the argument and the address of the argument. |
* TRUE if evaluation went okay |
* |
* |
* Side Effects: |
* Side Effects: |
* The pointer is set to point to the closing parenthesis of the |
* The line pointer is set to point to the closing parenthesis of the |
* function call. |
* function call. The argument and argument length are filled. |
* |
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
static size_t |
static Boolean |
CondGetArg(linePtr, argPtr, func, parens) |
CondGetArg(linePtr, argPtr, argLen, func, parens) |
char **linePtr; |
char **linePtr; |
char **argPtr; |
char **argPtr; |
|
size_t *argLen; |
char *func; |
char *func; |
Boolean parens; /* TRUE if arg should be bounded by parens */ |
Boolean parens; /* TRUE if arg should be bounded by parens */ |
{ |
{ |
register char *cp; |
register char *cp; |
size_t argLen; |
|
register Buffer buf; |
register Buffer buf; |
|
|
cp = *linePtr; |
cp = *linePtr; |
|
|
* the word 'make' or 'defined' at the beginning of a symbol... |
* the word 'make' or 'defined' at the beginning of a symbol... |
*/ |
*/ |
*argPtr = cp; |
*argPtr = cp; |
return (0); |
return FALSE; |
} |
} |
|
|
while (*cp == ' ' || *cp == '\t') { |
while (*cp == ' ' || *cp == '\t') { |
|
|
} |
} |
} |
} |
|
|
/* XXX */ |
|
Buf_AddChar(buf, '\0'); |
|
*argPtr = Buf_Retrieve(buf); |
*argPtr = Buf_Retrieve(buf); |
argLen = Buf_Size(buf); |
*argLen = Buf_Size(buf); |
Buf_Destroy(buf, FALSE); |
Buf_Destroy(buf, FALSE); |
|
|
while (*cp == ' ' || *cp == '\t') { |
while (*cp == ' ' || *cp == '\t') { |
|
|
if (parens && *cp != ')') { |
if (parens && *cp != ')') { |
Parse_Error (PARSE_WARNING, "Missing closing parenthesis for %s()", |
Parse_Error (PARSE_WARNING, "Missing closing parenthesis for %s()", |
func); |
func); |
return (0); |
return FALSE; |
} else if (parens) { |
} else if (parens) { |
/* |
/* |
* Advance pointer past close parenthesis. |
* Advance pointer past close parenthesis. |
|
|
} |
} |
|
|
*linePtr = cp; |
*linePtr = cp; |
return (argLen); |
return TRUE; |
} |
} |
|
|
/*- |
/*- |
|
|
if (rhs == condExpr) { |
if (rhs == condExpr) { |
if (!qt && *cp == ')') |
if (!qt && *cp == ')') |
condExpr = cp; |
condExpr = cp; |
|
else if (*cp == '\0') |
|
condExpr = cp; |
else |
else |
condExpr = cp + 1; |
condExpr = cp + 1; |
} |
} |
|
|
*/ |
*/ |
evalProc = CondDoDefined; |
evalProc = CondDoDefined; |
condExpr += 7; |
condExpr += 7; |
arglen = CondGetArg (&condExpr, &arg, "defined", TRUE); |
if (!CondGetArg(&condExpr, &arg, &arglen, |
if (arglen == 0) { |
"defined", TRUE)) { |
condExpr -= 7; |
condExpr -= 7; |
goto use_default; |
goto use_default; |
} |
} |
} else if (strncmp (condExpr, "make", 4) == 0) { |
} else if (strncmp (condExpr, "make", 4) == 0) { |
/* |
/* |
* Use CondDoMake to evaluate the argument and |
* Use CondDoMake to evaluate the argument and |
|
|
*/ |
*/ |
evalProc = CondDoMake; |
evalProc = CondDoMake; |
condExpr += 4; |
condExpr += 4; |
arglen = CondGetArg (&condExpr, &arg, "make", TRUE); |
if (!CondGetArg(&condExpr, &arg, &arglen, |
if (arglen == 0) { |
"make", TRUE)) { |
condExpr -= 4; |
condExpr -= 4; |
goto use_default; |
goto use_default; |
} |
} |
} else if (strncmp (condExpr, "exists", 6) == 0) { |
} else if (strncmp (condExpr, "exists", 6) == 0) { |
/* |
/* |
* Use CondDoExists to evaluate the argument and |
* Use CondDoExists to evaluate the argument and |
|
|
*/ |
*/ |
evalProc = CondDoExists; |
evalProc = CondDoExists; |
condExpr += 6; |
condExpr += 6; |
arglen = CondGetArg(&condExpr, &arg, "exists", TRUE); |
if (!CondGetArg(&condExpr, &arg, &arglen, |
if (arglen == 0) { |
"exists", TRUE)) { |
condExpr -= 6; |
condExpr -= 6; |
goto use_default; |
goto use_default; |
} |
} |
} else if (strncmp(condExpr, "empty", 5) == 0) { |
} else if (strncmp(condExpr, "empty", 5) == 0) { |
/* |
/* |
|
|
*/ |
*/ |
evalProc = CondDoTarget; |
evalProc = CondDoTarget; |
condExpr += 6; |
condExpr += 6; |
arglen = CondGetArg(&condExpr, &arg, "target", TRUE); |
if (!CondGetArg(&condExpr, &arg, &arglen, |
if (arglen == 0) { |
"target", TRUE)) { |
condExpr -= 6; |
condExpr -= 6; |
goto use_default; |
goto use_default; |
} |
} |
} else { |
} else { |
/* |
/* |
|
|
use_default: |
use_default: |
invert = condInvert; |
invert = condInvert; |
evalProc = condDefProc; |
evalProc = condDefProc; |
arglen = CondGetArg(&condExpr, &arg, "", FALSE); |
/* XXX should we ignore problems now ? */ |
|
CondGetArg(&condExpr, &arg, &arglen, "", FALSE); |
} |
} |
|
|
/* |
/* |