CUBRID Engine  latest
esql_host_variable.c File Reference
#include "config.h"
#include <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include "esql_grammar.h"
#include "esql_scanner_support.h"
#include "util_func.h"
#include "misc_string.h"
#include "esql_misc.h"
#include "memory_alloc.h"
Include dependency graph for esql_host_variable.c:

Go to the source code of this file.

Classes

struct  builtin_type_s
 

Macros

#define BAD_C_TYPE   ((C_TYPE) -1)
 
#define UNINIT_C_TYPE   ((C_TYPE) -2)
 
#define C_TYPE_STRUCT   ((C_TYPE) -3)
 
#define UNINITIALIZED(p)   ((p) == UNINIT_C_TYPE)
 

Typedefs

typedef struct builtin_type_s BUILTIN_TYPE
 

Functions

static HOST_REFpp_add_struct_field_refs (HOST_VAR *var, int *n_refs)
 
static C_TYPE pp_check (HOST_VAR *var, bool structs_allowed)
 
static C_TYPE pp_check_builtin_type (LINK *type, bool mode)
 
static char * pp_expr (HOST_VAR *var)
 
static char * pp_addr_expr (HOST_VAR *var)
 
static SYMBOLpp_find_field (STRUCTDEF *sdef, const char *field)
 
static void pp_add_dummy_structdef (SYMBOL **symp, const char *name)
 
void pp_gather_input_refs (void)
 
void pp_gather_output_refs (void)
 
HOST_LODpp_input_refs (void)
 
HOST_LODpp_output_refs (void)
 
void pp_clear_host_refs (void)
 
HOST_VARpp_new_host_var (HOST_VAR *var, SYMBOL *sym)
 
void pp_free_host_var (HOST_VAR *var)
 
HOST_REFpp_add_host_ref (HOST_VAR *var, HOST_VAR *indicator, bool structs_allowed, int *n_refs)
 
void pp_free_host_ref (HOST_REF *ref)
 
HOST_LODpp_copy_host_refs (void)
 
HOST_LODpp_detach_host_refs (void)
 
HOST_REFpp_add_host_str (char *str)
 
HOST_REFpp_check_type (HOST_REF *ref, BITSET typeset, const char *msg)
 
void pp_check_host_var_list (void)
 
C_TYPE pp_get_type (HOST_REF *ref)
 
char * pp_get_precision (HOST_REF *ref)
 
char * pp_get_input_size (HOST_REF *ref)
 
char * pp_get_output_size (HOST_REF *ref)
 
char * pp_get_expr (HOST_REF *ref)
 
char * pp_get_addr_expr (HOST_REF *ref)
 
char * pp_get_ind_expr (HOST_REF *ref)
 
char * pp_get_ind_addr_expr (HOST_REF *ref)
 
void pp_print_host_ref (HOST_REF *ref, FILE *fp)
 
HOST_VARpp_ptr_deref (HOST_VAR *var, int style)
 
HOST_VARpp_struct_deref (HOST_VAR *var, char *field, int indirect)
 
HOST_VARpp_addr_of (HOST_VAR *var)
 
void pp_hv_init (void)
 
void pp_hv_finish (void)
 
HOST_LODpp_new_host_lod (void)
 
void pp_free_host_lod (HOST_LOD *lod)
 
void pp_clear_host_lod (HOST_LOD *lod)
 
char * pp_switch_to_descriptor (void)
 
void pp_translate_string (varstring *vstr, const char *str, int in_string)
 

Variables

static BUILTIN_TYPE builtin_types []
 
static HOST_LOD ** pp_gathering
 
static HOST_LODpp_host_refs
 
static SYMBOLstring_dummy
 
static HOST_LODhost_lod_chain
 
static HOST_LODhost_lod_free_list
 

Macro Definition Documentation

#define BAD_C_TYPE   ((C_TYPE) -1)

Definition at line 40 of file esql_host_variable.c.

Referenced by pp_add_host_ref(), pp_check(), and pp_check_builtin_type().

#define C_TYPE_STRUCT   ((C_TYPE) -3)

Definition at line 42 of file esql_host_variable.c.

