Functions

objs/kite_symtab.c File Reference

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

Functions

kite_symtab_tkite_new_symtab ()
void kite_copy_symtab_elements (kite_thread_t *thd, kite_symtab_t **dest, kite_symtab_t *src, kite_object_t *p)
void kite_copy_symtab (kite_symtab_t **dest, kite_symtab_t *src)
void kite_destruct_symtab (kite_thread_t *thd, kite_symtab_t **obj, int r)
void kite_symtab_insert (kite_thread_t *thd, kite_symtab_t **st, kite_symtab_t *obj)
void kite_symtab_remove (kite_thread_t *thd, kite_symtab_t **st, char *name, int n)

Function Documentation

void kite_copy_symtab ( kite_symtab_t **  ret,
kite_symtab_t symt 
)

Copy entire symbol table.

Parameters:
[out] ret The variable to place the new symbol table.
symt The symbol table to copy.

References kite_symtab_t::docstring, kite_symtab_t::global, kite_copy_symtab(), kite_reference_object(), kite_symtab_t::name, and kite_symtab_t::value.

Referenced by kite_copy_symtab().

void kite_copy_symtab_elements ( kite_thread_t *  thd,
kite_symtab_t **  ret,
kite_symtab_t symt,
kite_object_t p 
)

Copy entire symbol table into another possibly existing table, setting parent as appropriate.

Parameters:
thd The current thread.
[in,out] ret The symbol table to copy to (*ret = NULL to make a new table)
symt The symbol table to copy.
p The new parent for each object copied from the table.

References kite_symtab_t::docstring, kite_copy_symtab_elements(), kite_reference_object(), kite_symtab_insert(), kite_symtab_t::name, OBJ_BOOLEAN, OBJ_FLOAT, OBJ_INTEGER, kite_object_t::type, and kite_symtab_t::value.

Referenced by kite_copy_symtab_elements().

void kite_destruct_symtab ( kite_thread_t *  thd,
kite_symtab_t **  symt,
int  ref 
)

Destroy symbol table.

Parameters:
thd The current thread.
[in,out] symt The symbol table to remove.
ref If TRUE, dereference objects inside symbol table.

References kite_dereference_object(), and kite_destruct_symtab().

Referenced by kite_destruct_object_nofree(), and kite_destruct_symtab().

kite_symtab_t* kite_new_symtab (  ) 

Create a new symbol table object.

Returns:
Symbol table object.

Referenced by kite_new_ident().

void kite_symtab_insert ( kite_thread_t *  thd,
kite_symtab_t **  symt,
kite_symtab_t entry 
)

Insert entry into symbol table.

Parameters:
thd The current thread.
symt The symbol table to insert into.
entry The entry to insert.

References kite_symtab_t::global, kite_dereference_object(), kite_symtab_insert(), and kite_symtab_t::name.

Referenced by kite_add_method(), kite_add_property(), kite_copy_symtab_elements(), kite_loader_register(), kite_new_ident(), and kite_symtab_insert().

void kite_symtab_remove ( kite_thread_t *  thd,
kite_symtab_t **  symt,
char *  name,
int  num 
)

Remove entry from symbol table.

Parameters:
thd The current thread.
[in,out] symt The symbol table to remove from.
name The name of the entry to remove.
num The number of arguments (or global vs non-global property) to remove.

References kite_symtab_t::docstring, kite_dereference_object(), kite_symtab_remove(), kite_symtab_t::name, and kite_symtab_t::value.

Referenced by kite_remove_method(), kite_remove_property(), and kite_symtab_remove().