mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-22 23:18:01 +03:00
Implement R_NOTE instruction
It corresponds to the !== operator.
This commit is contained in:
@@ -851,6 +851,14 @@ static enum opcode execute_instruction(enum opcode opcode)
|
||||
stack_push(lhs_page == rhs_page && lhs_var == rhs_var ? 1 : 0);
|
||||
break;
|
||||
}
|
||||
case R_NOTE: {
|
||||
int rhs_var = stack_pop().i;
|
||||
int rhs_page = stack_pop().i;
|
||||
int lhs_var = stack_pop().i;
|
||||
int lhs_page = stack_pop().i;
|
||||
stack_push(lhs_page == rhs_page && lhs_var == rhs_var ? 0 : 1);
|
||||
break;
|
||||
}
|
||||
case NEW: {
|
||||
union vm_value v;
|
||||
create_struct(stack_pop().i, &v);
|
||||
|
||||
@@ -97,6 +97,24 @@ void set_page_ref(int v)
|
||||
gi <- v;
|
||||
}
|
||||
|
||||
void test_ref_compare(void)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
ref int rn;
|
||||
ref int ri = i;
|
||||
ref int rj = j;
|
||||
|
||||
test_bool("NULL === NULL", rn === NULL, true);
|
||||
test_bool("NULL !== NULL", rn !== NULL, false);
|
||||
test_bool("ri === NULL", ri === NULL, false);
|
||||
test_bool("ri !== NULL", ri !== NULL, true);
|
||||
test_bool("ri === ri", ri === ri, true);
|
||||
test_bool("ri !== ri", ri !== ri, false);
|
||||
test_bool("ri === rj", ri === rj, false);
|
||||
test_bool("ri !== rj", ri !== rj, true);
|
||||
}
|
||||
|
||||
void func_stack2(void)
|
||||
{
|
||||
func_stack1();
|
||||
@@ -140,6 +158,7 @@ void test_lang(void)
|
||||
func_stack2();
|
||||
'message1';
|
||||
'message2';
|
||||
test_ref_compare();
|
||||
}
|
||||
|
||||
int msg_count = 0;
|
||||
|
||||
Reference in New Issue
Block a user