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

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

This commit is contained in:
robocop 2008-12-31 09:35:52 +00:00
parent 7780e53f50
commit a1d52589d2
19 changed files with 1114 additions and 1271 deletions

View File

@ -1270,7 +1270,7 @@ static void gen_ddl( const act* action, int column)
static void gen_drop_database( const act* action, int column)
{
DBB db = (DBB) action->act_object;
gpre_req* request = action->act_request;
//gpre_req* request = action->act_request;
printa(column, "firebird.DROP_DATABASE (%s %d, \"%s\", RDBK_DB_TYPE_GDS);",
status_vector(action), strlen(db->dbb_filename), db->dbb_filename);
@ -1664,7 +1664,7 @@ static void gen_erase( const act* action, int column)
static SSHORT gen_event_block( const act* action)
{
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];
const int ident = CMP_next_ident();
init->nod_arg[2] = (gpre_nod*) ident;
@ -1761,7 +1761,7 @@ static void gen_event_wait( const act* action, int column)
// event has been initialized and getting the event identifier
int ident = -1;
DBB database;
DBB database = NULL;
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;
@ -3089,10 +3089,12 @@ static void gen_variable( const act* action, int column)
static void gen_whenever(const swe* label, int column)
{
while (label) {
const TEXT* condition;
while (label)
{
const TEXT* condition = NULL;
switch (label->swe_condition) {
switch (label->swe_condition)
{
case SWE_error:
condition = "SQLCODE < 0";
break;
@ -3104,6 +3106,11 @@ static void gen_whenever(const swe* label, int column)
case SWE_not_found:
condition = "SQLCODE = 100";
break;
default:
// condition undefined
fb_assert(false);
return;
}
printa(column, "if %s then goto %s; end if;", condition, label->swe_label);
label = label->swe_next;

View File

@ -82,7 +82,7 @@ static void gen_emodify(const act*, int);
static void gen_estore(const act*, int);
static void gen_endfor(const act*, int);
static void gen_erase(const act*, int);
static SSHORT gen_event_block(const act*);
static SSHORT gen_event_block(act*);
static void gen_event_init(const act*, int);
static void gen_event_wait(const act*, int);
static void gen_fetch(const act*, int);
@ -554,7 +554,8 @@ static void asgn_from( const act* action, ref* reference, int column)
{
TEXT name[MAX_REF_SIZE], variable[MAX_REF_SIZE], temp[MAX_REF_SIZE];
for (; reference; reference = reference->ref_next) {
for (; reference; reference = reference->ref_next)
{
bool slice_flag = false;
const gpre_fld* field = reference->ref_field;
if (field->fld_array_info) {
@ -608,8 +609,8 @@ static void asgn_from( const act* action, ref* reference, int column)
fprintf(gpreGlob.out_file, "isc_ftof (%s, sizeof(%s), %s, %d);",
value, value, variable, field->fld_length);
else
fprintf(gpreGlob.out_file, "isc_vtof (%s, %s, %d);", value,
variable, field->fld_length);
fprintf(gpreGlob.out_file, "isc_vtof (%s, %s, %d);",
value, variable, field->fld_length);
}
else if (!reference->ref_master || (reference->ref_flags & REF_literal))
{
@ -640,7 +641,8 @@ static void asgn_to( const act* action, ref* reference, int column)
ref* source = reference->ref_friend;
const gpre_fld* field = source->ref_field;
if (field) {
if (field)
{
act* slice_action;
if (field->fld_array_info && (slice_action = (act*) source->ref_slice)) {
source->ref_value = reference->ref_value;
@ -670,8 +672,8 @@ static void asgn_to( const act* action, ref* reference, int column)
fprintf(gpreGlob.out_file, "isc_ftof (%s, %d, %s, %d);",
s, field->fld_length, reference->ref_value, field->fld_length);
else if (!gpreGlob.sw_cstring || field->fld_sub_type == 1)
fprintf(gpreGlob.out_file, "isc_ftof (%s, %d, %s, sizeof (%s));", s,
field->fld_length, reference->ref_value, reference->ref_value);
fprintf(gpreGlob.out_file, "isc_ftof (%s, %d, %s, sizeof(%s));",
s, field->fld_length, reference->ref_value, reference->ref_value);
else
fprintf(gpreGlob.out_file, isLangCpp(gpreGlob.sw_language) ?
"isc_vtov ((const char*) %s, (char*) %s, sizeof(%s));" :
@ -713,8 +715,8 @@ static void asgn_to_proc(const ref* reference, int column)
fprintf(gpreGlob.out_file, "isc_ftof (%s, %d, %s, %d);",
s, field->fld_length, reference->ref_value, field->fld_length);
else if (!gpreGlob.sw_cstring || field->fld_sub_type == 1)
fprintf(gpreGlob.out_file, "isc_ftof (%s, %d, %s, sizeof (%s));", s,
field->fld_length, reference->ref_value, reference->ref_value);
fprintf(gpreGlob.out_file, "isc_ftof (%s, %d, %s, sizeof(%s));",
s, field->fld_length, reference->ref_value, reference->ref_value);
else
fprintf(gpreGlob.out_file, isLangCpp(gpreGlob.sw_language) ?
"isc_vtov ((const char*) %s, (char*) %s, sizeof(%s));" :
@ -771,11 +773,11 @@ static void gen_at_end( const act* action, int column)
static void gen_based( const act* action, int column)
{
USHORT datatype;
SLONG length;
SLONG length = -1;
align(column);
bas* based_on = (bas*) action->act_object;
gpre_fld* field = based_on->bas_field;
const gpre_fld* field = based_on->bas_field;
if (based_on->bas_flags & BAS_segment) {
datatype = gpreGlob.sw_cstring ? dtype_cstring : dtype_text;
@ -789,7 +791,8 @@ static void gen_based( const act* action, int column)
else
datatype = field->fld_dtype;
switch (datatype) {
switch (datatype)
{
case dtype_short:
fprintf(gpreGlob.out_file, "short");
break;
@ -906,7 +909,7 @@ static void gen_blob_close( const act* action, USHORT column)
if (action->act_error)
begin(column);
blb* blob;
const blb* blob;
if (action->act_flags & ACT_sql) {
column = gen_cursor_close(action, action->act_request, column);
blob = (blb*) action->act_request->req_blobs;
@ -942,7 +945,7 @@ static void gen_blob_end( const act* action, USHORT column)
isc_close_blob (%V1, &%BH);\n\
}";
args.pat_blob = (blb*) action->act_object;
args.pat_blob = (const blb*) action->act_object;
if (action->act_error) {
sprintf(s1, "%s2", global_status_name);
args.pat_vector1 = s1;
@ -1001,12 +1004,12 @@ static void gen_blob_open( const act* action, USHORT column)
}
TEXT s[MAX_REF_SIZE];
blb* blob;
const blb* blob;
const ref* reference;
if (action->act_flags & ACT_sql) {
column = gen_cursor_open(action, action->act_request, column);
blob = (blb*) action->act_request->req_blobs;
reference = ((open_cursor*) action->act_object)->opn_using;
reference = ((const open_cursor*) action->act_object)->opn_using;
gen_name(s, reference, true);
}
else {
@ -1209,13 +1212,12 @@ static void gen_compile( const act* action, int column)
static void gen_create_database( const act* action, int column)
{
PAT args;
const TEXT* pattern1 =
"isc_create_database (%V1, %N1, \"%DF\", &%DH, %IF%S1, %S2%EL(short) 0, (char*) 0%EN, 0);";
TEXT s1[32], s2[32], trname[32];
gpre_req* request = ((mdbb*) action->act_object)->mdbb_dpb_request;
DBB db = (DBB) request->req_database;
const gpre_req* request = ((const mdbb*) action->act_object)->mdbb_dpb_request;
const dbb* db = (dbb*) request->req_database;
sprintf(s1, "isc_%dl", request->req_ident);
sprintf(trname, "isc_%dt", request->req_ident);
@ -1239,12 +1241,12 @@ static void gen_create_database( const act* action, int column)
else
sprintf(s2, "isc_%d", request->req_ident);
PAT args;
args.pat_vector1 = status_vector(action);
args.pat_request = request;
args.pat_database = db;
args.pat_value1 = strlen(db->dbb_filename);
args.pat_condition = (request->req_length
|| (request->req_flags & REQ_extend_dpb));
args.pat_condition = (request->req_length || (request->req_flags & REQ_extend_dpb));
args.pat_string1 = s1;
args.pat_string2 = s2;
@ -1442,7 +1444,8 @@ static void gen_database( const act* action, int column)
column -= INDENT;
for (db = gpreGlob.isc_databases; db; db = db->dbb_next)
for (tpb* tpb_iterator = db->dbb_tpbs; tpb_iterator; tpb_iterator = tpb_iterator->tpb_dbb_next)
for (const tpb* tpb_iterator = db->dbb_tpbs; tpb_iterator;
tpb_iterator = tpb_iterator->tpb_dbb_next)
{
gen_tpb(tpb_iterator, column);
}
@ -1451,7 +1454,7 @@ static void gen_database( const act* action, int column)
SSHORT max_count = 0;
for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) {
SSHORT count = gen_event_block((const act*) (stack_ptr->lls_object));
SSHORT count = gen_event_block((act*) stack_ptr->lls_object);
max_count = MAX(count, max_count);
}
@ -1472,8 +1475,7 @@ static void gen_database( const act* action, int column)
}
fprintf(gpreGlob.out_file, "\n\n");
gen_compatibility_symbol("blob_null", "isc_",
"\t/* compatibility symbols */");
gen_compatibility_symbol("blob_null", "isc_", "\t/* compatibility symbols */");
// ****
//gen_compatibility_symbol ("database", "isc_", "");
//gen_compatibility_symbol ("trans", "isc_", "");
@ -1539,7 +1541,7 @@ static void gen_ddl( const act* action, int column)
static void gen_drop_database( const act* action, int column)
{
DBB db = (DBB) action->act_object;
const dbb* db = (dbb*) action->act_object;
align(column);
fprintf(gpreGlob.out_file, "isc_drop_database (%s, %d, \"%s\", rdb$k_db_type_gds);",
@ -1588,9 +1590,7 @@ static void gen_dyn_declare( const act* action, int column)
// Generate a dynamic SQL statement.
//
static void gen_dyn_describe(const act* action,
int column,
bool bind_flag)
static void gen_dyn_describe(const act* action, int column, bool bind_flag)
{
TEXT s[MAX_CURSOR_SIZE];
@ -1951,10 +1951,10 @@ static void gen_erase( const act* action, int column)
// with a particular call to isc_event_wait.
//
static SSHORT gen_event_block( const act* action)
static SSHORT gen_event_block(act* action)
{
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();
init->nod_arg[2] = (gpre_nod*)(IPTR)ident;
@ -1962,7 +1962,7 @@ static SSHORT gen_event_block( const act* action)
printa(0, "static %schar\n *isc_%da, *isc_%db;", CONST_STR, ident, ident);
printa(0, "static short\n isc_%dl;", ident);
gpre_nod* list = init->nod_arg[1];
const gpre_nod* list = init->nod_arg[1];
return list->nod_count;
}
@ -1982,8 +1982,8 @@ static void gen_event_init( const act* action, int column)
begin(column);
begin(column);
gpre_nod* init = (gpre_nod*) action->act_object;
gpre_nod* event_list = init->nod_arg[1];
const gpre_nod* init = (gpre_nod*) action->act_object;
const gpre_nod* event_list = init->nod_arg[1];
PAT args;
args.pat_database = (DBB) init->nod_arg[3];
@ -1996,12 +1996,12 @@ static void gen_event_init( const act* action, int column)
PATTERN_expand((USHORT) column, pattern1, &args);
TEXT variable[MAX_REF_SIZE];
gpre_nod** ptr = event_list->nod_arg;
const gpre_nod* const* ptr = event_list->nod_arg;
for (const gpre_nod* const* const end = ptr + event_list->nod_count; ptr < end; ptr++)
{
gpre_nod* node = *ptr;
const gpre_nod* node = *ptr;
if (node->nod_type == nod_field) {
ref* reference = (ref*) node->nod_arg[0];
const ref* reference = (ref*) node->nod_arg[0];
gen_name(variable, reference, true);
printb(", %s", variable);
}
@ -2032,7 +2032,6 @@ static void gen_event_init( const act* action, int column)
static void gen_event_wait( const act* action, int column)
{
PAT args;
TEXT s[64];
const TEXT* pattern1 = "isc_wait_for_event (%V1, &%DH, isc_%L1l, isc_%L1a, isc_%L1b);";
const TEXT* pattern2 = "isc_event_counts (isc_events, isc_%L1l, isc_%L1a, isc_%L1b);";
@ -2041,17 +2040,17 @@ static void gen_event_wait( const act* action, int column)
begin(column);
begin(column);
gpre_sym* event_name = (gpre_sym*) action->act_object;
const gpre_sym* event_name = (gpre_sym*) action->act_object;
// go through the stack of gpreGlob.events, checking to see if the
// event has been initialized and getting the event identifier
DBB database;
const dbb* database = NULL;
int ident = -1;
for (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;
gpre_nod* event_init = (gpre_nod*) event_action->act_object;
gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0];
const gpre_nod* event_init = (gpre_nod*) event_action->act_object;
const gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0];
if (!strcmp(event_name->sym_string, stack_name->sym_string)) {
ident = (IPTR) event_init->nod_arg[2];
database = (DBB) event_init->nod_arg[3];
@ -2064,6 +2063,7 @@ static void gen_event_wait( const act* action, int column)
return;
}
PAT args;
args.pat_database = database;
args.pat_vector1 = status_vector(action);
args.pat_long1 = ident;
@ -2092,7 +2092,8 @@ static void gen_fetch( const act* action, int column)
#ifdef SCROLLABLE_CURSORS
gpre_port* port = request->req_aport;
if (port) {
if (port)
{
// set up the reference to point to the correct value
// in the linked list of values, and prepare for the
// next FETCH statement if applicable
@ -2158,6 +2159,7 @@ static void gen_fetch( const act* action, int column)
align(column);
asgn_to(action, (ref*) (var_list->nod_arg[i]), column);
}
endp(column);
printa(column - INDENT, "else");
printa(column, "SQLCODE = 100;");
@ -2195,11 +2197,11 @@ static void gen_finish( const act* action, int column)
PATTERN_expand((USHORT) column, pattern1, &args);
}
DBB db = NULL;
const dbb* db = NULL;
// the user supplied one or more db_handles
for (rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) {
for (const rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) {
db = ready->rdy_database;
printa(column, "isc_detach_database (%s, &%s);",
status_vector(action), db->dbb_name->sym_string);
@ -2208,8 +2210,7 @@ static void gen_finish( const act* action, int column)
if (!db)
for (db = gpreGlob.isc_databases; db; db = db->dbb_next) {
if ((action->act_error || (action->act_flags & ACT_sql)) &&
(db != gpreGlob.isc_databases))
if ((action->act_error || (action->act_flags & ACT_sql)) && db != gpreGlob.isc_databases)
{
printa(column, "if (%s && !%s [1]) ", db->dbb_name->sym_string, global_status_name);
}
@ -2231,7 +2232,7 @@ static void gen_finish( const act* action, int column)
static void gen_for( const act* action, int column)
{
gen_s_start(action, column);
gpre_req* request = action->act_request;
const gpre_req* request = action->act_request;
if (action->act_error || (action->act_flags & ACT_sql))
printa(column, "if (!%s [1]) {", global_status_name);
@ -2266,7 +2267,7 @@ static void gen_for( const act* action, int column)
static void gen_function( const act* function, int column)
{
ref* reference;
const ref* reference;
const act* action = (const act*) function->act_object;
@ -2275,7 +2276,7 @@ static void gen_function( const act* function, int column)
return;
}
gpre_req* request = action->act_request;
const gpre_req* request = action->act_request;
fprintf(gpreGlob.out_file, "static %s_r (request, transaction ", request->req_handle);
@ -2377,10 +2378,7 @@ static void gen_function( const act* function, int column)
// or isc_put_slice for an array.
//
static void gen_get_or_put_slice(const act* action,
const ref* reference,
bool get,
int column)
static void gen_get_or_put_slice(const act* action, const ref* reference, bool get, int column)
{
const TEXT* pattern1 =
"isc_get_slice (%V1, &%DH, &%RT, &%S2, (short) %N1, (char*) %S3, 0, (%S6*) 0, (%S6) %L1, %S5, &isc_array_length);";
@ -2436,7 +2434,7 @@ static void gen_get_segment( const act* action, int column)
if (action->act_error && (action->act_type != ACT_blob_for))
begin(column);
blb* blob;
const blb* blob;
if (action->act_flags & ACT_sql)
blob = (blb*) action->act_request->req_blobs;
else
@ -2452,7 +2450,7 @@ static void gen_get_segment( const act* action, int column)
PATTERN_expand((USHORT) column, pattern1, &args);
if (action->act_flags & ACT_sql) {
ref* into = action->act_object;
const ref* into = action->act_object;
set_sqlcode(action, column);
printa(column, "if (!SQLCODE || SQLCODE == 101)");
column += INDENT;
@ -2481,8 +2479,8 @@ static void gen_loop( const act* action, int column)
TEXT name[MAX_REF_SIZE];
gen_s_start(action, column);
gpre_req* request = action->act_request;
gpre_port* port = request->req_primary;
const gpre_req* request = action->act_request;
const gpre_port* port = request->req_primary;
printa(column, "if (!SQLCODE) ");
column += INDENT;
begin(column);
@ -2550,14 +2548,13 @@ static void gen_on_error( const act* action, USHORT column)
static void gen_procedure( const act* action, int column)
{
column += INDENT;
gpre_req* request = action->act_request;
gpre_port* in_port = request->req_vport;
gpre_port* out_port = request->req_primary;
const gpre_req* request = action->act_request;
const gpre_port* in_port = request->req_vport;
const gpre_port* out_port = request->req_primary;
const dbb* database = request->req_database;
PAT args;
args.pat_database = database;
args.pat_request = action->act_request;
args.pat_vector1 = status_vector(action);
args.pat_request = request;
args.pat_port = in_port;
@ -2610,10 +2607,10 @@ static void gen_put_segment( const act* action, int column)
if (action->act_error || (action->act_flags & ACT_sql))
begin(column);
blb* blob;
const blb* blob;
if (action->act_flags & ACT_sql) {
blob = (blb*) action->act_request->req_blobs;
ref* from = action->act_object;
const ref* from = action->act_object;
align(column);
fprintf(gpreGlob.out_file, "isc_%d = %s;", blob->blb_len_ident, from->ref_null_value);
align(column);
@ -2683,7 +2680,7 @@ static void gen_ready( const act* action, int column)
{
const TEXT* vector = status_vector(action);
for (rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) {
for (const rdy* ready = (rdy*) action->act_object; ready; ready = ready->rdy_next) {
const dbb* db = ready->rdy_database;
const TEXT* filename = ready->rdy_filename;
if (!filename)
@ -2740,7 +2737,7 @@ static void gen_release( const act* action, int column)
DBB exp_db = (DBB) action->act_object;
for (gpre_req* request = gpreGlob.requests; request; request = request->req_next) {
DBB db = request->req_database;
const dbb* db = request->req_database;
if (exp_db && db != exp_db)
continue;
if (db && request->req_handle && !(request->req_flags & REQ_exp_hand)) {
@ -2798,7 +2795,8 @@ static void gen_request(const gpre_req* request)
printa(0, "static %schar\n isc_%d [] = {", CONST_STR, request->req_ident);
const TEXT* string_type = "blr";
if (gpreGlob.sw_raw) {
if (gpreGlob.sw_raw)
{
gen_raw(request->req_blr, request->req_length);
switch (request->req_type) {
@ -2819,7 +2817,8 @@ static void gen_request(const gpre_req* request)
}
}
else
switch (request->req_type) {
switch (request->req_type)
{
case REQ_create_database:
case REQ_ready:
string_type = "dpb";
@ -2922,13 +2921,14 @@ static void gen_routine( const act* action, int column)
{
column += INDENT;
for (gpre_req* request = (gpre_req*) action->act_object; request; request = request->req_routine)
for (const gpre_req* request = (gpre_req*) action->act_object; request;
request = request->req_routine)
{
if (request->req_type == REQ_any)
continue;
for (gpre_port* port = request->req_ports; port; port = port->por_next)
for (const gpre_port* port = request->req_ports; port; port = port->por_next)
make_port(port, column);
for (blb* blob = request->req_blobs; blob; blob = blob->blb_next) {
for (const blb* blob = request->req_blobs; blob; blob = blob->blb_next) {
printa(column, "isc_blob_handle\t\tisc_%d;\t\t/* blob handle */", blob->blb_ident);
printa(column, "char\t\t\tisc_%d [%d];\t/* blob segment */",
blob->blb_buff_ident, blob->blb_seg_length);
@ -2948,7 +2948,7 @@ static void gen_s_end( const act* action, int column)
if (action->act_error)
begin(column);
gpre_req* request = action->act_request;
const gpre_req* request = action->act_request;
if (action->act_type == ACT_close)
column = gen_cursor_close(action, request, column);
@ -3031,7 +3031,7 @@ static void gen_s_start( const act* action, int column)
static void gen_segment( const act* action, int column)
{
blb* blob = (blb*) action->act_object;
const blb* blob = (blb*) action->act_object;
printa(column, "isc_%d",
(action->act_type == ACT_segment) ? blob->blb_buff_ident :
@ -3118,9 +3118,9 @@ static void gen_slice( const act* action, ref* var_reference, int column)
const TEXT* pattern2 = "isc_put_slice (%V1, &%DH, &%RT, &%FR, (short) %N1, \
(char*) %I1, (short) %N2, %I1v, %I1s, %S5);";
gpre_req* request = action->act_request;
slc* slice = (slc*) action->act_object;
gpre_req* parent_request = slice->slc_parent_request;
const gpre_req* request = action->act_request;
const slc* slice = (slc*) action->act_object;
const gpre_req* parent_request = slice->slc_parent_request;
// Compute array size
@ -3143,7 +3143,7 @@ static void gen_slice( const act* action, ref* var_reference, int column)
// Make assignments to variable vector
ref* reference;
const ref* reference;
for (reference = request->req_values; reference; reference = reference->ref_next)
{
printa(column, "isc_%dv [%d] = %s;",
@ -3214,7 +3214,7 @@ static void gen_start(const act* action,
static void gen_store( const act* action, int column)
{
gpre_req* request = action->act_request;
const gpre_req* request = action->act_request;
align(column);
gen_compile(action, column);
@ -3230,9 +3230,9 @@ static void gen_store( const act* action, int column)
TEXT name[MAX_REF_SIZE];
gpre_port* port = request->req_primary;
for (ref* reference = port->por_references; reference; reference = reference->ref_next)
for (const ref* reference = port->por_references; reference; reference = reference->ref_next)
{
gpre_fld* field = reference->ref_field;
const gpre_fld* field = reference->ref_field;
if (field->fld_flags & FLD_blob)
printa(column, "%s = isc_blob_null;", gen_name(name, reference, true));
}
@ -3423,10 +3423,12 @@ static void gen_variable( const act* action, int column)
static void gen_whenever( const swe* label, int column)
{
const TEXT* condition;
const TEXT* condition = NULL;
while (label) {
switch (label->swe_condition) {
while (label)
{
switch (label->swe_condition)
{
case SWE_error:
condition = "SQLCODE < 0";
break;
@ -3438,6 +3440,11 @@ static void gen_whenever( const swe* label, int column)
case SWE_not_found:
condition = "SQLCODE == 100";
break;
default:
// condition undefined
fb_assert(false);
return;
}
align(column);
fprintf(gpreGlob.out_file, "if (%s) goto %s;", condition, label->swe_label);
@ -3466,7 +3473,8 @@ static void make_array_declaration(ref* reference)
field->fld_array_info->ary_declared = true;
const TEXT* dtype;
switch (field->fld_array_info->ary_dtype) {
switch (field->fld_array_info->ary_dtype)
{
case dtype_short:
dtype = "short";
break;
@ -3525,7 +3533,7 @@ static void make_array_declaration(ref* reference)
// Print out the dimension part of the declaration
for (dim* dimension = field->fld_array_info->ary_dimension; dimension;
for (const dim* dimension = field->fld_array_info->ary_dimension; dimension;
dimension = dimension->dim_next)
{
fprintf(gpreGlob.out_file, " [%ld]", dimension->dim_upper - dimension->dim_lower + 1);
@ -3619,7 +3627,8 @@ static void make_port(const gpre_port* port, int column)
int fld_len = 0;
const TEXT* dtype;
switch (field->fld_dtype) {
switch (field->fld_dtype)
{
case dtype_short:
dtype = "short";
break;
@ -3701,7 +3710,8 @@ static void make_ready(const dbb* db,
{
TEXT s1[32], s2[32];
if (request) {
if (request)
{
sprintf(s1, "isc_%dl", request->req_ident);
if (request->req_flags & REQ_extend_dpb)

View File

@ -1752,8 +1752,8 @@ static bool create_view(gpre_req* request,
fld = reference->ref_field;
const gpre_req* slice_req;
const slc* slice;
if ((value->nod_count >= 2) && (slice_req = (gpre_req*) value->nod_arg[2])
&& (slice = slice_req->req_slice))
if ((value->nod_count >= 2) && (slice_req = (gpre_req*) value->nod_arg[2]) &&
(slice = slice_req->req_slice))
{
CPR_error("Array slices not supported in views");
}
@ -2274,8 +2274,8 @@ static void put_blr(gpre_req* request,
static void put_computed_blr( gpre_req* request, const gpre_fld* field)
{
const act* action = request->req_actions;
const gpre_rel* relation = (gpre_rel*) action->act_object;
//const act* action = request->req_actions;
//const gpre_rel* relation = (gpre_rel*) action->act_object;
// Computed field context has to be 0 - so force it
@ -2308,8 +2308,8 @@ static void put_computed_blr( gpre_req* request, const gpre_fld* field)
static void put_computed_source( gpre_req* request, const gpre_fld* field)
{
const act* action = request->req_actions;
const gpre_rel* relation = (gpre_rel*) action->act_object;
//const act* action = request->req_actions;
//const gpre_rel* relation = (gpre_rel*) action->act_object;
if (field->fld_computed->cmpf_text != NULL) {
TEXT* computed_source = (TEXT*) MSC_alloc(field->fld_computed->cmpf_text->txt_length + 1);
@ -2343,12 +2343,13 @@ static void put_cstring(gpre_req* request, USHORT ddl_operator,
static void put_dtype( gpre_req* request, const gpre_fld* field)
{
USHORT dtype;
USHORT dtype = 0;
USHORT length = field->fld_length;
const USHORT precision = field->fld_precision;
const USHORT sub_type = field->fld_sub_type;
switch (field->fld_dtype) {
//const USHORT precision = field->fld_precision;
//const USHORT sub_type = field->fld_sub_type;
switch (field->fld_dtype)
{
case dtype_cstring:
// If the user is defining a field as cstring then generate

View File

@ -2224,15 +2224,15 @@ static void get_dtype_of_list(const gpre_nod* node, gpre_fld* f)
UCHAR max_dtype = 0;
SCHAR max_scale = 0;
USHORT max_length = 0, max_dtype_length = 0, maxtextlength = 0, max_significant_digits = 0;
SSHORT max_sub_type = 0, first_sub_type, ttype = ttype_ascii; // default type if all nodes are nod_null.
SSHORT max_sub_type = 0, first_sub_type = -1, ttype = ttype_ascii; // default type if all nodes are nod_null.
SSHORT max_numeric_sub_type = 0;
bool firstarg = true, all_same_sub_type = true, all_equal = true, all_nulls = true;
bool firstarg = true, all_same_sub_type = true, all_equal = true; //, all_nulls = true;
bool all_numeric = true, any_numeric = false, any_approx = false, any_float = false;
bool all_text = true, any_text = false, any_varying = false;
bool all_date = true, all_time = true, all_timestamp = true, any_datetime = false;
bool all_blob = true, any_blob = false, any_text_blob = false;
bool nullable = false;
bool err = false;
//bool nullable = false;
//bool err = false;
gpre_fld field_aux;
// Set default values

View File

@ -240,8 +240,8 @@ void CMP_compile_request( gpre_req* request)
// Assume that a general port needs to be constructed.
gpre_port* port;
if ((request->req_type != REQ_insert) && (request->req_type != REQ_store2)
&& (request->req_type != REQ_set_generator))
if ((request->req_type != REQ_insert) && (request->req_type != REQ_store2) &&
(request->req_type != REQ_set_generator))
{
request->req_primary = port = make_port(request, reference);
}
@ -1191,7 +1191,7 @@ static void cmp_ready( gpre_req* request)
{
dbb* db = request->req_database;
act* action = request->req_actions;
//act* action = request->req_actions;
request->req_blr = request->req_base = MSC_alloc(250);
request->req_length = 250;
request->req_flags |= REQ_exp_hand;

View File

@ -2318,7 +2318,7 @@ static void gen_event_wait( const act* action)
return; // silence non initialized warning
}
const SSHORT column = strlen(names[COLUMN]);
const USHORT column = strlen(names[COLUMN]);
PAT args;
args.pat_database = database;
@ -2966,8 +2966,7 @@ static void gen_release( const act* action)
static void gen_receive( const act* action, const gpre_port* port)
{
const gpre_req* request = action->act_request;
sprintf(output_buffer,
"%sCALL \"%s\" USING %s, %s%s, %s%d%s, %s%d%s, %s%s%d, %s%s%s\n",
sprintf(output_buffer, "%sCALL \"%s\" USING %s, %s%s, %s%d%s, %s%d%s, %s%s%d, %s%s%s\n",
names[COLUMN],
ISC_RECEIVE,
status_vector(action),
@ -3607,10 +3606,12 @@ static void gen_variable( const act* action)
static void gen_whenever(const swe* label)
{
const TEXT* condition;
const TEXT* condition = NULL;
while (label) {
switch (label->swe_condition) {
while (label)
{
switch (label->swe_condition)
{
case SWE_error:
condition = "SQLCODE < 0";
break;

View File

@ -355,9 +355,9 @@ gpre_nod* EXP_literal()
/** Do not put a default here **/
}
// ** End date/time/timestamp *
if ((gpreGlob.token_global.tok_type == tok_sglquoted && (gpreGlob.token_global.tok_charset)) ||
((isQuoted(gpreGlob.token_global.tok_type) && (gpreGlob.sw_sql_dialect == 1))
&& (gpreGlob.token_global.tok_charset)))
if ((gpreGlob.token_global.tok_type == tok_sglquoted && gpreGlob.token_global.tok_charset) ||
((isQuoted(gpreGlob.token_global.tok_type) && gpreGlob.sw_sql_dialect == 1) &&
gpreGlob.token_global.tok_charset))
{
reference->ref_flags |= REF_ttype;
gpre_sym* symbol = gpreGlob.token_global.tok_charset;

View File

@ -320,7 +320,8 @@ void FTN_action(const act* action, int column)
if (action->act_flags & ACT_break)
global_first_flag = false;
switch (action->act_type) {
switch (action->act_type)
{
case ACT_alter_database:
case ACT_alter_domain:
case ACT_alter_table:
@ -1319,10 +1320,10 @@ static void gen_database(const act* action)
{
if (global_first_flag)
return;
global_first_flag = true;
sprintf(output_buffer,
"\n%s **** GDS Preprocessor Definitions ****\n\n", COMMENT);
sprintf(output_buffer, "\n%s **** GDS Preprocessor Definitions ****\n\n", COMMENT);
FTN_print_buffer(output_buffer);
gen_database_decls(action);
@ -2552,8 +2553,7 @@ static void gen_put_segment(const act* action)
else
blob = (blb*) action->act_object;
sprintf(output_buffer,
"%sISC_STATUS(2) = ISC_PUT_SEGMENT (%s, isc_%d, %sisc_%d%s, %sisc_%d%s)\n",
sprintf(output_buffer, "%sISC_STATUS(2) = ISC_PUT_SEGMENT (%s, isc_%d, %sisc_%d%s, %sisc_%d%s)\n",
COLUMN,
status_vector(action),
blob->blb_ident,
@ -3197,9 +3197,8 @@ static void gen_start(const act* action, const gpre_port* port)
I2CONST_1, request->req_request_level, I2CONST_2);
}
else
sprintf(output_buffer,
"%sCALL ISC_START_REQUEST (%s, %s, %s, %s%s%s)\n", COLUMN,
vector, request->req_handle, request_trans(action, request),
sprintf(output_buffer, "%sCALL ISC_START_REQUEST (%s, %s, %s, %s%s%s)\n",
COLUMN, vector, request->req_handle, request_trans(action, request),
I2CONST_1, request->req_request_level, I2CONST_2);
FTN_print_buffer(output_buffer);
@ -3436,10 +3435,12 @@ static void gen_variable(const act* action)
static void gen_whenever(const swe* label)
{
const TEXT* condition;
const TEXT* condition = NULL;
while (label) {
switch (label->swe_condition) {
while (label)
{
switch (label->swe_condition)
{
case SWE_error:
condition = "SQLCODE .LT. 0";
break;
@ -3451,7 +3452,11 @@ static void gen_whenever(const swe* label)
case SWE_not_found:
condition = "SQLCODE .EQ. 100";
break;
//CVC: default: => error???
default:
// condition undefined
fb_assert(false);
return;
}
printa(COLUMN, "if (%s) goto %s", condition, label->swe_label);
label = label->swe_next;
@ -4052,7 +4057,7 @@ static void gen_function(const act* function)
for (const ref* reference = port->por_references; reference; reference = reference->ref_next)
{
const gpre_fld* field = reference->ref_field;
const TEXT* dtype;
const TEXT* dtype = NULL;
switch (field->fld_dtype) {
case dtype_short:

View File

@ -1485,8 +1485,8 @@ static bool file_rename(TEXT* file_nameL, const TEXT* extension, const TEXT* new
static void finish_based( act* action)
{
gpre_rel* relation;
gpre_fld* field;
gpre_rel* relation = NULL;
gpre_fld* field = NULL;
TEXT s[MAXPATHLEN << 1];
for (; action; action = action->act_rest) {
@ -2766,8 +2766,8 @@ static SSHORT skip_white()
if (gpreGlob.sw_language == lang_cobol &&
(!isAnsiCobol(gpreGlob.sw_cob_dialect) && line_position == 1 &&
(c == 'C' || c == 'c' || c == '*' || c == '/' || c == '\\') ||
(isAnsiCobol(gpreGlob.sw_cob_dialect) && line_position == 7 && c != '\t' && c != ' '
&& c != '-')))
(isAnsiCobol(gpreGlob.sw_cob_dialect) && line_position == 7 && c != '\t' &&
c != ' ' && c != '-')))
{
while ((c = nextchar()) != '\n' && c != EOF)
;

View File

@ -318,13 +318,6 @@ inline size_t STR_LEN(const size_t size)
/* SQL WHENEVER BLOCK */
struct swe {
swe* swe_next; /* Next in chain */
USHORT swe_condition; /* Condition */
USHORT swe_length; /* Length of label */
TEXT swe_label[1]; /* Label */
};
enum swe_condition_vals {
SWE_error,
SWE_warning,
@ -332,6 +325,14 @@ enum swe_condition_vals {
SWE_max
};
struct swe
{
swe* swe_next; // Next in chain
swe_condition_vals swe_condition; // Condition
USHORT swe_length; // Length of label
TEXT swe_label[1]; // Label
};
/* Text block */

View File

@ -702,7 +702,6 @@ gpre_fld* MET_field(gpre_rel* relation, const char* string)
// Lookup field. If we find it, nifty. If not, look it up in the
// database.
gpre_fld* field = NULL;
gpre_sym* symbol;
for (symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym)
{
@ -710,6 +709,8 @@ gpre_fld* MET_field(gpre_rel* relation, const char* string)
{
return relation->rel_dbkey;
}
gpre_fld* field;
if (symbol->sym_type == SYM_field && (field = (gpre_fld*) symbol->sym_object) &&
field->fld_relation == relation)
{
@ -728,7 +729,7 @@ gpre_fld* MET_field(gpre_rel* relation, const char* string)
DB = database->dbb_handle;
gds_trans = database->dbb_transaction;
field = NULL;
gpre_fld* field = NULL;
if (!(database->dbb_flags & DBB_v3)) {
FOR(REQUEST_HANDLE database->dbb_field_request)
RFR IN RDB$RELATION_FIELDS CROSS F IN RDB$FIELDS WITH

View File

@ -235,7 +235,6 @@ gpre_lls* MET_get_primary_key(DBB db, const TEXT* relation_name)
gpre_fld* MET_field(gpre_rel* relation, const char* string)
{
gpre_fld* field;
SCHAR name[NAME_SIZE];
strcpy(name, string);
@ -252,6 +251,7 @@ gpre_fld* MET_field(gpre_rel* relation, const char* string)
return relation->rel_dbkey;
}
gpre_fld* field;
if (symbol->sym_type == SYM_field && (field = (gpre_fld*) symbol->sym_object) &&
field->fld_relation == relation)
{

View File

@ -94,7 +94,8 @@ void INT_CXX_action( const act* action, int column)
// Put leading braces where required
switch (action->act_type) {
switch (action->act_type)
{
case ACT_for:
case ACT_insert:
case ACT_modify:
@ -105,7 +106,8 @@ void INT_CXX_action( const act* action, int column)
align(column);
}
switch (action->act_type) {
switch (action->act_type)
{
case ACT_at_end:
gen_at_end(action, column);
return;
@ -285,8 +287,8 @@ static void gen_blr(void* user_arg, SSHORT offset, const char* string)
static void gen_compile( const gpre_req* request, int column)
{
column += INDENT;
const dbb* db = request->req_database;
const gpre_sym* symbol = db->dbb_name;
//const dbb* db = request->req_database;
//const gpre_sym* symbol = db->dbb_name;
fprintf(gpreGlob.out_file, "if (!%s)", request->req_handle);
align(column);
fprintf(gpreGlob.out_file, "%s = CMP_compile2 (tdbb, (UCHAR*) jrd_%"ULONGFORMAT", TRUE);",

View File

@ -460,7 +460,7 @@ SSHORT PAR_blob_subtype(DBB db)
// Check for symbol type name
if (gpreGlob.token_global.tok_type == tok_ident) {
gpre_fld* field;
gpre_fld* field = NULL;
gpre_rel* relation = MET_get_relation(db, "RDB$FIELDS", "");
if (!relation || !(field = MET_field(relation, "RDB$FIELD_SUB_TYPE")))
{

View File

@ -1967,10 +1967,11 @@ static void gen_finish( const act* action, int column)
}
if (!db)
for (db = gpreGlob.isc_databases; db; db = db->dbb_next) {
if ((action->act_error || (action->act_flags & ACT_sql))
&& (db != gpreGlob.isc_databases)) printa(column,
"if (%s <> nil) and (gds__status[2] = 0) then",
db->dbb_name->sym_string);
if ((action->act_error || (action->act_flags & ACT_sql)) &&
(db != gpreGlob.isc_databases))
{
printa(column, "if (%s <> nil) and (gds__status[2] = 0) then", db->dbb_name->sym_string);
}
else
printa(column, "if %s <> nil then", db->dbb_name->sym_string);
printa(column + INDENT, "GDS__DETACH_DATABASE (%s, %s);",
@ -2064,8 +2065,7 @@ static void gen_get_or_put_slice(const act* action,
args.pat_string5 = reference->ref_value;
}
else {
sprintf(s4, "gds__%d",
reference->ref_field->fld_array_info->ary_ident);
sprintf(s4, "gds__%d", reference->ref_field->fld_array_info->ary_ident);
args.pat_string5 = s4; // array name
}
@ -3049,13 +3049,15 @@ static void gen_variable( const act* action, int column)
static void gen_whenever( const swe* label, int column)
{
const TEXT* condition;
const TEXT* condition = NULL;
if (label)
fprintf(gpreGlob.out_file, ";");
while (label) {
switch (label->swe_condition) {
while (label)
{
switch (label->swe_condition)
{
case SWE_error:
condition = "SQLCODE < 0";
break;
@ -3067,6 +3069,11 @@ static void gen_whenever( const swe* label, int column)
case SWE_not_found:
condition = "SQLCODE = 100";
break;
default:
// condition undefined
fb_assert(false);
return;
}
align(column);
fprintf(gpreGlob.out_file, "if %s then goto %s;", condition, label->swe_label);

View File

@ -309,8 +309,8 @@ static int indent( ctl* control, SSHORT level)
static int print_blr_dtype(ctl* control, bool print_object)
{
const char* string;
SSHORT length;
const char* string = NULL;
SSHORT length = -1;
const USHORT dtype = BLR_BYTE;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff