Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ bar", 127 } }, 0 }, // Newline
{ "if 1 == 1 then if 1 < 2 then elseif 1 == 1 then $a = 1; end end", { { NULL, 0 } }, { { NULL, 0 } }, -1 },
{ "if 1 == 1 then if 1 < 2 then end end", { { NULL, 0 } }, { { NULL, 0 } }, -1 },
{ "on foo then $a = \"1\"; if $a == \"1\" then $b = \"2\"; end end", { { NULL, 0 } }, { { NULL, 0 } }, -1 },
{ "if 1 == 1 then $a = 1; $b = 1; $c = 1; $d = 1; $e = 1; $f = 1; $g = 1; $h = 1; $i = 1; $j = 1; $k = 1; $l = 1; $m = 1; $n = 1; $o = 1; $p = 1; $q = 1; $r = 1; $s = 1; $t = 1; $u = 1; $v = 1; $w = 1; $x = 1; $y = 1; $z = 1; $aa = 1; $ab = 1; $ac = 1; $ad = 1; $ae = 1; $af = 1; $ag = 1; $ah = 1; $aj = 1; $aj = 1; $ak = 1; $al = 1; $am = 1; $an = 1; $ao = 1; $ap = 1; $aq = 1; $ar = 1; $as = 1; $at = 1; $au = 1; $av = 1; $aw = 1; $ax = 1; $ay = 1; $az = 1; $ba = 1; $bb = 1; $bc = 1; $bd = 1; $be = 1; $bf = 1; $bg = 1; $bh = 1; $bj = 1; $bj = 1; $bk = 1; $bl = 1; $bm = 1; $bn = 1; $bo = 1; $bp = 1; $bq = 1; $br = 1; $bs = 1; $bt = 1; $bu = 1; $bv = 1; $bw = 1; $bx = 1; $by = 1; $bz = 1; $ca = 1; $cb = 1; $cc = 1; $cd = 1; $ce = 1; $cf = 1; $cg = 1; $ch = 1; $cj = 1; $cj = 1; $ck = 1; $cl = 1; $cm = 1; $cn = 1; $co = 1; $cp = 1; $cq = 1; $cr = 1; $cs = 1; $ct = 1; $cu = 1; $cv = 1; $cw = 1; $cx = 1; $cy = 1; $cz = 1; $da = 1; $db = 1; $dc = 1; $dd = 1; $de = 1; $df = 1; $dg = 1; $dh = 1; $dj = 1; $dj = 1; $dk = 1; $dl = 1; $dm = 1; $dn = 1; $do = 1; $dp = 1; $dq = 1; $dr = 1; $ds = 1; $dt = 1; $du = 1; $dv = 1; $dw = 1; $dx = 1; $dy = 1; $dz = 1; $ea = 1; $eb = 1; $ec = 1; $ed = 1; $ee = 1;end", { { "", 3098 } }, { { "", 0 } }, -1 },
{ "if 1 == 1 then $a = 1; $b = 1; $c = 1; $d = 1; $e = 1; $f = 1; $g = 1; $h = 1; $i = 1; $j = 1; $k = 1; $l = 1; $m = 1; $n = 1; $o = 1; $p = 1; $q = 1; $r = 1; $s = 1; $t = 1; $u = 1; $v = 1; $w = 1; $x = 1; $y = 1; $z = 1; $aa = 1; $ab = 1; $ac = 1; $ad = 1; $ae = 1; $af = 1; $ag = 1; $ah = 1; $aj = 1; $aj = 1; $ak = 1; $al = 1; $am = 1; $an = 1; $ao = 1; $ap = 1; $aq = 1; $ar = 1; $as = 1; $at = 1; $au = 1; $av = 1; $aw = 1; $ax = 1; $ay = 1; $az = 1; $ba = 1; $bb = 1; $bc = 1; $bd = 1; $be = 1; $bf = 1; $bg = 1; $bh = 1; $bj = 1; $bj = 1; $bk = 1; $bl = 1; $bm = 1; $bn = 1; $bo = 1; $bp = 1; $bq = 1; $br = 1; $bs = 1; $bt = 1; $bu = 1; $bv = 1; $bw = 1; $bx = 1; $by = 1; $bz = 1; $ca = 1; $cb = 1; $cc = 1; $cd = 1; $ce = 1; $cf = 1; $cg = 1; $ch = 1; $cj = 1; $cj = 1; $ck = 1; $cl = 1; $cm = 1; $cn = 1; $co = 1; $cp = 1; $cq = 1; $cr = 1; $cs = 1; $ct = 1; $cu = 1; $cv = 1; $cw = 1; $cx = 1; $cy = 1; $cz = 1; $da = 1; $db = 1; $dc = 1; $dd = 1; $de = 1; $df = 1; $dg = 1; $dh = 1; $dj = 1; $dj = 1; $dk = 1; $dl = 1; $dm = 1; $dn = 1; $do = 1; $dp = 1; $dq = 1; $dr = 1; $ds = 1; $dt = 1; $du = 1; $dv = 1; $dw = 1; $dx = 1; $dy = 1; $dz = 1; $ea = 1; $eb = 1; $ec = 1; $ed = 1; $ee = 1; $ai = 1; $bi = 1; $ci = 1; $di = 1; $ef = 1; $eg = 1; $eh = 1; $ei = 1; $ej = 1; $ek = 1; $el = 1; $em = 1; $en = 1; $eo = 1; $ep = 1; $eq = 1; $er = 1; $es = 1; $et = 1; $eu = 1; $ev = 1; $ew = 1; $ex = 1; $ey = 1; $ez = 1; $fa = 1; $fb = 1; $fc = 1; $fd = 1; $fe = 1; $ff = 1; $fg = 1; $fh = 1; $fi = 1; $fj = 1; $fk = 1; $fl = 1; $fm = 1; $fn = 1; $fo = 1; $fp = 1; $fq = 1; $fr = 1; $fs = 1; $ft = 1; $fu = 1; $fv = 1; $fw = 1; $fx = 1; $fy = 1; $fz = 1; $ga = 1; $gb = 1; $gc = 1; $gd = 1; $ge = 1; $gf = 1; $gg = 1; $gh = 1; $gi = 1; $gj = 1; $gk = 1; $gl = 1; $gm = 1; $gn = 1; $go = 1; $gp = 1; $gq = 1; $gr = 1; $gs = 1; $gt = 1; $gu = 1; $gv = 1; $gw = 1; $gx = 1; $gy = 1; $gz = 1; $ha = 1; $hb = 1; $hc = 1; $hd = 1; $he = 1; $hf = 1; $hg = 1; $hh = 1; $hi = 1; $hj = 1; $hk = 1; $hl = 1; $hm = 1; $hn = 1; $ho = 1; $hp = 1; $hq = 1; $hr = 1; $hs = 1; $ht = 1; $hu = 1; $hv = 1; $hw = 1; $hx = 1; $hy = 1; $hz = 1; $ia = 1; $ib = 1; $ic = 1; $id = 1; $ie = 1; $if = 1; $ig = 1; $ih = 1; $ii = 1; $ij = 1; $ik = 1; $il = 1; $im = 1; $in = 1; $io = 1; $ip = 1; $iq = 1; $ir = 1; $is = 1; $it = 1; $iu = 1; $iv = 1; $iw = 1;end", { { "", 3098 } }, { { "", 0 } }, -1 },
};

