#include <stdarg.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include <dlfcn.h>#include "kite_object.h"#include "kite_gc.h"| #define BOOLEAN_OBJECT "System.boolean" |
Referenced by kite_new_boolean().
| #define FLOAT_OBJECT "System.float" |
Referenced by kite_new_float().
| #define INTEGER_OBJECT "System.integer" |
Referenced by kite_new_integer().
| #define LIST_OBJECT "System.list" |
Referenced by kite_new_list().
| #define METHOD_OBJECT "System.method" |
Referenced by kite_new_method_bytecode(), and kite_new_method_compiled().
| #define NULL_OBJECT "System.null" |
Referenced by kite_new_null().
| #define STRING_OBJECT "System.string" |
Referenced by kite_new_string(), and kite_new_string_with_length().
| void kite_destruct_object | ( | kite_thread_t * | , | |
| kite_object_t ** | , | |||
| int | ||||
| ) |
Destroy object.
References kite_destruct_object_nofree().
Referenced by kite_finalize_object(), kite_free_vm(), and kite_gc_destroy_all().
| void kite_destruct_object_nofree | ( | kite_thread_t * | , | |
| kite_object_t ** | , | |||
| int | ||||
| ) |
Destroy object.
References kite_object_t::builtin_data, kite_object_t::docstring, kite_object_t::dylib_hndl, kite_function_t::funcptr, kite_function_t::functype, kite_object_t::funcvalue, kite_vm_t::gc_begin, kite_vm_t::gc_end, kite_object_t::gc_entry, kite_object_t::inherit_from, kite_dereference_object(), kite_destruct_symtab(), kite_free_instruction_list(), kite_list_remove(), kite_object_t::listvalue, kite_object_t::mtx, kite_object_t::name, kite_object_t::object_data, kite_object_t::parent, kite_object_t::properties, kite_object_t::stringvalue, kite_function_t::this, kite_object_t::type, and kite_thread_t::vm.
Referenced by kite_destruct_object(), and kite_gc_incremental().
| void kite_finalize_object | ( | void * | , | |
| void * | ||||
| ) |
Destroy object.
References kite_destruct_object(), and kite_object_t::owner_thread.
Referenced by kite_new_class(), and kite_new_instance().
| kite_object_t* kite_new_boolean | ( | kite_thread_t * | thd, | |
| int | val | |||
| ) |
Create a new boolean object.
| thd | The associated thread for the object. | |
| val | The value to associate with the object. |
References BOOLEAN_OBJECT, kite_object_t::builtin_data, FALSE, kite_vm_t::false_cached, kite_object_t::intvalue, kite_dereference_and_load(), kite_new_instance(), kite_reference_object(), kite_object_t::shareable, TRUE, kite_vm_t::true_cached, kite_object_t::type, and kite_thread_t::vm.
Referenced by kite_boolean_object(), and kite_new_vm().
| kite_object_t* kite_new_class | ( | kite_thread_t * | thd, | |
| kite_object_t * | parent, | |||
| char * | name | |||
| ) |
Create a new Kite class.
| thd | The associated thread for this object. | |
| parent | The class that this inherits from. | |
| name | The new class' name. |
References kite_object_t::builtin_data, FALSE, kite_function_t::funcptr, kite_object_t::funcvalue, kite_vm_t::gc_begin, kite_vm_t::gc_end, kite_object_t::gc_entry, kite_object_t::inherit_from, kite_finalize_object(), kite_gc_incremental(), kite_list_add_end(), kite_reference_object(), kite_object_t::mtx, kite_object_t::name, kite_list_t::next, kite_list_t::obj, kite_object_t::object_data, kite_object_t::owner_thread, kite_list_t::prev, kite_object_t::refcount, kite_object_t::shareable, kite_object_t::type, and kite_thread_t::vm.
Referenced by kite_dereference_and_load(), kite_new_ident(), kite_new_vm(), kite_vm_compile_from_file(), and kite_vm_compile_from_string().
| kite_object_t* kite_new_exception | ( | kite_thread_t * | thd, | |
| char * | name, | |||
| char * | message | |||
| ) |
Create a new exception object.
| thd | The thread to associate the exception with. | |
| name | The fully-qualified name of the exception (e.g. System.exceptions.FileError) | |
| message | The message to associate with the given exception. |
References kite_dereference_and_load(), kite_dereference_object(), kite_list_object(), kite_new_instance_with_constructor(), and kite_new_string().
Referenced by kite_dereference_and_load(), kite_vm_call_method(), and kite_vm_call_operator().
| kite_object_t* kite_new_float | ( | kite_thread_t * | thd, | |
| double | val | |||
| ) |
Create a new floating-point object.
| thd | The associated thread for the object. | |
| val | The value to associate with the object. |
References kite_object_t::builtin_data, FLOAT_OBJECT, kite_object_t::floatvalue, kite_dereference_and_load(), kite_new_instance(), kite_object_t::shareable, and kite_object_t::type.
Referenced by kite_float_object().
| kite_object_t* kite_new_ident | ( | kite_thread_t * | thd, | |
| char * | val | |||
| ) |
Create a new identifier object.
| thd | The associated thread for the object. | |
| val | The value to associate with the object. |
References kite_object_t::builtin_data, kite_new_class(), kite_object_t::shareable, kite_object_t::stringvalue, and kite_object_t::type.
Referenced by kite_new_method_bytecode_with_docs(), and kite_new_method_compiled_with_docs().
| kite_object_t* kite_new_instance | ( | kite_thread_t * | thd, | |
| kite_object_t * | parent | |||
| ) |
Create a new Kite instance (without initialization)
| thd | The associated thread for this object. | |
| parent | The class that this instance is associated with. |
References kite_vm_t::gc_begin, kite_vm_t::gc_end, kite_object_t::gc_entry, kite_object_t::inherit_from, kite_finalize_object(), kite_gc_incremental(), kite_list_add_end(), kite_reference_object(), kite_object_t::name, kite_list_t::next, kite_list_t::obj, kite_object_t::object_data, kite_object_t::owner_thread, kite_list_t::prev, kite_object_t::refcount, kite_object_t::shareable, kite_object_t::type, and kite_thread_t::vm.
Referenced by kite_new_boolean(), kite_new_float(), kite_new_instance_with_constructor(), kite_new_integer(), kite_new_list(), kite_new_method_bytecode(), kite_new_method_compiled(), kite_new_null(), kite_new_string(), and kite_new_string_with_length().
| kite_object_t* kite_new_instance_with_constructor | ( | kite_thread_t * | thd, | |
| kite_object_t * | parent, | |||
| kite_object_t * | args | |||
| ) |
Create a new Kite instance (with initialization)
| thd | The associated thread for this object. | |
| parent | The class that this instance is associated with. | |
| args | A list specifying arguments to pass to the constructor. |
References kite_new_instance(), and kite_vm_call_constructor().
Referenced by kite_new_exception().
| kite_object_t* kite_new_integer | ( | kite_thread_t * | thd, | |
| long | val | |||
| ) |
Create a new integer object.
| thd | The associated thread for the object. | |
| val | The value to associate with the object. |
References kite_object_t::builtin_data, kite_vm_t::int_cached, INTEGER_OBJECT, kite_object_t::intvalue, kite_dereference_and_load(), kite_new_instance(), kite_object_t::shareable, kite_object_t::type, and kite_thread_t::vm.
Referenced by kite_handle_signal(), and kite_int_object().
| kite_object_t* kite_new_list | ( | kite_thread_t * | thd | ) |
Create a new empty list object.
| thd | The associated thread for the object. |
References kite_object_t::builtin_data, kite_dereference_and_load(), kite_new_instance(), LIST_OBJECT, kite_object_t::listvalue, and kite_object_t::type.
Referenced by kite_append_list(), kite_boolean_object(), kite_dereference_and_load(), kite_float_object(), kite_gc_destroy_all(), kite_gc_incremental(), kite_handle_signal(), kite_int_object(), kite_list_object(), kite_new_method_bytecode_with_docs(), kite_new_method_compiled_with_docs(), kite_string_object(), kite_vm_call_method(), and kite_vm_call_operator().
| kite_object_t* kite_new_method_bytecode | ( | kite_thread_t * | thd, | |
| kite_opcode_t * | func, | |||
| int | numargs | |||
| ) |
Create a new method object (based on Kite bytecode).
| thd | The associated thread for the object. | |
| func | The C function that this method refers to. | |
| numargs | The number of arguments this method should take in Kite code. |
References kite_object_t::builtin_data, kite_function_t::funcptr, kite_function_t::functype, kite_object_t::funcvalue, kite_dereference_and_load(), kite_new_instance(), METHOD_OBJECT, kite_function_t::numargs, kite_object_t::shareable, kite_function_t::this, and kite_object_t::type.
Referenced by kite_new_method_bytecode_with_docs().
| kite_object_t* kite_new_method_bytecode_with_docs | ( | kite_thread_t * | thd, | |
| kite_opcode_t * | func, | |||
| char * | desc, | |||
| int | numargs, | |||
| ... | ||||
| ) |
Create a new method object with documentation strings (based on Kite bytecode).
| thd | The associated thread for the object. | |
| func | The bytecode that this method refers to. | |
| desc | The method's description. | |
| numargs | The number of arguments this method should take in Kite code. | |
| argname | (for each argument) The name of the argument. | |
| argdesc | (for each argument) The description of the argument. |
References kite_append_list(), kite_new_ident(), kite_new_list(), kite_new_method_bytecode(), kite_set_arginfo(), and kite_set_docstring().
| kite_object_t* kite_new_method_compiled | ( | kite_thread_t * | thd, | |
| kite_compiled_func_t | func, | |||
| int | numargs | |||
| ) |
Create a new method object (based on C-compiled code).
| thd | The associated thread for the object. | |
| func | The C function that this method refers to. | |
| numargs | The number of arguments this method should take in Kite code. |
References kite_object_t::builtin_data, kite_function_t::funcptr, kite_function_t::functype, kite_object_t::funcvalue, kite_dereference_and_load(), kite_new_instance(), METHOD_OBJECT, kite_function_t::numargs, kite_object_t::shareable, kite_function_t::this, and kite_object_t::type.
Referenced by kite_new_method_compiled_with_docs().
| kite_object_t* kite_new_method_compiled_with_docs | ( | kite_thread_t * | thd, | |
| kite_compiled_func_t | func, | |||
| char * | desc, | |||
| int | numargs, | |||
| ... | ||||
| ) |
Create a new method object with documentation strings (based on C-compiled code).
| thd | The associated thread for the object. | |
| func | The C function that this method refers to. | |
| desc | The method's description. | |
| numargs | The number of arguments this method should take in Kite code. | |
| argname | (for each argument) The name of the argument. | |
| argdesc | (for each argument) The description of the argument. |
References kite_append_list(), kite_new_ident(), kite_new_list(), kite_new_method_compiled(), kite_set_arginfo(), and kite_set_docstring().
Referenced by kite_new_vm().
| kite_object_t* kite_new_null | ( | kite_thread_t * | thd | ) |
Create a new null object.
| thd | The associated thread for the object. |
References kite_dereference_and_load(), kite_new_instance(), kite_reference_object(), kite_vm_t::null_cached, NULL_OBJECT, kite_object_t::shareable, kite_object_t::type, and kite_thread_t::vm.
Referenced by kite_handle_signal(), kite_new_vm(), and kite_vm_execute().
| kite_object_t* kite_new_string | ( | kite_thread_t * | thd, | |
| char * | val | |||
| ) |
Create a new string object.
| thd | The associated thread for the object. | |
| val | The value to associate with the object. |
References kite_object_t::builtin_data, kite_dereference_and_load(), kite_new_instance(), kite_object_t::shareable, STRING_OBJECT, kite_object_t::stringvalue, and kite_object_t::type.
Referenced by kite_new_exception(), kite_object_name(), kite_string_object(), and kite_vm_call_method().
| kite_object_t* kite_new_string_with_length | ( | kite_thread_t * | thd, | |
| char * | val, | |||
| int | length | |||
| ) |
Create a new string object (with given length).
| thd | The associated thread for the object. | |
| val | The value to associate with the object. | |
| length | The length of the string. |
References kite_object_t::builtin_data, kite_dereference_and_load(), KITE_GET_STRING_VALUE, kite_new_instance(), kite_object_t::shareable, STRING_OBJECT, kite_object_t::stringvalue, and kite_object_t::type.
1.5.6