#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "kite_object.h"
Functions | |
void | kite_add_property (kite_thread_t *thd, kite_object_t *obj, char *name, int global, char *doc) |
void | kite_add_method (kite_thread_t *thd, kite_object_t *obj, char *name, kite_object_t *method) |
void | kite_add_operator (kite_thread_t *thd, kite_object_t *obj, int op, kite_object_t *method) |
void | kite_remove_property (kite_thread_t *thd, kite_object_t *obj, char *name, int n) |
void | kite_remove_method (kite_thread_t *thd, kite_object_t *obj, char *name, int n) |
void | kite_remove_operator (kite_thread_t *thd, kite_object_t *obj, int op) |
void | kite_set_property (kite_thread_t *thd, kite_object_t *obj, char *name, kite_object_t *val) |
int | kite_exists_property (kite_object_t *obj, char *name) |
int | kite_exists_method (kite_object_t *obj, char *name) |
int | kite_exists_operator (kite_object_t *obj, int op) |
kite_object_t * | kite_get_property (kite_object_t *obj, char *prop) |
void | kite_set_docstring (kite_object_t *obj, char *doc) |
char * | kite_get_docstring (kite_object_t *obj) |
void | kite_set_arginfo (kite_object_t *obj, kite_object_t *info) |
void kite_add_method | ( | kite_thread_t * | thd, | |
kite_object_t * | obj, | |||
char * | name, | |||
kite_object_t * | method | |||
) |
Add method to object.
thd | The current thread. | |
obj | The object to operate on. | |
name | The name of the new property. | |
method | The method object to add. |
References kite_object_t::builtin_data, kite_symtab_t::docstring, kite_object_t::funcvalue, kite_symtab_t::global, kite_reference_object(), kite_symtab_insert(), kite_symtab_t::name, kite_function_t::numargs, kite_object_t::object_data, kite_object_t::properties, and kite_symtab_t::value.
Referenced by kite_add_operator().
void kite_add_operator | ( | kite_thread_t * | thd, | |
kite_object_t * | obj, | |||
int | op, | |||
kite_object_t * | method | |||
) |
Add operator to object.
thd | The current thread. | |
obj | The object to operate on. | |
op | The operator to add (from enum kite_operators) | |
method | The method object to associate with the operator. |
References kite_add_method(), and kite_remove_operator().
void kite_add_property | ( | kite_thread_t * | thd, | |
kite_object_t * | obj, | |||
char * | name, | |||
int | global, | |||
char * | doc | |||
) |
Add property to object.
thd | The current thread. | |
obj | The object to operate on. | |
name | The name of the new property. | |
global | 1 for global property, 0 for non-global. | |
doc | Description of property (NULL if not given). |
References kite_symtab_t::docstring, kite_symtab_t::global, kite_exists_property(), kite_symtab_insert(), kite_symtab_t::name, kite_object_t::object_data, kite_object_t::properties, and kite_symtab_t::value.
Referenced by kite_dereference_and_load(), and kite_set_property().
int kite_exists_method | ( | kite_object_t * | obj, | |
char * | name | |||
) |
Determines the existance of a method.
obj | The object to operate on. | |
name | The name of the method to check. |
References KITE_FIND_METHOD, OBJ_METHOD, kite_object_t::type, and kite_symtab_t::value.
int kite_exists_operator | ( | kite_object_t * | obj, | |
int | op | |||
) |
Determines the existance of an operator.
obj | The object to operate on. | |
op | The operator to check for (from kite_operators) |
References KITE_FIND_ANY_IN_SYMTAB, kite_object_t::object_data, and kite_object_t::properties.
int kite_exists_property | ( | kite_object_t * | obj, | |
char * | name | |||
) |
Determines the existance of a property.
obj | The object to operate on. | |
name | The name of the property to check. |
References KITE_FIND_PROPERTY.
Referenced by kite_add_property().
char* kite_get_docstring | ( | kite_object_t * | obj | ) |
Gets the documentation string for a given object.
obj | The object to operate on. |
References kite_object_t::docstring, and kite_object_t::object_data.
kite_object_t* kite_get_property | ( | kite_object_t * | obj, | |
char * | name | |||
) |
Retrieve the value of a property.
obj | The object to operate on. | |
name | The name of the property to retrieve. |
References KITE_FIND_PROPERTY, kite_reference_object(), and kite_symtab_t::value.
void kite_remove_method | ( | kite_thread_t * | thd, | |
kite_object_t * | obj, | |||
char * | name, | |||
int | numargs | |||
) |
Removes method from the given object.
thd | The current thread. | |
obj | The object to operate on. | |
name | The name of the method to remove. | |
numargs | The number of arguments of the method to remove. |
References kite_symtab_remove(), kite_object_t::object_data, and kite_object_t::properties.
Referenced by kite_remove_operator().
void kite_remove_operator | ( | kite_thread_t * | thd, | |
kite_object_t * | obj, | |||
int | op | |||
) |
Removes operator from the given object.
thd | The current thread. | |
obj | The object to operate on. | |
op | The operator to remove (from kite_operators) |
References kite_symtab_t::global, KITE_FIND_ANY_IN_SYMTAB, kite_remove_method(), kite_object_t::object_data, and kite_object_t::properties.
Referenced by kite_add_operator().
void kite_remove_property | ( | kite_thread_t * | thd, | |
kite_object_t * | obj, | |||
char * | name, | |||
int | global | |||
) |
Removes property from the given object.
thd | The current thread. | |
obj | The object to operate on. | |
name | The name of the property to remove. | |
global | 1 for global properties, 0 otherwise. |
References kite_symtab_remove(), kite_object_t::object_data, and kite_object_t::properties.
void kite_set_arginfo | ( | kite_object_t * | obj, | |
kite_object_t * | arginfo | |||
) |
Sets the argument information for a given method.
obj | The method to operate on. | |
arginfo | A list of arguments. Each element is an identifier containing a name, and the documentation string associated with each identifier contains the description. |
References kite_function_t::arginfo, kite_object_t::builtin_data, kite_object_t::funcvalue, and kite_reference_object().
Referenced by kite_new_method_bytecode_with_docs(), and kite_new_method_compiled_with_docs().
void kite_set_docstring | ( | kite_object_t * | obj, | |
char * | str | |||
) |
Sets the documentation string for a given object.
obj | The object to operate on. | |
str | The documentation string to set. |
References kite_object_t::docstring, and kite_object_t::object_data.
Referenced by kite_new_method_bytecode_with_docs(), and kite_new_method_compiled_with_docs().
void kite_set_property | ( | kite_thread_t * | thd, | |
kite_object_t * | obj, | |||
char * | name, | |||
kite_object_t * | value | |||
) |
Sets property to the given object.
thd | The current thread. | |
obj | The object to operate on. | |
name | The name of the property to set. | |
value | The object to set the property to. |
References kite_symtab_t::global, kite_object_t::inherit_from, kite_add_property(), kite_dereference_object(), KITE_FIND_PROPERTY, kite_reference_object(), kite_set_property(), OBJ_BOOLEAN, OBJ_FLOAT, OBJ_INTEGER, kite_object_t::object_data, kite_object_t::type, and kite_symtab_t::value.
Referenced by kite_dereference_and_load(), and kite_set_property().