update
This commit is contained in:
parent
d7f1de5d7f
commit
1625f241fa
|
@ -1,6 +1,31 @@
|
||||||
#ifndef __NASAL_CODEGEN_H__
|
#ifndef __NASAL_CODEGEN_H__
|
||||||
#define __NASAL_CODEGEN_H__
|
#define __NASAL_CODEGEN_H__
|
||||||
|
|
||||||
|
enum op_code
|
||||||
|
{
|
||||||
|
op_nop,
|
||||||
|
op_load,
|
||||||
|
op_pushnum,op_pushone,op_pushzero,
|
||||||
|
op_pushnil,
|
||||||
|
op_pushstr,
|
||||||
|
op_newvec,op_newhash,op_newfunc,
|
||||||
|
op_vecappend,op_hashappend,
|
||||||
|
op_unot,op_usub,
|
||||||
|
op_add,op_sub,op_mul,op_div,op_lnk,
|
||||||
|
op_eq,op_neq,op_less,op_leq,op_grt,op_geq,
|
||||||
|
op_jmp,op_jmptrue,op_jmpfalse,
|
||||||
|
op_gccall,op_gccallvec,op_gccallhash,op_gccallfunc,op_builtincall,op_slice,
|
||||||
|
op_memcall,op_memcallvec,op_memcallhash,
|
||||||
|
op_return,
|
||||||
|
op_end
|
||||||
|
};
|
||||||
|
|
||||||
|
struct opcode
|
||||||
|
{
|
||||||
|
unsigned char op;
|
||||||
|
int index;
|
||||||
|
};
|
||||||
|
|
||||||
// unfinished
|
// unfinished
|
||||||
// now it can output ast but it is not byte code yet
|
// now it can output ast but it is not byte code yet
|
||||||
// please wait...
|
// please wait...
|
||||||
|
|
|
@ -531,7 +531,7 @@ bool nasal_runtime::check_condition(int value_addr)
|
||||||
if(value_addr<0)
|
if(value_addr<0)
|
||||||
return false;
|
return false;
|
||||||
int type=nasal_vm.gc_get(value_addr).get_type();
|
int type=nasal_vm.gc_get(value_addr).get_type();
|
||||||
if(type==vm_vector || type==vm_hash || type==vm_function)
|
if(type==vm_nil || type==vm_vector || type==vm_hash || type==vm_function)
|
||||||
return false;
|
return false;
|
||||||
else if(type==vm_string)
|
else if(type==vm_string)
|
||||||
{
|
{
|
||||||
|
@ -541,8 +541,6 @@ bool nasal_runtime::check_condition(int value_addr)
|
||||||
return false;
|
return false;
|
||||||
return (number!=0);
|
return (number!=0);
|
||||||
}
|
}
|
||||||
else if(type==vm_nil)
|
|
||||||
return false;
|
|
||||||
else if(type==vm_number)
|
else if(type==vm_number)
|
||||||
return (nasal_vm.gc_get(value_addr).get_number()!=0);
|
return (nasal_vm.gc_get(value_addr).get_number()!=0);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue