CUBRID Engine  latest
esql_declare.c File Reference
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "esql_grammar.h"
#include "esql_misc.h"
#include "memory_alloc.h"
#include "esql_translate.h"
#include "variable_string.h"
Include dependency graph for esql_declare.c:

Go to the source code of this file.

Classes

struct  spec_state
 
struct  scope
 

Macros

#define NFRAMES   8
 
#define MAX_LONGS_ALLOWED   1
 
#define TOK_SPACE   " "
 
#define TOK_COMMA   ","
 
#define TOK_LB   "{"
 
#define TOK_RB   "}"
 
#define TOK_LP   "("
 
#define TOK_RP   ")"
 
#define TOK_SC   ";"
 
#define TOK_STAR   "*"
 
#define TOK_AUTO   "auto"
 
#define TOK_CONST   "const"
 
#define TOK_EXTERN   "extern"
 
#define TOK_CHAR   "char"
 
#define TOK_DOUBLE   "double"
 
#define TOK_FLOAT   "float"
 
#define TOK_INT   "int"
 
#define TOK_LONG   "long"
 
#define TOK_REGISTER   "register"
 
#define TOK_SHORT   "short"
 
#define TOK_STATIC   "static"
 
#define TOK_TYPEDEF   "typedef"
 
#define TOK_UNSIGNED   "unsigned"
 
#define TOK_VOID   "void"
 
#define TOK_VOLATILE   "volatile"
 
#define TOK_INVALID   "whoknows"
 

Typedefs

typedef struct spec_state SPEC_STATE
 
typedef struct scope SCOPE
 

Enumerations

enum  {
  MSG_BAD_STORAGE_CLASS = 1, MSG_MALFORMED_CHAIN = 2, MSG_SPECIFIER_NOT_ALLOWED = 3, MSG_ILLEGAL_CLASS_COMBO = 4,
  MSG_ILLEGAL_TYPE_COMBO = 5, MSG_ILLEGAL_MODIFIER_COMBO = 6, MSG_TYPE_SPEC_UNEXPECTED_CASE = 7, MSG_TYPE_ADJ_UNEXPECTED_CASE = 8,
  MSG_BAD_PSEUDO_DECL = 9
}
 

Functions

static void pp_set_class_bit (int storage_class, LINK *p)
 
static LINKpp_new_type_spec (void)
 
static void pp_remove_structdefs_from_table (STRUCTDEF *struct_chain)
 
static void pp_print_link (LINK *p, varstring *buf, int context, int preechoed)
 
static void pp_print_decl (SYMBOL *sym, varstring *buf, int preechoed)
 
void pp_add_spec_to_decl (LINK *p_spec, SYMBOL *decl_chain)
 
void pp_add_symbols_to_table (SYMBOL *sym)
 
void pp_remove_symbols_from_table (SYMBOL *sym_chain)
 
void pp_do_enum (SYMBOL *sym)
 
void pp_push_name_scope (void)
 
void pp_pop_name_scope (void)
 
void pp_make_typedef_names_visible (int sense)
 
void pp_decl_init (void)
 
void pp_decl_finish (void)
 
void pp_push_spec_scope (void)
 
void pp_pop_spec_scope (void)
 
void pp_reset_current_type_spec (void)
 
LINKpp_current_type_spec (void)
 
void pp_add_storage_class (int sc)
 
void pp_add_struct_spec (STRUCTDEF *sdef)
 
void pp_add_type_noun (int type)
 
void pp_add_type_adj (int adj)
 
void pp_add_typedefed_spec (LINK *spec)
 
void pp_add_initializer (SYMBOL *sym)
 
void pp_disallow_storage_classes (void)
 
void pp_add_cursor_to_scope (CURSOR *cursor)
 
void pp_add_whenever_to_scope (WHEN_CONDITION when, WHEN_ACTION action, char *name)
 
void pp_print_decls (SYMBOL *decl_chain, int preechoed)
 
void pp_print_specs (LINK *link)
 

Variables

FILE * esql_yyout
 
int pp_recognizing_typedef_names = 1
 
int pp_nesting_level = 0
 
static SCOPEpp_current_name_scope
 
static SPEC_STATEpp_current_spec_scope
 
static SCOPEpp_name_scope_base
 
static SCOPEpp_name_scope_limit
 
static SPEC_STATEpp_spec_scope_base
 
static SPEC_STATEpp_spec_scope_limit
 

Macro Definition Documentation

#define MAX_LONGS_ALLOWED   1

Definition at line 39 of file esql_declare.c.

Referenced by pp_add_type_adj().

#define NFRAMES   8

Definition at line 38 of file esql_declare.c.

Referenced by pp_decl_init(), pp_push_name_scope(), and pp_push_spec_scope().

#define TOK_AUTO   "auto"

Definition at line 94 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_CHAR   "char"

Definition at line 97 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_COMMA   ","

Definition at line 87 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_CONST   "const"

Definition at line 95 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_DOUBLE   "double"

Definition at line 98 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_EXTERN   "extern"

Definition at line 96 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_FLOAT   "float"

Definition at line 99 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_INT   "int"

Definition at line 100 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_INVALID   "whoknows"

Definition at line 109 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_LB   "{"

Definition at line 88 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_LONG   "long"

Definition at line 101 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_LP   "("

Definition at line 90 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_RB   "}"

Definition at line 89 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_REGISTER   "register"

Definition at line 102 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_RP   ")"

Definition at line 91 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_SC   ";"

Definition at line 92 of file esql_declare.c.

Referenced by pp_print_decls(), and pp_print_link().

#define TOK_SHORT   "short"

Definition at line 103 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_SPACE   " "

Definition at line 86 of file esql_declare.c.

Referenced by pp_print_decl(), pp_print_decls(), and pp_print_link().

#define TOK_STAR   "*"

Definition at line 93 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_STATIC   "static"

Definition at line 104 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_TYPEDEF   "typedef"

Definition at line 105 of file esql_declare.c.

Referenced by pp_print_decl().

#define TOK_UNSIGNED   "unsigned"

Definition at line 106 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_VOID   "void"

Definition at line 107 of file esql_declare.c.

Referenced by pp_print_link().

#define TOK_VOLATILE   "volatile"

Definition at line 108 of file esql_declare.c.

Referenced by pp_print_link().

Typedef Documentation

typedef struct scope SCOPE

Definition at line 42 of file esql_declare.c.

typedef struct spec_state SPEC_STATE

Definition at line 41 of file esql_declare.c.

Enumeration Type Documentation

anonymous enum
Enumerator
MSG_BAD_STORAGE_CLASS 
MSG_MALFORMED_CHAIN 
MSG_SPECIFIER_NOT_ALLOWED 
MSG_ILLEGAL_CLASS_COMBO 
MSG_ILLEGAL_TYPE_COMBO 
MSG_ILLEGAL_MODIFIER_COMBO 
MSG_TYPE_SPEC_UNEXPECTED_CASE 
MSG_TYPE_ADJ_UNEXPECTED_CASE 
MSG_BAD_PSEUDO_DECL 

Definition at line 72 of file esql_declare.c.

Function Documentation

void pp_add_cursor_to_scope ( CURSOR cursor)

Definition at line 1090 of file esql_declare.c.

References scope::cursor_chain, and cursor::next.

Referenced by pp_new_cursor().

Here is the caller graph for this function:

void pp_add_initializer ( SYMBOL sym)

Definition at line 1056 of file esql_declare.c.

References link::d, link::decl, IS_ARRAY, NULL, declarator::num_ele, and symbol::type.

void pp_add_whenever_to_scope ( WHEN_CONDITION  when,
WHEN_ACTION  action,
char *  name 
)
LINK* pp_current_type_spec ( void  )

Definition at line 663 of file esql_declare.c.

References spec_state::spec.

Referenced by pp_add_dummy_structdef(), pp_hv_init(), and pp_new_pseudo_def().

Here is the caller graph for this function:

void pp_decl_finish ( void  )

Definition at line 555 of file esql_declare.c.

References free_and_init, pp_pop_name_scope(), and pp_pop_spec_scope().

Referenced by pp_finish().

Here is the caller graph for this function:

void pp_decl_init ( void  )

Definition at line 530 of file esql_declare.c.

References NFRAMES, NULL, pp_make_typedef_names_visible(), pp_malloc(), pp_nesting_level, pp_push_name_scope(), and pp_push_spec_scope().

Referenced by pp_startup().

Here is the caller graph for this function:

void pp_disallow_storage_classes ( void  )

Definition at line 1076 of file esql_declare.c.

References spec_state::sc_allowed.

void pp_make_typedef_names_visible ( int  sense)

Definition at line 515 of file esql_declare.c.

References pp_recognizing_typedef_names, and scope::recognizing_typedef_names.

Referenced by pp_decl_init(), pp_pop_name_scope(), and pp_push_name_scope().

Here is the caller graph for this function:

static LINK * pp_new_type_spec ( void  )
static

Definition at line 185 of file esql_declare.c.

References C_AUTO, link::class_, link::decl, N_INT, specifier::noun, NULL, p, pp_new_link(), link::s, specifier::sclass, and SPECIFIER.

Referenced by pp_do_enum(), and pp_reset_current_type_spec().

Here is the caller graph for this function:

void pp_pop_spec_scope ( void  )

Definition at line 626 of file esql_declare.c.

References assert, and NULL.

Referenced by pp_decl_finish(), and pp_new_pseudo_def().

Here is the caller graph for this function:

static void pp_print_decl ( SYMBOL sym,
varstring buf,
int  preechoed 
)
static

Definition at line 1359 of file esql_declare.c.

References D_ARRAY, symbol::name, pp_print_link(), link::tdef, TOK_SPACE, TOK_TYPEDEF, symbol::type, vs_clear(), vs_prepend(), and vs_strcpy().

Referenced by pp_print_decls(), and pp_print_link().

Here is the caller graph for this function:

void pp_print_decls ( SYMBOL decl_chain,
int  preechoed 
)
void pp_print_specs ( LINK link)

Definition at line 1414 of file esql_declare.c.

References D_ARRAY, esql_yyout, pp_print_link(), vs_free(), vs_new(), and vs_str().

static void pp_remove_structdefs_from_table ( STRUCTDEF struct_chain)
static

Definition at line 380 of file esql_declare.c.

References structdef::next, pp_Struct_table, and hash_tab_s::remove_symbol.

Referenced by pp_pop_name_scope().

Here is the caller graph for this function:

void pp_remove_symbols_from_table ( SYMBOL sym_chain)

Definition at line 361 of file esql_declare.c.

References symbol::next, pp_Symbol_table, and hash_tab_s::remove_symbol.

Referenced by pp_pop_name_scope().

Here is the caller graph for this function:

static void pp_set_class_bit ( int  storage_class,
LINK p 
)
static

Variable Documentation

FILE* esql_yyout
SCOPE* pp_current_name_scope
static

Definition at line 116 of file esql_declare.c.

Referenced by pp_pop_name_scope().

SCOPE* pp_name_scope_base
static

Definition at line 118 of file esql_declare.c.

SCOPE * pp_name_scope_limit
static

Definition at line 118 of file esql_declare.c.

int pp_nesting_level = 0
int pp_recognizing_typedef_names = 1

Definition at line 113 of file esql_declare.c.

Referenced by pp_make_typedef_names_visible().

SPEC_STATE* pp_spec_scope_base
static

Definition at line 119 of file esql_declare.c.

SPEC_STATE * pp_spec_scope_limit
static

Definition at line 119 of file esql_declare.c.