Add a bytecode which returns the type of a given structure.

This commit is contained in:
Jesse D. McDonald 2009-12-05 15:44:01 -06:00
parent 62e2095f31
commit 8ca34f40ec
2 changed files with 2 additions and 0 deletions

View File

@ -36,6 +36,7 @@ unary-expr: up to 255, 1 out, 1 in
28 (set! out (vector-size in)) 28 (set! out (vector-size in))
29 (set! out (byte-string-size in)) 29 (set! out (byte-string-size in))
2a (set! out (struct-nslots in)) 2a (set! out (struct-nslots in))
2b (set! out (struct-type in))
; ISO C floating-point ; ISO C floating-point
30 (set! out (acos in)) 30 (set! out (acos in))

View File

@ -417,6 +417,7 @@ static value_t eval_unary_expression(interp_state_t *state, uint8_t subcode, uin
case 0x28: return fixnum_value(get_vector(ST1)->size); case 0x28: return fixnum_value(get_vector(ST1)->size);
case 0x29: return fixnum_value(get_byte_string(ST1)->size); case 0x29: return fixnum_value(get_byte_string(ST1)->size);
case 0x2a: return fixnum_value(get_struct(ST1)->nslots); case 0x2a: return fixnum_value(get_struct(ST1)->nslots);
case 0x2b: return get_struct(ST1)->type;
case 0x30: return make_float(acos(get_float(ST1))); case 0x30: return make_float(acos(get_float(ST1)));
case 0x31: return make_float(asin(get_float(ST1))); case 0x31: return make_float(asin(get_float(ST1)));
case 0x32: return make_float(atan(get_float(ST1))); case 0x32: return make_float(atan(get_float(ST1)));