Example #1
0
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);
}
Example #2
0
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);
}
Example #3
0
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);
}
Example #4
0
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);
}
Example #5
0
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);
}
Example #6
0
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());
}