Referenced by pp_add_host_ref(), and pp_check().

#define UNINIT_C_TYPE   ((C_TYPE) -2)

Definition at line 41 of file esql_host_variable.c.

#define UNINITIALIZED (   p)    ((p) == UNINIT_C_TYPE)

Definition at line 43 of file esql_host_variable.c.

Referenced by pp_get_type().

Typedef Documentation

typedef struct builtin_type_s BUILTIN_TYPE

Definition at line 46 of file esql_host_variable.c.

Function Documentation

static void pp_add_dummy_structdef ( SYMBOL **  symp,
const char *  name 
)
static
static HOST_REF * pp_add_struct_field_refs ( HOST_VAR var,
int *  n_refs 
)
static
static char * pp_addr_expr ( HOST_VAR var)
static
HOST_VAR* pp_addr_of ( HOST_VAR var)
static C_TYPE pp_check_builtin_type ( LINK type,
bool  mode 
)
static

Definition at line 1087 of file esql_host_variable.c.

References BAD_C_TYPE, builtin_type_s::c_type, i, builtin_type_s::mode, pp_the_same_type(), builtin_type_s::sym, and symbol::type.

Referenced by pp_check().

Here is the caller graph for this function:

HOST_REF* pp_check_type ( HOST_REF ref,
BITSET  typeset,
const char *  msg 
)
void pp_clear_host_lod ( HOST_LOD lod)

Definition at line 1467 of file esql_host_variable.c.

References host_lod::desc, i, host_lod::n_real_refs, host_lod::n_refs, NULL, pp_free_host_ref(), host_lod::real_refs, and host_lod::refs.

Referenced by pp_clear_host_refs(), and pp_free_host_lod().

Here is the caller graph for this function:

void pp_clear_host_refs ( void  )

Definition at line 167 of file esql_host_variable.c.

References host_lod_chain, host_lod_free_list, input_refs, host_lod::next, NULL, output_refs, and pp_clear_host_lod().

Referenced by pp_hv_init().

Here is the caller graph for this function:

HOST_LOD* pp_copy_host_refs ( void  )

Definition at line 474 of file esql_host_variable.c.

References NULL, and pp_host_refs.

Referenced by pp_detach_host_refs().

Here is the caller graph for this function:

HOST_LOD* pp_detach_host_refs ( void  )

Definition at line 494 of file esql_host_variable.c.

References host_lod_chain, host_lod::next, NULL, and pp_copy_host_refs().

static char * pp_expr ( HOST_VAR var)
static

Definition at line 1108 of file esql_host_variable.c.

References host_var::expr, and vs_str().

Referenced by pp_addr_expr(), pp_check_type(), pp_get_expr(), and pp_get_ind_expr().

Here is the caller graph for this function:

static SYMBOL * pp_find_field ( STRUCTDEF sdef,
const char *  field 
)
static

Definition at line 1267 of file esql_host_variable.c.

References structdef::fields, symbol::name, symbol::next, NULL, and builtin_type_s::sym.

Referenced by pp_struct_deref().

Here is the caller graph for this function:

void pp_free_host_lod ( HOST_LOD lod)

Definition at line 1445 of file esql_host_variable.c.

References free_and_init, NULL, pp_clear_host_lod(), and host_lod::real_refs.

Referenced by pp_free_cursor(), and pp_hv_finish().

Here is the caller graph for this function:

void pp_free_host_var ( HOST_VAR var)
void pp_gather_input_refs ( void  )

Definition at line 112 of file esql_host_variable.c.

References input_refs, output_refs, and pp_host_refs.

void pp_gather_output_refs ( void  )

Definition at line 128 of file esql_host_variable.c.

References input_refs, output_refs, and pp_host_refs.

char* pp_get_addr_expr ( HOST_REF ref)

Definition at line 878 of file esql_host_variable.c.

References host_ref::addr_expr_buf, NULL, pp_addr_expr(), host_ref::var, vs_new(), vs_str(), and vs_strcpy().

Referenced by emit_get_db_value(), emit_put_db_value(), and get_quasi_string().

Here is the caller graph for this function:

char* pp_get_ind_addr_expr ( HOST_REF ref)

Definition at line 925 of file esql_host_variable.c.

References host_ref::ind, host_ref::ind_addr_expr_buf, NULL, pp_addr_expr(), pp_internal_ind, vs_new(), vs_str(), and vs_strcpy().

Referenced by emit_get_db_value(), and emit_put_db_value().

Here is the caller graph for this function:

char* pp_get_ind_expr ( HOST_REF ref)

Definition at line 901 of file esql_host_variable.c.

References host_ref::ind, host_ref::ind_expr_buf, NULL, pp_expr(), vs_new(), vs_str(), and vs_strcpy().

Referenced by pp_print_host_ref().

Here is the caller graph for this function:

char* pp_get_output_size ( HOST_REF ref)
C_TYPE pp_get_type ( HOST_REF ref)

Definition at line 614 of file esql_host_variable.c.

References assert, NULL, pp_check(), host_ref::uci_type, UNINITIALIZED, and host_ref::var.

Referenced by emit_get_db_value(), emit_put_db_value(), get_quasi_string(), pp_check_host_var_list(), and pp_check_type().

Here is the caller graph for this function:

void pp_hv_finish ( void  )

Definition at line 1382 of file esql_host_variable.c.

References host_lod::next, pp_discard_symbol(), and pp_free_host_lod().

Referenced by pp_finish().

Here is the caller graph for this function:

HOST_LOD* pp_input_refs ( void  )

Definition at line 144 of file esql_host_variable.c.

References input_refs.

HOST_VAR* pp_new_host_var ( HOST_VAR var,
SYMBOL sym 
)
HOST_LOD* pp_output_refs ( void  )

Definition at line 154 of file esql_host_variable.c.

References output_refs.

void pp_print_host_ref ( HOST_REF ref,
FILE *  fp 
)

Definition at line 961 of file esql_host_variable.c.

References NULL, p, pp_get_expr(), pp_get_ind_expr(), pp_get_input_size(), and host_ref::var.

Referenced by pp_print_cursor().

Here is the caller graph for this function:

char* pp_switch_to_descriptor ( void  )
void pp_translate_string ( varstring vstr,
const char *  str,
int  in_string 
)

Definition at line 1532 of file esql_host_variable.c.

References NULL, p, vs_putc(), and vs_strcat().

Referenced by pp_add_host_str().

Here is the caller graph for this function:

Variable Documentation

BUILTIN_TYPE builtin_types[]
static
Initial value:
= {
{
"CUBRIDDA", NULL, C_TYPE_SQLDA, true},
{
"DB_VALUE", NULL, C_TYPE_DB_VALUE, false},
{
"DB_OBJECT", NULL, C_TYPE_OBJECTID, true},
{
"DB_DATE", NULL, C_TYPE_DATE, false},
{
"DB_TIME", NULL, C_TYPE_TIME, false},
{
"DB_UTIME", NULL, C_TYPE_TIMESTAMP, false},
{
"DB_TIMESTAMP", NULL, C_TYPE_TIMESTAMP, false},
{
"DB_MONETARY", NULL, C_TYPE_MONETARY, false},
{
"DB_SET", NULL, C_TYPE_BASICSET, true},
{
"DB_MULTISET", NULL, C_TYPE_MULTISET, true},
{
"DB_SEQ", NULL, C_TYPE_SEQUENCE, true},
{
"DB_COLLECTION", NULL, C_TYPE_COLLECTION, true}
}
#define NULL
Definition: freelistheap.h:34

Definition at line 56 of file esql_host_variable.c.

HOST_LOD* host_lod_chain
static

Definition at line 96 of file esql_host_variable.c.

Referenced by pp_clear_host_refs(), pp_detach_host_refs(), and pp_new_host_lod().

HOST_LOD* host_lod_free_list
static

Definition at line 97 of file esql_host_variable.c.

Referenced by pp_clear_host_refs(), and pp_new_host_lod().

HOST_LOD** pp_gathering
static

Definition at line 92 of file esql_host_variable.c.

HOST_LOD* pp_host_refs
static
SYMBOL* string_dummy
static

Definition at line 95 of file esql_host_variable.c.