pike.git/
src/
lex.c
Branch:
Tag:
Non-build tags
All tags
No tags
1997-12-16
1997-12-16 22:31:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>
f2912c0a3023683c9625d94fe0621cc3fddf11bd (
67
lines) (+
66
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
Added an experimental implementation of #if resolv().
Rev: src/lex.c:1.31
4:
||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h"
-
RCSID("$Id: lex.c,v 1.
30
1997/
11
/
08
01
:
34
:
40
hubbe
Exp $");
+
RCSID("$Id: lex.c,v 1.
31
1997/
12
/
16
22
:
31
:
25
grubba
Exp $");
#include "language.h" #include "array.h" #include "lex.h"
1868:
UNGETSTR(" 0 ",3); continue;
+
} else if (!strcmp("resolv", my_yylval.str)) {
+
int res = 0;
+
struct svalue *oldsp = sp;
+
+
SKIPWHITE();
+
if (!GOBBLE('(')) {
+
yyerror("Missing '(' in #if resolv().\n");
+
return;
}
-
+
READBUF(isidchar(C));
-
+
/* code from low_idents here */
+
if (get_master) {
+
push_text(buf);
+
current_file->refs++;
+
push_string(current_file);
+
+
SAFE_APPLY_MASTER("resolv", 2);
+
+
if ((throw_value.type != T_STRING) &&
+
(!(IS_ZERO(sp-1) && sp[-1].subtype == 1))) {
+
res = 1;
+
}
+
} else {
+
res = 0;
+
}
+
+
while(GOBBLE('.')) {
+
READBUF(isidchar(C));
+
if (res) {
+
JMP_BUF recovery;
+
+
push_text(buf);
+
+
free_svalue(&throw_value);
+
throw_value.type = T_INT;
+
+
if (SETJMP(recovery)) {
+
res = 0;
+
} else {
+
f_index(2);
+
if (IS_ZERO(sp-1) && sp[-1].subtype == 1) {
+
res = 0;
+
}
+
}
+
UNSETJMP(recovery);
+
}
+
}
+
+
if (!GOBBLE(')')) {
+
yyerror("Missing ')' in #if resolv().\n");
+
return;
+
}
+
+
if (sp > oldsp) {
+
pop_n_elems(sp - oldsp);
+
}
+
+
if (res) {
+
UNGETSTR(" 1 ", 3);
+
} else {
+
UNGETSTR(" 0 ", 3);
+
}
+
continue;
+
}
+
s=findstring(my_yylval.str); if(!s || !expand_define(s,1)) UNGETSTR(" 0 ",3);