;
constant:
- CONST '(' expr ')' { $$ = f_new_inst(); $$->code = 'c'; $$->arg1 = T_INT; $$->arg2 = $3; }
- | NUM { $$ = f_new_inst(); $$->code = 'c'; $$->arg1 = T_INT; $$->arg2 = $1; }
- | TRUE { $$ = f_new_inst(); $$->code = 'c'; $$->arg1 = T_BOOL; $$->arg2 = 1; }
- | FALSE { $$ = f_new_inst(); $$->code = 'c'; $$->arg1 = T_BOOL; $$->arg2 = 0; }
- | TEXT { $$ = f_new_inst(); $$->code = 'c'; $$->arg1 = T_STRING; $$->arg2 = $1; }
+ CONST '(' expr ')' { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_INT; $$->a2.i = $3; }
+ | NUM { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_INT; $$->a2.i = $1; }
+ | TRUE { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_BOOL; $$->a2.i = 1; }
+ | FALSE { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_BOOL; $$->a2.i = 0; }
+ | TEXT { $$ = f_new_inst(); $$->code = 'c'; $$->a1.i = T_STRING; $$->a2.p = $1; }
;
term:
- term '+' term { $$ = f_new_inst(); $$->code = '+'; $$->arg1 = $1; $$->arg2 = $3; }
+ term '+' term { $$ = f_new_inst(); $$->code = '+'; $$->a1.p = $1; $$->a2.p = $3; }
- | term '=' term { $$ = f_new_inst(); $$->code = '=='; $$->arg1 = $1; $$->arg2 = $3; }
- | term '!' '=' term { $$ = f_new_inst(); $$->code = '!='; $$->arg1 = $1; $$->arg2 = $4; }
- | term '<' term { $$ = f_new_inst(); $$->code = '<'; $$->arg1 = $1; $$->arg2 = $3; }
- | term '<' '=' term { $$ = f_new_inst(); $$->code = '<='; $$->arg1 = $1; $$->arg2 = $4; }
- | term '>' term { $$ = f_new_inst(); $$->code = '<'; $$->arg1 = $3; $$->arg2 = $1; }
- | term '>' '=' term { $$ = f_new_inst(); $$->code = '<='; $$->arg1 = $4; $$->arg2 = $1; }
+ | term '=' term { $$ = f_new_inst(); $$->code = '=='; $$->a1.p = $1; $$->a2.p = $3; }
+ | term '!' '=' term { $$ = f_new_inst(); $$->code = '!='; $$->a1.p = $1; $$->a2.p = $4; }
+ | term '<' term { $$ = f_new_inst(); $$->code = '<'; $$->a1.p = $1; $$->a2.p = $3; }
+ | term '<' '=' term { $$ = f_new_inst(); $$->code = '<='; $$->a1.p = $1; $$->a2.p = $4; }
+ | term '>' term { $$ = f_new_inst(); $$->code = '<'; $$->a1.p = $3; $$->a2.p = $1; }
+ | term '>' '=' term { $$ = f_new_inst(); $$->code = '<='; $$->a1.p = $4; $$->a2.p = $1; }
| SYM {
$$ = f_new_inst();
switch ($1->class) {
case SYM_VARIABLE | T_INT:
$$->code = 'i';
- $$->arg1 = T_INT;
- $$->arg2 = &($1->aux);
+ $$->a1.i = T_INT;
+ $$->a2.p = &($1->aux);
break;
default:
cf_error("Can not use this class of symbol as variable" );
IF term THEN block {
$$ = f_new_inst();
$$->code = '?';
- $$->arg1 = $2;
- $$->arg2 = $4;
+ $$->a1.p = $2;
+ $$->a2.p = $4;
}
;
print_one:
- term { $$ = f_new_inst(); $$->code = 'p'; $$->arg1 = $1; $$->arg2 = NULL; }
+ term { $$ = f_new_inst(); $$->code = 'p'; $$->a1.p = $1; $$->a2.p = NULL; }
;
print_list: /* EMPTY */ { $$ = NULL; }
| ifthen ELSE block {
$$ = f_new_inst();
$$->code = '?';
- $$->arg1 = $1;
- $$->arg2 = $3;
+ $$->a1.p = $1;
+ $$->a2.p = $3;
}
| SYM '=' term ';' {
$$ = f_new_inst();
if (($1->class & ~T_MASK) != SYM_VARIABLE)
cf_error( "You may only set variables, and this is %x.\n", $1->class );
$$->code = 's';
- $$->arg1 = $1;
- $$->arg2 = $3;
+ $$->a1.p = $1;
+ $$->a2.p = $3;
}
- | break_command print_list ';' { $$ = f_new_inst(); $$->code = 'p,'; $$->arg1 = $2; $$->arg2 = $1; }
+ | break_command print_list ';' { $$ = f_new_inst(); $$->code = 'p,'; $$->a1.p = $2; $$->a2.i = $1; }
;
CF_END
if (x.type == T_RETURN) \
return x;
-#define ONEARG ARG(v1, arg1)
-#define TWOARGS ARG(v1, arg1) \
- ARG(v2, arg2)
+#define ONEARG ARG(v1, a1.p)
+#define TWOARGS ARG(v1, a1.p) \
+ ARG(v2, a2.p)
#define TWOARGS_C TWOARGS \
if (v1.type != v2.type) \
runtime( "Can not operate with values of incompatible types" );
/* Set */
case 's':
- ARG(v2, arg2);
- sym = what->arg1;
+ ARG(v2, a2.p);
+ sym = what->a1.p;
switch (res.type = v2.type) {
case T_VOID: runtime( "Can not assign void values" );
case T_INT:
break;
case 'c':
- res.type = (int) what->arg1;
- res.val.i = (int) what->arg2;
+ res.type = what->a1.i;
+ res.val.i = (int) what->a2.p;
break;
case 'i':
- res.type = (int) what->arg1;
- res.val.i = * ((int *) what->arg2);
+ res.type = what->a1.i;
+ res.val.i = * ((int *) what->a2.p);
break;
case 'p':
ONEARG;
if (v1.type != T_BOOL)
runtime( "If requires bool expression" );
if (v1.val.i) {
- ARG(res,arg2);
+ ARG(res,a2.p);
res.val.i = 0;
} else res.val.i = 1;
res.type = T_BOOL;
ONEARG;
printf( "\n" );
- switch ((int) what->arg2) {
+ switch (what->a2.i) {
case F_QUITBIRD:
die( "Filter asked me to die" );
case F_ACCEPT:
case F_ERROR:
case F_REJECT:
res.type = T_RETURN;
- res.val.i = (int) what->arg1;
+ res.val.i = what->a1.i;
break;
case F_NOP:
break;