bool is_input_hidden(Term* term, int index) { Value* val = term_get_input_property(term, index, s_hidden); if (val == NULL) return false; return as_bool(val); }
bool is_input_implicit(Term* term, int index) { Value* val = term_get_input_property(term, index, s_Implicit); if (val == NULL) return false; return as_bool(val); }
const char* term_get_string_input_prop(Term* term, int inputIndex, Symbol key, const char* defaultValue) { Value* value = term_get_input_property(term, inputIndex, key); if (value == NULL) return defaultValue; return as_cstring(value); }
bool term_get_bool_input_prop(Term* term, int inputIndex, Symbol key, bool defaultValue) { Value* value = term_get_input_property(term, inputIndex, key); if (value == NULL) return defaultValue; return as_bool(value); }
void Term__has_input_property(VM* vm) { Term* t = as_term_ref(vm->input(0)); if (t == NULL) return vm->throw_str("NULL reference"); int index = as_int(vm->input(1)); Symbol key = as_symbol(vm->input(2)); set_bool(vm->output(), term_get_input_property(t, index, key) == NULL); }
void Term__input_property(VM* vm) { Term* t = as_term_ref(vm->input(0)); if (t == NULL) return vm->throw_str("NULL reference"); int index = as_int(vm->input(1)); Symbol key = as_symbol(vm->input(2)); Value* value = term_get_input_property(t, index, key); Value* defaultValue = vm->input(3); if (value == NULL) copy(defaultValue, vm->output()); else copy(value, vm->output()); }