CUBRID Engine
latest
|
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include "esql_grammar.h"
#include "misc_string.h"
#include "esql_misc.h"
#include "memory_alloc.h"
Go to the source code of this file.
Classes | |
struct | linkchunk |
Macros | |
#define | LCHUNK 10 |
Typedefs | |
typedef struct linkchunk | LINKCHUNK |
Enumerations | |
enum | esql_err_msg { MSG_ILLEGAL_ARRAY = 1, MSG_UNKNOWN_CLASS = 2, MSG_BAD_NOUN = 3 } |
Variables | |
SYMTAB * | pp_Symbol_table |
SYMTAB * | pp_Struct_table |
static SYMBOL * | symbol_free_list |
static LINK * | link_free_list |
static STRUCTDEF * | struct_free_list |
static const unsigned int | SYMTAB_SIZE = 511 |
static LINKCHUNK * | link_chunks |
static int | syms_to_free_lists = 1 |
static int | syms_allocated = 0 |
static int | syms_deallocated = 0 |
static int | sdefs_allocated = 0 |
static int | sdefs_deallocated = 0 |
static int | links_allocated = 0 |
static int | links_deallocated = 0 |
#define LCHUNK 10 |
Definition at line 35 of file esql_symbol_table.c.
Referenced by pp_new_link().
enum esql_err_msg |
Enumerator | |
---|---|
MSG_ILLEGAL_ARRAY | |
MSG_UNKNOWN_CLASS | |
MSG_BAD_NOUN |
Definition at line 43 of file esql_symbol_table.c.
|
static |
Definition at line 781 of file esql_symbol_table.c.
References structdef::fields, symbol::name, symbol::next, pp_type_str(), structdef::tag, symbol::type, and structdef::type_string.
Referenced by pp_print_syms().
|
static |
Definition at line 769 of file esql_symbol_table.c.
References symbol::level, symbol::name, pp_type_str(), and symbol::type.
Referenced by pp_print_syms().
void pp_add_declarator | ( | SYMBOL * | sym, |
int | type | ||
) |
Definition at line 452 of file esql_symbol_table.c.
References declarator::args, symbol::args, link::d, D_FUNCTION, D_POINTER, declarator::dcl_type, link::decl, esql_yyverror(), symbol::etype, EX_SYMBOL_SET, IS_ARRAY, linkchunk::link, MSG_ILLEGAL_ARRAY, link::next, NULL, pp_get_msg(), pp_new_link(), and symbol::type.
Referenced by pp_hv_init(), and pp_new_pseudo_def().
char* pp_attr_str | ( | LINK * | type | ) |
Definition at line 620 of file esql_symbol_table.c.
References assert, link::decl, specifier::is_long, specifier::is_short, IS_SPECIFIER, specifier::is_unsigned, N_CHR, N_FLOAT, N_INT, specifier::noun, and link::s.
Referenced by pp_type_str().
Definition at line 493 of file esql_symbol_table.c.
References symbol::etype, symbol::level, symbol::name, symbol::next, NULL, pp_clone_type(), pp_new_symbol(), and symbol::type.
Referenced by pp_clone_type().
Definition at line 518 of file esql_symbol_table.c.
References declarator::args, link::d, link::decl, IS_ARRAY, IS_FUNCT, link::next, symbol::next, NULL, declarator::num_ele, pp_clone_symbol(), pp_new_link(), pp_strdup(), and link::tdef.
Referenced by pp_add_spec_to_decl(), pp_clone_symbol(), pp_new_host_var(), and pp_struct_deref().
void pp_discard_link | ( | LINK * | p | ) |
Definition at line 266 of file esql_symbol_table.c.
References declarator::args, link::d, link::decl, free_and_init, IS_ARRAY, IS_FUNCT, link_free_list, links_deallocated, link::next, declarator::num_ele, p, and pp_discard_symbol_chain().
Referenced by pp_add_dummy_structdef(), pp_add_spec_to_decl(), pp_discard_link_chain(), pp_hv_init(), pp_new_pseudo_def(), pp_ptr_deref(), and pp_struct_deref().
void pp_discard_link_chain | ( | LINK * | p | ) |
Definition at line 248 of file esql_symbol_table.c.
References linkchunk::next, link::next, and pp_discard_link().
Referenced by pp_add_typedefed_spec(), pp_discard_symbol(), pp_free_host_var(), and pp_struct_deref().
void pp_discard_structdef | ( | STRUCTDEF * | sdef | ) |
Definition at line 339 of file esql_symbol_table.c.
References es_ht_free_symbol(), structdef::fields, free_and_init, structdef::next, pp_discard_symbol_chain(), sdefs_deallocated, struct_free_list, syms_to_free_lists, and structdef::tag.
Referenced by pp_add_struct_spec(), pp_discard_structdef_chain(), and pp_symbol_finish().
void pp_discard_structdef_chain | ( | STRUCTDEF * | sdef_chain | ) |
Definition at line 369 of file esql_symbol_table.c.
References linkchunk::next, structdef::next, NULL, and pp_discard_structdef().
Referenced by pp_pop_name_scope().
void pp_discard_symbol | ( | SYMBOL * | sym | ) |
Definition at line 139 of file esql_symbol_table.c.
References symbol::args, es_ht_free_symbol(), free_and_init, IS_FUNCT, symbol::name, symbol::next, pp_discard_link_chain(), pp_discard_symbol_chain(), symbol_free_list, syms_deallocated, syms_to_free_lists, and symbol::type.
Referenced by pp_add_symbols_to_table(), pp_discard_symbol_chain(), pp_hv_finish(), and pp_symbol_finish().
void pp_discard_symbol_chain | ( | SYMBOL * | sym | ) |
Definition at line 183 of file esql_symbol_table.c.
References symbol::next, p, and pp_discard_symbol().
Referenced by pp_discard_link(), pp_discard_structdef(), pp_discard_symbol(), and pp_pop_name_scope().
Definition at line 831 of file esql_symbol_table.c.
References hash_tab_s::find_symbol, and symbol::name.
Referenced by pp_add_symbols_to_table(), and pp_new_pseudo_def().
void pp_free_symtab | ( | SYMTAB * | symtab, |
HT_FREE_FN | free_fn | ||
) |
Definition at line 90 of file esql_symbol_table.c.
References hash_tab_s::free_table.
Referenced by pp_symbol_finish().
LINK* pp_new_link | ( | void | ) |
Definition at line 200 of file esql_symbol_table.c.
References link::decl, esql_yyverror(), EX_MISC_SET, i, specifier::is_long, specifier::is_short, LCHUNK, linkchunk::link, link_chunks, link_free_list, links_allocated, MSG_OUT_OF_MEMORY, linkchunk::next, link::next, NULL, p, pp_get_msg(), and link::s.
Referenced by pp_add_declarator(), pp_addr_of(), pp_clone_type(), and pp_new_type_spec().
STRUCTDEF* pp_new_pseudo_def | ( | SPECIFIER_NOUN | type, |
const char * | subscript | ||
) |
Definition at line 395 of file esql_symbol_table.c.
References hash_tab_s::add_symbol, link::d, D_ARRAY, link::decl, symbol::etype, structdef::fields, N_VARCHAR, symbol::next, NULL, declarator::num_ele, pp_add_declarator(), pp_add_spec_to_decl(), pp_add_type_noun(), pp_add_typedefed_spec(), pp_current_type_spec(), pp_discard_link(), pp_findsym(), pp_nesting_level, pp_new_structdef(), pp_new_symbol(), pp_pop_spec_scope(), pp_push_spec_scope(), pp_reset_current_type_spec(), pp_strdup(), symbol::type, VARCHAR_ARRAY_NAME, VARCHAR_LENGTH_NAME, vs_free(), vs_new(), vs_sprintf(), and vs_str().
Referenced by pp_add_spec_to_decl().
Definition at line 290 of file esql_symbol_table.c.
References structdef::by_name, es_ht_alloc_new_symbol(), structdef::fields, structdef::next, NULL, sdefs_allocated, strdup(), struct_free_list, structdef::tag, structdef::type, and structdef::type_string.
Referenced by pp_add_dummy_structdef(), and pp_new_pseudo_def().
Definition at line 105 of file esql_symbol_table.c.
References es_ht_alloc_new_symbol(), symbol::etype, symbol::level, symbol::name, symbol::next, NULL, strdup(), symbol_free_list, syms_allocated, and symbol::type.
Referenced by pp_add_dummy_structdef(), pp_add_spec_to_decl(), pp_clone_symbol(), pp_hv_init(), and pp_new_pseudo_def().
SYMTAB* pp_new_symtab | ( | void | ) |
Definition at line 78 of file esql_symbol_table.c.
References es_ht_make_table(), pp_generic_cmp(), pp_generic_hash(), and SYMTAB_SIZE.
Referenced by pp_symbol_init().
void pp_print_syms | ( | FILE * | fp | ) |
Definition at line 801 of file esql_symbol_table.c.
References es_print_struct(), es_print_symbol(), hash_tab_s::get_symbol_count, NULL, and hash_tab_s::print_table.
Referenced by pp_pop_name_scope().
void pp_symbol_finish | ( | void | ) |
Definition at line 869 of file esql_symbol_table.c.
References es_ht_free_symbol(), free_and_init, linkchunk::next, structdef::next, symbol::next, NULL, pp_discard_structdef(), pp_discard_symbol(), pp_free_symtab(), and syms_to_free_lists.
Referenced by pp_finish().
void pp_symbol_init | ( | void | ) |
Definition at line 844 of file esql_symbol_table.c.
References links_allocated, links_deallocated, NULL, pp_new_symtab(), sdefs_allocated, sdefs_deallocated, syms_allocated, syms_deallocated, and syms_to_free_lists.
Referenced by pp_startup().
void pp_symbol_stats | ( | FILE * | fp | ) |
Definition at line 921 of file esql_symbol_table.c.
References links_allocated, links_deallocated, pp_dump_malloc_info, sdefs_allocated, sdefs_deallocated, syms_allocated, and syms_deallocated.
Referenced by pp_finish().
Definition at line 576 of file esql_symbol_table.c.
References link::class_, link::d, declarator::dcl_type, link::decl, DECLARATOR, esql_yyerror(), EX_SYMBOL_SET, specifier::is_long, IS_PTR_TYPE, specifier::is_short, specifier::is_unsigned, MSG_UNKNOWN_CLASS, N_STRUCTURE, link::next, specifier::noun, pp_get_msg(), link::s, specifier::v_struct, and specifier::val.
Referenced by pp_add_symbols_to_table(), and pp_check_builtin_type().
Definition at line 667 of file esql_symbol_table.c.
References link::d, D_ARRAY, D_FUNCTION, D_POINTER, declarator::dcl_type, link::decl, IS_DECLARATOR, linkchunk::link, N_BIT, N_CHR, N_FLOAT, N_INT, N_LABEL, N_STRUCTURE, N_VARBIT, N_VARCHAR, N_VOID, link::next, specifier::noun, NULL, pp_attr_str(), link::s, strncpy_bufsize, structdef::tag, link::tdef, structdef::type_string, specifier::v_struct, and specifier::val.
Referenced by es_print_struct(), es_print_symbol(), pp_add_spec_to_decl(), pp_check(), pp_check_host_var_list(), pp_get_input_size(), and pp_get_precision().
|
static |
Definition at line 58 of file esql_symbol_table.c.
Referenced by pp_new_link().
|
static |
Definition at line 54 of file esql_symbol_table.c.
Referenced by pp_discard_link(), and pp_new_link().
|
static |
Definition at line 67 of file esql_symbol_table.c.
Referenced by pp_new_link(), pp_symbol_init(), and pp_symbol_stats().
|
static |
Definition at line 68 of file esql_symbol_table.c.
Referenced by pp_discard_link(), pp_symbol_init(), and pp_symbol_stats().
SYMTAB* pp_Struct_table |
Definition at line 51 of file esql_symbol_table.c.
Referenced by pp_add_dummy_structdef(), and pp_remove_structdefs_from_table().
SYMTAB* pp_Symbol_table |
Definition at line 50 of file esql_symbol_table.c.
Referenced by pp_add_dummy_structdef(), pp_add_symbols_to_table(), pp_do_enum(), and pp_remove_symbols_from_table().
|
static |
Definition at line 65 of file esql_symbol_table.c.
Referenced by pp_new_structdef(), pp_symbol_init(), and pp_symbol_stats().
|
static |
Definition at line 66 of file esql_symbol_table.c.
Referenced by pp_discard_structdef(), pp_symbol_init(), and pp_symbol_stats().
|
static |
Definition at line 55 of file esql_symbol_table.c.
Referenced by pp_discard_structdef(), and pp_new_structdef().
|
static |
Definition at line 53 of file esql_symbol_table.c.
Referenced by pp_discard_symbol(), and pp_new_symbol().
|
static |
Definition at line 63 of file esql_symbol_table.c.
Referenced by pp_new_symbol(), pp_symbol_init(), and pp_symbol_stats().
|
static |
Definition at line 64 of file esql_symbol_table.c.
Referenced by pp_discard_symbol(), pp_symbol_init(), and pp_symbol_stats().
|
static |
Definition at line 61 of file esql_symbol_table.c.
Referenced by pp_discard_structdef(), pp_discard_symbol(), pp_symbol_finish(), and pp_symbol_init().
|
static |
Definition at line 57 of file esql_symbol_table.c.
Referenced by pp_new_symtab().