8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 17:23:04 +01:00

Cleanup: style, get rid of typedef needed by plain C, other C++ legacy declarations, etc. First pass.

This commit is contained in:
robocop 2008-12-25 07:46:53 +00:00
parent 11e63a5dd1
commit 1214fcdbd8
34 changed files with 1001 additions and 1157 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1981,17 +1981,17 @@ static void gen_erase( const act* action, int column)
static SSHORT gen_event_block( const act* action) static SSHORT gen_event_block( const act* action)
{ {
GPRE_NOD init = (GPRE_NOD) action->act_object; gpre_nod* init = (gpre_nod*) action->act_object;
gpre_sym* event_name = (gpre_sym*) init->nod_arg[0]; gpre_sym* event_name = (gpre_sym*) init->nod_arg[0];
int ident = CMP_next_ident(); int ident = CMP_next_ident();
init->nod_arg[2] = (GPRE_NOD)(IPTR)ident; init->nod_arg[2] = (gpre_nod*)(IPTR)ident;
printa(0, "static %schar\n *isc_%da, *isc_%db;", CONST_STR, ident, printa(0, "static %schar\n *isc_%da, *isc_%db;", CONST_STR, ident,
ident); ident);
printa(0, "static short\n isc_%dl;", ident); printa(0, "static short\n isc_%dl;", ident);
GPRE_NOD list = init->nod_arg[1]; gpre_nod* list = init->nod_arg[1];
return list->nod_count; return list->nod_count;
} }
@ -2014,8 +2014,8 @@ static void gen_event_init( const act* action, int column)
begin(column); begin(column);
begin(column); begin(column);
GPRE_NOD init = (GPRE_NOD) action->act_object; gpre_nod* init = (gpre_nod*) action->act_object;
GPRE_NOD event_list = init->nod_arg[1]; gpre_nod* event_list = init->nod_arg[1];
PAT args; PAT args;
args.pat_database = (DBB) init->nod_arg[3]; args.pat_database = (DBB) init->nod_arg[3];
@ -2085,7 +2085,7 @@ static void gen_event_wait( const act* action, int column)
int ident = -1; int ident = -1;
for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) { for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) {
const act* event_action = (const act*) stack_ptr->lls_object; const act* event_action = (const act*) stack_ptr->lls_object;
GPRE_NOD event_init = (GPRE_NOD) event_action->act_object; gpre_nod* event_init = (gpre_nod*) event_action->act_object;
gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0]; gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0];
if (!strcmp(event_name->sym_string, stack_name->sym_string)) { if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
ident = (IPTR) event_init->nod_arg[2]; ident = (IPTR) event_init->nod_arg[2];
@ -2136,7 +2136,7 @@ static void gen_fetch( const act* action, int column)
for (reference = port->por_references; reference; for (reference = port->por_references; reference;
reference = reference->ref_next) reference = reference->ref_next)
{ {
VAL value = reference->ref_values; gpre_value* value = reference->ref_values;
reference->ref_value = value->val_value; reference->ref_value = value->val_value;
reference->ref_values = value->val_next; reference->ref_values = value->val_next;
} }
@ -2189,7 +2189,7 @@ static void gen_fetch( const act* action, int column)
column += INDENT; column += INDENT;
begin(column); begin(column);
GPRE_NOD var_list = (GPRE_NOD) action->act_object; gpre_nod* var_list = (gpre_nod*) action->act_object;
if (var_list) if (var_list)
for (int i = 0; i < var_list->nod_count; i++) { for (int i = 0; i < var_list->nod_count; i++) {
align(column); align(column);
@ -3135,7 +3135,7 @@ static void gen_select( const act* action, int column)
column += INDENT; column += INDENT;
begin(column); begin(column);
GPRE_NOD var_list = (GPRE_NOD) action->act_object; gpre_nod* var_list = (gpre_nod*) action->act_object;
if (var_list) if (var_list)
for (int i = 0; i < var_list->nod_count; i++) { for (int i = 0; i < var_list->nod_count; i++) {
align(column); align(column);

View File

@ -80,14 +80,14 @@ static void create_trg_firing_cond(gpre_req*, const cnstrt*);
static void create_trigger(gpre_req*, const act*, gpre_trg*, pfn_local_trigger_cb); static void create_trigger(gpre_req*, const act*, gpre_trg*, pfn_local_trigger_cb);
static void create_upd_cascade_trg(gpre_req*, const act*, CNSTRT); static void create_upd_cascade_trg(gpre_req*, const act*, CNSTRT);
static bool create_view(gpre_req*, act*); static bool create_view(gpre_req*, act*);
static void create_view_trigger(gpre_req*, const act*, gpre_trg*, GPRE_NOD, gpre_ctx**, GPRE_NOD); static void create_view_trigger(gpre_req*, const act*, gpre_trg*, gpre_nod*, gpre_ctx**, gpre_nod*);
static void declare_filter(gpre_req*, const act*); static void declare_filter(gpre_req*, const act*);
static void declare_udf(gpre_req*, const act*); static void declare_udf(gpre_req*, const act*);
static void get_referred_fields(const act*, CNSTRT); static void get_referred_fields(const act*, CNSTRT);
static void grant_revoke_privileges(gpre_req*, const act*); static void grant_revoke_privileges(gpre_req*, const act*);
static void init_field_struct(gpre_fld*); static void init_field_struct(gpre_fld*);
static void put_array_info(gpre_req*, const gpre_fld*); static void put_array_info(gpre_req*, const gpre_fld*);
static void put_blr(gpre_req*, USHORT, GPRE_NOD, pfn_local_trigger_cb); static void put_blr(gpre_req*, USHORT, gpre_nod*, pfn_local_trigger_cb);
static void put_computed_blr(gpre_req*, const gpre_fld*); static void put_computed_blr(gpre_req*, const gpre_fld*);
static void put_computed_source(gpre_req*, const gpre_fld*); static void put_computed_source(gpre_req*, const gpre_fld*);
static void put_cstring(gpre_req*, USHORT, const TEXT*); static void put_cstring(gpre_req*, USHORT, const TEXT*);
@ -97,9 +97,9 @@ static void put_numeric(gpre_req*, USHORT, SSHORT);
static void put_short_cstring(gpre_req*, USHORT, const TEXT*); static void put_short_cstring(gpre_req*, USHORT, const TEXT*);
static void put_string(gpre_req*, USHORT, const TEXT*, USHORT); static void put_string(gpre_req*, USHORT, const TEXT*, USHORT);
static void put_symbol(gpre_req*, int, const gpre_sym*); static void put_symbol(gpre_req*, int, const gpre_sym*);
static void put_trigger_blr(gpre_req*, USHORT, GPRE_NOD, pfn_local_trigger_cb); static void put_trigger_blr(gpre_req*, USHORT, gpre_nod*, pfn_local_trigger_cb);
static void put_view_trigger_blr(gpre_req*, const gpre_rel*, USHORT, gpre_trg*, static void put_view_trigger_blr(gpre_req*, const gpre_rel*, USHORT, gpre_trg*,
GPRE_NOD, gpre_ctx**, GPRE_NOD); gpre_nod*, gpre_ctx**, gpre_nod*);
static void replace_field_names(gpre_nod* const, const gpre_nod* const, static void replace_field_names(gpre_nod* const, const gpre_nod* const,
gpre_fld* const, bool, gpre_ctx**); gpre_fld* const, bool, gpre_ctx**);
static void set_statistics(gpre_req*, const act*); static void set_statistics(gpre_req*, const act*);
@ -266,7 +266,7 @@ static void add_cache( gpre_req* request, const act* action, dbb* database)
{ {
TEXT file_name[254]; // CVC: Maybe MAXPATHLEN? TEXT file_name[254]; // CVC: Maybe MAXPATHLEN?
const fil* file = database->dbb_cache_file; const gpre_file* file = database->dbb_cache_file;
const SSHORT l = MIN((strlen(file->fil_name)), (sizeof(file_name) - 1)); const SSHORT l = MIN((strlen(file->fil_name)), (sizeof(file_name) - 1));
strncpy(file_name, file->fil_name, l); strncpy(file_name, file->fil_name, l);
@ -286,7 +286,7 @@ static void add_cache( gpre_req* request, const act* action, dbb* database)
static void alter_database( gpre_req* request, act* action) static void alter_database( gpre_req* request, act* action)
{ {
FIL file, next; gpre_file* file;
dbb* db = (DBB) action->act_object; dbb* db = (DBB) action->act_object;
@ -294,7 +294,8 @@ static void alter_database( gpre_req* request, act* action)
// Reverse the order of files (parser left them backwards) // Reverse the order of files (parser left them backwards)
FIL files = db->dbb_files; gpre_file* next;
gpre_file* files = db->dbb_files;
for (file = files, files = NULL; file; file = next) { for (file = files, files = NULL; file; file = next) {
next = file->fil_next; next = file->fil_next;
file->fil_next = files; file->fil_next = files;
@ -1445,10 +1446,11 @@ static void create_database_modify_dyn( gpre_req* request, act* action)
request->add_byte(isc_dyn_mod_database); request->add_byte(isc_dyn_mod_database);
gpre_file* file;
// Reverse the order of files (parser left them backwards) // Reverse the order of files (parser left them backwards)
FIL files = db->dbb_files; gpre_file* files = db->dbb_files;
FIL file, next; gpre_file* next;
for (file = files, files = NULL; file; file = next) { for (file = files, files = NULL; file; file = next) {
next = file->fil_next; next = file->fil_next;
file->fil_next = files; file->fil_next = files;
@ -1600,10 +1602,11 @@ static void create_index( gpre_req* request, const ind* index)
static void create_shadow( gpre_req* request, act* action) static void create_shadow( gpre_req* request, act* action)
{ {
fil* files = (FIL) action->act_object; gpre_file* files = (gpre_file*) action->act_object;
gpre_file* file;
// Reverse the order of files (parser left them backwards) // Reverse the order of files (parser left them backwards)
FIL file, next; gpre_file* next;
for (file = files, files = NULL; file; file = next) { for (file = files, files = NULL; file; file = next) {
next = file->fil_next; next = file->fil_next;
file->fil_next = files; file->fil_next = files;
@ -1748,7 +1751,7 @@ static bool create_view(gpre_req* request,
// write out blr // write out blr
put_blr(request, isc_dyn_view_blr, (GPRE_NOD) relation->rel_view_rse, put_blr(request, isc_dyn_view_blr, (gpre_nod*) relation->rel_view_rse,
reinterpret_cast<pfn_local_trigger_cb>(CME_rse)); reinterpret_cast<pfn_local_trigger_cb>(CME_rse));
// write out view source // write out view source
@ -1896,8 +1899,8 @@ static bool create_view(gpre_req* request,
new_view_ref->ref_context = contexts[1]; new_view_ref->ref_context = contexts[1];
new_view_ref->ref_field = view_ref->ref_field = new_view_ref->ref_field = view_ref->ref_field =
(field) ? field : fld; (field) ? field : fld;
gpre_nod* view_field = MSC_unary(nod_field, (GPRE_NOD) view_ref); gpre_nod* view_field = MSC_unary(nod_field, (gpre_nod*) view_ref);
gpre_nod* new_view_field = MSC_unary(nod_field, (GPRE_NOD) new_view_ref); gpre_nod* new_view_field = MSC_unary(nod_field, (gpre_nod*) new_view_ref);
gpre_nod* anull_node = MSC_unary(nod_missing, view_field); gpre_nod* anull_node = MSC_unary(nod_missing, view_field);
gpre_nod* bnull_node = MSC_unary(nod_missing, value); gpre_nod* bnull_node = MSC_unary(nod_missing, value);
@ -1926,7 +1929,7 @@ static bool create_view(gpre_req* request,
gpre_nod* set_list = MSC_node(nod_list, count); gpre_nod* set_list = MSC_node(nod_list, count);
ptr = set_list->nod_arg + count; ptr = set_list->nod_arg + count;
while (stack) while (stack)
*--ptr = (GPRE_NOD) MSC_pop(&stack); *--ptr = (gpre_nod*) MSC_pop(&stack);
// Modify the context of fields in boolean to be that of the // Modify the context of fields in boolean to be that of the
// sub-relation. // sub-relation.
@ -1945,7 +1948,7 @@ static bool create_view(gpre_req* request,
// "update violates CHECK constraint on view" // "update violates CHECK constraint on view"
trigger->trg_message = NULL; trigger->trg_message = NULL;
trigger->trg_boolean = (GPRE_NOD) select; trigger->trg_boolean = (gpre_nod*) select;
create_view_trigger(request, action, trigger, view_boolean, contexts, create_view_trigger(request, action, trigger, view_boolean, contexts,
set_list); set_list);
@ -1974,7 +1977,7 @@ static void create_view_trigger(gpre_req* request,
const act* action, const act* action,
gpre_trg* trigger, gpre_trg* trigger,
gpre_nod* view_boolean, gpre_nod* view_boolean,
gpre_ctx** contexts, GPRE_NOD set_list) gpre_ctx** contexts, gpre_nod* set_list)
{ {
const gpre_rel* relation = (gpre_rel*) action->act_object; const gpre_rel* relation = (gpre_rel*) action->act_object;
@ -2013,7 +2016,7 @@ static void create_view_trigger(gpre_req* request,
static void declare_filter( gpre_req* request, const act* action) static void declare_filter( gpre_req* request, const act* action)
{ {
const fltr* filter = (FLTR) action->act_object; const gpre_filter* filter = (gpre_filter*) action->act_object;
put_cstring(request, isc_dyn_def_filter, filter->fltr_name); put_cstring(request, isc_dyn_def_filter, filter->fltr_name);
put_numeric(request, isc_dyn_filter_in_subtype, filter->fltr_input_type); put_numeric(request, isc_dyn_filter_in_subtype, filter->fltr_input_type);
put_numeric(request, isc_dyn_filter_out_subtype, put_numeric(request, isc_dyn_filter_out_subtype,
@ -2319,7 +2322,7 @@ static void put_array_info( gpre_req* request, const gpre_fld* field)
// //
static void put_blr(gpre_req* request, static void put_blr(gpre_req* request,
USHORT blr_operator, GPRE_NOD node, pfn_local_trigger_cb routine) USHORT blr_operator, gpre_nod* node, pfn_local_trigger_cb routine)
{ {
request->add_byte(blr_operator); request->add_byte(blr_operator);
const USHORT offset = request->req_blr - request->req_base; const USHORT offset = request->req_blr - request->req_base;
@ -2681,7 +2684,7 @@ static void put_symbol(gpre_req* request, int ddl_operator,
static void put_trigger_blr(gpre_req* request, static void put_trigger_blr(gpre_req* request,
USHORT blr_operator, USHORT blr_operator,
GPRE_NOD node, pfn_local_trigger_cb routine) gpre_nod* node, pfn_local_trigger_cb routine)
{ {
request->add_byte(blr_operator); request->add_byte(blr_operator);
const USHORT offset = request->req_blr - request->req_base; const USHORT offset = request->req_blr - request->req_base;
@ -2723,7 +2726,7 @@ static void put_view_trigger_blr(gpre_req* request,
const gpre_rel* relation, const gpre_rel* relation,
USHORT blr_operator, USHORT blr_operator,
gpre_trg* trigger, gpre_trg* trigger,
GPRE_NOD view_boolean, gpre_ctx** contexts, GPRE_NOD set_list) gpre_nod* view_boolean, gpre_ctx** contexts, gpre_nod* set_list)
{ {
gpre_rse* node = (gpre_rse*) trigger->trg_boolean; gpre_rse* node = (gpre_rse*) trigger->trg_boolean;
request->add_byte(blr_operator); request->add_byte(blr_operator);

View File

@ -46,15 +46,15 @@
#include "../jrd/misc_func_ids.h" #include "../jrd/misc_func_ids.h"
#include "../jrd/align.h" #include "../jrd/align.h"
static void cmp_array(GPRE_NOD, gpre_req*); static void cmp_array(gpre_nod*, gpre_req*);
static void cmp_array_element(GPRE_NOD, gpre_req*); static void cmp_array_element(gpre_nod*, gpre_req*);
static void cmp_cast(GPRE_NOD, gpre_req*); static void cmp_cast(gpre_nod*, gpre_req*);
static void cmp_field(const gpre_nod*, gpre_req*); static void cmp_field(const gpre_nod*, gpre_req*);
static void cmp_literal(const gpre_nod*, gpre_req*); static void cmp_literal(const gpre_nod*, gpre_req*);
static void cmp_map(MAP, gpre_req*); static void cmp_map(MAP, gpre_req*);
static void cmp_plan(const gpre_nod*, gpre_req*); static void cmp_plan(const gpre_nod*, gpre_req*);
static void cmp_sdl_dtype(const gpre_fld*, REF); static void cmp_sdl_dtype(const gpre_fld*, REF);
static void cmp_udf(GPRE_NOD, gpre_req*); static void cmp_udf(gpre_nod*, gpre_req*);
static void cmp_value(const gpre_nod*, gpre_req*); static void cmp_value(const gpre_nod*, gpre_req*);
static void get_dtype_of_case(const gpre_nod*, gpre_fld*); static void get_dtype_of_case(const gpre_nod*, gpre_fld*);
static void get_dtype_of_list(const gpre_nod*, gpre_fld*); static void get_dtype_of_list(const gpre_nod*, gpre_fld*);
@ -78,7 +78,7 @@ static bool debug_on;
struct op_table struct op_table
{ {
enum nod_t op_type; nod_t op_type;
UCHAR op_blr; UCHAR op_blr;
}; };
@ -164,7 +164,7 @@ static inline bool is_date_and_time(const USHORT d1, const USHORT d2)
// Compile a random expression. // Compile a random expression.
// //
void CME_expr(GPRE_NOD node, gpre_req* request) void CME_expr(gpre_nod* node, gpre_req* request)
{ {
gpre_ctx* context; gpre_ctx* context;
gpre_fld field; gpre_fld field;
@ -272,7 +272,7 @@ void CME_expr(GPRE_NOD node, gpre_req* request)
// ** Begin date/time/timestamp support * // ** Begin date/time/timestamp support *
case nod_extract: case nod_extract:
request->add_byte(blr_extract); request->add_byte(blr_extract);
switch ((KWWORDS) (IPTR) node->nod_arg[0]) switch ((kwwords_t) (IPTR) node->nod_arg[0])
{ {
case KW_YEAR: case KW_YEAR:
request->add_byte(blr_extract_year); request->add_byte(blr_extract_year);
@ -609,7 +609,7 @@ void CME_get_dtype(const gpre_nod* node, gpre_fld* f)
// ** Begin date/time/timestamp support * // ** Begin date/time/timestamp support *
case nod_extract: case nod_extract:
{ {
KWWORDS kw_word = (KWWORDS) (IPTR) node->nod_arg[0]; kwwords_t kw_word = (kwwords_t) (IPTR) node->nod_arg[0];
CME_get_dtype(node->nod_arg[1], f); CME_get_dtype(node->nod_arg[1], f);
switch (f->fld_dtype) switch (f->fld_dtype)
{ {
@ -1222,7 +1222,7 @@ void CME_rse(gpre_rse* selection, gpre_req* request)
{ {
SSHORT i; SSHORT i;
if (selection->rse_join_type == (NOD_T) 0) if (selection->rse_join_type == nod_nothing)
{ {
if ((selection->rse_flags & RSE_singleton) && if ((selection->rse_flags & RSE_singleton) &&
!(request->req_database->dbb_flags & DBB_v3)) !(request->req_database->dbb_flags & DBB_v3))
@ -1338,7 +1338,7 @@ void CME_rse(gpre_rse* selection, gpre_req* request)
cmp_plan(temp, request); cmp_plan(temp, request);
} }
if (selection->rse_join_type != (NOD_T) 0 if (selection->rse_join_type != nod_nothing
&& selection->rse_join_type != nod_join_inner) && selection->rse_join_type != nod_join_inner)
{ {
request->add_byte(blr_join_type); request->add_byte(blr_join_type);
@ -1384,7 +1384,7 @@ void CME_rse(gpre_rse* selection, gpre_req* request)
// out sdl (slice description language) // out sdl (slice description language)
// //
static void cmp_array( GPRE_NOD node, gpre_req* request) static void cmp_array( gpre_nod* node, gpre_req* request)
{ {
CMP_check(request, 0); CMP_check(request, 0);
@ -1464,7 +1464,7 @@ static void cmp_array( GPRE_NOD node, gpre_req* request)
// from an gpre_rse and output blr for this reference // from an gpre_rse and output blr for this reference
// //
static void cmp_array_element( GPRE_NOD node, gpre_req* request) static void cmp_array_element( gpre_nod* node, gpre_req* request)
{ {
request->add_byte(blr_index); request->add_byte(blr_index);
@ -1483,7 +1483,7 @@ static void cmp_array_element( GPRE_NOD node, gpre_req* request)
// //
// //
static void cmp_cast( GPRE_NOD node, gpre_req* request) static void cmp_cast( gpre_nod* node, gpre_req* request)
{ {
request->add_byte(blr_cast); request->add_byte(blr_cast);
@ -1780,7 +1780,7 @@ static void cmp_plan(const gpre_nod* plan_expression, gpre_req* request)
gpre_nod* const* ptr = list->nod_arg; gpre_nod* const* ptr = list->nod_arg;
for (gpre_nod* const* const end = ptr + list->nod_count; ptr < end; ptr++) for (gpre_nod* const* const end = ptr + list->nod_count; ptr < end; ptr++)
{ {
GPRE_NOD node = *ptr; gpre_nod* node = *ptr;
if (node->nod_type == nod_plan_expr) if (node->nod_type == nod_plan_expr)
{ {
cmp_plan(node, request); cmp_plan(node, request);
@ -1944,7 +1944,7 @@ static void cmp_sdl_dtype( const gpre_fld* field, REF reference)
// Compile a reference to a user defined function. // Compile a reference to a user defined function.
// //
static void cmp_udf( GPRE_NOD node, gpre_req* request) static void cmp_udf( gpre_nod* node, gpre_req* request)
{ {
const udf* an_udf = (udf*) node->nod_arg[1]; const udf* an_udf = (udf*) node->nod_arg[1];
request->add_byte(blr_function); request->add_byte(blr_function);

View File

@ -24,7 +24,7 @@
#ifndef GPRE_CME_PROTO_H #ifndef GPRE_CME_PROTO_H
#define GPRE_CME_PROTO_H #define GPRE_CME_PROTO_H
void CME_expr(GPRE_NOD, gpre_req*); void CME_expr(gpre_nod*, gpre_req*);
void CME_get_dtype(const gpre_nod*, gpre_fld*); void CME_get_dtype(const gpre_nod*, gpre_fld*);
void CME_relation(gpre_ctx*, gpre_req*); void CME_relation(gpre_ctx*, gpre_req*);
void CME_rse(gpre_rse*, gpre_req*); void CME_rse(gpre_rse*, gpre_req*);

View File

@ -44,7 +44,7 @@
static void cmp_any(gpre_req*); static void cmp_any(gpre_req*);
static void cmp_assignment(GPRE_NOD, gpre_req*); static void cmp_assignment(gpre_nod*, gpre_req*);
static void cmp_blob(blb*, bool); static void cmp_blob(blb*, bool);
static void cmp_blr(gpre_req*); static void cmp_blr(gpre_req*);
static void cmp_erase(act*, gpre_req*); static void cmp_erase(act*, gpre_req*);
@ -70,7 +70,8 @@ static void make_receive(gpre_port*, gpre_req*);
static void make_send(gpre_port*, gpre_req*); static void make_send(gpre_port*, gpre_req*);
static void update_references(REF); static void update_references(REF);
static GPRE_NOD lit0, lit1; static gpre_nod* lit0;
static gpre_nod* lit1;
static gpre_fld* eof_field; static gpre_fld* eof_field;
static gpre_fld* count_field; static gpre_fld* count_field;
static gpre_fld* slack_byte_field; static gpre_fld* slack_byte_field;
@ -155,11 +156,11 @@ void CMP_compile_request( gpre_req* request)
slack_byte_field = MET_make_field(gpreGlob.slack_name, dtype_text, 1, false); slack_byte_field = MET_make_field(gpreGlob.slack_name, dtype_text, 1, false);
reference = (REF) MSC_alloc(REF_LEN); reference = (REF) MSC_alloc(REF_LEN);
reference->ref_value = "0"; reference->ref_value = "0";
lit0 = MSC_unary(nod_literal, (GPRE_NOD) reference); lit0 = MSC_unary(nod_literal, (gpre_nod*) reference);
reference = (REF) MSC_alloc(REF_LEN); reference = (REF) MSC_alloc(REF_LEN);
reference->ref_value = "1"; reference->ref_value = "1";
lit1 = MSC_unary(nod_literal, (GPRE_NOD) reference); lit1 = MSC_unary(nod_literal, (gpre_nod*) reference);
} }
// Handle different request types differently // Handle different request types differently
@ -341,7 +342,7 @@ void CMP_external_field( gpre_req* request, const gpre_fld* field)
// called at most once per module. // called at most once per module.
// //
void CMP_init(void) void CMP_init()
{ {
lit0 = lit1 = NULL; lit0 = lit1 = NULL;
@ -355,7 +356,7 @@ void CMP_init(void)
// Give out next identifier. // Give out next identifier.
// //
ULONG CMP_next_ident(void) ULONG CMP_next_ident()
{ {
return next_ident++; return next_ident++;
} }
@ -500,7 +501,7 @@ static void cmp_any( gpre_req* request)
request->add_byte(blr_any); request->add_byte(blr_any);
CME_rse(request->req_rse, request); CME_rse(request->req_rse, request);
gpre_nod* value = MSC_unary(nod_value, (GPRE_NOD) port->por_references); gpre_nod* value = MSC_unary(nod_value, (gpre_nod*) port->por_references);
// Make a send to signal end of file // Make a send to signal end of file
@ -530,7 +531,7 @@ static void cmp_any( gpre_req* request)
// Compile a build assignment statement. // Compile a build assignment statement.
// //
static void cmp_assignment( GPRE_NOD node, gpre_req* request) static void cmp_assignment( gpre_nod* node, gpre_req* request)
{ {
CMP_check(request, 0); CMP_check(request, 0);
request->add_byte(blr_assignment); request->add_byte(blr_assignment);
@ -697,7 +698,7 @@ static void cmp_erase( act* action, gpre_req* request)
static void cmp_fetch( act* action) static void cmp_fetch( act* action)
{ {
gpre_nod* list = (GPRE_NOD) action->act_object; gpre_nod* list = (gpre_nod*) action->act_object;
if (!list) if (!list)
return; return;
@ -907,11 +908,11 @@ static void cmp_for( gpre_req* request)
if (reference->ref_expr) if (reference->ref_expr)
CME_expr(reference->ref_expr, request); CME_expr(reference->ref_expr, request);
else { else {
field->nod_arg[0] = (GPRE_NOD) reference; field->nod_arg[0] = (gpre_nod*) reference;
CME_expr(field, request); CME_expr(field, request);
} }
} }
value->nod_arg[0] = (GPRE_NOD) reference; value->nod_arg[0] = (gpre_nod*) reference;
CME_expr(value, request); CME_expr(value, request);
} }
request->add_byte(blr_end); request->add_byte(blr_end);
@ -948,7 +949,7 @@ static void cmp_for( gpre_req* request)
make_send(port, request); make_send(port, request);
request->add_byte(blr_assignment); request->add_byte(blr_assignment);
CME_expr(lit0, request); CME_expr(lit0, request);
value->nod_arg[0] = (GPRE_NOD) request->req_eof; value->nod_arg[0] = (gpre_nod*) request->req_eof;
CME_expr(value, request); CME_expr(value, request);
request->add_byte(blr_end); request->add_byte(blr_end);
@ -973,7 +974,7 @@ static void cmp_loop( gpre_req* request)
reference = reference->ref_next) reference = reference->ref_next)
{ {
if (reference->ref_field == count_field) if (reference->ref_field == count_field)
counter->nod_arg[0] = (GPRE_NOD) reference; counter->nod_arg[0] = (gpre_nod*) reference;
} }
request->add_byte(blr_assignment); request->add_byte(blr_assignment);
@ -1117,7 +1118,7 @@ static void cmp_procedure( gpre_req* request)
ref* reference = request->req_references; ref* reference = request->req_references;
if (reference) { if (reference) {
for (gpre_lls** list = &outputs; reference; reference = reference->ref_next) { for (gpre_lls** list = &outputs; reference; reference = reference->ref_next) {
MSC_push((GPRE_NOD) reference, list); MSC_push((gpre_nod*) reference, list);
list = &(*list)->lls_next; list = &(*list)->lls_next;
} }
} }

View File

@ -27,8 +27,8 @@
void CMP_check(gpre_req*, SSHORT); void CMP_check(gpre_req*, SSHORT);
void CMP_compile_request(gpre_req*); void CMP_compile_request(gpre_req*);
void CMP_external_field(gpre_req*, const gpre_fld*); void CMP_external_field(gpre_req*, const gpre_fld*);
void CMP_init(void); void CMP_init();
ULONG CMP_next_ident(void); ULONG CMP_next_ident();
void CMP_stuff_symbol(gpre_req*, const gpre_sym*); void CMP_stuff_symbol(gpre_req*, const gpre_sym*);
void CMP_t_start(gpre_tra*); void CMP_t_start(gpre_tra*);

View File

@ -217,7 +217,7 @@ static TEXT* gen_name(TEXT* const, const ref*, bool);
static void gen_on_error (const act*); static void gen_on_error (const act*);
static void gen_procedure (const act*); static void gen_procedure (const act*);
static void gen_put_segment (const act*); static void gen_put_segment (const act*);
static void gen_raw (const UCHAR*, enum req_t, int, int); static void gen_raw (const UCHAR*, req_t, int, int);
static void gen_ready (const act*); static void gen_ready (const act*);
static void gen_receive (const act*, const gpre_port*); static void gen_receive (const act*, const gpre_port*);
static void gen_release (const act*); static void gen_release (const act*);
@ -2255,10 +2255,10 @@ static void gen_erase( const act* action)
static SSHORT gen_event_block( const act* action) static SSHORT gen_event_block( const act* action)
{ {
gpre_nod* init = (GPRE_NOD) action->act_object; gpre_nod* init = (gpre_nod*) action->act_object;
int ident = CMP_next_ident(); int ident = CMP_next_ident();
init->nod_arg[2] = (GPRE_NOD) (IPTR) ident; init->nod_arg[2] = (gpre_nod*) (IPTR) ident;
printa(names[COLUMN_0], false, "01 %s%dA PIC S9(9) USAGE COMP.", printa(names[COLUMN_0], false, "01 %s%dA PIC S9(9) USAGE COMP.",
names[isc_a_pos], ident); names[isc_a_pos], ident);
@ -2292,7 +2292,7 @@ static void gen_event_init( const act* action)
const TEXT *pattern3 = const TEXT *pattern3 =
"CALL \"%S3\" USING %S5, %VF%S4%N1L%VE, %VF%S4%N1A%VE, %VF%S4%N1B%VE"; "CALL \"%S3\" USING %S5, %VF%S4%N1L%VE, %VF%S4%N1A%VE, %VF%S4%N1B%VE";
const gpre_nod* init = (GPRE_NOD) action->act_object; const gpre_nod* init = (gpre_nod*) action->act_object;
const gpre_nod* event_list = init->nod_arg[1]; const gpre_nod* event_list = init->nod_arg[1];
const SSHORT column = strlen(names[COLUMN]); const SSHORT column = strlen(names[COLUMN]);
@ -2368,7 +2368,7 @@ static void gen_event_wait( const act* action)
for (const gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) for (const gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next)
{ {
const act* event_action = (const act*) stack_ptr->lls_object; const act* event_action = (const act*) stack_ptr->lls_object;
const gpre_nod* event_init = (GPRE_NOD) event_action->act_object; const gpre_nod* event_init = (gpre_nod*) event_action->act_object;
const gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0]; const gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0];
if (!strcmp(event_name->sym_string, stack_name->sym_string)) { if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
ident = (int) (IPTR) event_init->nod_arg[2]; ident = (int) (IPTR) event_init->nod_arg[2];
@ -2425,7 +2425,7 @@ static void gen_fetch( const act* action)
for (reference = port->por_references; reference; for (reference = port->por_references; reference;
reference = reference->ref_next) reference = reference->ref_next)
{ {
VAL value = reference->ref_values; gpre_value* value = reference->ref_values;
reference->ref_value = value->val_value; reference->ref_value = value->val_value;
reference->ref_values = value->val_next; reference->ref_values = value->val_next;
} }
@ -2467,7 +2467,7 @@ static void gen_fetch( const act* action)
printa(names[COLUMN], false, printa(names[COLUMN], false,
"IF %s NOT = 0 THEN", gen_name(s, request->req_eof, true)); "IF %s NOT = 0 THEN", gen_name(s, request->req_eof, true));
printa(names[COLUMN], false, "MOVE 0 TO SQLCODE"); printa(names[COLUMN], false, "MOVE 0 TO SQLCODE");
if (gpre_nod* var_list = (GPRE_NOD) action->act_object) if (gpre_nod* var_list = (gpre_nod*) action->act_object)
for (int i = 0; i < var_list->nod_count; i++) { for (int i = 0; i < var_list->nod_count; i++) {
asgn_to(action, (REF) var_list->nod_arg[i]); asgn_to(action, (REF) var_list->nod_arg[i]);
} }
@ -2914,9 +2914,7 @@ static void gen_put_segment( const act* action)
// Generate BLR in raw, numeric form. Ughly but dense. // Generate BLR in raw, numeric form. Ughly but dense.
// //
static void gen_raw( static void gen_raw(const UCHAR* blr, req_t request_type, int request_length, int ident)
const UCHAR* blr,
enum req_t request_type, int request_length, int ident)
{ {
union { union {
UCHAR bytewise_blr[4]; UCHAR bytewise_blr[4];
@ -3449,7 +3447,7 @@ static void gen_select( const act* action)
gen_receive(action, port); gen_receive(action, port);
printa(names[COLUMN], false, "IF %s NOT = 0 THEN", name); printa(names[COLUMN], false, "IF %s NOT = 0 THEN", name);
gpre_nod* var_list = (GPRE_NOD) action->act_object; gpre_nod* var_list = (gpre_nod*) action->act_object;
if (var_list) if (var_list)
for (int i = 0; i < var_list->nod_count; i++) { for (int i = 0; i < var_list->nod_count; i++) {
asgn_to(action, (REF) var_list->nod_arg[i]); asgn_to(action, (REF) var_list->nod_arg[i]);

View File

@ -24,7 +24,6 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: dyntable.cpp,v 1.11 2008-12-05 01:19:48 asfernandes Exp $
// //
// CVC: Strange, this file is only referenced in a MacOsX project and gpre // CVC: Strange, this file is only referenced in a MacOsX project and gpre
// works directly with dyntable.h. // works directly with dyntable.h.
@ -35,10 +34,12 @@
#define NODE(dyn) {dyn, "dyn"}, #define NODE(dyn) {dyn, "dyn"},
struct dyn { struct dyn
{
SSHORT dyn_value; SSHORT dyn_value;
const char* dyn_string; const char* dyn_string;
} dyn_table[] = { } dyn_table[] =
{
NODE(gds__dyn_begin) NODE(gds__dyn_begin)
NODE(gds__dyn_end) NODE(gds__dyn_end)
NODE(gds__dyn_if) NODE(gds__dyn_if)
@ -132,18 +133,19 @@ int main()
max = 0; max = 0;
for (const dyn* item = dyn_table; item->dyn_string; item++) { for (const dyn* item = dyn_table; item->dyn_string; item++) {
if (table[item->dyn_value]) if (table[item->dyn_value])
fprintf(stderr, "%s (%d) is duplicate\n", fprintf(stderr, "%s (%d) is duplicate\n", item->dyn_string, item->dyn_value);
item->dyn_string, item->dyn_value);
table[item->dyn_value] = item->dyn_string; table[item->dyn_value] = item->dyn_string;
if (item->dyn_value > max) if (item->dyn_value > max)
max = item->dyn_value; max = item->dyn_value;
} }
for (int dyn_iter = 0; dyn_iter <= max; dyn_iter++) for (int dyn_iter = 0; dyn_iter <= max; dyn_iter++)
{
if (table[dyn_iter]) if (table[dyn_iter])
printf(" \"%s\",\n", table[dyn_iter]); printf(" \"%s\",\n", table[dyn_iter]);
else else
printf(" NULL,\n"); printf(" NULL,\n");
}
return 0; return 0;
} }

View File

@ -47,34 +47,36 @@
const int ZERO_BASED = 0; const int ZERO_BASED = 0;
const int ONE_BASED = 1; const int ONE_BASED = 1;
static bool check_relation(void); static bool check_relation();
static GPRE_NOD lookup_field(gpre_ctx*); static gpre_nod* lookup_field(gpre_ctx*);
static GPRE_NOD make_and(GPRE_NOD, GPRE_NOD); static gpre_nod* make_and(gpre_nod*, gpre_nod*);
static GPRE_NOD make_list(gpre_lls*); static gpre_nod* make_list(gpre_lls*);
static GPRE_NOD normalize_index(dim*, GPRE_NOD, USHORT); static gpre_nod* normalize_index(dim*, gpre_nod*, USHORT);
static GPRE_NOD par_and(gpre_req*); static gpre_nod* par_and(gpre_req*);
static GPRE_NOD par_array(gpre_req*, gpre_fld*, bool, bool); static gpre_nod* par_array(gpre_req*, gpre_fld*, bool, bool);
static GPRE_NOD par_boolean(gpre_req*); static gpre_nod* par_boolean(gpre_req*);
static GPRE_NOD par_field(gpre_req*); static gpre_nod* par_field(gpre_req*);
static GPRE_NOD par_multiply(gpre_req*, gpre_fld*); static gpre_nod* par_multiply(gpre_req*, gpre_fld*);
static GPRE_NOD par_native_value(gpre_req*, gpre_fld*); static gpre_nod* par_native_value(gpre_req*, gpre_fld*);
static GPRE_NOD par_not(gpre_req*); static gpre_nod* par_not(gpre_req*);
static GPRE_NOD par_over(gpre_ctx*); static gpre_nod* par_over(gpre_ctx*);
static GPRE_NOD par_primitive_value(gpre_req*, gpre_fld*); static gpre_nod* par_primitive_value(gpre_req*, gpre_fld*);
static GPRE_NOD par_relational(gpre_req*); static gpre_nod* par_relational(gpre_req*);
static GPRE_NOD par_udf(gpre_req*, USHORT, gpre_fld*); static gpre_nod* par_udf(gpre_req*, USHORT, gpre_fld*);
static GPRE_NOD par_value(gpre_req*, gpre_fld*); static gpre_nod* par_value(gpre_req*, gpre_fld*);
static gpre_fld* global_count_field; static gpre_fld* global_count_field;
static gpre_fld* global_subscript_field; static gpre_fld* global_subscript_field;
struct rel_ops { struct rel_ops
enum nod_t rel_op; {
enum kwwords rel_kw; nod_t rel_op;
kwwords_t rel_kw;
SSHORT rel_args; SSHORT rel_args;
}; };
static const rel_ops relops[] = { static const rel_ops relops[] =
{
{ nod_eq, KW_EQ, 2 }, { nod_eq, KW_EQ, 2 },
{ nod_eq, KW_EQUALS, 2 }, { nod_eq, KW_EQUALS, 2 },
{ nod_equiv, KW_EQUIV, 2 }, { nod_equiv, KW_EQUIV, 2 },
@ -92,12 +94,14 @@ static const rel_ops relops[] = {
{ nod_any, KW_none, 0} { nod_any, KW_none, 0}
}; };
struct dtypes { struct dtypes
enum kwwords dtype_keyword; {
kwwords_t dtype_keyword;
USHORT dtype_dtype; USHORT dtype_dtype;
}; };
static const dtypes data_types[] = { static const dtypes data_types[] =
{
{ KW_CHAR, dtype_text }, { KW_CHAR, dtype_text },
{ KW_VARYING, dtype_varying }, { KW_VARYING, dtype_varying },
{ KW_STRING, dtype_cstring }, { KW_STRING, dtype_cstring },
@ -116,7 +120,7 @@ static const dtypes data_types[] = {
// Parse array subscript. // Parse array subscript.
// //
GPRE_NOD EXP_array(gpre_req* request, gpre_fld* field, bool subscript_flag, bool sql_flag) gpre_nod* EXP_array(gpre_req* request, gpre_fld* field, bool subscript_flag, bool sql_flag)
{ {
return par_array(request, field, subscript_flag, sql_flag); return par_array(request, field, subscript_flag, sql_flag);
} }
@ -306,7 +310,7 @@ void EXP_left_paren(const TEXT* string)
// Parse a native literal constant value. // Parse a native literal constant value.
// //
GPRE_NOD EXP_literal(void) gpre_nod* EXP_literal()
{ {
switch (gpreGlob.sw_sql_dialect) { switch (gpreGlob.sw_sql_dialect) {
case 1: case 1:
@ -319,7 +323,7 @@ GPRE_NOD EXP_literal(void)
} }
ref* reference = (REF) MSC_alloc(REF_LEN); ref* reference = (REF) MSC_alloc(REF_LEN);
gpre_nod* node = MSC_unary(nod_literal, (GPRE_NOD) reference); gpre_nod* node = MSC_unary(nod_literal, (gpre_nod*) reference);
if (isQuoted(gpreGlob.token_global.tok_type)) { if (isQuoted(gpreGlob.token_global.tok_type)) {
TEXT* string = (TEXT *) MSC_alloc(gpreGlob.token_global.tok_length + 3); TEXT* string = (TEXT *) MSC_alloc(gpreGlob.token_global.tok_length + 3);
reference->ref_value = string; reference->ref_value = string;
@ -614,7 +618,7 @@ REF EXP_post_field(gpre_fld* field, gpre_ctx* context, bool null_flag)
// and return FALSE. // and return FALSE.
// //
bool EXP_match_paren(void) bool EXP_match_paren()
{ {
if (MSC_match(KW_RIGHT_PAREN)) if (MSC_match(KW_RIGHT_PAREN))
return true; return true;
@ -629,7 +633,7 @@ bool EXP_match_paren(void)
// Parse and look up a qualified relation name. // Parse and look up a qualified relation name.
// //
gpre_rel* EXP_relation(void) gpre_rel* EXP_relation()
{ {
if (!gpreGlob.isc_databases) if (!gpreGlob.isc_databases)
PAR_error("no database for operation"); PAR_error("no database for operation");
@ -772,7 +776,7 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol)
} }
gpre_nod* item = par_value(request, 0); gpre_nod* item = par_value(request, 0);
count++; count++;
MSC_push((GPRE_NOD) (IPTR) ((direction) ? 1 : 0), &directions); MSC_push((gpre_nod*) (IPTR) ((direction) ? 1 : 0), &directions);
if (insensitive) { if (insensitive) {
gpre_nod* upcase = MSC_node(nod_upcase, 1); gpre_nod* upcase = MSC_node(nod_upcase, 1);
upcase->nod_arg[0] = item; upcase->nod_arg[0] = item;
@ -788,8 +792,8 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol)
sort->nod_count = count; sort->nod_count = count;
gpre_nod** ptr = sort->nod_arg + count * 2; gpre_nod** ptr = sort->nod_arg + count * 2;
while (--count >= 0) { while (--count >= 0) {
*--ptr = (GPRE_NOD) MSC_pop(&items); *--ptr = (gpre_nod*) MSC_pop(&items);
*--ptr = (GPRE_NOD) MSC_pop(&directions); *--ptr = (gpre_nod*) MSC_pop(&directions);
} }
} }
@ -811,7 +815,7 @@ gpre_rse* EXP_rse(gpre_req* request, gpre_sym* initial_symbol)
sort->nod_count = count; sort->nod_count = count;
gpre_nod** ptr = sort->nod_arg + count; gpre_nod** ptr = sort->nod_arg + count;
while (--count >= 0) while (--count >= 0)
*--ptr = (GPRE_NOD) MSC_pop(&items); *--ptr = (gpre_nod*) MSC_pop(&items);
} }
else else
break; break;
@ -858,10 +862,10 @@ void EXP_rse_cleanup( gpre_rse* rs)
// Parse a subscript value. This is called by PAR\par_slice. // Parse a subscript value. This is called by PAR\par_slice.
// //
GPRE_NOD EXP_subscript(gpre_req* request) gpre_nod* EXP_subscript(gpre_req* request)
{ {
ref* reference = (REF) MSC_alloc(REF_LEN); ref* reference = (REF) MSC_alloc(REF_LEN);
gpre_nod* node = MSC_unary(nod_value, (GPRE_NOD) reference); gpre_nod* node = MSC_unary(nod_value, (gpre_nod*) reference);
// Special case literals // Special case literals
@ -890,7 +894,7 @@ GPRE_NOD EXP_subscript(gpre_req* request)
// Check current token for either a relation or database name. // Check current token for either a relation or database name.
// //
static bool check_relation(void) static bool check_relation()
{ {
// The current token is (i.e. should be) either a relation // The current token is (i.e. should be) either a relation
// name or a database name. If it's a database name, search // name or a database name. If it's a database name, search
@ -917,7 +921,7 @@ static bool check_relation(void)
// block) for field. // block) for field.
// //
static GPRE_NOD lookup_field(gpre_ctx* context) static gpre_nod* lookup_field(gpre_ctx* context)
{ {
SQL_resolve_identifier("<Field Name>", NULL, NAME_SIZE); SQL_resolve_identifier("<Field Name>", NULL, NAME_SIZE);
gpre_fld* field = MET_field(context->ctx_relation, gpreGlob.token_global.tok_string); gpre_fld* field = MET_field(context->ctx_relation, gpreGlob.token_global.tok_string);
@ -928,7 +932,7 @@ static GPRE_NOD lookup_field(gpre_ctx* context)
reference->ref_field = field; reference->ref_field = field;
reference->ref_context = context; reference->ref_context = context;
return MSC_unary(nod_field, (GPRE_NOD) reference); return MSC_unary(nod_field, (gpre_nod*) reference);
} }
@ -939,7 +943,7 @@ static GPRE_NOD lookup_field(gpre_ctx* context)
// If both are null, return null. // If both are null, return null.
// //
static GPRE_NOD make_and( GPRE_NOD node1, GPRE_NOD node2) static gpre_nod* make_and( gpre_nod* node1, gpre_nod* node2)
{ {
if (!node1) if (!node1)
return node2; return node2;
@ -956,7 +960,7 @@ static GPRE_NOD make_and( GPRE_NOD node1, GPRE_NOD node2)
// Make a generic variable length node from a stack. // Make a generic variable length node from a stack.
// //
static GPRE_NOD make_list( gpre_lls* stack) static gpre_nod* make_list( gpre_lls* stack)
{ {
USHORT count = 0; USHORT count = 0;
for (const gpre_lls* temp = stack; temp; temp = temp->lls_next) for (const gpre_lls* temp = stack; temp; temp = temp->lls_next)
@ -980,7 +984,7 @@ static GPRE_NOD make_list( gpre_lls* stack)
// in the user's program. // in the user's program.
// //
static GPRE_NOD normalize_index( dim* dimension, GPRE_NOD user_index, USHORT array_base) static gpre_nod* normalize_index( dim* dimension, gpre_nod* user_index, USHORT array_base)
{ {
TEXT string[33]; TEXT string[33];
bool negate = false; bool negate = false;
@ -1006,7 +1010,7 @@ static GPRE_NOD normalize_index( dim* dimension, GPRE_NOD user_index, USHORT arr
char* tmp = (TEXT *) MSC_alloc(strlen(string)); char* tmp = (TEXT *) MSC_alloc(strlen(string));
reference->ref_value = tmp; reference->ref_value = tmp;
strcpy(tmp, string); strcpy(tmp, string);
gpre_nod* adjustment_node = MSC_unary(nod_literal, (GPRE_NOD) reference); gpre_nod* adjustment_node = MSC_unary(nod_literal, (gpre_nod*) reference);
gpre_nod* negate_node; gpre_nod* negate_node;
if (negate) if (negate)
@ -1025,7 +1029,7 @@ static GPRE_NOD normalize_index( dim* dimension, GPRE_NOD user_index, USHORT arr
// Parse a boolean AND. // Parse a boolean AND.
// //
static GPRE_NOD par_and( gpre_req* request) static gpre_nod* par_and( gpre_req* request)
{ {
gpre_nod* expr1 = par_not(request); gpre_nod* expr1 = par_not(request);
@ -1043,7 +1047,7 @@ static GPRE_NOD par_and( gpre_req* request)
// in an gpre_rse. // in an gpre_rse.
// //
static GPRE_NOD par_array(gpre_req* request, static gpre_nod* par_array(gpre_req* request,
gpre_fld* field, bool subscript_flag, bool sql_flag) gpre_fld* field, bool subscript_flag, bool sql_flag)
{ {
bool paren = false; bool paren = false;
@ -1138,7 +1142,7 @@ static GPRE_NOD par_array(gpre_req* request,
// an OR node or anything of lower precedence. // an OR node or anything of lower precedence.
// //
static GPRE_NOD par_boolean( gpre_req* request) static gpre_nod* par_boolean( gpre_req* request)
{ {
gpre_nod* expr1 = par_and(request); gpre_nod* expr1 = par_and(request);
@ -1154,7 +1158,7 @@ static GPRE_NOD par_boolean( gpre_req* request)
// Parse a field reference. Anything else is an error. // Parse a field reference. Anything else is an error.
// //
static GPRE_NOD par_field( gpre_req* request) static gpre_nod* par_field( gpre_req* request)
{ {
const gpre_sym* symbol = gpreGlob.token_global.tok_symbol; const gpre_sym* symbol = gpreGlob.token_global.tok_symbol;
if (!symbol) if (!symbol)
@ -1204,7 +1208,7 @@ static GPRE_NOD par_field( gpre_req* request)
reference->ref_context = context; reference->ref_context = context;
if (node->nod_type == nod_array) if (node->nod_type == nod_array)
reference->ref_flags |= REF_array_elem; reference->ref_flags |= REF_array_elem;
node->nod_arg[0] = (GPRE_NOD) reference; node->nod_arg[0] = (gpre_nod*) reference;
} }
else { else {
/* Field wants to straddle two gpreGlob.requests. We need to do /* Field wants to straddle two gpreGlob.requests. We need to do
@ -1220,7 +1224,7 @@ static GPRE_NOD par_field( gpre_req* request)
value_reference->ref_source = reference; value_reference->ref_source = reference;
node->nod_type = nod_value; node->nod_type = nod_value;
node->nod_arg[0] = (GPRE_NOD) value_reference; node->nod_arg[0] = (gpre_nod*) value_reference;
} }
if (upcase_flag) { if (upcase_flag) {
@ -1239,12 +1243,12 @@ static GPRE_NOD par_field( gpre_req* request)
// precedence operator plus/minus. // precedence operator plus/minus.
// //
static GPRE_NOD par_multiply( gpre_req* request, gpre_fld* field) static gpre_nod* par_multiply( gpre_req* request, gpre_fld* field)
{ {
gpre_nod* node = par_primitive_value(request, field); gpre_nod* node = par_primitive_value(request, field);
while (true) { while (true) {
enum nod_t nod_type; nod_t nod_type;
if (MSC_match(KW_ASTERISK)) if (MSC_match(KW_ASTERISK))
nod_type = nod_times; nod_type = nod_times;
else if (MSC_match(KW_SLASH)) else if (MSC_match(KW_SLASH))
@ -1263,7 +1267,7 @@ static GPRE_NOD par_multiply( gpre_req* request, gpre_fld* field)
// Parse a native C value. // Parse a native C value.
// //
static GPRE_NOD par_native_value( gpre_req* request, gpre_fld* field) static gpre_nod* par_native_value( gpre_req* request, gpre_fld* field)
{ {
TEXT s[64]; TEXT s[64];
@ -1277,7 +1281,7 @@ static GPRE_NOD par_native_value( gpre_req* request, gpre_fld* field)
} }
ref* reference = (REF) MSC_alloc(REF_LEN); ref* reference = (REF) MSC_alloc(REF_LEN);
gpre_nod* node = MSC_unary(nod_value, (GPRE_NOD) reference); gpre_nod* node = MSC_unary(nod_value, (gpre_nod*) reference);
// Handle general native value references. Since these values will need // Handle general native value references. Since these values will need
// to be exported to the database system, make sure there is a reference // to be exported to the database system, make sure there is a reference
@ -1303,7 +1307,7 @@ static GPRE_NOD par_native_value( gpre_req* request, gpre_fld* field)
// Parse either a boolean NOT or a boolean parenthetical. // Parse either a boolean NOT or a boolean parenthetical.
// //
static GPRE_NOD par_not( gpre_req* request) static gpre_nod* par_not( gpre_req* request)
{ {
if (MSC_match(KW_LEFT_PAREN)) { if (MSC_match(KW_LEFT_PAREN)) {
gpre_nod* anode = par_boolean(request); gpre_nod* anode = par_boolean(request);
@ -1327,7 +1331,7 @@ static GPRE_NOD par_not( gpre_req* request)
// Parse the substance of an OVER clause (but not the leading keyword). // Parse the substance of an OVER clause (but not the leading keyword).
// //
static GPRE_NOD par_over( gpre_ctx* context) static gpre_nod* par_over( gpre_ctx* context)
{ {
TEXT s[64]; TEXT s[64];
@ -1365,7 +1369,7 @@ static GPRE_NOD par_over( gpre_ctx* context)
// precedence operator plus/minus. // precedence operator plus/minus.
// //
static GPRE_NOD par_primitive_value( gpre_req* request, gpre_fld* field) static gpre_nod* par_primitive_value( gpre_req* request, gpre_fld* field)
{ {
if (MSC_match(KW_MINUS)) if (MSC_match(KW_MINUS))
return MSC_unary(nod_negate, par_primitive_value(request, field)); return MSC_unary(nod_negate, par_primitive_value(request, field));
@ -1417,12 +1421,12 @@ static GPRE_NOD par_primitive_value( gpre_req* request, gpre_fld* field)
// Parse a relational expression. // Parse a relational expression.
// //
static GPRE_NOD par_relational( gpre_req* request) static gpre_nod* par_relational( gpre_req* request)
{ {
if (MSC_match(KW_ANY)) { if (MSC_match(KW_ANY)) {
gpre_nod* expr = MSC_node(nod_any, 1); gpre_nod* expr = MSC_node(nod_any, 1);
expr->nod_count = 0; expr->nod_count = 0;
expr->nod_arg[0] = (GPRE_NOD) EXP_rse(request, 0); expr->nod_arg[0] = (gpre_nod*) EXP_rse(request, 0);
EXP_rse_cleanup((gpre_rse*) expr->nod_arg[0]); EXP_rse_cleanup((gpre_rse*) expr->nod_arg[0]);
return expr; return expr;
} }
@ -1430,7 +1434,7 @@ static GPRE_NOD par_relational( gpre_req* request)
if (MSC_match(KW_UNIQUE)) { if (MSC_match(KW_UNIQUE)) {
gpre_nod* expr = MSC_node(nod_unique, 1); gpre_nod* expr = MSC_node(nod_unique, 1);
expr->nod_count = 0; expr->nod_count = 0;
expr->nod_arg[0] = (GPRE_NOD) EXP_rse(request, 0); expr->nod_arg[0] = (gpre_nod*) EXP_rse(request, 0);
EXP_rse_cleanup((gpre_rse*) expr->nod_arg[0]); EXP_rse_cleanup((gpre_rse*) expr->nod_arg[0]);
return expr; return expr;
} }
@ -1523,7 +1527,7 @@ static GPRE_NOD par_relational( gpre_req* request)
// complain bitterly. // complain bitterly.
// //
static GPRE_NOD par_udf( gpre_req* request, USHORT type, gpre_fld* field) static gpre_nod* par_udf( gpre_req* request, USHORT type, gpre_fld* field)
{ {
if (!request) if (!request)
return NULL; return NULL;
@ -1538,7 +1542,7 @@ static GPRE_NOD par_udf( gpre_req* request, USHORT type, gpre_fld* field)
{ {
gpre_nod* node = MSC_node(nod_udf, 2); gpre_nod* node = MSC_node(nod_udf, 2);
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[1] = (GPRE_NOD) new_udf; node->nod_arg[1] = (gpre_nod*) new_udf;
PAR_get_token(); PAR_get_token();
if (!MSC_match(KW_LEFT_PAREN)) if (!MSC_match(KW_LEFT_PAREN))
EXP_left_paren(0); EXP_left_paren(0);
@ -1563,12 +1567,12 @@ static GPRE_NOD par_udf( gpre_req* request, USHORT type, gpre_fld* field)
// precedence operator plus/minus. // precedence operator plus/minus.
// //
static GPRE_NOD par_value( gpre_req* request, gpre_fld* field) static gpre_nod* par_value( gpre_req* request, gpre_fld* field)
{ {
gpre_nod* node = par_multiply(request, field); gpre_nod* node = par_multiply(request, field);
while (true) { while (true) {
enum nod_t nod_type; nod_t nod_type;
if (MSC_match(KW_PLUS)) if (MSC_match(KW_PLUS))
nod_type = nod_plus; nod_type = nod_plus;
else if (MSC_match(KW_MINUS)) else if (MSC_match(KW_MINUS))

View File

@ -24,19 +24,19 @@
#ifndef GPRE_EXP_PROTO_H #ifndef GPRE_EXP_PROTO_H
#define GPRE_EXP_PROTO_H #define GPRE_EXP_PROTO_H
GPRE_NOD EXP_array(gpre_req*, gpre_fld*, bool, bool); gpre_nod* EXP_array(gpre_req*, gpre_fld*, bool, bool);
gpre_fld* EXP_cast(gpre_fld*); gpre_fld* EXP_cast(gpre_fld*);
gpre_ctx* EXP_context(gpre_req*, gpre_sym*); gpre_ctx* EXP_context(gpre_req*, gpre_sym*);
gpre_fld* EXP_field(gpre_ctx**); gpre_fld* EXP_field(gpre_ctx**);
void EXP_left_paren(const TEXT*); void EXP_left_paren(const TEXT*);
GPRE_NOD EXP_literal(void); gpre_nod* EXP_literal();
void EXP_post_array(REF); void EXP_post_array(REF);
REF EXP_post_field(gpre_fld*, gpre_ctx*, bool); REF EXP_post_field(gpre_fld*, gpre_ctx*, bool);
bool EXP_match_paren(void); bool EXP_match_paren();
gpre_rel* EXP_relation(void); gpre_rel* EXP_relation();
gpre_rse* EXP_rse(gpre_req*, gpre_sym*); gpre_rse* EXP_rse(gpre_req*, gpre_sym*);
void EXP_rse_cleanup(gpre_rse*); void EXP_rse_cleanup(gpre_rse*);
GPRE_NOD EXP_subscript(gpre_req*); gpre_nod* EXP_subscript(gpre_req*);
SLONG EXP_SLONG_ordinal(bool); SLONG EXP_SLONG_ordinal(bool);
SINT64 EXP_SINT64_ordinal(bool); SINT64 EXP_SINT64_ordinal(bool);
SSHORT EXP_SSHORT_ordinal(bool); SSHORT EXP_SSHORT_ordinal(bool);

View File

@ -89,7 +89,7 @@ static void gen_dyn_open (const act*);
static void gen_dyn_prepare (const act*); static void gen_dyn_prepare (const act*);
static void gen_emodify (const act*); static void gen_emodify (const act*);
static void gen_estore (const act*); static void gen_estore (const act*);
static void gen_end_fetch (void); static void gen_end_fetch ();
static void gen_endfor (const act*); static void gen_endfor (const act*);
static void gen_erase (const act*); static void gen_erase (const act*);
static SSHORT gen_event_block (const act*); static SSHORT gen_event_block (const act*);
@ -109,7 +109,7 @@ static void gen_put_segment (const act*);
/* RRK_?: the following prototype is differnet from C stuff */ /* RRK_?: the following prototype is differnet from C stuff */
static void gen_raw(const UCHAR*, enum req_t, int, int, int); static void gen_raw(const UCHAR*, req_t, int, int, int);
static void gen_ready (const act*); static void gen_ready (const act*);
static void gen_receive (const act*, const gpre_port*); static void gen_receive (const act*, const gpre_port*);
@ -143,7 +143,7 @@ static TEXT* make_name (TEXT* const, const gpre_sym*);
static void make_ok_test (const act*, const gpre_req*); static void make_ok_test (const act*, const gpre_req*);
static void make_port (const gpre_port*); static void make_port (const gpre_port*);
static void make_ready (DBB, const TEXT*, const TEXT*, const gpre_req*); static void make_ready (DBB, const TEXT*, const TEXT*, const gpre_req*);
static USHORT next_label (void); static USHORT next_label ();
static void printa(const TEXT*, const TEXT*, ...); static void printa(const TEXT*, const TEXT*, ...);
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED
static void printb(const TEXT*, ...); static void printb(const TEXT*, ...);
@ -579,7 +579,7 @@ void FTN_action(const act* action, int column)
// all databases not declared as extern // all databases not declared as extern
// //
void FTN_fini(void) void FTN_fini()
{ {
if (!gpreGlob.global_db_count) if (!gpreGlob.global_db_count)
return; return;
@ -2050,7 +2050,7 @@ static void gen_estore(const act* action)
// the AT_END clause. // the AT_END clause.
// //
static void gen_end_fetch(void) static void gen_end_fetch()
{ {
printa(COLUMN, "END IF"); printa(COLUMN, "END IF");
} }
@ -2093,16 +2093,16 @@ static void gen_erase(const act* action)
static SSHORT gen_event_block(const act* action) static SSHORT gen_event_block(const act* action)
{ {
GPRE_NOD init = (GPRE_NOD) action->act_object; gpre_nod* init = (gpre_nod*) action->act_object;
int ident = CMP_next_ident(); int ident = CMP_next_ident();
init->nod_arg[2] = (GPRE_NOD) ident; init->nod_arg[2] = (gpre_nod*) ident;
printa(COLUMN, "INTEGER*4 isc_%dA", ident); printa(COLUMN, "INTEGER*4 isc_%dA", ident);
printa(COLUMN, "INTEGER*4 isc_%dB", ident); printa(COLUMN, "INTEGER*4 isc_%dB", ident);
printa(COLUMN, "INTEGER*2 isc_%dL", ident); printa(COLUMN, "INTEGER*2 isc_%dL", ident);
GPRE_NOD list = init->nod_arg[1]; gpre_nod* list = init->nod_arg[1];
return list->nod_count; return list->nod_count;
} }
@ -2127,8 +2127,8 @@ static void gen_event_init(const act* action)
const TEXT* pattern3 = const TEXT* pattern3 =
"CALL %S2 (ISC_EVENTS, %VFISC_%N1L%VE, %VFISC_%N1A%VE, %VFISC_%N1B%VE)"; "CALL %S2 (ISC_EVENTS, %VFISC_%N1L%VE, %VFISC_%N1A%VE, %VFISC_%N1B%VE)";
GPRE_NOD init = (GPRE_NOD) action->act_object; gpre_nod* init = (gpre_nod*) action->act_object;
GPRE_NOD event_list = init->nod_arg[1]; gpre_nod* event_list = init->nod_arg[1];
PAT args; PAT args;
args.pat_database = (DBB) init->nod_arg[3]; args.pat_database = (DBB) init->nod_arg[3];
@ -2144,11 +2144,11 @@ static void gen_event_init(const act* action)
TEXT variable[MAX_REF_SIZE]; TEXT variable[MAX_REF_SIZE];
SSHORT count = 0; SSHORT count = 0;
GPRE_NOD* ptr = event_list->nod_arg; gpre_nod** ptr = event_list->nod_arg;
for (GPRE_NOD* end = ptr + event_list->nod_count; ptr < end; ptr++) for (gpre_nod** const end = ptr + event_list->nod_count; ptr < end; ptr++)
{ {
count++; count++;
GPRE_NOD node = *ptr; gpre_nod* node = *ptr;
if (node->nod_type == nod_field) { if (node->nod_type == nod_field) {
const ref* reference = (const ref*) node->nod_arg[0]; const ref* reference = (const ref*) node->nod_arg[0];
gen_name(variable, reference, true); gen_name(variable, reference, true);
@ -2205,7 +2205,7 @@ static void gen_event_wait(const act* action)
DBB database = NULL; DBB database = NULL;
for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) { for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) {
const act* event_action = (const act*) stack_ptr->lls_object; const act* event_action = (const act*) stack_ptr->lls_object;
GPRE_NOD event_init = (GPRE_NOD) event_action->act_object; gpre_nod* event_init = (gpre_nod*) event_action->act_object;
const gpre_sym* stack_name = (const gpre_sym*) event_init->nod_arg[0]; const gpre_sym* stack_name = (const gpre_sym*) event_init->nod_arg[0];
if (!strcmp(event_name->sym_string, stack_name->sym_string)) { if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
ident = (int) event_init->nod_arg[2]; ident = (int) event_init->nod_arg[2];
@ -2259,7 +2259,7 @@ static void gen_fetch(const act* action)
gen_name(s, request->req_eof, true)); gen_name(s, request->req_eof, true));
printa(COLUMN, "SQLCODE = 0"); printa(COLUMN, "SQLCODE = 0");
GPRE_NOD var_list = (GPRE_NOD) action->act_object; gpre_nod* var_list = (gpre_nod*) action->act_object;
if (var_list) { if (var_list) {
for (int i = 0; i < var_list->nod_count; i++) { for (int i = 0; i < var_list->nod_count; i++) {
asgn_to(action, (const ref*) var_list->nod_arg[i]); asgn_to(action, (const ref*) var_list->nod_arg[i]);
@ -2651,10 +2651,7 @@ static void gen_put_segment(const act* action)
// Generate BLR in raw, numeric form. Ughly but dense. // Generate BLR in raw, numeric form. Ughly but dense.
// //
static void gen_raw( static void gen_raw(const UCHAR* blr, req_t request_type, int request_length, int begin_c, int end_c)
const UCHAR* blr,
enum req_t request_type,
int request_length, int begin_c, int end_c)
{ {
union { union {
UCHAR bytewise_blr[4]; UCHAR bytewise_blr[4];
@ -3181,7 +3178,7 @@ static void gen_select(const act* action)
printa(COLUMN, "IF (SQLCODE .EQ. 0) THEN"); printa(COLUMN, "IF (SQLCODE .EQ. 0) THEN");
gen_receive(action, port); gen_receive(action, port);
printa(COLUMN, "IF (%s .NE. 0) THEN", name); printa(COLUMN, "IF (%s .NE. 0) THEN", name);
GPRE_NOD var_list = (GPRE_NOD) action->act_object; gpre_nod* var_list = (gpre_nod*) action->act_object;
if (var_list) if (var_list)
{ {
for (int i = 0; i < var_list->nod_count; ++i) for (int i = 0; i < var_list->nod_count; ++i)
@ -3944,7 +3941,7 @@ static void make_ready( DBB db, const TEXT* filename, const TEXT* vector,
// label as used. // label as used.
// //
static USHORT next_label(void) static USHORT next_label()
{ {
UCHAR* byte = gpreGlob.fortran_labels; UCHAR* byte = gpreGlob.fortran_labels;
while (*byte == 255) while (*byte == 255)

View File

@ -1077,7 +1077,7 @@ TOK CPR_eol_token()
gpreGlob.token_global.tok_white_space = 0; gpreGlob.token_global.tok_white_space = 0;
gpreGlob.token_global.tok_position = position; gpreGlob.token_global.tok_position = position;
gpreGlob.token_global.tok_symbol = HSH_lookup(gpreGlob.token_global.tok_string); gpreGlob.token_global.tok_symbol = HSH_lookup(gpreGlob.token_global.tok_string);
gpreGlob.token_global.tok_keyword = (KWWORDS) gpreGlob.token_global.tok_symbol->sym_keyword; gpreGlob.token_global.tok_keyword = (kwwords_t) gpreGlob.token_global.tok_symbol->sym_keyword;
if (sw_trace) if (sw_trace)
puts(gpreGlob.token_global.tok_string); puts(gpreGlob.token_global.tok_string);
@ -2006,7 +2006,7 @@ static TOK get_token()
gpreGlob.token_global.tok_white_space = 0; gpreGlob.token_global.tok_white_space = 0;
gpreGlob.token_global.tok_position = start_position + 1; gpreGlob.token_global.tok_position = start_position + 1;
gpreGlob.token_global.tok_symbol = HSH_lookup(gpreGlob.token_global.tok_string); gpreGlob.token_global.tok_symbol = HSH_lookup(gpreGlob.token_global.tok_string);
gpreGlob.token_global.tok_keyword = (KWWORDS) gpreGlob.token_global.tok_symbol->sym_keyword; gpreGlob.token_global.tok_keyword = (kwwords_t) gpreGlob.token_global.tok_symbol->sym_keyword;
return &gpreGlob.token_global; return &gpreGlob.token_global;
} }
} }
@ -2214,7 +2214,7 @@ static TOK get_token()
else else
gpreGlob.token_global.tok_symbol = symbol = NULL; gpreGlob.token_global.tok_symbol = symbol = NULL;
if (symbol && symbol->sym_type == SYM_keyword) if (symbol && symbol->sym_type == SYM_keyword)
gpreGlob.token_global.tok_keyword = (KWWORDS) symbol->sym_keyword; gpreGlob.token_global.tok_keyword = (kwwords_t) symbol->sym_keyword;
else else
gpreGlob.token_global.tok_keyword = KW_none; gpreGlob.token_global.tok_keyword = KW_none;
} }
@ -2222,14 +2222,14 @@ static TOK get_token()
if (!gpreGlob.override_case) { if (!gpreGlob.override_case) {
gpreGlob.token_global.tok_symbol = symbol = HSH_lookup2(gpreGlob.token_global.tok_string); gpreGlob.token_global.tok_symbol = symbol = HSH_lookup2(gpreGlob.token_global.tok_string);
if (symbol && symbol->sym_type == SYM_keyword) if (symbol && symbol->sym_type == SYM_keyword)
gpreGlob.token_global.tok_keyword = (KWWORDS) symbol->sym_keyword; gpreGlob.token_global.tok_keyword = (kwwords_t) symbol->sym_keyword;
else else
gpreGlob.token_global.tok_keyword = KW_none; gpreGlob.token_global.tok_keyword = KW_none;
} }
else { else {
gpreGlob.token_global.tok_symbol = symbol = HSH_lookup(gpreGlob.token_global.tok_string); gpreGlob.token_global.tok_symbol = symbol = HSH_lookup(gpreGlob.token_global.tok_string);
if (symbol && symbol->sym_type == SYM_keyword) if (symbol && symbol->sym_type == SYM_keyword)
gpreGlob.token_global.tok_keyword = (KWWORDS) symbol->sym_keyword; gpreGlob.token_global.tok_keyword = (kwwords_t) symbol->sym_keyword;
else else
gpreGlob.token_global.tok_keyword = KW_none; gpreGlob.token_global.tok_keyword = KW_none;
gpreGlob.override_case = false; gpreGlob.override_case = false;
@ -2238,7 +2238,7 @@ static TOK get_token()
else { else {
gpreGlob.token_global.tok_symbol = symbol = HSH_lookup(gpreGlob.token_global.tok_string); gpreGlob.token_global.tok_symbol = symbol = HSH_lookup(gpreGlob.token_global.tok_string);
if (symbol && symbol->sym_type == SYM_keyword) if (symbol && symbol->sym_type == SYM_keyword)
gpreGlob.token_global.tok_keyword = (KWWORDS) symbol->sym_keyword; gpreGlob.token_global.tok_keyword = (kwwords_t) symbol->sym_keyword;
else else
gpreGlob.token_global.tok_keyword = KW_none; gpreGlob.token_global.tok_keyword = KW_none;
} }
@ -2255,7 +2255,7 @@ static TOK get_token()
{ {
gpreGlob.token_global.tok_symbol = symbol = HSH_lookup2(gpreGlob.token_global.tok_string); gpreGlob.token_global.tok_symbol = symbol = HSH_lookup2(gpreGlob.token_global.tok_string);
if (symbol && symbol->sym_type == SYM_keyword) if (symbol && symbol->sym_type == SYM_keyword)
gpreGlob.token_global.tok_keyword = (KWWORDS) symbol->sym_keyword; gpreGlob.token_global.tok_keyword = (kwwords_t) symbol->sym_keyword;
else else
gpreGlob.token_global.tok_keyword = KW_none; gpreGlob.token_global.tok_keyword = KW_none;
} }

View File

@ -150,7 +150,8 @@ bool isAnsiCobol(cob_t dialect);
/* Structure used by Fortran and Basic to determine whether or not /* Structure used by Fortran and Basic to determine whether or not
an array has been declared in a subroutine. */ an array has been declared in a subroutine. */
struct adl { struct adl
{
ULONG adl_gds_ident; /* Identifier of array for which Gpre has ULONG adl_gds_ident; /* Identifier of array for which Gpre has
generated a declaration in main or a generated a declaration in main or a
subroutine */ subroutine */
@ -162,7 +163,8 @@ const size_t ADL_LEN = sizeof(adl);
/* database block data, for generating block data section in fussy fortran */ /* database block data, for generating block data section in fussy fortran */
struct dbd { struct dbd
{
enum {dbb_size = 128}; enum {dbb_size = 128};
TEXT dbb_name[dbb_size]; /* database name */ TEXT dbb_name[dbb_size]; /* database name */
}; };
@ -175,7 +177,8 @@ struct dbd {
* *
*/ */
struct dim { struct dim
{
int dim_number; /* Dimension number i (i=1 to n) */ int dim_number; /* Dimension number i (i=1 to n) */
SLONG dim_lower; /* Lower bound */ SLONG dim_lower; /* Lower bound */
SLONG dim_upper; /* Upper bound */ SLONG dim_upper; /* Upper bound */
@ -186,14 +189,15 @@ struct dim {
const size_t DIM_LEN = sizeof(dim); const size_t DIM_LEN = sizeof(dim);
typedef struct fil { struct gpre_file
{
SLONG fil_length; /* File length in pages */ SLONG fil_length; /* File length in pages */
SLONG fil_start; /* Starting page */ SLONG fil_start; /* Starting page */
TEXT *fil_name; /* File name */ TEXT *fil_name; /* File name */
fil* fil_next; /* next file */ gpre_file* fil_next; /* next file */
USHORT fil_shadow_number; /* shadow number if part of shadow */ USHORT fil_shadow_number; /* shadow number if part of shadow */
USHORT fil_flags; USHORT fil_flags;
} *FIL; };
enum fil_flags_vals { enum fil_flags_vals {
FIL_manual = 1, // Manual shadow FIL_manual = 1, // Manual shadow
@ -201,25 +205,27 @@ enum fil_flags_vals {
FIL_conditional = 4 // Conditional shadow FIL_conditional = 4 // Conditional shadow
}; };
const size_t FIL_LEN = sizeof(fil); const size_t FIL_LEN = sizeof(gpre_file);
/* filter block */ /* filter block */
typedef struct fltr { struct gpre_filter
{
TEXT *fltr_name; TEXT *fltr_name;
const TEXT *fltr_entry_point; const TEXT *fltr_entry_point;
const TEXT *fltr_module_name; const TEXT *fltr_module_name;
SSHORT fltr_input_type; SSHORT fltr_input_type;
SSHORT fltr_output_type; SSHORT fltr_output_type;
} *FLTR; };
const size_t FLTR_LEN = sizeof(fltr); const size_t FLTR_LEN = sizeof(gpre_filter);
/* General Syntax node, produced by parser */ /* General Syntax node, produced by parser */
typedef enum nod_t { enum nod_t {
nod_nothing = 0,
nod_field = 1, nod_literal, nod_value, nod_field = 1, nod_literal, nod_value,
nod_and, nod_or, nod_not, nod_and, nod_or, nod_not,
nod_eq, nod_equiv, nod_ne, nod_ge, nod_eq, nod_equiv, nod_ne, nod_ge,
@ -256,14 +262,15 @@ typedef enum nod_t {
nod_current_role, nod_current_transaction, nod_current_role, nod_current_transaction,
nod_coalesce, nod_case, nod_case1, nod_coalesce, nod_case, nod_case1,
nod_substring, nod_substring,
nod_LASTNOD /* Leave this debugging GPRE_NOD last */ nod_LASTNOD /* Leave this debugging gpre_nod last */
} NOD_T; };
typedef struct gpre_nod { struct gpre_nod
enum nod_t nod_type; /* node type */ {
nod_t nod_type; /* node type */
USHORT nod_count; /* number of sub-items */ USHORT nod_count; /* number of sub-items */
gpre_nod* nod_arg[1]; /* argument */ gpre_nod* nod_arg[1]; /* argument */
} *GPRE_NOD; };
inline size_t NOD_LEN(const size_t cnt) inline size_t NOD_LEN(const size_t cnt)
{ {
@ -321,7 +328,8 @@ enum swe_condition_vals {
/* Text block */ /* Text block */
struct gpre_txt { struct gpre_txt
{
ULONG txt_position; ULONG txt_position;
USHORT txt_length; USHORT txt_length;
}; };
@ -331,7 +339,8 @@ const size_t TXT_LEN = sizeof(gpre_txt);
/* User name -- used for SQL GRANT/REVOKE */ /* User name -- used for SQL GRANT/REVOKE */
struct gpre_usn { struct gpre_usn
{
gpre_usn* usn_next; gpre_usn* usn_next;
SCHAR *usn_name; SCHAR *usn_name;
USHORT usn_dyn; /* describes the type of user via a dyn-verb, USHORT usn_dyn; /* describes the type of user via a dyn-verb,
@ -343,26 +352,29 @@ const size_t USN_LEN = sizeof(gpre_usn);
/* value block, used to store a set of values */ /* value block, used to store a set of values */
typedef struct val { struct gpre_value
val* val_next; /* next value in list */ {
gpre_value* val_next; /* next value in list */
const TEXT* val_value; /* value */ const TEXT* val_value; /* value */
} *VAL; };
const size_t VAL_LEN = sizeof(val); const size_t VAL_LEN = sizeof(gpre_value);
/* Array information block. Used to hold info about an array field. /* Array information block. Used to hold info about an array field.
Note: the dimension (dim) block used to hold dimension information. Note: the dimension (dim) block used to hold dimension information.
The preferred mechanism is the repeating tail on the array block. */ The preferred mechanism is the repeating tail on the array block. */
struct ary { struct ary
{
USHORT ary_dtype; /* data type of array */ USHORT ary_dtype; /* data type of array */
int ary_dimension_count; /* Number of dimensions in this array */ int ary_dimension_count; /* Number of dimensions in this array */
dim* ary_dimension; /* Linked list of range info for each dimension */ dim* ary_dimension; /* Linked list of range info for each dimension */
SLONG ary_size; /* Size of the array */ SLONG ary_size; /* Size of the array */
ULONG ary_ident; /* Array identifier */ ULONG ary_ident; /* Array identifier */
bool ary_declared; /* True if a declaration already was generated */ bool ary_declared; /* True if a declaration already was generated */
struct ary_repeat { struct ary_repeat
{
SLONG ary_lower; SLONG ary_lower;
SLONG ary_upper; SLONG ary_upper;
} ary_rpt[MAX_ARRAY_DIMENSIONS]; } ary_rpt[MAX_ARRAY_DIMENSIONS];
@ -378,7 +390,8 @@ const size_t ARY_LEN = sizeof(ary);
use is to create a trigger for CHECK constraints which always use is to create a trigger for CHECK constraints which always
abort on error */ abort on error */
struct gpre_trg { struct gpre_trg
{
str* trg_name; str* trg_name;
USHORT trg_type; /* Type of trigger */ USHORT trg_type; /* Type of trigger */
str* trg_source; /* source for trigger */ str* trg_source; /* source for trigger */
@ -526,7 +539,7 @@ struct gpre_rel;
class gpre_req; class gpre_req;
class ref; class ref;
typedef enum act_t { enum act_t {
ACT_any, ACT_any,
ACT_alter_database, ACT_alter_database,
ACT_alter_domain, ACT_alter_domain,
@ -636,14 +649,14 @@ typedef enum act_t {
ACT_sql_dialect, ACT_sql_dialect,
ACT_LASTACT /* leave this debugging ACT last */ ACT_LASTACT /* leave this debugging ACT last */
} ACT_T; };
/* Action block, used to make action points in source */ /* Action block, used to make action points in source */
struct act { struct act {
SLONG act_position; /* position in input stream */ SLONG act_position; /* position in input stream */
SLONG act_length; /* length to be commented out */ SLONG act_length; /* length to be commented out */
enum act_t act_type; /* type of action */ act_t act_type; /* type of action */
act* act_next; /* next action in request */ act* act_next; /* next action in request */
act* act_rest; /* remaining actions in module */ act* act_rest; /* remaining actions in module */
act* act_error; /* on-error action (maybe) */ act* act_error; /* on-error action (maybe) */
@ -698,7 +711,7 @@ enum sym_t {
struct gpre_sym { struct gpre_sym {
const char* sym_string; /* address of asciz string */ const char* sym_string; /* address of asciz string */
enum sym_t sym_type; /* symbol type */ sym_t sym_type; /* symbol type */
USHORT sym_keyword; /* keyword number, if keyword */ USHORT sym_keyword; /* keyword number, if keyword */
gpre_ctx* sym_object; /* general pointer to object */ gpre_ctx* sym_object; /* general pointer to object */
gpre_sym* sym_collision; /* collision pointer */ gpre_sym* sym_collision; /* collision pointer */
@ -818,12 +831,12 @@ typedef struct dbb {
int dbb_buffersize; int dbb_buffersize;
int dbb_users; int dbb_users;
ULONG dbb_length; /* Length of database in pages, if known */ ULONG dbb_length; /* Length of database in pages, if known */
fil* dbb_logfiles; gpre_file* dbb_logfiles;
#ifdef SCROLLABLE_CURSORS #ifdef SCROLLABLE_CURSORS
SSHORT dbb_base_level; /* code level of the engine we are talking to */ SSHORT dbb_base_level; /* code level of the engine we are talking to */
#endif #endif
fil* dbb_cache_file; gpre_file* dbb_cache_file;
fil* dbb_files; gpre_file* dbb_files;
} *DBB; } *DBB;
const size_t DBB_LEN = sizeof(dbb); const size_t DBB_LEN = sizeof(dbb);
@ -919,7 +932,7 @@ struct gpre_rse {
gpre_nod* rse_plan; /* user-specified access plan */ gpre_nod* rse_plan; /* user-specified access plan */
map* rse_map; /* map for aggregates */ map* rse_map; /* map for aggregates */
gpre_rse* rse_aggregate; /* Aggregate rse */ gpre_rse* rse_aggregate; /* Aggregate rse */
enum nod_t rse_join_type; /* Join type */ nod_t rse_join_type; /* Join type */
USHORT rse_flags; /* flags */ USHORT rse_flags; /* flags */
USHORT rse_count; /* number of relations */ USHORT rse_count; /* number of relations */
gpre_ctx* rse_context[1]; /* context block */ gpre_ctx* rse_context[1]; /* context block */
@ -1065,18 +1078,19 @@ enum fld_flags_vals {
}; };
typedef enum { enum fun_t {
FUN_value, FUN_value,
FUN_reference, FUN_reference,
FUN_descriptor, FUN_descriptor,
FUN_blob_struct, FUN_blob_struct,
FUN_scalar_array FUN_scalar_array
} FUN_T; };
/* Port block */ /* Port block */
struct gpre_port { struct gpre_port
{
USHORT por_msg_number; /* message number within request */ USHORT por_msg_number; /* message number within request */
ULONG por_ident; /* ident in source */ ULONG por_ident; /* ident in source */
int por_length; /* length of port in bytes */ int por_length; /* length of port in bytes */
@ -1090,14 +1104,16 @@ const size_t POR_LEN = sizeof(gpre_port);
/* Slice description block */ /* Slice description block */
struct slc { struct slc
{
gpre_req* slc_parent_request; /* request for blob id */ gpre_req* slc_parent_request; /* request for blob id */
gpre_fld* slc_field; /* database array field */ gpre_fld* slc_field; /* database array field */
gpre_nod* slc_array; /* user defined array */ gpre_nod* slc_array; /* user defined array */
ref* slc_field_ref; /* array field reference */ ref* slc_field_ref; /* array field reference */
USHORT slc_dimensions; /* dimensions */ USHORT slc_dimensions; /* dimensions */
USHORT slc_parameters; /* number of parameters */ USHORT slc_parameters; /* number of parameters */
struct slc_repeat { struct slc_repeat
{
gpre_nod* slc_lower; gpre_nod* slc_lower;
gpre_nod* slc_upper; gpre_nod* slc_upper;
} slc_rpt[1]; } slc_rpt[1];
@ -1131,10 +1147,11 @@ enum req_t {
REQ_LASTREQUEST /* Leave this debugging gpre_req last */ REQ_LASTREQUEST /* Leave this debugging gpre_req last */
}; };
class gpre_req { class gpre_req
{
public: public:
enum req_t req_type; /* request type */ req_t req_type; /* request type */
ULONG req_ident; /* ident for request handle */ ULONG req_ident; /* ident for request handle */
USHORT req_act_flag; /* activity flag ident, if used */ USHORT req_act_flag; /* activity flag ident, if used */
int req_length; /* blr length of request */ int req_length; /* blr length of request */
@ -1184,21 +1201,26 @@ class gpre_req {
USHORT req_in_subselect; /* processing a subselect clause */ USHORT req_in_subselect; /* processing a subselect clause */
ULONG req_flags; ULONG req_flags;
inline void add_end() { inline void add_end()
{
*req_blr++ = isc_dyn_end; *req_blr++ = isc_dyn_end;
} }
inline void add_byte(const int byte) { inline void add_byte(const int byte)
{
*req_blr++ = (SCHAR) (byte); *req_blr++ = (SCHAR) (byte);
} }
inline void add_word(const int word) { inline void add_word(const int word)
{
add_byte(word); add_byte(word);
add_byte(word >> 8); add_byte(word >> 8);
} }
inline void add_long(const long lg) { inline void add_long(const long lg)
{
add_word(lg); add_word(lg);
add_word(lg >> 16); add_word(lg >> 16);
} }
inline void add_cstring(const char* string) { inline void add_cstring(const char* string)
{
add_byte(strlen(string)); add_byte(strlen(string));
UCHAR c; UCHAR c;
while (c = *string++) { while (c = *string++) {
@ -1264,7 +1286,7 @@ class ref {
ref* ref_friend; /* value for variable */ ref* ref_friend; /* value for variable */
gpre_nod* ref_expr; /* expression, if node is expression */ gpre_nod* ref_expr; /* expression, if node is expression */
const TEXT* ref_value; /* value string if host language value */ const TEXT* ref_value; /* value string if host language value */
val* ref_values; /* linked list of values */ gpre_value* ref_values; /* linked list of values */
const TEXT* ref_null_value; /* value string if host language value */ const TEXT* ref_null_value; /* value string if host language value */
UCHAR* ref_sdl; /* Raw slice description language for an array */ UCHAR* ref_sdl; /* Raw slice description language for an array */
UCHAR* ref_sdl_base; /* base of sdl string during generation */ UCHAR* ref_sdl_base; /* base of sdl string during generation */
@ -1275,14 +1297,17 @@ class ref {
USHORT ref_flags; USHORT ref_flags;
SSHORT ref_ttype; /* Character set type for literals */ SSHORT ref_ttype; /* Character set type for literals */
inline void add_byte(const int byte) { inline void add_byte(const int byte)
{
*ref_sdl++ = (UCHAR) byte; *ref_sdl++ = (UCHAR) byte;
} }
inline void add_word(const int word) { inline void add_word(const int word)
{
add_byte(word); add_byte(word);
add_byte(word >> 8); add_byte(word >> 8);
} }
inline void add_long(const long lg) { inline void add_long(const long lg)
{
add_word(lg); add_word(lg);
add_word(lg >> 16); add_word(lg >> 16);
} }

View File

@ -682,7 +682,7 @@ gpre_lls* MET_get_primary_key(dbb* database, const TEXT* relation_name)
*tmp++; *tmp++;
*tmp = '\0'; *tmp = '\0';
MSC_push((GPRE_NOD) field_name, ptr_fields); MSC_push((gpre_nod*) field_name, ptr_fields);
ptr_fields = &(*ptr_fields)->lls_next; ptr_fields = &(*ptr_fields)->lls_next;
END_FOR END_FOR
@ -848,21 +848,21 @@ gpre_fld* MET_field(gpre_rel* relation, const char* string)
* Return a list of the fields in a relation * Return a list of the fields in a relation
*/ */
GPRE_NOD MET_fields(gpre_ctx* context) gpre_nod* MET_fields(gpre_ctx* context)
{ {
gpre_fld* field; gpre_fld* field;
GPRE_NOD field_node; gpre_nod* field_node;
REF reference; REF reference;
gpre_prc* procedure = context->ctx_procedure; gpre_prc* procedure = context->ctx_procedure;
if (procedure) { if (procedure) {
GPRE_NOD node = MSC_node(nod_list, procedure->prc_out_count); gpre_nod* node = MSC_node(nod_list, procedure->prc_out_count);
//count = 0; //count = 0;
for (field = procedure->prc_outputs; field; field = field->fld_next) { for (field = procedure->prc_outputs; field; field = field->fld_next) {
reference = (REF) MSC_alloc(REF_LEN); reference = (REF) MSC_alloc(REF_LEN);
reference->ref_field = field; reference->ref_field = field;
reference->ref_context = context; reference->ref_context = context;
field_node = MSC_unary(nod_field, (GPRE_NOD) reference); field_node = MSC_unary(nod_field, (gpre_nod*) reference);
node->nod_arg[field->fld_position] = field_node; node->nod_arg[field->fld_position] = field_node;
//count++; //count++;
} }
@ -875,13 +875,13 @@ GPRE_NOD MET_fields(gpre_ctx* context)
for (field = relation->rel_fields; field; field = field->fld_next) { for (field = relation->rel_fields; field; field = field->fld_next) {
++count; ++count;
} }
GPRE_NOD anode = MSC_node(nod_list, count); gpre_nod* anode = MSC_node(nod_list, count);
//count = 0; //count = 0;
for (field = relation->rel_fields; field; field = field->fld_next) { for (field = relation->rel_fields; field; field = field->fld_next) {
reference = (REF) MSC_alloc(REF_LEN); reference = (REF) MSC_alloc(REF_LEN);
reference->ref_field = field; reference->ref_field = field;
reference->ref_context = context; reference->ref_context = context;
field_node = MSC_unary(nod_field, (GPRE_NOD) reference); field_node = MSC_unary(nod_field, (gpre_nod*) reference);
anode->nod_arg[field->fld_position] = field_node; anode->nod_arg[field->fld_position] = field_node;
//count++; //count++;
} }
@ -907,18 +907,18 @@ GPRE_NOD MET_fields(gpre_ctx* context)
// This code stops at the first blank. // This code stops at the first blank.
for (p = RFR.RDB$FIELD_NAME; *p && *p != ' '; p++); for (p = RFR.RDB$FIELD_NAME; *p && *p != ' '; p++);
*p = 0; *p = 0;
MSC_push((GPRE_NOD) MET_field(relation, RFR.RDB$FIELD_NAME), &stack); MSC_push((gpre_nod*) MET_field(relation, RFR.RDB$FIELD_NAME), &stack);
count++; count++;
END_FOR; END_FOR;
GPRE_NOD node = MSC_node(nod_list, count); gpre_nod* node = MSC_node(nod_list, count);
while (stack) { while (stack) {
field = (gpre_fld*) MSC_pop(&stack); field = (gpre_fld*) MSC_pop(&stack);
reference = (REF) MSC_alloc(REF_LEN); reference = (REF) MSC_alloc(REF_LEN);
reference->ref_field = field; reference->ref_field = field;
reference->ref_context = context; reference->ref_context = context;
field_node = MSC_unary(nod_field, (GPRE_NOD) reference); field_node = MSC_unary(nod_field, (gpre_nod*) reference);
node->nod_arg[--count] = field_node; node->nod_arg[--count] = field_node;
} }

View File

@ -28,7 +28,7 @@ gpre_fld* MET_context_field(gpre_ctx*, const char*);
bool MET_database(DBB, bool); bool MET_database(DBB, bool);
bool MET_domain_lookup(gpre_req*, gpre_fld*, const char*); bool MET_domain_lookup(gpre_req*, gpre_fld*, const char*);
gpre_fld* MET_field(gpre_rel*, const char*); gpre_fld* MET_field(gpre_rel*, const char*);
GPRE_NOD MET_fields(gpre_ctx*); gpre_nod* MET_fields(gpre_ctx*);
void MET_fini(DBB); void MET_fini(DBB);
const SCHAR* MET_generator(const TEXT*, DBB); const SCHAR* MET_generator(const TEXT*, DBB);
bool MET_get_column_default(const gpre_rel*, const TEXT*, TEXT*, USHORT); bool MET_get_column_default(const gpre_rel*, const TEXT*, TEXT*, USHORT);

View File

@ -273,10 +273,11 @@ gpre_fld* MET_field(gpre_rel* relation, const char* string)
* Return a list of the fields in a relation * Return a list of the fields in a relation
*/ */
GPRE_NOD MET_fields(gpre_ctx* context) gpre_nod* MET_fields(gpre_ctx* context)
{ {
gpre_fld* field; gpre_fld* field;
GPRE_NOD node, field_node; gpre_nod* node;
gpre_nod* field_node;
REF reference; REF reference;
gpre_prc* procedure = context->ctx_procedure; gpre_prc* procedure = context->ctx_procedure;
@ -287,7 +288,7 @@ GPRE_NOD MET_fields(gpre_ctx* context)
reference = (REF) MSC_alloc(REF_LEN); reference = (REF) MSC_alloc(REF_LEN);
reference->ref_field = field; reference->ref_field = field;
reference->ref_context = context; reference->ref_context = context;
field_node = MSC_unary(nod_field, (GPRE_NOD)reference); field_node = MSC_unary(nod_field, (gpre_nod*) reference);
node->nod_arg[field->fld_position] = field_node; node->nod_arg[field->fld_position] = field_node;
//count++; //count++;
} }
@ -306,7 +307,7 @@ GPRE_NOD MET_fields(gpre_ctx* context)
reference = (REF) MSC_alloc(REF_LEN); reference = (REF) MSC_alloc(REF_LEN);
reference->ref_field = field; reference->ref_field = field;
reference->ref_context = context; reference->ref_context = context;
field_node = MSC_unary(nod_field, (GPRE_NOD)reference); field_node = MSC_unary(nod_field, (gpre_nod*) reference);
node->nod_arg[field->fld_position] = field_node; node->nod_arg[field->fld_position] = field_node;
//count++; //count++;
} }

View File

@ -26,7 +26,7 @@
#include "../gpre/parse.h" #include "../gpre/parse.h"
void CPR_abort(void); void CPR_abort();
#ifdef DEV_BUILD #ifdef DEV_BUILD
void CPR_assert(const TEXT*, int); void CPR_assert(const TEXT*, int);
#endif #endif
@ -35,12 +35,12 @@ void CPR_end_text(gpre_txt*);
int CPR_error(const TEXT*); int CPR_error(const TEXT*);
void CPR_exit(int); void CPR_exit(int);
void CPR_warn(const TEXT*); void CPR_warn(const TEXT*);
TOK CPR_eol_token(void); TOK CPR_eol_token();
void CPR_get_text(TEXT*, const gpre_txt*); void CPR_get_text(TEXT*, const gpre_txt*);
void CPR_raw_read(void); void CPR_raw_read();
void CPR_s_error(const TEXT*); void CPR_s_error(const TEXT*);
gpre_txt* CPR_start_text(void); gpre_txt* CPR_start_text();
TOK CPR_token(void); TOK CPR_token();
#endif // GPRE_GPRE_PROTO_H #endif // GPRE_GPRE_PROTO_H

View File

@ -43,10 +43,12 @@ const int HASH_SIZE = 211;
static gpre_sym* hash_table[HASH_SIZE]; static gpre_sym* hash_table[HASH_SIZE];
static gpre_sym* key_symbols; static gpre_sym* key_symbols;
static struct word { static struct word
{
const char* keyword; const char* keyword;
enum kwwords id; kwwords_t id;
} keywords[] = { } keywords[] =
{
#include "../gpre/hsh.h" #include "../gpre/hsh.h"
}; };
@ -56,7 +58,7 @@ static struct word {
// Release space used by keywords. // Release space used by keywords.
// //
void HSH_fini(void) void HSH_fini()
{ {
while (key_symbols) { while (key_symbols) {
gpre_sym* symbol = key_symbols; gpre_sym* symbol = key_symbols;
@ -73,7 +75,7 @@ void HSH_fini(void)
// inserting all known keywords. // inserting all known keywords.
// //
void HSH_init(void) void HSH_init()
{ {
//const char *string; //const char *string;

View File

@ -24,8 +24,8 @@
#ifndef GPRE_HSH_PROTO_H #ifndef GPRE_HSH_PROTO_H
#define GPRE_HSH_PROTO_H #define GPRE_HSH_PROTO_H
void HSH_fini(void); void HSH_fini();
void HSH_init(void); void HSH_init();
void HSH_insert(gpre_sym*); void HSH_insert(gpre_sym*);
gpre_sym* HSH_lookup(const SCHAR*); gpre_sym* HSH_lookup(const SCHAR*);
gpre_sym* HSH_lookup2(const SCHAR*); gpre_sym* HSH_lookup2(const SCHAR*);

View File

@ -34,7 +34,7 @@ void COB_action(const act*, int);
void COB_name_init(bool); void COB_name_init(bool);
void COB_print_buffer(TEXT*, bool); void COB_print_buffer(TEXT*, bool);
void FTN_action(const act*, int); void FTN_action(const act*, int);
void FTN_fini(void); void FTN_fini();
void FTN_print_buffer(TEXT*); void FTN_print_buffer(TEXT*);
void INT_action(const act*, int); void INT_action(const act*, int);
void INT_CXX_action(const act*, int); void INT_CXX_action(const act*, int);

View File

@ -54,12 +54,14 @@
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
typedef struct spc { struct gpre_space
spc* spc_next; {
gpre_space* spc_next;
SLONG spc_remaining; SLONG spc_remaining;
} *SPC; };
static SPC space, permanent_space; static gpre_space* space;
static gpre_space* permanent_space;
static gpre_lls* free_lls; static gpre_lls* free_lls;
@ -68,7 +70,7 @@ static gpre_lls* free_lls;
// Make an action and link it to a request. // Make an action and link it to a request.
// //
act* MSC_action( gpre_req* request, enum act_t type) act* MSC_action( gpre_req* request, act_t type)
{ {
act* action = (act*) MSC_alloc(ACT_LEN); act* action = (act*) MSC_alloc(ACT_LEN);
action->act_type = type; action->act_type = type;
@ -93,7 +95,7 @@ UCHAR* MSC_alloc(int size)
if (!space || size > space->spc_remaining) { if (!space || size > space->spc_remaining) {
const int n = MAX(size, 4096); const int n = MAX(size, 4096);
SPC next = (SPC) gds__alloc((SLONG) (n + sizeof(spc))); gpre_space* next = (gpre_space*) gds__alloc((SLONG) (n + sizeof(gpre_space)));
if (!next) if (!next)
CPR_error("virtual memory exhausted"); CPR_error("virtual memory exhausted");
#ifdef DEBUG_GDS_ALLOC #ifdef DEBUG_GDS_ALLOC
@ -106,7 +108,7 @@ UCHAR* MSC_alloc(int size)
} }
space->spc_remaining -= size; space->spc_remaining -= size;
UCHAR* blk = ((UCHAR*) space + sizeof(spc) + space->spc_remaining); UCHAR* blk = ((UCHAR*) space + sizeof(gpre_space) + space->spc_remaining);
memset(blk, 0, size); memset(blk, 0, size);
return blk; return blk;
@ -124,7 +126,7 @@ UCHAR* MSC_alloc_permanent(int size)
if (!permanent_space || size > permanent_space->spc_remaining) { if (!permanent_space || size > permanent_space->spc_remaining) {
const int n = MAX(size, 4096); const int n = MAX(size, 4096);
SPC next = (SPC) gds__alloc((SLONG) (n + sizeof(spc))); gpre_space* next = (gpre_space*) gds__alloc((SLONG) (n + sizeof(gpre_space)));
if (!next) if (!next)
CPR_error("virtual memory exhausted"); CPR_error("virtual memory exhausted");
#ifdef DEBUG_GDS_ALLOC #ifdef DEBUG_GDS_ALLOC
@ -137,7 +139,7 @@ UCHAR* MSC_alloc_permanent(int size)
} }
permanent_space->spc_remaining -= size; permanent_space->spc_remaining -= size;
UCHAR* blk = ((UCHAR*) permanent_space + sizeof(spc) + UCHAR* blk = ((UCHAR*) permanent_space + sizeof(gpre_space) +
permanent_space->spc_remaining); permanent_space->spc_remaining);
memset(blk, 0, size); memset(blk, 0, size);
@ -150,9 +152,9 @@ UCHAR* MSC_alloc_permanent(int size)
// Make a binary node. // Make a binary node.
// //
GPRE_NOD MSC_binary(NOD_T type, GPRE_NOD arg1, GPRE_NOD arg2) gpre_nod* MSC_binary(nod_t type, gpre_nod* arg1, gpre_nod* arg2)
{ {
GPRE_NOD node = MSC_node(type, 2); gpre_nod* node = MSC_node(type, 2);
node->nod_arg[0] = arg1; node->nod_arg[0] = arg1;
node->nod_arg[1] = arg2; node->nod_arg[1] = arg2;
@ -219,7 +221,7 @@ void MSC_copy_cat(const char* from1, int length1, const char* from2, int length2
// Find a symbol of a particular type. // Find a symbol of a particular type.
// //
gpre_sym* MSC_find_symbol(gpre_sym* symbol, enum sym_t type) gpre_sym* MSC_find_symbol(gpre_sym* symbol, sym_t type)
{ {
for (; symbol; symbol = symbol->sym_homonym) for (; symbol; symbol = symbol->sym_homonym)
@ -261,11 +263,11 @@ void MSC_free_request( gpre_req* request)
// allocator. // allocator.
// //
void MSC_init(void) void MSC_init()
{ {
free_lls = NULL; free_lls = NULL;
SPC stuff; gpre_space* stuff;
while (stuff = space) { while (stuff = space) {
space = space->spc_next; space = space->spc_next;
gds__free(stuff); gds__free(stuff);
@ -280,7 +282,7 @@ void MSC_init(void)
// false. // false.
// //
bool MSC_match(KWWORDS keyword) bool MSC_match(kwwords_t keyword)
{ {
if (gpreGlob.token_global.tok_keyword == KW_none && gpreGlob.token_global.tok_symbol) { if (gpreGlob.token_global.tok_keyword == KW_none && gpreGlob.token_global.tok_symbol) {
@ -288,11 +290,11 @@ bool MSC_match(KWWORDS keyword)
for (symbol = gpreGlob.token_global.tok_symbol->sym_collision; symbol; for (symbol = gpreGlob.token_global.tok_symbol->sym_collision; symbol;
symbol = symbol->sym_collision) symbol = symbol->sym_collision)
{ {
if ((strcmp(symbol->sym_string, gpreGlob.token_global.tok_string) == if ((strcmp(symbol->sym_string, gpreGlob.token_global.tok_string) == 0) &&
0) && symbol->sym_keyword != KW_none) symbol->sym_keyword != KW_none)
{ {
gpreGlob.token_global.tok_symbol = symbol; gpreGlob.token_global.tok_symbol = symbol;
gpreGlob.token_global.tok_keyword = static_cast < kwwords > (symbol->sym_keyword); gpreGlob.token_global.tok_keyword = static_cast<kwwords_t>(symbol->sym_keyword);
} }
} }
} }
@ -312,7 +314,7 @@ bool MSC_match(KWWORDS keyword)
// represented on a linked list stack. // represented on a linked list stack.
// //
bool MSC_member(GPRE_NOD object, gpre_lls* stack) bool MSC_member(gpre_nod* object, gpre_lls* stack)
{ {
for (; stack; stack = stack->lls_next) for (; stack; stack = stack->lls_next)
@ -328,9 +330,9 @@ bool MSC_member(GPRE_NOD object, gpre_lls* stack)
// Allocate an initialize a syntax node. // Allocate an initialize a syntax node.
// //
GPRE_NOD MSC_node(enum nod_t type, SSHORT count) gpre_nod* MSC_node(nod_t type, SSHORT count)
{ {
GPRE_NOD node = (GPRE_NOD) MSC_alloc(NOD_LEN(count)); gpre_nod* node = (gpre_nod*) MSC_alloc(NOD_LEN(count));
node->nod_count = count; node->nod_count = count;
node->nod_type = type; node->nod_type = type;
@ -343,10 +345,10 @@ GPRE_NOD MSC_node(enum nod_t type, SSHORT count)
// Pop an item off a linked list stack. Free the stack node. // Pop an item off a linked list stack. Free the stack node.
// //
GPRE_NOD MSC_pop(gpre_lls** pointer) gpre_nod* MSC_pop(gpre_lls** pointer)
{ {
gpre_lls* stack = *pointer; gpre_lls* stack = *pointer;
GPRE_NOD node = stack->lls_object; gpre_nod* node = stack->lls_object;
*pointer = stack->lls_next; *pointer = stack->lls_next;
stack->lls_next = free_lls; stack->lls_next = free_lls;
@ -361,7 +363,7 @@ GPRE_NOD MSC_pop(gpre_lls** pointer)
// Allocate a new privilege (grant/revoke) block. // Allocate a new privilege (grant/revoke) block.
// //
PRV MSC_privilege_block(void) PRV MSC_privilege_block()
{ {
PRV privilege_block = (PRV) MSC_alloc(PRV_LEN); PRV privilege_block = (PRV) MSC_alloc(PRV_LEN);
privilege_block->prv_privileges = PRV_no_privs; privilege_block->prv_privileges = PRV_no_privs;
@ -379,7 +381,7 @@ PRV MSC_privilege_block(void)
// Push an arbitrary object onto a linked list stack. // Push an arbitrary object onto a linked list stack.
// //
void MSC_push( GPRE_NOD object, gpre_lls** pointer) void MSC_push( gpre_nod* object, gpre_lls** pointer)
{ {
gpre_lls* stack = free_lls; gpre_lls* stack = free_lls;
if (stack) if (stack)
@ -418,7 +420,7 @@ REF MSC_reference(REF* link)
// blocks, all linked up and ready to go. // blocks, all linked up and ready to go.
// //
gpre_req* MSC_request(enum req_t type) gpre_req* MSC_request(req_t type)
{ {
gpre_req* request = (gpre_req*) MSC_alloc(REQ_LEN); gpre_req* request = (gpre_req*) MSC_alloc(REQ_LEN);
request->req_type = type; request->req_type = type;
@ -456,7 +458,7 @@ SCHAR* MSC_string(const TEXT* input)
// Allocate and initialize a symbol block. // Allocate and initialize a symbol block.
// //
gpre_sym* MSC_symbol(enum sym_t type, const TEXT* string, USHORT length, gpre_ctx* object) gpre_sym* MSC_symbol(sym_t type, const TEXT* string, USHORT length, gpre_ctx* object)
{ {
gpre_sym* symbol = (gpre_sym*) MSC_alloc(SYM_LEN + length); gpre_sym* symbol = (gpre_sym*) MSC_alloc(SYM_LEN + length);
symbol->sym_type = type; symbol->sym_type = type;
@ -476,9 +478,9 @@ gpre_sym* MSC_symbol(enum sym_t type, const TEXT* string, USHORT length, gpre_ct
// Make a unary node. // Make a unary node.
// //
GPRE_NOD MSC_unary(NOD_T type, GPRE_NOD arg) gpre_nod* MSC_unary(nod_t type, gpre_nod* arg)
{ {
GPRE_NOD node = MSC_node(type, 1); gpre_nod* node = MSC_node(type, 1);
node->nod_arg[0] = arg; node->nod_arg[0] = arg;
return node; return node;

View File

@ -26,27 +26,27 @@
#include "../gpre/parse.h" #include "../gpre/parse.h"
act* MSC_action(gpre_req*, enum act_t); act* MSC_action(gpre_req*, act_t);
UCHAR* MSC_alloc(int); UCHAR* MSC_alloc(int);
UCHAR* MSC_alloc_permanent(int); UCHAR* MSC_alloc_permanent(int);
GPRE_NOD MSC_binary(NOD_T, GPRE_NOD, GPRE_NOD); gpre_nod* MSC_binary(nod_t, gpre_nod*, gpre_nod*);
gpre_ctx* MSC_context(gpre_req*); gpre_ctx* MSC_context(gpre_req*);
void MSC_copy(const char*, int, char*); void MSC_copy(const char*, int, char*);
void MSC_copy_cat(const char*, int, const char*, int, char*); void MSC_copy_cat(const char*, int, const char*, int, char*);
gpre_sym* MSC_find_symbol(gpre_sym*, enum sym_t); gpre_sym* MSC_find_symbol(gpre_sym*, sym_t);
void MSC_free(void*); void MSC_free(void*);
void MSC_free_request(gpre_req*); void MSC_free_request(gpre_req*);
void MSC_init(void); void MSC_init();
bool MSC_match(KWWORDS); bool MSC_match(kwwords_t);
GPRE_NOD MSC_node(enum nod_t, SSHORT); gpre_nod* MSC_node(nod_t, SSHORT);
GPRE_NOD MSC_pop(gpre_lls**); gpre_nod* MSC_pop(gpre_lls**);
PRV MSC_privilege_block(void); PRV MSC_privilege_block();
void MSC_push(GPRE_NOD, gpre_lls**); void MSC_push(gpre_nod*, gpre_lls**);
REF MSC_reference(REF*); REF MSC_reference(REF*);
gpre_req* MSC_request(enum req_t); gpre_req* MSC_request(req_t);
SCHAR* MSC_string(const TEXT*); SCHAR* MSC_string(const TEXT*);
gpre_sym* MSC_symbol(enum sym_t, const TEXT*, USHORT, gpre_ctx*); gpre_sym* MSC_symbol(sym_t, const TEXT*, USHORT, gpre_ctx*);
GPRE_NOD MSC_unary(NOD_T, GPRE_NOD); gpre_nod* MSC_unary(nod_t, gpre_nod*);
gpre_usn* MSC_username(SCHAR*, USHORT); gpre_usn* MSC_username(SCHAR*, USHORT);
#endif // GPRE_MSC_PROTO_H #endif // GPRE_MSC_PROTO_H

View File

@ -69,7 +69,7 @@ static act* par_at();
static act* par_based(); static act* par_based();
static act* par_begin(); static act* par_begin();
static blb* par_blob(); static blb* par_blob();
static act* par_blob_action(ACT_T); static act* par_blob_action(act_t);
static act* par_blob_field(); static act* par_blob_field();
static act* par_case(); static act* par_case();
static act* par_clear_handles(); static act* par_clear_handles();
@ -90,19 +90,19 @@ static act* par_left_brace();
static act* par_modify(); static act* par_modify();
static act* par_on(); static act* par_on();
static act* par_on_error(); static act* par_on_error();
static act* par_open_blob(ACT_T, gpre_sym*); static act* par_open_blob(act_t, gpre_sym*);
static bool par_options(gpre_req*, bool); static bool par_options(gpre_req*, bool);
static act* par_procedure(); static act* par_procedure();
static act* par_ready(); static act* par_ready();
static act* par_returning_values(); static act* par_returning_values();
static act* par_right_brace(); static act* par_right_brace();
static act* par_release(); static act* par_release();
static act* par_slice(ACT_T); static act* par_slice(act_t);
static act* par_store(); static act* par_store();
static act* par_start_stream(); static act* par_start_stream();
static act* par_start_transaction(); static act* par_start_transaction();
static act* par_subroutine(); static act* par_subroutine();
static act* par_trans(ACT_T); static act* par_trans(act_t);
static act* par_type(); static act* par_type();
static act* par_variable(); static act* par_variable();
static act* scan_routine_header(); static act* scan_routine_header();
@ -143,7 +143,7 @@ act* PAR_action(const TEXT* base_dir)
if ((USHORT) gpreGlob.token_global.tok_keyword >= (USHORT) KW_start_actions && if ((USHORT) gpreGlob.token_global.tok_keyword >= (USHORT) KW_start_actions &&
(USHORT) gpreGlob.token_global.tok_keyword <= (USHORT) KW_end_actions) (USHORT) gpreGlob.token_global.tok_keyword <= (USHORT) KW_end_actions)
{ {
const enum kwwords keyword = gpreGlob.token_global.tok_keyword; const kwwords_t keyword = gpreGlob.token_global.tok_keyword;
if (! gpreGlob.sw_no_qli) if (! gpreGlob.sw_no_qli)
{ {
switch (keyword) switch (keyword)
@ -736,8 +736,8 @@ act* PAR_event_init(bool sql)
//SQL_resolve_identifier("<identifier>", req_name, sizeof(req_name)); //SQL_resolve_identifier("<identifier>", req_name, sizeof(req_name));
//strcpy(gpreGlob.token_global.tok_string, req_name); Why? It's already done. //strcpy(gpreGlob.token_global.tok_string, req_name); Why? It's already done.
gpre_nod* init = MSC_node(nod_event_init, 4); gpre_nod* init = MSC_node(nod_event_init, 4);
init->nod_arg[0] = (GPRE_NOD) PAR_symbol(SYM_dummy); init->nod_arg[0] = (gpre_nod*) PAR_symbol(SYM_dummy);
init->nod_arg[3] = (GPRE_NOD) gpreGlob.isc_databases; init->nod_arg[3] = (gpre_nod*) gpreGlob.isc_databases;
act* action = MSC_action(0, ACT_event_init); act* action = MSC_action(0, ACT_event_init);
action->act_object = (REF) init; action->act_object = (REF) init;
@ -747,7 +747,7 @@ act* PAR_event_init(bool sql)
if (!MSC_match(KW_LEFT_PAREN)) { if (!MSC_match(KW_LEFT_PAREN)) {
gpre_sym* symbol = gpreGlob.token_global.tok_symbol; gpre_sym* symbol = gpreGlob.token_global.tok_symbol;
if (symbol && (symbol->sym_type == SYM_database)) if (symbol && (symbol->sym_type == SYM_database))
init->nod_arg[3] = (GPRE_NOD) symbol->sym_object; init->nod_arg[3] = (gpre_nod*) symbol->sym_object;
else else
CPR_s_error("left parenthesis or database handle"); CPR_s_error("left parenthesis or database handle");
@ -759,7 +759,7 @@ act* PAR_event_init(bool sql)
// eat any number of event strings until a right paren is found, // eat any number of event strings until a right paren is found,
// pushing the gpreGlob.events onto a stack // pushing the gpreGlob.events onto a stack
GPRE_NOD node; gpre_nod* node;
gpre_lls* stack = NULL; gpre_lls* stack = NULL;
int count = 0; int count = 0;
@ -775,14 +775,14 @@ act* PAR_event_init(bool sql)
gpre_fld* field = EXP_field(&context); gpre_fld* field = EXP_field(&context);
ref* reference = EXP_post_field(field, context, false); ref* reference = EXP_post_field(field, context, false);
node = MSC_node(nod_field, 1); node = MSC_node(nod_field, 1);
node->nod_arg[0] = (GPRE_NOD) reference; node->nod_arg[0] = (gpre_nod*) reference;
} }
else { else {
node = MSC_node(nod_null, 1); node = MSC_node(nod_null, 1);
if (sql) if (sql)
node->nod_arg[0] = (GPRE_NOD) SQL_var_or_string(false); node->nod_arg[0] = (gpre_nod*) SQL_var_or_string(false);
else else
node->nod_arg[0] = (GPRE_NOD) PAR_native_value(false, false); node->nod_arg[0] = (gpre_nod*) PAR_native_value(false, false);
} }
MSC_push(node, &stack); MSC_push(node, &stack);
count++; count++;
@ -795,9 +795,9 @@ act* PAR_event_init(bool sql)
gpre_nod* event_list = init->nod_arg[1] = MSC_node(nod_list, (SSHORT) count); gpre_nod* event_list = init->nod_arg[1] = MSC_node(nod_list, (SSHORT) count);
gpre_nod** ptr = event_list->nod_arg + count; gpre_nod** ptr = event_list->nod_arg + count;
while (stack) while (stack)
*--ptr = (GPRE_NOD) MSC_pop(&stack); *--ptr = (gpre_nod*) MSC_pop(&stack);
MSC_push((GPRE_NOD) action, &gpreGlob.events); MSC_push((gpre_nod*) action, &gpreGlob.events);
if (!sql) if (!sql)
PAR_end(); PAR_end();
@ -893,7 +893,7 @@ void PAR_init()
gpreGlob.cur_routine = MSC_action(0, ACT_routine); gpreGlob.cur_routine = MSC_action(0, ACT_routine);
gpreGlob.cur_routine->act_flags |= ACT_main; gpreGlob.cur_routine->act_flags |= ACT_main;
MSC_push((GPRE_NOD) gpreGlob.cur_routine, &routine_stack); MSC_push((gpre_nod*) gpreGlob.cur_routine, &routine_stack);
routine_decl = true; routine_decl = true;
flag_field = NULL; flag_field = NULL;
@ -928,7 +928,7 @@ TEXT* PAR_native_value(bool array_ref,
**/ **/
if (gpreGlob.sw_sql_dialect == 1) { if (gpreGlob.sw_sql_dialect == 1) {
if (isQuoted(gpreGlob.token_global.tok_type)) { if (isQuoted(gpreGlob.token_global.tok_type)) {
//const enum tok_t typ = gpreGlob.token_global.tok_type; //const tok_t typ = gpreGlob.token_global.tok_type;
gpreGlob.token_global.tok_length += 2; gpreGlob.token_global.tok_length += 2;
*string++ = '\"'; *string++ = '\"';
gobble(string); gobble(string);
@ -968,11 +968,11 @@ TEXT* PAR_native_value(bool array_ref,
if ((gpreGlob.sw_language == lang_ada) && (gpreGlob.token_global.tok_string[0] == '\'')) { if ((gpreGlob.sw_language == lang_ada) && (gpreGlob.token_global.tok_string[0] == '\'')) {
gobble(string); gobble(string);
} }
enum kwwords keyword = gpreGlob.token_global.tok_keyword; kwwords_t keyword = gpreGlob.token_global.tok_keyword;
if (keyword == KW_LEFT_PAREN) { if (keyword == KW_LEFT_PAREN) {
int parens = 1; int parens = 1;
while (parens) { while (parens) {
const enum tok_t typ = gpreGlob.token_global.tok_type; const tok_t typ = gpreGlob.token_global.tok_type;
if (isQuoted(typ)) if (isQuoted(typ))
*string++ = (typ == tok_sglquoted) ? '\'' : '\"'; *string++ = (typ == tok_sglquoted) ? '\'' : '\"';
gobble(string); gobble(string);
@ -1144,7 +1144,7 @@ gpre_req* PAR_set_up_dpb_info(rdy* ready, act* action, USHORT buffercount)
// redefined. // redefined.
// //
gpre_sym* PAR_symbol(enum sym_t type) gpre_sym* PAR_symbol(sym_t type)
{ {
gpre_sym* symbol; gpre_sym* symbol;
@ -1325,7 +1325,7 @@ static act* par_array_element()
reference->ref_field = element; reference->ref_field = element;
element->fld_symbol = field->fld_symbol; element->fld_symbol = field->fld_symbol;
reference->ref_context = context; reference->ref_context = context;
node->nod_arg[0] = (GPRE_NOD) reference; node->nod_arg[0] = (gpre_nod*) reference;
act* action = MSC_action(request, ACT_variable); act* action = MSC_action(request, ACT_variable);
action->act_object = reference; action->act_object = reference;
@ -1463,7 +1463,7 @@ static act* par_based()
case lang_c: case lang_c:
case lang_cxx: case lang_cxx:
do { do {
MSC_push((GPRE_NOD) PAR_native_value(false, false), MSC_push((gpre_nod*) PAR_native_value(false, false),
&based_on->bas_variables); &based_on->bas_variables);
} while (MSC_match(KW_COMMA)); } while (MSC_match(KW_COMMA));
/* /*
@ -1566,7 +1566,7 @@ static blb* par_blob()
// Parse a GET_SEGMENT, PUT_SEGMENT, CLOSE_BLOB or CANCEL_BLOB. // Parse a GET_SEGMENT, PUT_SEGMENT, CLOSE_BLOB or CANCEL_BLOB.
// //
static act* par_blob_action( ACT_T type) static act* par_blob_action( act_t type)
{ {
blb* blob = par_blob(); blb* blob = par_blob();
act* action = MSC_action(blob->blb_request, type); act* action = MSC_action(blob->blb_request, type);
@ -1594,7 +1594,7 @@ static act* par_blob_field()
blb* blob = par_blob(); blb* blob = par_blob();
ACT_T type; act_t type;
if (MSC_match(KW_DOT)) { if (MSC_match(KW_DOT)) {
if (MSC_match(KW_SEGMENT)) if (MSC_match(KW_SEGMENT))
type = ACT_segment; type = ACT_segment;
@ -1683,7 +1683,7 @@ static act* par_derived_from()
based_on->bas_variables = (gpre_lls*) MSC_alloc(LLS_LEN); based_on->bas_variables = (gpre_lls*) MSC_alloc(LLS_LEN);
based_on->bas_variables->lls_next = NULL; based_on->bas_variables->lls_next = NULL;
based_on->bas_variables->lls_object = based_on->bas_variables->lls_object =
(GPRE_NOD) PAR_native_value(false, false); (gpre_nod*) PAR_native_value(false, false);
strcpy(based_on->bas_terminator, gpreGlob.token_global.tok_string); strcpy(based_on->bas_terminator, gpreGlob.token_global.tok_string);
PAR_get_token(); PAR_get_token();
@ -1859,9 +1859,9 @@ static act* par_end_modify()
change->ref_flags = reference->ref_flags; change->ref_flags = reference->ref_flags;
gpre_nod* item = MSC_node(nod_assignment, 2); gpre_nod* item = MSC_node(nod_assignment, 2);
item->nod_arg[0] = MSC_unary(nod_value, (GPRE_NOD) change); item->nod_arg[0] = MSC_unary(nod_value, (gpre_nod*) change);
item->nod_arg[1] = MSC_unary(nod_field, (GPRE_NOD) change); item->nod_arg[1] = MSC_unary(nod_field, (gpre_nod*) change);
MSC_push((GPRE_NOD) item, &stack); MSC_push((gpre_nod*) item, &stack);
count++; count++;
if (reference->ref_null) { if (reference->ref_null) {
@ -1873,9 +1873,9 @@ static act* par_end_modify()
change->ref_null = flag; change->ref_null = flag;
item = MSC_node(nod_assignment, 2); item = MSC_node(nod_assignment, 2);
item->nod_arg[0] = MSC_unary(nod_value, (GPRE_NOD) flag); item->nod_arg[0] = MSC_unary(nod_value, (gpre_nod*) flag);
item->nod_arg[1] = MSC_unary(nod_field, (GPRE_NOD) flag); item->nod_arg[1] = MSC_unary(nod_field, (gpre_nod*) flag);
MSC_push((GPRE_NOD) item, &stack); MSC_push((gpre_nod*) item, &stack);
count++; count++;
} }
} }
@ -1888,7 +1888,7 @@ static act* par_end_modify()
gpre_nod** ptr = assignments->nod_arg + count; gpre_nod** ptr = assignments->nod_arg + count;
while (stack) while (stack)
*--ptr = (GPRE_NOD) MSC_pop(&stack); *--ptr = (gpre_nod*) MSC_pop(&stack);
act* action = MSC_action(request, ACT_endmodify); act* action = MSC_action(request, ACT_endmodify);
action->act_object = (REF) modify; action->act_object = (REF) modify;
@ -1962,8 +1962,8 @@ static act* par_end_store(bool special)
if (reference->ref_master) if (reference->ref_master)
continue; continue;
gpre_nod* item = MSC_node(nod_assignment, 2); gpre_nod* item = MSC_node(nod_assignment, 2);
item->nod_arg[0] = MSC_unary(nod_value, (GPRE_NOD) reference); item->nod_arg[0] = MSC_unary(nod_value, (gpre_nod*) reference);
item->nod_arg[1] = MSC_unary(nod_field, (GPRE_NOD) reference); item->nod_arg[1] = MSC_unary(nod_field, (gpre_nod*) reference);
assignments->nod_arg[count++] = item; assignments->nod_arg[count++] = item;
} }
} }
@ -1995,9 +1995,9 @@ static act* par_end_store(bool special)
change->ref_flags = reference->ref_flags; change->ref_flags = reference->ref_flags;
gpre_nod* item = MSC_node(nod_assignment, 2); gpre_nod* item = MSC_node(nod_assignment, 2);
item->nod_arg[0] = MSC_unary(nod_field, (GPRE_NOD) change); item->nod_arg[0] = MSC_unary(nod_field, (gpre_nod*) change);
item->nod_arg[1] = MSC_unary(nod_value, (GPRE_NOD) change); item->nod_arg[1] = MSC_unary(nod_value, (gpre_nod*) change);
MSC_push((GPRE_NOD) item, &stack); MSC_push((gpre_nod*) item, &stack);
count++; count++;
} }
} }
@ -2009,7 +2009,7 @@ static act* par_end_store(bool special)
gpre_nod** ptr = assignments->nod_arg + count; gpre_nod** ptr = assignments->nod_arg + count;
while (stack) while (stack)
*--ptr = (GPRE_NOD) MSC_pop(&stack); *--ptr = (gpre_nod*) MSC_pop(&stack);
} }
gpre_ctx* context = request->req_contexts; gpre_ctx* context = request->req_contexts;
@ -2075,7 +2075,7 @@ static act* par_fetch()
PAR_end(); PAR_end();
act* action = MSC_action(request, ACT_s_fetch); act* action = MSC_action(request, ACT_s_fetch);
MSC_push((GPRE_NOD) action, &cur_fetch); MSC_push((gpre_nod*) action, &cur_fetch);
return action; return action;
} }
@ -2164,7 +2164,7 @@ static act* par_for()
} }
act* action = MSC_action(request, ACT_for); act* action = MSC_action(request, ACT_for);
MSC_push((GPRE_NOD) action, &cur_for); MSC_push((gpre_nod*) action, &cur_for);
request->req_rse = rec_expr; request->req_rse = rec_expr;
gpre_ctx* context = rec_expr->rse_context[0]; gpre_ctx* context = rec_expr->rse_context[0];
@ -2238,7 +2238,7 @@ static act* par_modify()
// structure in place to cleanly handle END_MODIFY under error conditions. // structure in place to cleanly handle END_MODIFY under error conditions.
upd* modify = (upd*) MSC_alloc(UPD_LEN); upd* modify = (upd*) MSC_alloc(UPD_LEN);
MSC_push((GPRE_NOD) modify, &cur_modify); MSC_push((gpre_nod*) modify, &cur_modify);
// If the next token isn't a context variable, we can't continue // If the next token isn't a context variable, we can't continue
@ -2312,7 +2312,7 @@ static act* par_on_error()
cur_statement->act_error = action; cur_statement->act_error = action;
action->act_object = (REF) cur_statement; action->act_object = (REF) cur_statement;
MSC_push((GPRE_NOD) action, &cur_error); MSC_push((gpre_nod*) action, &cur_error);
if (cur_statement->act_pair) if (cur_statement->act_pair)
cur_statement->act_pair->act_error = action; cur_statement->act_pair->act_error = action;
@ -2327,7 +2327,7 @@ static act* par_on_error()
// CREATE_BLOB, and blob FOR. // CREATE_BLOB, and blob FOR.
// //
static act* par_open_blob( ACT_T act_op, gpre_sym* symbol) static act* par_open_blob( act_t act_op, gpre_sym* symbol)
{ {
// If somebody hasn't already parsed up a symbol for us, parse the // If somebody hasn't already parsed up a symbol for us, parse the
// symbol and the mandatory IN now. // symbol and the mandatory IN now.
@ -2403,7 +2403,7 @@ static act* par_open_blob( ACT_T act_op, gpre_sym* symbol)
action->act_object = (REF) blob; action->act_object = (REF) blob;
if (act_op == ACT_blob_for) if (act_op == ACT_blob_for)
MSC_push((GPRE_NOD) action, &cur_for); MSC_push((gpre_nod*) action, &cur_for);
// Need to eat the semicolon if present // Need to eat the semicolon if present
@ -2471,7 +2471,7 @@ static act* par_procedure()
routine_decl = true; routine_decl = true;
action = scan_routine_header(); action = scan_routine_header();
if (!(action->act_flags & ACT_decl)) { if (!(action->act_flags & ACT_decl)) {
MSC_push((GPRE_NOD) gpreGlob.cur_routine, &routine_stack); MSC_push((gpre_nod*) gpreGlob.cur_routine, &routine_stack);
gpreGlob.cur_routine = action; gpreGlob.cur_routine = action;
} }
} }
@ -2681,7 +2681,7 @@ static act* par_returning_values()
count++; count++;
} }
GPRE_NOD assignments = MSC_node(nod_list, (SSHORT) count); gpre_nod* assignments = MSC_node(nod_list, (SSHORT) count);
request->req_node = assignments; request->req_node = assignments;
count = 0; count = 0;
@ -2696,9 +2696,9 @@ static act* par_returning_values()
if (reference->ref_master) if (reference->ref_master)
continue; continue;
GPRE_NOD item = MSC_node(nod_assignment, 2); gpre_nod* item = MSC_node(nod_assignment, 2);
item->nod_arg[0] = MSC_unary(nod_value, (GPRE_NOD) save_ref); item->nod_arg[0] = MSC_unary(nod_value, (gpre_nod*) save_ref);
item->nod_arg[1] = MSC_unary(nod_field, (GPRE_NOD) save_ref); item->nod_arg[1] = MSC_unary(nod_field, (gpre_nod*) save_ref);
assignments->nod_arg[count++] = item; assignments->nod_arg[count++] = item;
} }
@ -2726,8 +2726,8 @@ static act* par_returning_values()
// both actions go on the cur_store stack, the store topmost // both actions go on the cur_store stack, the store topmost
MSC_push((GPRE_NOD) action, &cur_store); MSC_push((gpre_nod*) action, &cur_store);
MSC_push((GPRE_NOD) begin_action, &cur_store); MSC_push((gpre_nod*) begin_action, &cur_store);
return action; return action;
} }
@ -2780,7 +2780,7 @@ static act* par_release()
// Handle a GET_SLICE or PUT_SLICE statement. // Handle a GET_SLICE or PUT_SLICE statement.
// //
static act* par_slice( ACT_T type) static act* par_slice( act_t type)
{ {
gpre_ctx* context; gpre_ctx* context;
gpre_fld* field = EXP_field(&context); gpre_fld* field = EXP_field(&context);
@ -2848,7 +2848,7 @@ static act* par_store()
gpre_req* request = MSC_request(REQ_store); gpre_req* request = MSC_request(REQ_store);
par_options(request, false); par_options(request, false);
act* action = MSC_action(request, ACT_store); act* action = MSC_action(request, ACT_store);
MSC_push((GPRE_NOD) action, &cur_store); MSC_push((gpre_nod*) action, &cur_store);
gpre_ctx* context = EXP_context(request, 0); gpre_ctx* context = EXP_context(request, 0);
gpre_rel* relation = context->ctx_relation; gpre_rel* relation = context->ctx_relation;
@ -3015,7 +3015,7 @@ static act* par_subroutine()
// prepare, rollback, or save (commit retaining context). // prepare, rollback, or save (commit retaining context).
// //
static act* par_trans( ACT_T act_op) static act* par_trans( act_t act_op)
{ {
act* action = MSC_action(0, act_op); act* action = MSC_action(0, act_op);

View File

@ -27,20 +27,20 @@
act* PAR_action(const TEXT*); act* PAR_action(const TEXT*);
SSHORT PAR_blob_subtype(DBB); SSHORT PAR_blob_subtype(DBB);
act* PAR_database(bool, const TEXT*); act* PAR_database(bool, const TEXT*);
bool PAR_end(void); bool PAR_end();
void PAR_error(const TEXT*); void PAR_error(const TEXT*);
act* PAR_event_init(bool); act* PAR_event_init(bool);
act* PAR_event_wait(bool); act* PAR_event_wait(bool);
void PAR_fini(void); void PAR_fini();
TOK PAR_get_token(void); TOK PAR_get_token();
void PAR_init(void); void PAR_init();
TEXT* PAR_native_value(bool, bool); TEXT* PAR_native_value(bool, bool);
gpre_fld* PAR_null_field(void); gpre_fld* PAR_null_field();
void PAR_reserving(USHORT, bool); void PAR_reserving(USHORT, bool);
gpre_req* PAR_set_up_dpb_info(rdy*, act*, USHORT); gpre_req* PAR_set_up_dpb_info(rdy*, act*, USHORT);
gpre_sym* PAR_symbol(enum sym_t); gpre_sym* PAR_symbol(sym_t);
void PAR_unwind(void); void PAR_unwind();
void PAR_using_db(void); void PAR_using_db();
#endif // GPRE_PAR_PROTO_H #endif // GPRE_PAR_PROTO_H

View File

@ -39,9 +39,9 @@ enum tok_t {
}; };
typedef struct tok { typedef struct tok {
enum tok_t tok_type; /* type of token */ tok_t tok_type; /* type of token */
gpre_sym* tok_symbol; /* hash block if recognized */ gpre_sym* tok_symbol; /* hash block if recognized */
KWWORDS tok_keyword; /* keyword number, if recognized */ kwwords_t tok_keyword; /* keyword number, if recognized */
SLONG tok_position; /* byte number in input stream */ SLONG tok_position; /* byte number in input stream */
USHORT tok_length; USHORT tok_length;
USHORT tok_white_space; USHORT tok_white_space;

View File

@ -1490,7 +1490,7 @@ static void gen_dyn_execute( const act* action, int column)
TEXT s[MAX_CURSOR_SIZE]; TEXT s[MAX_CURSOR_SIZE];
make_name(s, statement->dyn_cursor_name); make_name(s, statement->dyn_cursor_name);
GPRE_NOD var_list; gpre_nod* var_list;
if (var_list = statement->dyn_using) { if (var_list = statement->dyn_using) {
printa(column, "gds__sqlda.sqln = %s;", gpreGlob.sw_dyn_using); printa(column, "gds__sqlda.sqln = %s;", gpreGlob.sw_dyn_using);
printa(column, "gds__sqlda.sqld = %s;", gpreGlob.sw_dyn_using); printa(column, "gds__sqlda.sqld = %s;", gpreGlob.sw_dyn_using);
@ -1611,7 +1611,7 @@ static void gen_dyn_open( const act* action, int column)
TEXT s[MAX_CURSOR_SIZE]; TEXT s[MAX_CURSOR_SIZE];
gpre_req* request; gpre_req* request;
gpre_req req_const; gpre_req req_const;
GPRE_NOD var_list; gpre_nod* var_list;
int i; int i;
DYN statement = (DYN) action->act_object; DYN statement = (DYN) action->act_object;
@ -1806,13 +1806,14 @@ static void gen_erase( const act* action, int column)
static SSHORT gen_event_block( const act* action) static SSHORT gen_event_block( const act* action)
{ {
GPRE_NOD init, list; gpre_nod* init;
gpre_nod* list;
int ident; int ident;
init = (GPRE_NOD) action->act_object; init = (gpre_nod*) action->act_object;
ident = CMP_next_ident(); ident = CMP_next_ident();
init->nod_arg[2] = (GPRE_NOD) ident; init->nod_arg[2] = (gpre_nod*) ident;
printa(INDENT, "gds__%da\t\t: ^char;\t\t(* event parameter block *)", printa(INDENT, "gds__%da\t\t: ^char;\t\t(* event parameter block *)",
ident); ident);
@ -1834,7 +1835,11 @@ static SSHORT gen_event_block( const act* action)
static void gen_event_init( const act* action, int column) static void gen_event_init( const act* action, int column)
{ {
GPRE_NOD init, event_list, *ptr, *end, node; gpre_nod* init;
gpre_nod* event_list;
gpre_nod** ptr;
gpre_nod** end;
gpre_nod* node;
const ref* reference; const ref* reference;
PAT args; PAT args;
SSHORT count; SSHORT count;
@ -1847,7 +1852,7 @@ static void gen_event_init( const act* action, int column)
begin(column); begin(column);
begin(column); begin(column);
init = (GPRE_NOD) action->act_object; init = (gpre_nod*) action->act_object;
event_list = init->nod_arg[1]; event_list = init->nod_arg[1];
args.pat_database = (DBB) init->nod_arg[3]; args.pat_database = (DBB) init->nod_arg[3];
@ -1902,7 +1907,7 @@ static void gen_event_init( const act* action, int column)
static void gen_event_wait( const act* action, int column) static void gen_event_wait( const act* action, int column)
{ {
PAT args; PAT args;
GPRE_NOD event_init; gpre_nod* event_init;
gpre_sym* event_name; gpre_sym* event_name;
gpre_sym* stack_name; gpre_sym* stack_name;
DBB database; DBB database;
@ -1925,7 +1930,7 @@ static void gen_event_wait( const act* action, int column)
ident = -1; ident = -1;
for (stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) { for (stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) {
event_action = (const act*) stack_ptr->lls_object; event_action = (const act*) stack_ptr->lls_object;
event_init = (GPRE_NOD) event_action->act_object; event_init = (gpre_nod*) event_action->act_object;
stack_name = (gpre_sym*) event_init->nod_arg[0]; stack_name = (gpre_sym*) event_init->nod_arg[0];
if (!strcmp(event_name->sym_string, stack_name->sym_string)) { if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
ident = (int) event_init->nod_arg[2]; ident = (int) event_init->nod_arg[2];
@ -1966,7 +1971,7 @@ static void gen_event_wait( const act* action, int column)
static void gen_fetch( const act* action, int column) static void gen_fetch( const act* action, int column)
{ {
const gpre_req* request; const gpre_req* request;
GPRE_NOD var_list; gpre_nod* var_list;
int i; int i;
request = action->act_request; request = action->act_request;
@ -1974,7 +1979,7 @@ static void gen_fetch( const act* action, int column)
#ifdef SCROLLABLE_CURSORS #ifdef SCROLLABLE_CURSORS
gpre_port* port; gpre_port* port;
ref* reference; ref* reference;
VAL value; gpre_value* value;
const TEXT* direction; const TEXT* direction;
const TEXT* offset; const TEXT* offset;
@ -2039,7 +2044,7 @@ static void gen_fetch( const act* action, int column)
column += INDENT; column += INDENT;
begin(column); begin(column);
if (var_list = (GPRE_NOD) action->act_object) if (var_list = (gpre_nod*) action->act_object)
for (i = 0; i < var_list->nod_count; i++) { for (i = 0; i < var_list->nod_count; i++) {
align(column); align(column);
asgn_to(action, reinterpret_cast<ref*>(var_list->nod_arg[i]), column); asgn_to(action, reinterpret_cast<ref*>(var_list->nod_arg[i]), column);
@ -2869,7 +2874,7 @@ static void gen_select( const act* action, int column)
column += INDENT; column += INDENT;
begin(column); begin(column);
const gpre_nod* var_list = (GPRE_NOD) action->act_object; const gpre_nod* var_list = (gpre_nod*) action->act_object;
if (var_list) { if (var_list) {
for (int i = 0; i < var_list->nod_count; i++) { for (int i = 0; i < var_list->nod_count; i++) {
align(column); align(column);

View File

@ -36,7 +36,7 @@
#include "../gpre/lang_proto.h" #include "../gpre/lang_proto.h"
typedef enum { enum pat_t {
NL, NL,
RH, RL, RT, RI, RS, // Request handle, level, transaction, ident, length RH, RL, RT, RI, RS, // Request handle, level, transaction, ident, length
DH, DF, // Database handle, filename DH, DF, // Database handle, filename
@ -55,10 +55,11 @@ typedef enum {
QN, QL, QI, // Second port number, port length, port ident QN, QL, QI, // Second port number, port length, port ident
IF, EL, EN, // If, else, end IF, EL, EN, // If, else, end
FR // Field reference FR // Field reference
} PAT_T; };
static const struct ops { static const struct ops
PAT_T ops_type; {
pat_t ops_type;
TEXT ops_string[3]; TEXT ops_string[3];
} operators[] = } operators[] =
{ {

View File

@ -177,7 +177,7 @@ static TEXT* gen_name(TEXT* const, const ref*, bool);
static void gen_on_error (const act*); static void gen_on_error (const act*);
static void gen_procedure (const act*); static void gen_procedure (const act*);
static void gen_put_segment (const act*); static void gen_put_segment (const act*);
static void gen_raw (const UCHAR*, enum req_t, int, int); static void gen_raw (const UCHAR*, req_t, int, int);
static void gen_ready (const act*); static void gen_ready (const act*);
static void gen_receive (const act*, const gpre_port*); static void gen_receive (const act*, const gpre_port*);
static void gen_release (const act*); static void gen_release (const act*);
@ -2440,10 +2440,10 @@ static void gen_erase( const act* action)
static SSHORT gen_event_block( const act* action) static SSHORT gen_event_block( const act* action)
{ {
gpre_nod* init = (GPRE_NOD) action->act_object; gpre_nod* init = (gpre_nod*) action->act_object;
int ident = CMP_next_ident(); int ident = CMP_next_ident();
init->nod_arg[2] = (GPRE_NOD) (IPTR) ident; init->nod_arg[2] = (gpre_nod*) (IPTR) ident;
printa(COLUMN8, false, "01 %s%dA PIC S9(10) %s.", printa(COLUMN8, false, "01 %s%dA PIC S9(10) %s.",
names[isc_a_pos], ident, USAGE_BINARY4); names[isc_a_pos], ident, USAGE_BINARY4);
@ -2472,7 +2472,7 @@ static void gen_event_init( const act* action)
const TEXT *pattern3 = const TEXT *pattern3 =
"CALL \"%S3\" USING %S5, %S4%N1L, %S4%N1A, %S4%N1B"; "CALL \"%S3\" USING %S5, %S4%N1L, %S4%N1A, %S4%N1B";
const gpre_nod* init = (GPRE_NOD) action->act_object; const gpre_nod* init = (gpre_nod*) action->act_object;
const gpre_nod* event_list = init->nod_arg[1]; const gpre_nod* event_list = init->nod_arg[1];
const SSHORT column = strlen(names[COLUMN]); const SSHORT column = strlen(names[COLUMN]);
@ -2549,7 +2549,7 @@ static void gen_event_wait( const act* action)
for (const gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) for (const gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next)
{ {
const act* event_action = (const act*) stack_ptr->lls_object; const act* event_action = (const act*) stack_ptr->lls_object;
const gpre_nod* event_init = (GPRE_NOD) event_action->act_object; const gpre_nod* event_init = (gpre_nod*) event_action->act_object;
const gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0]; const gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0];
if (!strcmp(event_name->sym_string, stack_name->sym_string)) { if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
ident = (int) (IPTR) event_init->nod_arg[2]; ident = (int) (IPTR) event_init->nod_arg[2];
@ -2607,7 +2607,7 @@ static void gen_fetch( const act* action)
for (reference = port->por_references; reference; for (reference = port->por_references; reference;
reference = reference->ref_next) reference = reference->ref_next)
{ {
VAL value = reference->ref_values; gpre_value* value = reference->ref_values;
reference->ref_value = value->val_value; reference->ref_value = value->val_value;
reference->ref_values = value->val_next; reference->ref_values = value->val_next;
} }
@ -2649,7 +2649,7 @@ static void gen_fetch( const act* action)
printa(names[COLUMN], false, printa(names[COLUMN], false,
"IF %s NOT = 0 THEN", gen_name(s, request->req_eof, true)); "IF %s NOT = 0 THEN", gen_name(s, request->req_eof, true));
printa(names[COLUMN], false, "MOVE 0 TO SQLCODE"); printa(names[COLUMN], false, "MOVE 0 TO SQLCODE");
if (gpre_nod* var_list = (GPRE_NOD) action->act_object) if (gpre_nod* var_list = (gpre_nod*) action->act_object)
for (int i = 0; i < var_list->nod_count; i++) { for (int i = 0; i < var_list->nod_count; i++) {
asgn_to(action, (REF) var_list->nod_arg[i]); asgn_to(action, (REF) var_list->nod_arg[i]);
} }
@ -3094,7 +3094,7 @@ static void gen_put_segment( const act* action)
static void gen_raw( static void gen_raw(
const UCHAR* blr, const UCHAR* blr,
enum req_t request_type, int request_length, int ident) req_t request_type, int request_length, int ident)
{ {
int length = 1; int length = 1;
ULONG ltemp = 0; ULONG ltemp = 0;
@ -3630,7 +3630,7 @@ static void gen_select( const act* action)
gen_receive(action, port); gen_receive(action, port);
printa(names[COLUMN], false, "IF %s NOT = 0 THEN", name); printa(names[COLUMN], false, "IF %s NOT = 0 THEN", name);
gpre_nod* var_list = (GPRE_NOD) action->act_object; gpre_nod* var_list = (gpre_nod*) action->act_object;
if (var_list) if (var_list)
for (int i = 0; i < var_list->nod_count; i++) { for (int i = 0; i < var_list->nod_count; i++) {
asgn_to(action, (REF) var_list->nod_arg[i]); asgn_to(action, (REF) var_list->nod_arg[i]);

View File

@ -67,53 +67,53 @@ struct scope {
USHORT req_in_subselect; // processing a subselect clause USHORT req_in_subselect; // processing a subselect clause
}; };
static bool compare_expr(GPRE_NOD, GPRE_NOD); static bool compare_expr(gpre_nod*, gpre_nod*);
static GPRE_NOD copy_fields(GPRE_NOD, map*); static gpre_nod* copy_fields(gpre_nod*, map*);
static GPRE_NOD explode_asterisk(GPRE_NOD, int, gpre_rse*); static gpre_nod* explode_asterisk(gpre_nod*, int, gpre_rse*);
static GPRE_NOD explode_asterisk_all(GPRE_NOD, int, gpre_rse*, bool); static gpre_nod* explode_asterisk_all(gpre_nod*, int, gpre_rse*, bool);
static gpre_fld* get_ref(GPRE_NOD); static gpre_fld* get_ref(gpre_nod*);
static GPRE_NOD implicit_any(gpre_req*, GPRE_NOD, enum nod_t, enum nod_t); static gpre_nod* implicit_any(gpre_req*, gpre_nod*, nod_t, nod_t);
static GPRE_NOD merge(GPRE_NOD, GPRE_NOD); static gpre_nod* merge(gpre_nod*, gpre_nod*);
static GPRE_NOD merge_fields(GPRE_NOD, GPRE_NOD, int, bool); static gpre_nod* merge_fields(gpre_nod*, gpre_nod*, int, bool);
static GPRE_NOD negate(GPRE_NOD); static gpre_nod* negate(gpre_nod*);
static void pair(GPRE_NOD, GPRE_NOD); static void pair(gpre_nod*, gpre_nod*);
static gpre_ctx* par_alias_list(gpre_req*, GPRE_NOD); static gpre_ctx* par_alias_list(gpre_req*, gpre_nod*);
static gpre_ctx* par_alias(gpre_req*, const TEXT*); static gpre_ctx* par_alias(gpre_req*, const TEXT*);
static GPRE_NOD par_and(gpre_req*, USHORT *); static gpre_nod* par_and(gpre_req*, USHORT *);
static gpre_rel* par_base_table(gpre_req*, const gpre_rel*, const TEXT*); static gpre_rel* par_base_table(gpre_req*, const gpre_rel*, const TEXT*);
static GPRE_NOD par_case(gpre_req*); static gpre_nod* par_case(gpre_req*);
static GPRE_NOD par_collate(gpre_req*, GPRE_NOD); static gpre_nod* par_collate(gpre_req*, gpre_nod*);
static GPRE_NOD par_in(gpre_req*, GPRE_NOD); static gpre_nod* par_in(gpre_req*, gpre_nod*);
static gpre_ctx* par_joined_relation(gpre_req*, gpre_ctx*); static gpre_ctx* par_joined_relation(gpre_req*, gpre_ctx*);
static gpre_ctx* par_join_clause(gpre_req*, gpre_ctx*); static gpre_ctx* par_join_clause(gpre_req*, gpre_ctx*);
static NOD_T par_join_type(void); static nod_t par_join_type();
static GPRE_NOD par_multiply(gpre_req*, bool, USHORT *, bool *); static gpre_nod* par_multiply(gpre_req*, bool, USHORT *, bool *);
static GPRE_NOD par_not(gpre_req*, USHORT *); static gpre_nod* par_not(gpre_req*, USHORT *);
static GPRE_NOD par_nullif(gpre_req*); static gpre_nod* par_nullif(gpre_req*);
static void par_order(gpre_req*, gpre_rse*, bool, bool); static void par_order(gpre_req*, gpre_rse*, bool, bool);
static GPRE_NOD par_plan(gpre_req*); static gpre_nod* par_plan(gpre_req*);
static GPRE_NOD par_plan_item(gpre_req*, bool, USHORT *, bool *); static gpre_nod* par_plan_item(gpre_req*, bool, USHORT *, bool *);
static GPRE_NOD par_primitive_value(gpre_req*, bool, USHORT *, bool *); static gpre_nod* par_primitive_value(gpre_req*, bool, USHORT *, bool *);
static GPRE_NOD par_relational(gpre_req*, USHORT *); static gpre_nod* par_relational(gpre_req*, USHORT *);
static gpre_rse* par_rse(gpre_req*, GPRE_NOD, bool); static gpre_rse* par_rse(gpre_req*, gpre_nod*, bool);
static gpre_rse* par_select(gpre_req*, gpre_rse*); static gpre_rse* par_select(gpre_req*, gpre_rse*);
static GPRE_NOD par_stat(gpre_req*); static gpre_nod* par_stat(gpre_req*);
static GPRE_NOD par_subscript(gpre_req*); static gpre_nod* par_subscript(gpre_req*);
static GPRE_NOD par_substring(gpre_req*); static gpre_nod* par_substring(gpre_req*);
static void par_terminating_parens(USHORT *, USHORT *); static void par_terminating_parens(USHORT *, USHORT *);
static GPRE_NOD par_udf(gpre_req*); static gpre_nod* par_udf(gpre_req*);
static GPRE_NOD par_udf_or_field(gpre_req*, bool); static gpre_nod* par_udf_or_field(gpre_req*, bool);
static GPRE_NOD par_udf_or_field_with_collate(gpre_req*, bool, USHORT *, bool *); static gpre_nod* par_udf_or_field_with_collate(gpre_req*, bool, USHORT *, bool *);
static void par_update(gpre_rse*, bool, bool); static void par_update(gpre_rse*, bool, bool);
static GPRE_NOD post_fields(GPRE_NOD, map*); static gpre_nod* post_fields(gpre_nod*, map*);
static GPRE_NOD post_map(GPRE_NOD, MAP); static gpre_nod* post_map(gpre_nod*, MAP);
static GPRE_NOD post_select_list(GPRE_NOD, map*); static gpre_nod* post_select_list(gpre_nod*, map*);
static void pop_scope(gpre_req*, scope*); static void pop_scope(gpre_req*, scope*);
static void push_scope(gpre_req*, scope*); static void push_scope(gpre_req*, scope*);
static gpre_fld* resolve(GPRE_NOD, gpre_ctx*, gpre_ctx**, act**); static gpre_fld* resolve(gpre_nod*, gpre_ctx*, gpre_ctx**, act**);
static bool resolve_fields(GPRE_NOD& fields, gpre_req* request, gpre_rse* selection); static bool resolve_fields(gpre_nod*& fields, gpre_req* request, gpre_rse* selection);
static gpre_ctx* resolve_asterisk(TOK, gpre_rse*); static gpre_ctx* resolve_asterisk(TOK, gpre_rse*);
static void set_ref(GPRE_NOD, gpre_fld*); static void set_ref(gpre_nod*, gpre_fld*);
static char* upcase_string(const char*); static char* upcase_string(const char*);
static bool validate_references(const gpre_nod*, const gpre_nod*); static bool validate_references(const gpre_nod*, const gpre_nod*);
@ -121,9 +121,9 @@ static bool validate_references(const gpre_nod*, const gpre_nod*);
struct ops { struct ops {
enum nod_t rel_op; nod_t rel_op;
enum kwwords rel_kw; kwwords_t rel_kw;
enum nod_t rel_negation; nod_t rel_negation;
}; };
static const ops rel_ops[] = static const ops rel_ops[] =
@ -144,7 +144,8 @@ static const ops rel_ops[] =
}; };
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED
static const ops scalar_stat_ops[] = { static const ops scalar_stat_ops[] =
{
{ nod_count, KW_COUNT, nod_any }, { nod_count, KW_COUNT, nod_any },
{ nod_max, KW_MAX, nod_any }, { nod_max, KW_MAX, nod_any },
{ nod_min, KW_MIN, nod_any }, { nod_min, KW_MIN, nod_any },
@ -155,7 +156,8 @@ static const ops scalar_stat_ops[] = {
}; };
#endif #endif
static const ops stat_ops[] = { static const ops stat_ops[] =
{
{ nod_agg_count, KW_COUNT, nod_any }, { nod_agg_count, KW_COUNT, nod_any },
{ nod_agg_max, KW_MAX, nod_any }, { nod_agg_max, KW_MAX, nod_any },
{ nod_agg_min, KW_MIN, nod_any }, { nod_agg_min, KW_MIN, nod_any },
@ -167,10 +169,11 @@ static const ops stat_ops[] = {
{ nod_ansi_all, KW_none, nod_ansi_all } { nod_ansi_all, KW_none, nod_ansi_all }
}; };
static const NOD_T relationals[] = { static const nod_t relationals[] =
{
nod_eq, nod_ne, nod_gt, nod_ge, nod_le, nod_lt, nod_containing, nod_eq, nod_ne, nod_gt, nod_ge, nod_le, nod_lt, nod_containing,
nod_starting, nod_matches, nod_any, nod_missing, nod_between, nod_like, nod_starting, nod_matches, nod_any, nod_missing, nod_between, nod_like,
nod_and, nod_or, nod_not, nod_ansi_any, nod_ansi_all, (NOD_T) 0 nod_and, nod_or, nod_not, nod_ansi_any, nod_ansi_all, nod_nothing
}; };
@ -179,7 +182,7 @@ static const NOD_T relationals[] = {
// Parse an OR boolean expression. // Parse an OR boolean expression.
// //
GPRE_NOD SQE_boolean( gpre_req* request, USHORT * paren_count) gpre_nod* SQE_boolean( gpre_req* request, USHORT * paren_count)
{ {
USHORT local_count; USHORT local_count;
@ -325,10 +328,10 @@ gpre_ctx* SQE_context(gpre_req* request)
// this will be turned into a reference later. // this will be turned into a reference later.
// //
GPRE_NOD SQE_field(gpre_req* request, gpre_nod* SQE_field(gpre_req* request,
bool aster_ok) bool aster_ok)
{ {
GPRE_NOD node; gpre_nod* node;
gpre_req* slice_req; gpre_req* slice_req;
assert_IS_REQ(request); assert_IS_REQ(request);
@ -384,7 +387,7 @@ GPRE_NOD SQE_field(gpre_req* request,
node = MSC_node(nod_deferred, 3); node = MSC_node(nod_deferred, 3);
node->nod_count = 0; node->nod_count = 0;
TOK f_token = (TOK) MSC_alloc(TOK_LEN); TOK f_token = (TOK) MSC_alloc(TOK_LEN);
node->nod_arg[0] = (GPRE_NOD) f_token; node->nod_arg[0] = (gpre_nod*) f_token;
f_token->tok_length = gpreGlob.token_global.tok_length; f_token->tok_length = gpreGlob.token_global.tok_length;
SQL_resolve_identifier("<identifier>", f_token->tok_string, f_token->tok_length + 1); SQL_resolve_identifier("<identifier>", f_token->tok_string, f_token->tok_length + 1);
CPR_token(); CPR_token();
@ -399,7 +402,7 @@ GPRE_NOD SQE_field(gpre_req* request,
else { else {
node->nod_arg[1] = node->nod_arg[0]; node->nod_arg[1] = node->nod_arg[0];
f_token = (TOK) MSC_alloc(TOK_LEN); f_token = (TOK) MSC_alloc(TOK_LEN);
node->nod_arg[0] = (GPRE_NOD) f_token; node->nod_arg[0] = (gpre_nod*) f_token;
f_token->tok_length = gpreGlob.token_global.tok_length; f_token->tok_length = gpreGlob.token_global.tok_length;
SQL_resolve_identifier("<identifier>", f_token->tok_string, f_token->tok_length + 1); SQL_resolve_identifier("<identifier>", f_token->tok_string, f_token->tok_length + 1);
} }
@ -437,7 +440,7 @@ GPRE_NOD SQE_field(gpre_req* request,
tail_ptr->slc_lower = MSC_pop(&lower_dim); tail_ptr->slc_lower = MSC_pop(&lower_dim);
tail_ptr->slc_upper = MSC_pop(&upper_dim); tail_ptr->slc_upper = MSC_pop(&upper_dim);
} }
node->nod_arg[2] = (GPRE_NOD) slice_req; node->nod_arg[2] = (gpre_nod*) slice_req;
/* added this to assign the correct nod_count /* added this to assign the correct nod_count
The nod type is converted to nod_field in SQE_resolve() The nod type is converted to nod_field in SQE_resolve()
@ -449,7 +452,7 @@ GPRE_NOD SQE_field(gpre_req* request,
else { else {
slice_req = (gpre_req*) MSC_alloc(REQ_LEN); slice_req = (gpre_req*) MSC_alloc(REQ_LEN);
slice_req->req_type = REQ_slice; slice_req->req_type = REQ_slice;
node->nod_arg[2] = (GPRE_NOD) slice_req; node->nod_arg[2] = (gpre_nod*) slice_req;
} }
} }
@ -458,7 +461,7 @@ GPRE_NOD SQE_field(gpre_req* request,
gpre_ctx* context; gpre_ctx* context;
ref* reference = (REF) MSC_alloc(REF_LEN); ref* reference = (REF) MSC_alloc(REF_LEN);
node = MSC_unary(nod_field, (GPRE_NOD) reference); node = MSC_unary(nod_field, (gpre_nod*) reference);
gpre_sym* symbol = gpreGlob.token_global.tok_symbol; gpre_sym* symbol = gpreGlob.token_global.tok_symbol;
if (symbol) { if (symbol) {
@ -566,7 +569,7 @@ GPRE_NOD SQE_field(gpre_req* request,
node = node =
EXP_array(request, reference->ref_field, EXP_array(request, reference->ref_field,
true, true); true, true);
node->nod_arg[0] = (GPRE_NOD) reference; node->nod_arg[0] = (gpre_nod*) reference;
} }
return node; return node;
} }
@ -608,7 +611,7 @@ GPRE_NOD SQE_field(gpre_req* request,
node = node =
EXP_array(request, reference->ref_field, true, EXP_array(request, reference->ref_field, true,
true); true);
node->nod_arg[0] = (GPRE_NOD) reference; node->nod_arg[0] = (gpre_nod*) reference;
} }
CPR_token(); CPR_token();
return node; return node;
@ -654,7 +657,7 @@ GPRE_NOD SQE_field(gpre_req* request,
CPR_token(); CPR_token();
if (reference->ref_field->fld_array_info) { if (reference->ref_field->fld_array_info) {
node = EXP_array(request, reference->ref_field, true, true); node = EXP_array(request, reference->ref_field, true, true);
node->nod_arg[0] = (GPRE_NOD) reference; node->nod_arg[0] = (gpre_nod*) reference;
} }
if (request->req_map) if (request->req_map)
return post_map(node, request->req_map); return post_map(node, request->req_map);
@ -673,7 +676,7 @@ GPRE_NOD SQE_field(gpre_req* request,
// whole mess in a list node. // whole mess in a list node.
// //
GPRE_NOD SQE_list(pfn_SQE_list_cb routine, gpre_nod* SQE_list(pfn_SQE_list_cb routine,
gpre_req* request, gpre_req* request,
bool aster_ok) bool aster_ok)
{ {
@ -691,7 +694,7 @@ GPRE_NOD SQE_list(pfn_SQE_list_cb routine,
gpre_nod** ptr = &list->nod_arg[count]; gpre_nod** ptr = &list->nod_arg[count];
while (stack) while (stack)
*--ptr = (GPRE_NOD) MSC_pop(&stack); *--ptr = (gpre_nod*) MSC_pop(&stack);
return list; return list;
} }
@ -798,7 +801,7 @@ REF SQE_parameter(gpre_req* request,
// Procedure called from EXP_array to post the "subscript field". // Procedure called from EXP_array to post the "subscript field".
// //
void SQE_post_field( GPRE_NOD input, gpre_fld* field) void SQE_post_field( gpre_nod* input, gpre_fld* field)
{ {
if (!input || !field) if (!input || !field)
return; return;
@ -856,7 +859,7 @@ void SQE_post_field( GPRE_NOD input, gpre_fld* field)
// //
REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context, REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context,
GPRE_NOD node) gpre_nod* node)
{ {
REF reference; REF reference;
@ -919,7 +922,7 @@ REF SQE_post_reference(gpre_req* request, gpre_fld* field, gpre_ctx* context,
// otherwise false. // otherwise false.
// //
bool SQE_resolve(GPRE_NOD node, bool SQE_resolve(gpre_nod* node,
gpre_req* request, gpre_req* request,
gpre_rse* selection) gpre_rse* selection)
{ {
@ -1072,7 +1075,7 @@ bool SQE_resolve(GPRE_NOD node,
node->nod_type = nod_field; node->nod_type = nod_field;
node->nod_arg[0] = (GPRE_NOD) reference; node->nod_arg[0] = (gpre_nod*) reference;
return false; return false;
} }
@ -1109,7 +1112,7 @@ gpre_rse* SQE_select(gpre_req* request,
if (!MSC_match(KW_SELECT)) if (!MSC_match(KW_SELECT))
CPR_s_error("SELECT"); CPR_s_error("SELECT");
MSC_push((GPRE_NOD) request->req_contexts, &context_stack); MSC_push((gpre_nod*) request->req_contexts, &context_stack);
request->req_contexts = NULL; request->req_contexts = NULL;
request->req_map = NULL; request->req_map = NULL;
gpre_rse* rse2 = par_select(request, rse1); gpre_rse* rse2 = par_select(request, rse1);
@ -1121,8 +1124,8 @@ gpre_rse* SQE_select(gpre_req* request,
select->rse_context[0] = context = MSC_context(request); select->rse_context[0] = context = MSC_context(request);
gpre_nod* node = MSC_node(nod_union, 2); gpre_nod* node = MSC_node(nod_union, 2);
select->rse_union = node; select->rse_union = node;
node->nod_arg[0] = (GPRE_NOD) rse1; node->nod_arg[0] = (gpre_nod*) rse1;
node->nod_arg[1] = (GPRE_NOD) rse2; node->nod_arg[1] = (gpre_nod*) rse2;
map* new_map = (map*) MSC_alloc(sizeof(map)); map* new_map = (map*) MSC_alloc(sizeof(map));
rse1->rse_map = new_map; rse1->rse_map = new_map;
@ -1168,7 +1171,7 @@ gpre_rse* SQE_select(gpre_req* request,
// Parse either of the low precedence operators + and -. // Parse either of the low precedence operators + and -.
// //
GPRE_NOD SQE_value(gpre_req* request, gpre_nod* SQE_value(gpre_req* request,
bool aster_ok, bool aster_ok,
USHORT * paren_count, USHORT * paren_count,
bool * bool_flag) bool * bool_flag)
@ -1220,7 +1223,7 @@ GPRE_NOD SQE_value(gpre_req* request,
// expression. // expression.
// //
GPRE_NOD SQE_value_or_null(gpre_req* request, gpre_nod* SQE_value_or_null(gpre_req* request,
bool aster_ok, bool aster_ok,
USHORT * paren_count, USHORT * paren_count,
bool * bool_flag) bool * bool_flag)
@ -1239,7 +1242,7 @@ GPRE_NOD SQE_value_or_null(gpre_req* request,
// "INDICATOR". // "INDICATOR".
// //
GPRE_NOD SQE_variable(gpre_req* request, gpre_nod* SQE_variable(gpre_req* request,
bool aster_ok, bool aster_ok,
USHORT * paren_count, USHORT * paren_count,
bool * bool_flag) bool * bool_flag)
@ -1270,7 +1273,7 @@ GPRE_NOD SQE_variable(gpre_req* request,
if (MSC_match(KW_COLON)) if (MSC_match(KW_COLON))
reference->ref_null_value = PAR_native_value(false, false); reference->ref_null_value = PAR_native_value(false, false);
return (GPRE_NOD) reference; return (gpre_nod*) reference;
} }
@ -1280,8 +1283,8 @@ GPRE_NOD SQE_variable(gpre_req* request,
// return TRUE, otherwise FALSE. // return TRUE, otherwise FALSE.
// //
static bool compare_expr(GPRE_NOD node1, static bool compare_expr(gpre_nod* node1,
GPRE_NOD node2) gpre_nod* node2)
{ {
REF ref1, ref2; REF ref1, ref2;
@ -1328,7 +1331,7 @@ static bool compare_expr(GPRE_NOD node1,
// Copy a field list for a SELECT against an artificial context. // Copy a field list for a SELECT against an artificial context.
// //
static GPRE_NOD copy_fields( GPRE_NOD fields, map* fields_map) static gpre_nod* copy_fields( gpre_nod* fields, map* fields_map)
{ {
assert_IS_NOD(fields); assert_IS_NOD(fields);
@ -1346,7 +1349,7 @@ static GPRE_NOD copy_fields( GPRE_NOD fields, map* fields_map)
// Expand an '*' in a field list to the corresponding fields. // Expand an '*' in a field list to the corresponding fields.
// //
static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, gpre_rse* selection) static gpre_nod* explode_asterisk( gpre_nod* fields, int n, gpre_rse* selection)
{ {
TEXT s[ERROR_LENGTH]; TEXT s[ERROR_LENGTH];
@ -1381,7 +1384,7 @@ static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, gpre_rse* selection)
// in the context list. // in the context list.
// //
static GPRE_NOD explode_asterisk_all(GPRE_NOD fields, static gpre_nod* explode_asterisk_all(gpre_nod* fields,
int n, int n,
gpre_rse* selection, gpre_rse* selection,
bool replace) bool replace)
@ -1410,7 +1413,7 @@ static GPRE_NOD explode_asterisk_all(GPRE_NOD fields,
// field for determining the data type of a host variable. // field for determining the data type of a host variable.
// //
static gpre_fld* get_ref( GPRE_NOD expr) static gpre_fld* get_ref( gpre_nod* expr)
{ {
gpre_fld* field; gpre_fld* field;
@ -1486,12 +1489,12 @@ static gpre_fld* get_ref( GPRE_NOD expr)
// map. // map.
// //
static GPRE_NOD implicit_any(gpre_req* request, static gpre_nod* implicit_any(gpre_req* request,
GPRE_NOD value, gpre_nod* value,
enum nod_t comparison, nod_t comparison,
enum nod_t any_all) nod_t any_all)
{ {
GPRE_NOD node; gpre_nod* node;
scope previous_scope; scope previous_scope;
assert_IS_REQ(request); assert_IS_REQ(request);
@ -1534,12 +1537,12 @@ static GPRE_NOD implicit_any(gpre_req* request,
else else
node = MSC_node(nod_any, 1); node = MSC_node(nod_any, 1);
node->nod_count = 0; node->nod_count = 0;
node->nod_arg[0] = (GPRE_NOD) selection; node->nod_arg[0] = (gpre_nod*) selection;
} }
else { else {
gpre_nod* node2 = MSC_node(nod_via, 3); gpre_nod* node2 = MSC_node(nod_via, 3);
node2->nod_count = 0; node2->nod_count = 0;
node2->nod_arg[0] = (GPRE_NOD) selection; node2->nod_arg[0] = (gpre_nod*) selection;
node2->nod_arg[2] = MSC_node(nod_null, 0); node2->nod_arg[2] = MSC_node(nod_null, 0);
node2->nod_arg[1] = value2; node2->nod_arg[1] = value2;
node = MSC_binary(comparison, value, node2); node = MSC_binary(comparison, value, node2);
@ -1557,7 +1560,7 @@ static GPRE_NOD implicit_any(gpre_req* request,
else else
node = MSC_node(nod_any, 1); node = MSC_node(nod_any, 1);
node->nod_count = 0; node->nod_count = 0;
node->nod_arg[0] = (GPRE_NOD) selection; node->nod_arg[0] = (gpre_nod*) selection;
} }
EXP_rse_cleanup(selection); EXP_rse_cleanup(selection);
@ -1574,7 +1577,7 @@ static GPRE_NOD implicit_any(gpre_req* request,
// Merge two (possibly null) booleans into a single conjunct. // Merge two (possibly null) booleans into a single conjunct.
// //
static GPRE_NOD merge( GPRE_NOD expr1, GPRE_NOD expr2) static gpre_nod* merge( gpre_nod* expr1, gpre_nod* expr2)
{ {
if (!expr1) if (!expr1)
@ -1598,8 +1601,8 @@ static GPRE_NOD merge( GPRE_NOD expr1, GPRE_NOD expr2)
// after the nth entry. // after the nth entry.
// //
static GPRE_NOD merge_fields(GPRE_NOD fields_1, static gpre_nod* merge_fields(gpre_nod* fields_1,
GPRE_NOD fields_2, gpre_nod* fields_2,
int n, int n,
bool replace) bool replace)
{ {
@ -1641,7 +1644,7 @@ static GPRE_NOD merge_fields(GPRE_NOD fields_1,
// Construct negation of expression. // Construct negation of expression.
// //
static GPRE_NOD negate( GPRE_NOD expr) static gpre_nod* negate( gpre_nod* expr)
{ {
assert_IS_NOD(expr); assert_IS_NOD(expr);
@ -1658,7 +1661,7 @@ static GPRE_NOD negate( GPRE_NOD expr)
// host language variable. // host language variable.
// //
static void pair( GPRE_NOD expr1, GPRE_NOD expr2) static void pair( gpre_nod* expr1, gpre_nod* expr2)
{ {
assert_IS_NOD(expr1); assert_IS_NOD(expr1);
assert_IS_NOD(expr2); assert_IS_NOD(expr2);
@ -1706,7 +1709,7 @@ static void pair( GPRE_NOD expr1, GPRE_NOD expr2)
// view stack are those used in the view definition. // view stack are those used in the view definition.
// //
static gpre_ctx* par_alias_list( gpre_req* request, GPRE_NOD alias_list) static gpre_ctx* par_alias_list( gpre_req* request, gpre_nod* alias_list)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
assert_IS_NOD(alias_list); assert_IS_NOD(alias_list);
@ -1889,11 +1892,11 @@ static gpre_rel* par_base_table( gpre_req* request, const gpre_rel* relation,
// In this case nod_arg[0] = value0, nod_arg[1] = test_value1, nod_arg[2] = match_value1, ..., // In this case nod_arg[0] = value0, nod_arg[1] = test_value1, nod_arg[2] = match_value1, ...,
// nod_arg[n] = else_value // nod_arg[n] = else_value
// //
static GPRE_NOD par_case(gpre_req* request) static gpre_nod* par_case(gpre_req* request)
{ {
gpre_lls* stack = NULL; gpre_lls* stack = NULL;
int count = 0; int count = 0;
NOD_T nod_type; nod_t nod_type;
if (MSC_match(KW_WHEN)) if (MSC_match(KW_WHEN))
{ {
@ -1969,7 +1972,7 @@ static GPRE_NOD par_case(gpre_req* request)
// Parse an AND boolean expression. // Parse an AND boolean expression.
// //
static GPRE_NOD par_and( gpre_req* request, USHORT * paren_count) static gpre_nod* par_and( gpre_req* request, USHORT * paren_count)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
@ -1986,7 +1989,7 @@ static GPRE_NOD par_and( gpre_req* request, USHORT * paren_count)
// //
// //
static GPRE_NOD par_collate( gpre_req* request, GPRE_NOD arg) static gpre_nod* par_collate( gpre_req* request, gpre_nod* arg)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
assert_IS_NOD(arg); assert_IS_NOD(arg);
@ -1995,7 +1998,7 @@ static GPRE_NOD par_collate( gpre_req* request, GPRE_NOD arg)
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[0] = arg; node->nod_arg[0] = arg;
gpre_fld* field = (gpre_fld*) MSC_alloc(FLD_LEN); gpre_fld* field = (gpre_fld*) MSC_alloc(FLD_LEN);
node->nod_arg[1] = (GPRE_NOD) field; node->nod_arg[1] = (gpre_nod*) field;
CME_get_dtype(arg, field); CME_get_dtype(arg, field);
if (field->fld_dtype > dtype_any_text) { if (field->fld_dtype > dtype_any_text) {
// cast expression to VARYING with implementation-defined // cast expression to VARYING with implementation-defined
@ -2025,9 +2028,9 @@ static GPRE_NOD par_collate( gpre_req* request, GPRE_NOD arg)
// <value> IN (SELECT <column> <from_nonsense>) // <value> IN (SELECT <column> <from_nonsense>)
// //
static GPRE_NOD par_in( gpre_req* request, GPRE_NOD value) static gpre_nod* par_in( gpre_req* request, gpre_nod* value)
{ {
GPRE_NOD node; gpre_nod* node;
SCHAR s[ERROR_LENGTH]; SCHAR s[ERROR_LENGTH];
assert_IS_REQ(request); assert_IS_REQ(request);
@ -2106,8 +2109,8 @@ static gpre_ctx* par_join_clause( gpre_req* request, gpre_ctx* context1)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
const NOD_T join_type = par_join_type(); const nod_t join_type = par_join_type();
if (join_type == (NOD_T) 0) if (join_type == nod_nothing)
return context1; return context1;
gpre_ctx* context2 = par_joined_relation(request, context1); gpre_ctx* context2 = par_joined_relation(request, context1);
@ -2138,9 +2141,9 @@ static gpre_ctx* par_join_clause( gpre_req* request, gpre_ctx* context1)
// Parse a join type. // Parse a join type.
// //
static NOD_T par_join_type(void) static nod_t par_join_type()
{ {
NOD_T nod_type; nod_t nod_type;
if (MSC_match(KW_INNER)) if (MSC_match(KW_INNER))
nod_type = nod_join_inner; nod_type = nod_join_inner;
@ -2153,7 +2156,7 @@ static NOD_T par_join_type(void)
else if (MSC_match(KW_JOIN)) else if (MSC_match(KW_JOIN))
return nod_join_inner; return nod_join_inner;
else else
return (NOD_T) 0; return nod_nothing;
if (nod_type != nod_join_inner) if (nod_type != nod_join_inner)
MSC_match(KW_OUTER); MSC_match(KW_OUTER);
@ -2170,7 +2173,7 @@ static NOD_T par_join_type(void)
// Parse either of the high precedence operators * and /. // Parse either of the high precedence operators * and /.
// //
static GPRE_NOD par_multiply(gpre_req* request, static gpre_nod* par_multiply(gpre_req* request,
bool aster_ok, bool aster_ok,
USHORT * paren_count, USHORT * paren_count,
bool * bool_flag) bool * bool_flag)
@ -2183,8 +2186,8 @@ static GPRE_NOD par_multiply(gpre_req* request,
if (gpreGlob.token_global.tok_keyword == KW_COLLATE) if (gpreGlob.token_global.tok_keyword == KW_COLLATE)
return par_collate(request, node); return par_collate(request, node);
GPRE_NOD arg; gpre_nod* arg;
enum nod_t nod_type; nod_t nod_type;
while (true) { while (true) {
if (MSC_match(KW_ASTERISK)) if (MSC_match(KW_ASTERISK))
nod_type = nod_times; nod_type = nod_times;
@ -2206,14 +2209,14 @@ static GPRE_NOD par_multiply(gpre_req* request,
// Parse an NOT boolean expression. // Parse an NOT boolean expression.
// //
static GPRE_NOD par_not( gpre_req* request, USHORT * paren_count) static gpre_nod* par_not( gpre_req* request, USHORT * paren_count)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
if (MSC_match(KW_NOT)) if (MSC_match(KW_NOT))
return negate(par_not(request, paren_count)); return negate(par_not(request, paren_count));
enum nod_t type = (enum nod_t) 0; nod_t type = nod_nothing;
if (MSC_match(KW_EXISTS)) if (MSC_match(KW_EXISTS))
type = nod_any; type = nod_any;
@ -2238,7 +2241,7 @@ static GPRE_NOD par_not( gpre_req* request, USHORT * paren_count)
gpre_nod* node = MSC_node(type, 1); gpre_nod* node = MSC_node(type, 1);
node->nod_count = 0; node->nod_count = 0;
gpre_rse* selection = par_rse(request, 0, false); gpre_rse* selection = par_rse(request, 0, false);
node->nod_arg[0] = (GPRE_NOD) selection; node->nod_arg[0] = (gpre_nod*) selection;
if (field) { if (field) {
SQE_resolve(field, 0, selection); SQE_resolve(field, 0, selection);
gpre_nod* expr = MSC_unary(nod_missing, field); gpre_nod* expr = MSC_unary(nod_missing, field);
@ -2261,7 +2264,7 @@ static GPRE_NOD par_not( gpre_req* request, USHORT * paren_count)
// CASE exp1 WHEN exp2 THEN NULL ELSE exp1 END, so // CASE exp1 WHEN exp2 THEN NULL ELSE exp1 END, so
// we generate a nod_case1 node. // we generate a nod_case1 node.
static GPRE_NOD par_nullif(gpre_req* request) static gpre_nod* par_nullif(gpre_req* request)
{ {
gpre_nod* node = MSC_node(nod_case1, 4); gpre_nod* node = MSC_node(nod_case1, 4);
EXP_left_paren(0); EXP_left_paren(0);
@ -2288,7 +2291,7 @@ static void par_order(gpre_req* request,
bool union_f, bool union_f,
bool view_flag) bool view_flag)
{ {
GPRE_NOD sort; gpre_nod* sort;
map* request_map; map* request_map;
USHORT i; USHORT i;
@ -2328,7 +2331,7 @@ static void par_order(gpre_req* request,
else if (MSC_match(KW_DESCENDING)) else if (MSC_match(KW_DESCENDING))
direction = TRUE; direction = TRUE;
count++; count++;
MSC_push((GPRE_NOD)(IPTR)direction, &directions); MSC_push((gpre_nod*)(IPTR)direction, &directions);
MSC_push(sort, &items); MSC_push(sort, &items);
if (!MSC_match(KW_COMMA)) if (!MSC_match(KW_COMMA))
break; break;
@ -2339,8 +2342,8 @@ static void par_order(gpre_req* request,
gpre_nod** ptr = sort->nod_arg + count * 2; gpre_nod** ptr = sort->nod_arg + count * 2;
while (items) { while (items) {
*--ptr = (GPRE_NOD) MSC_pop(&items); *--ptr = (gpre_nod*) MSC_pop(&items);
*--ptr = (GPRE_NOD) MSC_pop(&directions); *--ptr = (gpre_nod*) MSC_pop(&directions);
} }
} }
@ -2351,13 +2354,13 @@ static void par_order(gpre_req* request,
// for a query as part of a select expression. // for a query as part of a select expression.
// //
static GPRE_NOD par_plan( gpre_req* request) static gpre_nod* par_plan( gpre_req* request)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
// parse the join type // parse the join type
NOD_T nod_type; nod_t nod_type;
if (MSC_match(KW_JOIN)) if (MSC_match(KW_JOIN))
nod_type = nod_join; nod_type = nod_join;
else if (MSC_match(KW_MERGE)) else if (MSC_match(KW_MERGE))
@ -2392,7 +2395,7 @@ static GPRE_NOD par_plan( gpre_req* request)
// access plan. // access plan.
// //
static GPRE_NOD par_plan_item(gpre_req* request, static gpre_nod* par_plan_item(gpre_req* request,
bool aster_ok, bool aster_ok,
USHORT * paren_count, USHORT * paren_count,
bool * bool_flag) bool * bool_flag)
@ -2421,7 +2424,7 @@ static GPRE_NOD par_plan_item(gpre_req* request,
break; break;
} }
MSC_push((GPRE_NOD) upcase_string(gpreGlob.token_global.tok_string), &stack); MSC_push((gpre_nod*) upcase_string(gpreGlob.token_global.tok_string), &stack);
PAR_get_token(); PAR_get_token();
} }
@ -2432,7 +2435,7 @@ static GPRE_NOD par_plan_item(gpre_req* request,
gpre_nod* alias_list = MSC_node(nod_list, (SSHORT) count); gpre_nod* alias_list = MSC_node(nod_list, (SSHORT) count);
for (ptr = &alias_list->nod_arg[count]; stack;) for (ptr = &alias_list->nod_arg[count]; stack;)
*--ptr = (GPRE_NOD) MSC_pop(&stack); *--ptr = (gpre_nod*) MSC_pop(&stack);
// lookup the contexts for the aliases // lookup the contexts for the aliases
@ -2452,7 +2455,7 @@ static GPRE_NOD par_plan_item(gpre_req* request,
if (gpreGlob.token_global.tok_type != tok_ident) if (gpreGlob.token_global.tok_type != tok_ident)
CPR_s_error("<index name>"); CPR_s_error("<index name>");
access_type->nod_arg[0] = (GPRE_NOD) upcase_string(gpreGlob.token_global.tok_string); access_type->nod_arg[0] = (gpre_nod*) upcase_string(gpreGlob.token_global.tok_string);
PAR_get_token(); PAR_get_token();
} }
else if (gpreGlob.token_global.tok_keyword == KW_INDEX) { else if (gpreGlob.token_global.tok_keyword == KW_INDEX) {
@ -2464,7 +2467,7 @@ static GPRE_NOD par_plan_item(gpre_req* request,
stack = NULL; stack = NULL;
for (count = 0; gpreGlob.token_global.tok_type == tok_ident;) { for (count = 0; gpreGlob.token_global.tok_type == tok_ident;) {
MSC_push((GPRE_NOD) upcase_string(gpreGlob.token_global.tok_string), &stack); MSC_push((gpre_nod*) upcase_string(gpreGlob.token_global.tok_string), &stack);
PAR_get_token(); PAR_get_token();
count++; count++;
@ -2478,7 +2481,7 @@ static GPRE_NOD par_plan_item(gpre_req* request,
gpre_nod* index_list = MSC_node(nod_list, (SSHORT) count); gpre_nod* index_list = MSC_node(nod_list, (SSHORT) count);
access_type->nod_arg[0] = index_list; access_type->nod_arg[0] = index_list;
for (ptr = &index_list->nod_arg[count]; stack;) for (ptr = &index_list->nod_arg[count]; stack;)
*--ptr = (GPRE_NOD) MSC_pop(&stack); *--ptr = (gpre_nod*) MSC_pop(&stack);
if (!EXP_match_paren()) if (!EXP_match_paren())
return NULL; return NULL;
@ -2494,7 +2497,7 @@ static GPRE_NOD par_plan_item(gpre_req* request,
plan_item->nod_count = 2; plan_item->nod_count = 2;
plan_item->nod_arg[0] = alias_list; plan_item->nod_arg[0] = alias_list;
plan_item->nod_arg[1] = access_type; plan_item->nod_arg[1] = access_type;
plan_item->nod_arg[2] = (GPRE_NOD) context; plan_item->nod_arg[2] = (gpre_nod*) context;
return plan_item; return plan_item;
} }
@ -2515,7 +2518,7 @@ static GPRE_NOD par_plan_item(gpre_req* request,
// user defined function // user defined function
// //
static GPRE_NOD par_primitive_value(gpre_req* request, static gpre_nod* par_primitive_value(gpre_req* request,
bool aster_ok, bool aster_ok,
USHORT * paren_count, USHORT * paren_count,
bool * bool_flag) bool * bool_flag)
@ -2654,7 +2657,7 @@ static GPRE_NOD par_primitive_value(gpre_req* request,
return NULL; return NULL;
} }
ref* reference = (REF) SQE_variable(request, false, NULL, NULL); ref* reference = (REF) SQE_variable(request, false, NULL, NULL);
node = MSC_unary(nod_value, (GPRE_NOD) reference); node = MSC_unary(nod_value, (gpre_nod*) reference);
reference->ref_next = request->req_values; reference->ref_next = request->req_values;
request->req_values = reference; request->req_values = reference;
return node; return node;
@ -2675,7 +2678,7 @@ static GPRE_NOD par_primitive_value(gpre_req* request,
// anything that makes sense until now // anything that makes sense until now
{ {
// ** Begin date/time/timestamp support * // ** Begin date/time/timestamp support *
const KWWORDS kw_word = gpreGlob.token_global.tok_keyword; const kwwords_t kw_word = gpreGlob.token_global.tok_keyword;
if (MSC_match(KW_DATE) || MSC_match(KW_TIME) || MSC_match(KW_TIMESTAMP)) { if (MSC_match(KW_DATE) || MSC_match(KW_TIME) || MSC_match(KW_TIMESTAMP)) {
gpreGlob.token_global.tok_keyword = kw_word; gpreGlob.token_global.tok_keyword = kw_word;
@ -2696,7 +2699,7 @@ static GPRE_NOD par_primitive_value(gpre_req* request,
// Parse relational expression. // Parse relational expression.
// //
static GPRE_NOD par_relational(gpre_req* request, static gpre_nod* par_relational(gpre_req* request,
USHORT * paren_count) USHORT * paren_count)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
@ -2707,7 +2710,7 @@ static GPRE_NOD par_relational(gpre_req* request,
return expr1; return expr1;
if (gpreGlob.token_global.tok_keyword == KW_SEMI_COLON) if (gpreGlob.token_global.tok_keyword == KW_SEMI_COLON)
{ {
for (const NOD_T* relational_ops = relationals; *relational_ops != (NOD_T) 0; for (const nod_t* relational_ops = relationals; *relational_ops != nod_nothing;
relational_ops++) relational_ops++)
{ {
if (expr1->nod_type == *relational_ops) if (expr1->nod_type == *relational_ops)
@ -2721,7 +2724,7 @@ static GPRE_NOD par_relational(gpre_req* request,
// Check for one of the binary operators // Check for one of the binary operators
GPRE_NOD node; gpre_nod* node;
if (MSC_match(KW_IN)) if (MSC_match(KW_IN))
node = par_in(request, expr1); node = par_in(request, expr1);
else if (MSC_match(KW_BETWEEN)) { else if (MSC_match(KW_BETWEEN)) {
@ -2766,8 +2769,8 @@ static GPRE_NOD par_relational(gpre_req* request,
if (MSC_match(op->rel_kw)) if (MSC_match(op->rel_kw))
break; break;
if ((int) op->rel_kw == (int) KW_none) { if ((int) op->rel_kw == (int) KW_none) {
for (const NOD_T* relational_ops = relationals; for (const nod_t* relational_ops = relationals;
*relational_ops != (NOD_T) 0; relational_ops++) *relational_ops != nod_nothing; relational_ops++)
{ {
if (expr1->nod_type == *relational_ops) if (expr1->nod_type == *relational_ops)
return expr1; return expr1;
@ -2806,7 +2809,7 @@ static GPRE_NOD par_relational(gpre_req* request,
// Out of alphabetical order. // Out of alphabetical order.
static bool resolve_fields(GPRE_NOD& fields, static bool resolve_fields(gpre_nod*& fields,
gpre_req* request, gpre_req* request,
gpre_rse* selection) gpre_rse* selection)
{ {
@ -2859,7 +2862,7 @@ static bool resolve_fields(GPRE_NOD& fields,
// //
static gpre_rse* par_rse(gpre_req* request, static gpre_rse* par_rse(gpre_req* request,
GPRE_NOD fields, gpre_nod* fields,
bool distinct) bool distinct)
{ {
gpre_lls* stack = NULL; gpre_lls* stack = NULL;
@ -2876,7 +2879,7 @@ static gpre_rse* par_rse(gpre_req* request,
gpre_ctx* context; gpre_ctx* context;
do { do {
if (context = par_joined_relation(request, NULL)) { if (context = par_joined_relation(request, NULL)) {
MSC_push((GPRE_NOD) context, &stack); MSC_push((gpre_nod*) context, &stack);
count++; count++;
} }
else else
@ -3035,7 +3038,7 @@ static gpre_rse* par_select( gpre_req* request, gpre_rse* union_rse)
// has already eaten the SELECT on the front. // has already eaten the SELECT on the front.
// //
static GPRE_NOD par_stat( gpre_req* request) static gpre_nod* par_stat( gpre_req* request)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
@ -3060,7 +3063,7 @@ static GPRE_NOD par_stat( gpre_req* request)
gpre_nod* node = MSC_node(nod_via, 3); gpre_nod* node = MSC_node(nod_via, 3);
node->nod_count = 0; node->nod_count = 0;
node->nod_arg[0] = (GPRE_NOD) select; node->nod_arg[0] = (gpre_nod*) select;
node->nod_arg[2] = MSC_node(nod_null, 0); node->nod_arg[2] = MSC_node(nod_null, 0);
node->nod_arg[1] = item; node->nod_arg[1] = item;
@ -3077,12 +3080,12 @@ static GPRE_NOD par_stat( gpre_req* request)
// Parse a subscript value. // Parse a subscript value.
// //
static GPRE_NOD par_subscript( gpre_req* request) static gpre_nod* par_subscript( gpre_req* request)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
ref* reference = (REF) MSC_alloc(REF_LEN); ref* reference = (REF) MSC_alloc(REF_LEN);
gpre_nod* node = MSC_unary(nod_value, (GPRE_NOD) reference); gpre_nod* node = MSC_unary(nod_value, (gpre_nod*) reference);
// Special case literals // Special case literals
@ -3112,7 +3115,7 @@ static GPRE_NOD par_subscript( gpre_req* request)
// //
// Parse the SUBSTRING built-in function // Parse the SUBSTRING built-in function
// //
static GPRE_NOD par_substring(gpre_req* request) static gpre_nod* par_substring(gpre_req* request)
{ {
gpre_nod* node = MSC_node(nod_substring, 3); gpre_nod* node = MSC_node(nod_substring, 3);
EXP_left_paren(0); EXP_left_paren(0);
@ -3144,7 +3147,7 @@ static GPRE_NOD par_substring(gpre_req* request)
// No FOR clause given, fake up a numeric literal of 32767 (the max length // No FOR clause given, fake up a numeric literal of 32767 (the max length
// of a VarChar) to force copying to end of string. // of a VarChar) to force copying to end of string.
ref* reference1 = (ref*) MSC_alloc(REF_LEN); ref* reference1 = (ref*) MSC_alloc(REF_LEN);
node->nod_arg[2] = MSC_unary(nod_literal, (GPRE_NOD) reference1); node->nod_arg[2] = MSC_unary(nod_literal, (gpre_nod*) reference1);
string = (TEXT*) MSC_alloc(6); string = (TEXT*) MSC_alloc(6);
MSC_copy("32767", 5, (char*) string); MSC_copy("32767", 5, (char*) string);
reference1->ref_value = string; reference1->ref_value = string;
@ -3177,7 +3180,7 @@ static void par_terminating_parens(
// complain bitterly. // complain bitterly.
// //
static GPRE_NOD par_udf( gpre_req* request) static gpre_nod* par_udf( gpre_req* request)
{ {
if (!request) if (!request)
return NULL; return NULL;
@ -3189,7 +3192,7 @@ static GPRE_NOD par_udf( gpre_req* request)
if ((isQuoted(gpreGlob.token_global.tok_type)) || gpreGlob.token_global.tok_type == tok_ident) if ((isQuoted(gpreGlob.token_global.tok_type)) || gpreGlob.token_global.tok_type == tok_ident)
SQL_resolve_identifier("<Udf Name>", NULL, NAME_SIZE); SQL_resolve_identifier("<Udf Name>", NULL, NAME_SIZE);
GPRE_NOD node; gpre_nod* node;
USHORT local_count; USHORT local_count;
udf* an_udf; udf* an_udf;
@ -3228,7 +3231,7 @@ static GPRE_NOD par_udf( gpre_req* request)
node = MSC_node(nod_udf, 2); node = MSC_node(nod_udf, 2);
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[1] = (GPRE_NOD) an_udf; node->nod_arg[1] = (gpre_nod*) an_udf;
PAR_get_token(); PAR_get_token();
EXP_left_paren(0); EXP_left_paren(0);
if (!(gpreGlob.token_global.tok_keyword == KW_RIGHT_PAREN)) { if (!(gpreGlob.token_global.tok_keyword == KW_RIGHT_PAREN)) {
@ -3248,7 +3251,7 @@ static GPRE_NOD par_udf( gpre_req* request)
} }
} }
else { else {
node->nod_arg[0] = (GPRE_NOD) 0; node->nod_arg[0] = (gpre_nod*) 0;
node->nod_count = 0; node->nod_count = 0;
} }
local_count = 1; local_count = 1;
@ -3266,7 +3269,7 @@ static GPRE_NOD par_udf( gpre_req* request)
node->nod_count = 1; node->nod_count = 1;
EXP_left_paren(0); EXP_left_paren(0);
SQL_resolve_identifier("<Generator Name>", gen_name, NAME_SIZE); SQL_resolve_identifier("<Generator Name>", gen_name, NAME_SIZE);
node->nod_arg[1] = (GPRE_NOD) gen_name; node->nod_arg[1] = (gpre_nod*) gen_name;
PAR_get_token(); PAR_get_token();
if (!MSC_match(KW_COMMA)) if (!MSC_match(KW_COMMA))
CPR_s_error("<comma>"); CPR_s_error("<comma>");
@ -3312,7 +3315,7 @@ static GPRE_NOD par_udf( gpre_req* request)
if (MSC_match(KW_EXTRACT)) { if (MSC_match(KW_EXTRACT)) {
node = MSC_node(nod_extract, 2); node = MSC_node(nod_extract, 2);
EXP_left_paren(0); EXP_left_paren(0);
KWWORDS kw_word = gpreGlob.token_global.tok_keyword; kwwords_t kw_word = gpreGlob.token_global.tok_keyword;
if (MSC_match(KW_YEAR) || MSC_match(KW_MONTH) || MSC_match(KW_DAY) || if (MSC_match(KW_YEAR) || MSC_match(KW_MONTH) || MSC_match(KW_DAY) ||
MSC_match(KW_HOUR) || MSC_match(KW_MINUTE) || MSC_match(KW_SECOND) || MSC_match(KW_HOUR) || MSC_match(KW_MINUTE) || MSC_match(KW_SECOND) ||
MSC_match(KW_WEEKDAY) || MSC_match(KW_YEARDAY)) MSC_match(KW_WEEKDAY) || MSC_match(KW_YEARDAY))
@ -3357,7 +3360,7 @@ static GPRE_NOD par_udf( gpre_req* request)
if (!MSC_match(KW_AS)) if (!MSC_match(KW_AS))
CPR_s_error("AS"); CPR_s_error("AS");
gpre_fld* field = (gpre_fld*) MSC_alloc(FLD_LEN); gpre_fld* field = (gpre_fld*) MSC_alloc(FLD_LEN);
node->nod_arg[1] = (GPRE_NOD) field; node->nod_arg[1] = (gpre_nod*) field;
SQL_par_field_dtype(request, field, false); SQL_par_field_dtype(request, field, false);
SQL_par_field_collate(request, field); SQL_par_field_collate(request, field);
SQL_adjust_field_dtype(field); SQL_adjust_field_dtype(field);
@ -3403,7 +3406,7 @@ static GPRE_NOD par_udf( gpre_req* request)
// Parse a user defined function or a field name. // Parse a user defined function or a field name.
// //
static GPRE_NOD par_udf_or_field(gpre_req* request, static gpre_nod* par_udf_or_field(gpre_req* request,
bool aster_ok) bool aster_ok)
{ {
assert_IS_REQ(request); assert_IS_REQ(request);
@ -3422,7 +3425,7 @@ static GPRE_NOD par_udf_or_field(gpre_req* request,
// Allow the collate clause to follow. // Allow the collate clause to follow.
// //
static GPRE_NOD par_udf_or_field_with_collate(gpre_req* request, static gpre_nod* par_udf_or_field_with_collate(gpre_req* request,
bool aster_ok, bool aster_ok,
USHORT * paren_count, USHORT * paren_count,
bool * bool_flag) bool * bool_flag)
@ -3485,7 +3488,7 @@ static void par_update(gpre_rse *select, bool have_union, bool view_flag)
// not the computations around them. // not the computations around them.
// //
static GPRE_NOD post_fields( GPRE_NOD node, map* to_map) static gpre_nod* post_fields( gpre_nod* node, map* to_map)
{ {
assert_IS_NOD(node); assert_IS_NOD(node);
@ -3549,7 +3552,7 @@ static GPRE_NOD post_fields( GPRE_NOD node, map* to_map)
// than the expression itself). // than the expression itself).
// //
static GPRE_NOD post_map( GPRE_NOD node, map* to_map) static gpre_nod* post_map( gpre_nod* node, map* to_map)
{ {
MEL element; MEL element;
@ -3566,7 +3569,7 @@ static GPRE_NOD post_map( GPRE_NOD node, map* to_map)
for (element = to_map->map_elements; element; element = element->mel_next) for (element = to_map->map_elements; element; element = element->mel_next)
if (compare_expr(node, element->mel_expr)) if (compare_expr(node, element->mel_expr))
return MSC_unary(nod_map_ref, (GPRE_NOD) element); return MSC_unary(nod_map_ref, (gpre_nod*) element);
// We need to make up a new map reference // We need to make up a new map reference
@ -3579,7 +3582,7 @@ static GPRE_NOD post_map( GPRE_NOD node, map* to_map)
// Make up a reference to the map element // Make up a reference to the map element
return MSC_unary(nod_map_ref, (GPRE_NOD) element); return MSC_unary(nod_map_ref, (gpre_nod*) element);
} }
@ -3592,7 +3595,7 @@ static GPRE_NOD post_map( GPRE_NOD node, map* to_map)
// a UNION. See BUG_8021 & BUG_8000 for examples. // a UNION. See BUG_8021 & BUG_8000 for examples.
// //
static GPRE_NOD post_select_list( GPRE_NOD fields, map* to_map) static gpre_nod* post_select_list( gpre_nod* fields, map* to_map)
{ {
assert_IS_NOD(fields); assert_IS_NOD(fields);
@ -3659,7 +3662,7 @@ static void push_scope(gpre_req* request, scope* save_scope)
// //
static gpre_fld* resolve( static gpre_fld* resolve(
GPRE_NOD node, gpre_nod* node,
gpre_ctx* context, gpre_ctx** found_context, act** slice_action) gpre_ctx* context, gpre_ctx** found_context, act** slice_action)
{ {
gpre_fld* field; gpre_fld* field;
@ -3828,7 +3831,7 @@ static gpre_ctx* resolve_asterisk( TOK q_token, gpre_rse* selection)
// Set field reference for any host variables in expr to field_ref. // Set field reference for any host variables in expr to field_ref.
// //
static void set_ref( GPRE_NOD expr, gpre_fld* field_ref) static void set_ref( gpre_nod* expr, gpre_fld* field_ref)
{ {
assert_IS_NOD(expr); assert_IS_NOD(expr);

View File

@ -24,19 +24,19 @@
#ifndef GPRE_SQE_PROTO_H #ifndef GPRE_SQE_PROTO_H
#define GPRE_SQE_PROTO_H #define GPRE_SQE_PROTO_H
typedef GPRE_NOD (*pfn_SQE_list_cb) (gpre_req*, bool, USHORT*, bool*); typedef gpre_nod* (*pfn_SQE_list_cb) (gpre_req*, bool, USHORT*, bool*);
GPRE_NOD SQE_boolean(gpre_req*, USHORT*); gpre_nod* SQE_boolean(gpre_req*, USHORT*);
gpre_ctx* SQE_context(gpre_req*); gpre_ctx* SQE_context(gpre_req*);
GPRE_NOD SQE_field(gpre_req*, bool); gpre_nod* SQE_field(gpre_req*, bool);
GPRE_NOD SQE_list(pfn_SQE_list_cb, gpre_req*, bool); gpre_nod* SQE_list(pfn_SQE_list_cb, gpre_req*, bool);
REF SQE_parameter(gpre_req*, bool); REF SQE_parameter(gpre_req*, bool);
void SQE_post_field(GPRE_NOD, gpre_fld*); void SQE_post_field(gpre_nod*, gpre_fld*);
REF SQE_post_reference(gpre_req*, gpre_fld*, gpre_ctx*, GPRE_NOD); REF SQE_post_reference(gpre_req*, gpre_fld*, gpre_ctx*, gpre_nod*);
bool SQE_resolve(GPRE_NOD, gpre_req*, gpre_rse*); bool SQE_resolve(gpre_nod*, gpre_req*, gpre_rse*);
gpre_rse* SQE_select(gpre_req*, bool); gpre_rse* SQE_select(gpre_req*, bool);
GPRE_NOD SQE_value(gpre_req*, bool, USHORT*, bool*); gpre_nod* SQE_value(gpre_req*, bool, USHORT*, bool*);
GPRE_NOD SQE_variable(gpre_req*, bool, USHORT*, bool*); gpre_nod* SQE_variable(gpre_req*, bool, USHORT*, bool*);
#endif // GPRE_SQE_PROTO_H #endif // GPRE_SQE_PROTO_H

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@
act* SQL_action(const TEXT*); act* SQL_action(const TEXT*);
void SQL_adjust_field_dtype(gpre_fld*); void SQL_adjust_field_dtype(gpre_fld*);
void SQL_dialect1_bad_type(USHORT); void SQL_dialect1_bad_type(USHORT);
void SQL_init(void); void SQL_init();
void SQL_par_field_collate(gpre_req*, gpre_fld*); void SQL_par_field_collate(gpre_req*, gpre_fld*);
void SQL_par_field_dtype(gpre_req*, gpre_fld*, bool); void SQL_par_field_dtype(gpre_req*, gpre_fld*, bool);
gpre_prc* SQL_procedure(gpre_req*, const TEXT*, const TEXT*, const TEXT*, bool); gpre_prc* SQL_procedure(gpre_req*, const TEXT*, const TEXT*, const TEXT*, bool);

View File

@ -19,7 +19,7 @@
* Stephen W. Boyd - Added support for new features. * Stephen W. Boyd - Added support for new features.
*/ */
typedef enum kwwords { enum kwwords_t {
KW_none = 0, KW_none = 0,
KW_start_actions, KW_start_actions,
KW_ACTIVE, KW_ACTIVE,
@ -327,4 +327,4 @@ typedef enum kwwords {
KW_THEN, KW_THEN,
KW_SUBSTRING, KW_SUBSTRING,
KW_max KW_max
} KWWORDS; };