static int8_t is_variable(char *text, uint16_t size) {
Expand Down
110 changes: 64 additions & 46 deletions src/rules/rules.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ typedef struct vm_top_t {
int8_t c;
} __attribute__((aligned(4))) vm_top_t;

// Preserve the original compact VM format. High named-variable indices in
// unambiguous operands are interpreted as unsigned. For OP_SETVAL, c == 2
// distinguishes a high unsigned source index from a negative heap reference.
static_assert(sizeof(vm_top_t) == 4, "Rules bytecode instruction must occupy 4 bytes");

typedef struct vm_vchar_t {
uint8_t type;
uint8_t fixed;
Expand Down Expand Up @@ -548,7 +553,7 @@ static uint16_t varstack_add(char **text, uint16_t start, uint16_t len, uint8_t
struct vm_vchar_t *value = (struct vm_vchar_t *)&varstack->buffer[a];

#ifdef DEBUG
assert(a/sizeof(struct vm_vchar_t *)/2 <= 127);
assert(a/sizeof(struct vm_vchar_t) <= 255);
#endif

i = varstack_find(text, start, len);
Expand Down Expand Up @@ -1463,7 +1468,7 @@ static uint16_t vm_stack_del(uint16_t idx) {
return ret;
}

static int16_t vm_val_pos(int8_t pos) {
static int16_t vm_val_pos(int16_t pos) {
if(pos < 0) {
return (((pos*-1)-1)*rule_max_var_bytes())+4;
} else if(pos == 0) {
Expand All @@ -1473,7 +1478,7 @@ static int16_t vm_val_pos(int8_t pos) {
}
}

static int32_t vm_val_posr(int8_t pos) {
static int32_t vm_val_posr(int16_t pos) {
return ((pos-4)/rule_max_var_bytes()*-1)-1;
}

Expand Down Expand Up @@ -1680,6 +1685,11 @@ static uint16_t bc_parent(struct rules_t *obj, uint8_t type, int16_t a, int16_t

assert(size <= getval(obj->bc.bufsize));
struct vm_top_t *node = (struct vm_top_t *)&obj->bc.buffer[ret];
// The high byte of a variable index is data, not a negative heap offset.
// Only OP_SETVAL.b is ambiguous; its c field is otherwise unused here.
if(type == OP_SETVAL && b > INT8_MAX && c == 0) c = 2;
// OP_PUSH already supports a positive variable source via c == 1.
if(type == OP_PUSH && a > INT8_MAX && c == 0) c = 1;
setval(node->type, type);
setval(node->a, a);
setval(node->b, b);
Expand Down Expand Up @@ -2061,8 +2071,12 @@ static void bc_assign_slots(struct rules_t *obj) {
end = bc_before(a);
break;
}
// OP_SETVAL.a is an unsigned global-variable destination, not a signed
// temporary/heap reference. A high destination (128..254) must not
// split the statement before SETVAL, or its source stays unresolved.
if(((c = bc_before(a)) >= 0) &&
((((int8_t)getval(node->a) < 0 && gettype(obj->bc.buffer[a]) != OP_PUSH)) ||
((((int8_t)getval(node->a) < 0 && gettype(obj->bc.buffer[a]) != OP_PUSH &&
gettype(obj->bc.buffer[a]) != OP_SETVAL)) ||
gettype(obj->bc.buffer[a]) == OP_JMP ||
gettype(obj->bc.buffer[a]) == OP_TEST ||
gettype(obj->bc.buffer[a]) == OP_RET)) {
Expand Down Expand Up @@ -2101,7 +2115,7 @@ static void bc_assign_slots(struct rules_t *obj) {

struct vm_top_t *x = (struct vm_top_t *)&obj->bc.buffer[a];

int8_t d = (int8_t)getval(x->a);
int16_t d = (int8_t)getval(x->a);
if(!is_op_and_math(gettype(obj->bc.buffer[a])) &&
gettype(obj->bc.buffer[a]) != OP_GETVAL &&
gettype(obj->bc.buffer[a]) != OP_CLEAR &&
Expand Down Expand Up @@ -2196,7 +2210,7 @@ static void bc_assign_slots(struct rules_t *obj) {

struct vm_top_t *x = (struct vm_top_t *)&obj->bc.buffer[a];

int8_t d = (int8_t)getval(x->a);
int16_t d = (int8_t)getval(x->a);

tmp = bc_next(obj, a);

Expand Down Expand Up @@ -2302,7 +2316,7 @@ static void bc_math_move_closest(struct rules_t *obj, int16_t limit) {
tmp1 = nrbytes;
tmp1B = -1;

if(getval(x->a) >= 0) {
if((int8_t)getval(x->a) >= 0) {
tmp1B = tmp1;
while((tmp1B = bc_before(tmp1B)) != -1 && tmp1B >= limit) {
struct vm_top_t *xB = (struct vm_top_t *)&obj->bc.buffer[tmp1B];
Expand Down Expand Up @@ -2331,8 +2345,9 @@ static void bc_math_move_closest(struct rules_t *obj, int16_t limit) {
}

struct vm_top_t *y = (struct vm_top_t *)&obj->bc.buffer[tmp1B];
int8_t xT = getval(x->type), xA = getval(x->a), xB = getval(x->b), xC = getval(x->c);
int8_t yA = getval(y->a);
uint8_t xT = getval(x->type);
int16_t xA = (int8_t)getval(x->a), xB = (int8_t)getval(x->b), xC = (int8_t)getval(x->c);
int16_t yA = (int8_t)getval(y->a);

setval(x->type, getval(y->type));
setval(x->b, getval(y->b));
Expand Down Expand Up @@ -2369,7 +2384,7 @@ static void bc_math_move_closest(struct rules_t *obj, int16_t limit) {
tmp1 = nrbytes;
tmp1B = -1;

if(getval(x->a) >= 0) {
if((int8_t)getval(x->a) >= 0) {
tmp1B = tmp1;
while((tmp1B = bc_before(tmp1B)) != -1 && tmp1B >= limit) {
struct vm_top_t *xB = (struct vm_top_t *)&obj->bc.buffer[tmp1B];
Expand Down Expand Up @@ -2398,8 +2413,9 @@ static void bc_math_move_closest(struct rules_t *obj, int16_t limit) {
}

struct vm_top_t *y = (struct vm_top_t *)&obj->bc.buffer[tmp1B];
int8_t xT = getval(x->type), xA = getval(x->a), xB = getval(x->b), xC = getval(x->c);
int8_t yA = getval(y->a);
uint8_t xT = getval(x->type);
int16_t xA = (int8_t)getval(x->a), xB = (int8_t)getval(x->b), xC = (int8_t)getval(x->c);
int16_t yA = (int8_t)getval(y->a);

setval(x->type, getval(y->type));
setval(x->b, getval(y->b));
Expand Down Expand Up @@ -2436,7 +2452,7 @@ static void bc_math_move_closest(struct rules_t *obj, int16_t limit) {
if(is_op_and_math(gettype(x->type))) {
tmp1 = nrbytes;
tmp1C = -1;
if(getval(x->c) >= 0) {
if((int8_t)getval(x->c) >= 0) {
tmp1C = tmp1;
while((tmp1C = bc_before(tmp1C)) != -1) {
struct vm_top_t *xC = (struct vm_top_t *)&obj->bc.buffer[tmp1C];
Expand Down Expand Up @@ -2474,8 +2490,9 @@ static void bc_math_move_closest(struct rules_t *obj, int16_t limit) {
}

struct vm_top_t *y = (struct vm_top_t *)&obj->bc.buffer[tmp1C];
int8_t xT = getval(x->type), xA = getval(x->a), xB = getval(x->b), xC = getval(x->c);
int8_t yA = getval(y->a);
uint8_t xT = getval(x->type);
int16_t xA = (int8_t)getval(x->a), xB = (int8_t)getval(x->b), xC = (int8_t)getval(x->c);
int16_t yA = (int8_t)getval(y->a);

setval(x->type, getval(y->type));
setval(x->b, getval(y->b));
Expand Down Expand Up @@ -2514,7 +2531,7 @@ static void bc_math_move_closest(struct rules_t *obj, int16_t limit) {
tmp1 = nrbytes;
tmp1B = -1;

if(getval(x->b) >= 0) {
if((int8_t)getval(x->b) >= 0) {
tmp1B = tmp1;
while((tmp1B = bc_before(tmp1B)) != -1) {
struct vm_top_t *xB = (struct vm_top_t *)&obj->bc.buffer[tmp1B];
Expand Down Expand Up @@ -2551,8 +2568,9 @@ static void bc_math_move_closest(struct rules_t *obj, int16_t limit) {
}

struct vm_top_t *y = (struct vm_top_t *)&obj->bc.buffer[tmp1B];
int8_t xT = getval(x->type), xA = getval(x->a), xB = getval(x->b), xC = getval(x->c);
int8_t yA = getval(y->a);
uint8_t xT = getval(x->type);
int16_t xA = (int8_t)getval(x->a), xB = (int8_t)getval(x->b), xC = (int8_t)getval(x->c);
int16_t yA = (int8_t)getval(y->a);

setval(x->type, getval(y->type));
setval(x->b, getval(y->b));
Expand Down Expand Up @@ -2765,7 +2783,8 @@ static int32_t bc_parse_math_order(char **text, struct rules_t *obj, uint16_t *p
struct vm_top_t *x = (struct vm_top_t *)&obj->bc.buffer[tmp2];

if(gettype(x->type) != OP_GETVAL) {
int8_t a = (int8_t)getval(x->type), d = (int8_t)getval(x->c);
int8_t a = getval(x->type);
int16_t d = (int8_t)getval(x->c);

tmp2B = bc_find_math_dep(obj, tmp2, getval(x->b));
if(tmp2B == -1) {
Expand Down Expand Up @@ -2839,7 +2858,8 @@ static int32_t bc_parse_math_order(char **text, struct rules_t *obj, uint16_t *p

a_a = rule_operators[a_is_op].associativity;
if(a_a == 2) {
int8_t a = (int8_t)getval(x->type), d = (int8_t)getval(x->c);
int8_t a = getval(x->type);
int16_t d = (int8_t)getval(x->c);

tmp2B = bc_find_math_dep(obj, tmp2, getval(x->b));
if(tmp2B == -1) {
Expand Down Expand Up @@ -4746,11 +4766,11 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {
STEP_GETVAL: {
struct vm_top_t *node = (struct vm_top_t *)&obj->bc.buffer[pos];

uint16_t b = (int8_t)getval(node->b)*sizeof(struct vm_vchar_t);
int16_t a = vm_val_pos(getval(node->a));
uint16_t b = (uint8_t)getval(node->b)*sizeof(struct vm_vchar_t);
int16_t a = vm_val_pos((int8_t)getval(node->a));

#if defined(DEBUG) || defined(COVERALLS)
if((int8_t)getval(node->b) < 0) {
if((uint8_t)getval(node->b)*sizeof(struct vm_vchar_t) >= varstack->nrbytes) {
logprintf_P(F("FATAL: Internal error in %s #%d pos (%d)"), __FUNCTION__, __LINE__, pos/4);
return -1;
}
Expand All @@ -4765,7 +4785,6 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {
#endif

vm_stack_push(b, &varstack->buffer[b]);

rule_options.vm_value_get(obj);

#if defined(DEBUG) || defined(COVERALLS)
Expand Down Expand Up @@ -4841,9 +4860,8 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {
/*****************/
STEP_SETVAL: {
struct vm_top_t *node = (struct vm_top_t *)&obj->bc.buffer[pos];

#if defined(DEBUG) || defined(COVERALLS)
if((int8_t)getval(node->a) < 0) {
if((uint8_t)getval(node->a)*sizeof(struct vm_vchar_t) >= varstack->nrbytes) {
logprintf_P(F("FATAL: Internal error in %s #%d pos (%d)"), __FUNCTION__, __LINE__, pos/4);
return -1;
}
Expand All @@ -4853,8 +4871,8 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {
// }
#endif

if((int8_t)getval(node->b) < 0) {
uint16_t a = (int8_t)getval(node->a)*sizeof(struct vm_vchar_t);
if((int8_t)getval(node->b) < 0 && getval(node->c) != 2) {
uint16_t a = (uint8_t)getval(node->a)*sizeof(struct vm_vchar_t);
int16_t b = vm_val_pos((int8_t)getval(node->b));

#if defined(DEBUG) || defined(COVERALLS)
Expand Down Expand Up @@ -4897,9 +4915,9 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {

memset(stack->buffer, 0, getval(stack->bufsize));
setval(stack->nrbytes, 4);
} else if((int8_t)getval(node->b) > 0) {
uint16_t a = (int8_t)getval(node->a)*sizeof(struct vm_vchar_t);
uint16_t b = (int8_t)(getval(node->b)-1)*sizeof(struct vm_vchar_t);
} else if((int8_t)getval(node->b) > 0 || getval(node->c) == 2) {
uint16_t a = (uint8_t)getval(node->a)*sizeof(struct vm_vchar_t);
uint16_t b = ((uint8_t)getval(node->b)-1)*sizeof(struct vm_vchar_t);

#if defined(DEBUG) || defined(COVERALLS)
if(b > varstack->nrbytes) {
Expand All @@ -4919,7 +4937,7 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {
memset(stack->buffer, 0, getval(stack->bufsize));
setval(stack->nrbytes, 4);
} else { // node->b == 0
uint16_t a = (int8_t)getval(node->a)*sizeof(struct vm_vchar_t);
uint16_t a = (uint8_t)getval(node->a)*sizeof(struct vm_vchar_t);
uint16_t b = ((int8_t)getval(node->b)+1)*rule_max_var_bytes();

if(rules_gettop() >= 1) {
Expand All @@ -4943,7 +4961,7 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {

STEP_PUSH: {
struct vm_top_t *node = (struct vm_top_t *)&obj->bc.buffer[pos];
if((int8_t)getval(node->a) < 0) {
if((int8_t)getval(node->a) < 0 && getval(node->c) != 1) {
int16_t a = vm_val_pos((int8_t)getval(node->a));

#if defined(DEBUG) || defined(COVERALLS)
Expand All @@ -4955,7 +4973,7 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {

vm_stack_push(a, &obj->heap->buffer[a]);
} else {
uint16_t a = (uint8_t)(getval(node->a)-1)*sizeof(struct vm_vchar_t);
uint16_t a = ((uint8_t)getval(node->a)-1)*sizeof(struct vm_vchar_t);

#if defined(DEBUG) || defined(COVERALLS)
if(a > varstack->nrbytes) {
Expand All @@ -4977,15 +4995,15 @@ int8_t rule_run(struct rules_t *obj, uint8_t validate) {
STEP_CALL: {
struct vm_top_t *node = (struct vm_top_t *)&obj->bc.buffer[pos];
int16_t a = vm_val_pos((int8_t)getval(node->a));
uint16_t b = (int8_t)getval(node->b);
uint16_t b = (uint8_t)getval(node->b);
uint16_t c = (int8_t)getval(node->c);

#if defined(DEBUG) || defined(COVERALLS)
if((int8_t)getval(node->a) > 0) {
logprintf_P(F("FATAL: Internal error in %s #%d pos (%d)"), __FUNCTION__, __LINE__, pos/4);
return -1;
}
if((int8_t)getval(node->b) < 0) {
if(c != 0 && b >= varstack->nrbytes / sizeof(struct vm_vchar_t)) {
logprintf_P(F("FATAL: Internal error in %s #%d pos (%d)"), __FUNCTION__, __LINE__, pos/4);
return -1;
}
Expand Down Expand Up @@ -5414,13 +5432,13 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
/*LCOV_EXCL_STOP*/

if(rule_prepare((char **)&input->payload, &bcsize, &heapsize, &varsize, &memsize, &newlen) == -1 ||
(varsize/sizeof(struct vm_vchar_t)) > INT8_MAX ||
((varstack->nrbytes + varsize) / sizeof(struct vm_vchar_t)) > INT8_MAX) {
if(varsize/sizeof(struct vm_vchar_t) > INT8_MAX) {
logprintf_P(F("ERROR: maximum number of 127 variables reached"));
(varsize/sizeof(struct vm_vchar_t)) > 255 ||
((varstack->nrbytes + varsize) / sizeof(struct vm_vchar_t)) > 255) {
if(varsize/sizeof(struct vm_vchar_t) > 255) {
logprintf_P(F("ERROR: maximum number of 255 variables reached"));
}
if((varstack->nrbytes + varsize) / sizeof(struct vm_vchar_t) > INT8_MAX) {
logprintf_P(F("ERROR: maximum number of 127 variables reached"));
if((varstack->nrbytes + varsize) / sizeof(struct vm_vchar_t) > 255) {
logprintf_P(F("ERROR: maximum number of 255 variables reached"));
}
if((*rules = (struct rules_t **)REALLOC(*rules, sizeof(struct rules_t **)*((*nrrules)))) == NULL) {
OUT_OF_MEMORY
Expand Down Expand Up @@ -5551,7 +5569,7 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
timestamp.second = micros();

logprintf_P(F("rule #%d bytecode was created in %d microseconds"), getval(obj->nr), timestamp.second - timestamp.first);
logprintf_P(F("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %d/127"),
logprintf_P(F("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %d/255"),
getval(obj->bc.nrbytes),
getval(obj->bc.bufsize),
getval(obj->heap->nrbytes),
Expand All @@ -5569,7 +5587,7 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
((double)timestamp.second.tv_sec + 1.0e-9*timestamp.second.tv_nsec) -
((double)timestamp.first.tv_sec + 1.0e-9*timestamp.first.tv_nsec));

printf("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %lu/127\n",
printf("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %lu/255\n",
getval(obj->bc.nrbytes),
getval(obj->bc.bufsize),
getval(obj->heap->nrbytes),
Expand Down Expand Up @@ -5629,7 +5647,7 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
timestamp.second = micros();

logprintf_P(F("rule #%d was executed in %d microseconds"), getval(obj->nr), timestamp.second - timestamp.first);
logprintf_P(F("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %d/127"),
logprintf_P(F("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %d/255"),
getval(obj->bc.nrbytes),
getval(obj->bc.bufsize),
getval(obj->heap->nrbytes),
Expand All @@ -5647,7 +5665,7 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
((double)timestamp.second.tv_sec + 1.0e-9*timestamp.second.tv_nsec) -
((double)timestamp.first.tv_sec + 1.0e-9*timestamp.first.tv_nsec));

printf("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %lu/127\n",
printf("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %lu/255\n",
getval(obj->bc.nrbytes),
getval(obj->bc.bufsize),
getval(obj->heap->nrbytes),
Expand Down
Loading