@@ -7,6 +7,7 @@ XNAME("none", knone) | |||
#ifdef XATOM | |||
XATOM("true", ktrue) | |||
XATOM("false", kfalse) | |||
XATOM("stop", kstop) | |||
#endif | |||
#ifdef XFUNCTION |
@@ -122,7 +122,7 @@ struct l2_vm { | |||
struct l2_vm_stack_frame fstack[1024]; | |||
l2_word fsptr; | |||
l2_word knone, ktrue, kfalse; | |||
l2_word knone, ktrue, kfalse, kstop; | |||
l2_word gc_start; | |||
}; | |||
@@ -298,11 +298,12 @@ struct loop_context { | |||
}; | |||
static l2_word loop_callback(struct l2_vm *vm, l2_word retval, l2_word cont) { | |||
if (l2_vm_val_is_true(vm, &vm->values[retval])) { | |||
struct l2_vm_value *val = &vm->values[retval]; | |||
if (l2_value_get_type(val) == L2_VAL_TYPE_ATOM && val->atom == vm->values[vm->kstop].atom) { | |||
return vm->knone; | |||
} else { | |||
return cont; | |||
} | |||
return retval; | |||
} | |||
static void loop_marker( |