|
|
|
|
|
|
|
|
|
|
|
|
|
|
static l2_word loop_callback(struct l2_vm *vm, l2_word retval, l2_word cont) { |
|
|
static l2_word loop_callback(struct l2_vm *vm, l2_word retval, l2_word cont) { |
|
|
struct l2_vm_value *val = &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) { |
|
|
|
|
|
|
|
|
if (l2_value_get_type(val) == L2_VAL_TYPE_ERROR) { |
|
|
|
|
|
return retval; |
|
|
|
|
|
} else if ( |
|
|
|
|
|
l2_value_get_type(val) == L2_VAL_TYPE_ATOM && |
|
|
|
|
|
val->atom == vm->values[vm->kstop].atom) { |
|
|
return vm->knone; |
|
|
return vm->knone; |
|
|
} else { |
|
|
} else { |
|
|
return cont; |
|
|
return cont; |
|
|
|
|
|
|
|
|
cont->extra.cont_call = ctx->body; |
|
|
cont->extra.cont_call = ctx->body; |
|
|
return cont_id; |
|
|
return cont_id; |
|
|
} else { |
|
|
} else { |
|
|
return retval; |
|
|
|
|
|
|
|
|
return vm->knone; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
if (l2_value_get_type(ret) == L2_VAL_TYPE_ERROR) { |
|
|
if (l2_value_get_type(ret) == L2_VAL_TYPE_ERROR) { |