Functions

objs/kite_obj_canon.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "kite_object.h"
#include "kite_vm.h"

Functions

kite_object_tkite_boolean_object (kite_thread_t *thd, kite_object_t *obj)
kite_object_tkite_string_object (kite_thread_t *thd, kite_object_t *obj)
kite_object_tkite_int_object (kite_thread_t *thd, kite_object_t *obj)
kite_object_tkite_float_object (kite_thread_t *thd, kite_object_t *obj)
kite_object_tkite_list_object (kite_thread_t *thd, kite_object_t *obj)
kite_object_tkite_object_name (kite_thread_t *thd, kite_object_t *obj)

Function Documentation

kite_object_t* kite_boolean_object ( kite_thread_t *  thd,
kite_object_t obj 
)

Produce Boolean object from the given object.

Parameters:
thd The current thread.
obj The object to operate on.
Returns:
A new Kite object with the proper Boolean value.
Note:
Equivalent to executing obj|bool in Kite.

References kite_object_t::builtin_data, kite_object_t::floatvalue, kite_object_t::intvalue, kite_new_boolean(), kite_new_list(), kite_reference_object(), kite_vm_call_method(), kite_object_t::listvalue, OBJ_BOOLEAN, OBJ_FLOAT, OBJ_INSTANCE, OBJ_INTEGER, OBJ_LIST, OBJ_STRING, kite_object_t::stringvalue, TRUE, and kite_object_t::type.

kite_object_t* kite_float_object ( kite_thread_t *  thd,
kite_object_t obj 
)

Produce floating-point object from the given object.

Parameters:
thd The current thread.
obj The object to operate on.
Returns:
A new Kite object with the proper floating-point value.
Note:
Equivalent to executing obj|float in Kite.

References kite_object_t::builtin_data, kite_object_t::intvalue, kite_new_float(), kite_new_list(), kite_reference_object(), kite_vm_call_method(), OBJ_BOOLEAN, OBJ_FLOAT, OBJ_INSTANCE, OBJ_INTEGER, OBJ_LIST, OBJ_STRING, kite_object_t::stringvalue, TRUE, and kite_object_t::type.

kite_object_t* kite_int_object ( kite_thread_t *  thd,
kite_object_t obj 
)

Produce integer object from the given object.

Parameters:
thd The current thread.
obj The object to operate on.
Returns:
A new Kite object with the proper integer value.
Note:
Equivalent to executing obj|int in Kite.

References kite_object_t::builtin_data, kite_object_t::floatvalue, kite_object_t::intvalue, kite_new_integer(), kite_new_list(), kite_reference_object(), kite_vm_call_method(), OBJ_BOOLEAN, OBJ_FLOAT, OBJ_INSTANCE, OBJ_INTEGER, OBJ_LIST, OBJ_STRING, kite_object_t::stringvalue, TRUE, and kite_object_t::type.

kite_object_t* kite_list_object ( kite_thread_t *  thd,
kite_object_t obj 
)

Produce list object from the given object.

Parameters:
thd The current thread.
obj The object to operate on.
Returns:
A new Kite list with a single element: the given object.

References kite_object_t::builtin_data, kite_new_list(), kite_reference_object(), and kite_object_t::listvalue.

Referenced by kite_new_exception().

kite_object_t* kite_object_name ( kite_thread_t *  thd,
kite_object_t obj 
)

Find the fully-qualified name of the object.

Parameters:
thd The current thread.
obj The object to operate on.
Returns:
A new Kite object with the fully qualified name.

References kite_object_t::inherit_from, kite_new_string(), kite_object_t::name, and kite_object_t::object_data.

Referenced by kite_string_object().

kite_object_t* kite_string_object ( kite_thread_t *  thd,
kite_object_t obj 
)

Produce string object from the given object.

Parameters:
thd The current thread.
obj The object to operate on.
Returns:
A new Kite object with the proper string value.
Note:
Equivalent to executing obj|str in Kite.

References kite_object_t::builtin_data, kite_object_t::floatvalue, kite_object_t::intvalue, kite_new_list(), kite_new_string(), kite_object_name(), kite_reference_object(), kite_vm_call_method(), OBJ_BOOLEAN, OBJ_FLOAT, OBJ_INSTANCE, OBJ_INTEGER, OBJ_LIST, OBJ_NULL, OBJ_STRING, TRUE, and kite_object_t::type.