}
else
{
- rv = cfg_allocz(sizeof(struct f_inst3));
- rv->lineno = ifs->lino;
- rv->fi_code = FI_LC_CONSTRUCT;
+ rv = f_new_inst(FI_LC_CONSTRUCT);
rv->a1.p = t1;
rv->a2.p = t2;
- INST3(rv).p = t3;
+ rv->a3.p = t3;
}
return rv;
#define TWOARGS_C TWOARGS \
if (v1.type != v2.type) \
runtime( "Can't operate with values of incompatible types" );
+#define THREEARGS TWOARGS \
+ ARG(v3, a3.p)
#define ACCESS_RTE \
do { if (!f_rte) runtime("No route to access"); } while (0)
interpret(struct f_inst *what)
{
struct symbol *sym;
- struct f_val v1, v2, res = { .type = T_VOID }, *vp;
+ struct f_val v1, v2, v3, res = { .type = T_VOID }, *vp;
unsigned u1, u2;
int i;
u32 as;
case FI_LC_CONSTRUCT:
{
- TWOARGS;
-
- /* Third argument hack */
- struct f_val v3 = interpret(INST3(what).p);
- if (v3.type & T_RETURN)
- return v3;
+ THREEARGS;
if ((v1.type != T_INT) || (v2.type != T_INT) || (v3.type != T_INT))
runtime( "Can't operate with value of non-integer type in LC constructor" );
case FI_TYPE: ONEARG; break;
case FI_LC_CONSTRUCT:
- TWOARGS;
- if (!i_same(INST3(f1).p, INST3(f2).p))
- return 0;
+ THREEARGS;
break;
case FI_SET:
uint i;
void *p;
} a2; /* The second argument */
+ union {
+ int i;
+ void *p;
+ } a3; /* The third argument */
int lineno;
};
struct rtable_config *rtc;
};
-struct f_inst3 {
- struct f_inst i;
- union {
- int i;
- void *p;
- } a3;
-};
-
-#define INST3(x) (((struct f_inst3 *) x)->a3)
-
-
struct f_prefix {
net_addr net;
u8 lo, hi;