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

BOOLEAN cleaning

This commit is contained in:
brodsom 2003-09-10 17:52:12 +00:00
parent ddba6b7337
commit 7c7c2758dc
53 changed files with 1858 additions and 1807 deletions

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: alice.cpp,v 1.30 2003-09-08 01:46:46 brodsom Exp $ // $Id: alice.cpp,v 1.31 2003-09-10 17:46:44 brodsom Exp $
// //
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports // conditionals, as the engine now fully supports
@ -125,11 +125,8 @@ static void alice_output(const SCHAR*, ...) ATTRIBUTE_FORMAT(1,2);
int main_gfix(SVC service) int main_gfix(SVC service)
{ {
int exit_code = int exit_code = ALICE_gfix(service->svc_argc, service->svc_argv,
ALICE_gfix( service->svc_argc, output_thread, (SLONG) service);
service->svc_argv,
output_thread,
(SLONG) service);
service->svc_handle = 0; service->svc_handle = 0;
if (service->svc_service->in_use != NULL) { if (service->svc_service->in_use != NULL) {
@ -206,12 +203,12 @@ static int output_svc(SLONG output_data, UCHAR * output_buf)
int ALICE_gfix(int argc, int ALICE_gfix(int argc,
char* argv[], char* argv[],
int(*output_proc)(SLONG, UCHAR*), int(*output_proc) (SLONG, UCHAR*),
SLONG output_data) SLONG output_data)
{ {
IN_SW_TAB table = alice_in_sw_table; IN_SW_TAB table = alice_in_sw_table;
USHORT error; bool error;
TEXT* database; TEXT* database;
TEXT string[512]; TEXT string[512];
ULONG switches; ULONG switches;
@ -247,28 +244,28 @@ int ALICE_gfix(int argc,
// first switch can be "-svc" (lower case!) or it can be "-svc_re" followed // first switch can be "-svc" (lower case!) or it can be "-svc_re" followed
// by 3 file descriptors to use in re-directing ib_stdin, ib_stdout, and ib_stderr. // by 3 file descriptors to use in re-directing ib_stdin, ib_stdout, and ib_stderr.
tdgbl->sw_service = FALSE; tdgbl->sw_service = false;
tdgbl->sw_service_thd = FALSE; tdgbl->sw_service_thd = false;
tdgbl->service_blk = NULL; tdgbl->service_blk = NULL;
tdgbl->status = tdgbl->status =
/* TMN: cast away volatile */ /* TMN: cast away volatile */
(long *) tdgbl->status_vector; (long *) tdgbl->status_vector;
if (argc > 1 && !strcmp(argv[1], "-svc")) { if (argc > 1 && !strcmp(argv[1], "-svc")) {
tdgbl->sw_service = TRUE; tdgbl->sw_service = true;
argv++; argv++;
argc--; argc--;
} }
else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) { else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) {
tdgbl->sw_service = TRUE; tdgbl->sw_service = true;
tdgbl->sw_service_thd = TRUE; tdgbl->sw_service_thd = true;
tdgbl->service_blk = (SVC) output_data; tdgbl->service_blk = (SVC) output_data;
tdgbl->status = tdgbl->service_blk->svc_status; tdgbl->status = tdgbl->service_blk->svc_status;
argv++; argv++;
argc--; argc--;
} }
else if (argc > 4 && !strcmp(argv[1], "-svc_re")) { else if (argc > 4 && !strcmp(argv[1], "-svc_re")) {
tdgbl->sw_service = TRUE; tdgbl->sw_service = true;
tdgbl->output_proc = output_svc; tdgbl->output_proc = output_svc;
redir_in = atol(argv[2]); redir_in = atol(argv[2]);
redir_out = atol(argv[3]); redir_out = atol(argv[3]);
@ -304,7 +301,7 @@ int ALICE_gfix(int argc,
// Start by parsing switches // Start by parsing switches
error = 0; error = false;
switches = 0; switches = 0;
tdgbl->ALICE_data.ua_shutdown_delay = 0; tdgbl->ALICE_data.ua_shutdown_delay = 0;
database = NULL; database = NULL;
@ -335,12 +332,12 @@ int ALICE_gfix(int argc,
if (!string[1]) { if (!string[1]) {
continue; continue;
} }
for (table = alice_in_sw_table; TRUE; ++table) for (table = alice_in_sw_table; true; ++table)
{ {
const TEXT* p = (TEXT*) table->in_sw_name; const TEXT* p = (TEXT*) table->in_sw_name;
if (!p) { if (!p) {
ALICE_print(2, *--argv, 0, 0, 0, 0); /* msg 2: invalid switch %s */ ALICE_print(2, *--argv, 0, 0, 0, 0); /* msg 2: invalid switch %s */
error = TRUE; error = true;
break; break;
} }
@ -364,7 +361,7 @@ int ALICE_gfix(int argc,
if ((table->in_sw_incompatibilities & switches) || if ((table->in_sw_incompatibilities & switches) ||
(table->in_sw_requires && !(table->in_sw_requires & switches))) { (table->in_sw_requires && !(table->in_sw_requires & switches))) {
ALICE_print(4, 0, 0, 0, 0, 0); /* msg 4: incompatible switch combination */ ALICE_print(4, 0, 0, 0, 0, 0); /* msg 4: incompatible switch combination */
error = TRUE; error = true;
break; break;
} }
switches |= table->in_sw_value; switches |= table->in_sw_value;
@ -449,9 +446,9 @@ int ALICE_gfix(int argc,
} }
ALICE_down_case(*argv++, string); ALICE_down_case(*argv++, string);
if (!strcmp(string, ALICE_SW_SYNC)) { if (!strcmp(string, ALICE_SW_SYNC)) {
tdgbl->ALICE_data.ua_force = TRUE; tdgbl->ALICE_data.ua_force = true;
} else if (!strcmp(string, ALICE_SW_ASYNC)) { } else if (!strcmp(string, ALICE_SW_ASYNC)) {
tdgbl->ALICE_data.ua_force = FALSE; tdgbl->ALICE_data.ua_force = false;
} else { } else {
ALICE_error(11); /* msg 11: "sync" or "async" required */ ALICE_error(11); /* msg 11: "sync" or "async" required */
} }
@ -463,9 +460,9 @@ int ALICE_gfix(int argc,
} }
ALICE_down_case(*argv++, string); ALICE_down_case(*argv++, string);
if (!strcmp(string, "full")) { if (!strcmp(string, "full")) {
tdgbl->ALICE_data.ua_use = TRUE; tdgbl->ALICE_data.ua_use = true;
} else if (!strcmp(string, "reserve")) { } else if (!strcmp(string, "reserve")) {
tdgbl->ALICE_data.ua_use = FALSE; tdgbl->ALICE_data.ua_use = false;
} else { } else {
ALICE_error(12); /* msg 12: "full" or "reserve" required */ ALICE_error(12); /* msg 12: "full" or "reserve" required */
} }
@ -520,9 +517,9 @@ int ALICE_gfix(int argc,
} }
ALICE_down_case(*argv++, string); ALICE_down_case(*argv++, string);
if (!strcmp(string, ALICE_SW_MODE_RO)) { if (!strcmp(string, ALICE_SW_MODE_RO)) {
tdgbl->ALICE_data.ua_read_only = TRUE; tdgbl->ALICE_data.ua_read_only = true;
} else if (!strcmp(string, ALICE_SW_MODE_RW)) { } else if (!strcmp(string, ALICE_SW_MODE_RW)) {
tdgbl->ALICE_data.ua_read_only = FALSE; tdgbl->ALICE_data.ua_read_only = false;
} else { } else {
ALICE_error(110); /* msg 110: "read_only" or "read_write" required */ ALICE_error(110); /* msg 110: "read_only" or "read_write" required */
} }
@ -548,7 +545,7 @@ int ALICE_gfix(int argc,
#ifndef SUPERSERVER #ifndef SUPERSERVER
ALICE_print(20, 0, 0, 0, 0, 0); /* msg 20: please retry, specifying an option */ ALICE_print(20, 0, 0, 0, 0, 0); /* msg 20: please retry, specifying an option */
#endif #endif
error = TRUE; error = true;
} }
if (error) { if (error) {

View File

@ -62,9 +62,9 @@ typedef struct user_action
ULONG ua_switches; ULONG ua_switches;
UCHAR *ua_user; UCHAR *ua_user;
UCHAR *ua_password; UCHAR *ua_password;
UCHAR ua_use; bool ua_use;
UCHAR ua_force; bool ua_force;
BOOLEAN ua_read_only; bool ua_read_only;
SLONG ua_shutdown_delay; SLONG ua_shutdown_delay;
SLONG ua_sweep_interval; SLONG ua_sweep_interval;
SLONG ua_transaction; SLONG ua_transaction;
@ -170,8 +170,8 @@ public:
isc_tr_handle tr_handle; isc_tr_handle tr_handle;
ISC_STATUS* status; ISC_STATUS* status;
USHORT sw_redirect; USHORT sw_redirect;
USHORT sw_service; bool sw_service;
USHORT sw_service_thd; bool sw_service_thd;
}; };
typedef tgbl *TGBL; typedef tgbl *TGBL;

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: exe.cpp,v 1.14 2003-09-08 01:46:46 brodsom Exp $ // $Id: exe.cpp,v 1.15 2003-09-10 17:46:44 brodsom Exp $
// //
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports // conditionals, as the engine now fully supports
@ -78,7 +78,8 @@ static TEXT val_errors[] =
int EXE_action(TEXT * database, ULONG switches) int EXE_action(TEXT * database, ULONG switches)
{ {
UCHAR dpb[128]; UCHAR dpb[128];
USHORT dpb_length, error; USHORT dpb_length;
bool error;
FRBRD *handle; FRBRD *handle;
UCHAR error_string[128]; UCHAR error_string[128];
USHORT i; USHORT i;
@ -96,7 +97,7 @@ int EXE_action(TEXT * database, ULONG switches)
dpb_length = build_dpb(dpb, switches); dpb_length = build_dpb(dpb, switches);
error = FALSE; error = false;
handle = NULL; handle = NULL;
gds__attach_database(tdgbl->status, 0, database, &handle, dpb_length, gds__attach_database(tdgbl->status, 0, database, &handle, dpb_length,
reinterpret_cast <SCHAR *>(dpb)); reinterpret_cast <SCHAR *>(dpb));
@ -104,7 +105,7 @@ int EXE_action(TEXT * database, ULONG switches)
SVC_STARTED(tdgbl->service_blk); SVC_STARTED(tdgbl->service_blk);
if (tdgbl->status[1]) if (tdgbl->status[1])
error = TRUE; error = true;
if (tdgbl->status[2] == isc_arg_warning) if (tdgbl->status[2] == isc_arg_warning)
ALICE_print_status(tdgbl->status); ALICE_print_status(tdgbl->status);
@ -137,7 +138,8 @@ int EXE_action(TEXT * database, ULONG switches)
int EXE_two_phase(TEXT * database, ULONG switches) int EXE_two_phase(TEXT * database, ULONG switches)
{ {
UCHAR dpb[128]; UCHAR dpb[128];
USHORT dpb_length, error; USHORT dpb_length;
bool error;
FRBRD *handle; FRBRD *handle;
USHORT i; USHORT i;
TGBL tdgbl; TGBL tdgbl;
@ -154,7 +156,7 @@ int EXE_two_phase(TEXT * database, ULONG switches)
dpb_length = build_dpb(dpb, switches); dpb_length = build_dpb(dpb, switches);
error = FALSE; error = false;
handle = NULL; handle = NULL;
gds__attach_database(tdgbl->status, 0, database, &handle, gds__attach_database(tdgbl->status, 0, database, &handle,
dpb_length, reinterpret_cast < char *>(dpb)); dpb_length, reinterpret_cast < char *>(dpb));
@ -162,12 +164,11 @@ int EXE_two_phase(TEXT * database, ULONG switches)
SVC_STARTED(tdgbl->service_blk); SVC_STARTED(tdgbl->service_blk);
if (tdgbl->status[1]) if (tdgbl->status[1])
error = TRUE; error = true;
else if (switches & sw_list) else if (switches & sw_list)
TDR_list_limbo((handle), database, switches); TDR_list_limbo((handle), database, switches);
else if (switches & (sw_commit | sw_rollback | sw_two_phase)) else if (switches & (sw_commit | sw_rollback | sw_two_phase))
error = error = TDR_reconnect_multiple((handle),
TDR_reconnect_multiple((handle),
tdgbl->ALICE_data.ua_transaction, database, tdgbl->ALICE_data.ua_transaction, database,
switches); switches);
@ -261,18 +262,18 @@ static USHORT build_dpb(UCHAR * dpb, ULONG switches)
else if (switches & sw_write) { else if (switches & sw_write) {
*d++ = gds_dpb_force_write; *d++ = gds_dpb_force_write;
*d++ = 1; *d++ = 1;
*d++ = tdgbl->ALICE_data.ua_force; *d++ = tdgbl->ALICE_data.ua_force ? 1 : 0;
} }
else if (switches & sw_use) { else if (switches & sw_use) {
*d++ = gds_dpb_no_reserve; *d++ = gds_dpb_no_reserve;
*d++ = 1; *d++ = 1;
*d++ = tdgbl->ALICE_data.ua_use; *d++ = tdgbl->ALICE_data.ua_use ? 1 : 0;
} }
else if (switches & sw_mode) { else if (switches & sw_mode) {
*d++ = isc_dpb_set_db_readonly; *d++ = isc_dpb_set_db_readonly;
*d++ = 1; *d++ = 1;
*d++ = tdgbl->ALICE_data.ua_read_only; *d++ = (tdgbl->ALICE_data.ua_read_only) ? 1 : 0;
} }
else if (switches & sw_shut) { else if (switches & sw_shut) {
*d++ = gds_dpb_shutdown; *d++ = gds_dpb_shutdown;

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: tdr.cpp,v 1.18 2003-08-30 02:02:36 brodsom Exp $ // $Id: tdr.cpp,v 1.19 2003-09-10 17:46:44 brodsom Exp $
// //
// 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete "Apollo" port // 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete "Apollo" port
// //
@ -54,7 +54,7 @@ static ULONG ask(void);
static void print_description(TDR); static void print_description(TDR);
static void reattach_database(TDR); static void reattach_database(TDR);
static void reattach_databases(TDR); static void reattach_databases(TDR);
static BOOLEAN reconnect(FRBRD *, SLONG, TEXT *, ULONG); static bool reconnect(FRBRD *, SLONG, TEXT *, ULONG);
#define NEWLINE "\n" #define NEWLINE "\n"
@ -175,8 +175,9 @@ USHORT TDR_analyze(TDR trans)
// Attempt to attach a database with a given pathname. // Attempt to attach a database with a given pathname.
// //
BOOLEAN TDR_attach_database(ISC_STATUS * status_vector, bool TDR_attach_database(ISC_STATUS * status_vector,
TDR trans, TEXT * pathname) TDR trans,
TEXT * pathname)
{ {
UCHAR dpb[128], *d, *q; UCHAR dpb[128], *d, *q;
USHORT dpb_length; USHORT dpb_length;
@ -197,9 +198,7 @@ BOOLEAN TDR_attach_database(ISC_STATUS * status_vector,
if (tdgbl->ALICE_data.ua_user) { if (tdgbl->ALICE_data.ua_user) {
*d++ = gds_dpb_user_name; *d++ = gds_dpb_user_name;
*d++ = *d++ = strlen(reinterpret_cast <const char *>(tdgbl->ALICE_data.ua_user));
strlen(reinterpret_cast <
const char *>(tdgbl->ALICE_data.ua_user));
for (q = tdgbl->ALICE_data.ua_user; *q;) for (q = tdgbl->ALICE_data.ua_user; *q;)
*d++ = *q++; *d++ = *q++;
} }
@ -231,7 +230,7 @@ BOOLEAN TDR_attach_database(ISC_STATUS * status_vector,
ALICE_print(69, 0, 0, 0, 0, 0); /* msg 69: failed */ ALICE_print(69, 0, 0, 0, 0, 0); /* msg 69: failed */
ALICE_print_status(status_vector); ALICE_print_status(status_vector);
} }
return FALSE; return false;
} }
MET_set_capabilities(status_vector, trans); MET_set_capabilities(status_vector, trans);
@ -239,7 +238,7 @@ BOOLEAN TDR_attach_database(ISC_STATUS * status_vector,
if (tdgbl->ALICE_data.ua_debug) if (tdgbl->ALICE_data.ua_debug)
ALICE_print(70, 0, 0, 0, 0, 0); /* msg 70: succeeded */ ALICE_print(70, 0, 0, 0, 0, 0); /* msg 70: succeeded */
return TRUE; return true;
} }
@ -295,7 +294,9 @@ void TDR_list_limbo(FRBRD *handle, TEXT * name, ULONG switches)
UCHAR buffer[1024], *ptr; UCHAR buffer[1024], *ptr;
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
SLONG id; SLONG id;
USHORT item, flag, length; USHORT item;
bool flag;
USHORT length;
TDR trans; TDR trans;
TGBL tdgbl; TGBL tdgbl;
@ -310,7 +311,7 @@ void TDR_list_limbo(FRBRD *handle, TEXT * name, ULONG switches)
} }
ptr = buffer; ptr = buffer;
flag = TRUE; flag = true;
while (flag) { while (flag) {
item = *ptr++; item = *ptr++;
@ -320,7 +321,8 @@ void TDR_list_limbo(FRBRD *handle, TEXT * name, ULONG switches)
case gds_info_limbo: case gds_info_limbo:
id = gds__vax_integer(ptr, length); id = gds__vax_integer(ptr, length);
if (switches & if (switches &
(sw_commit | sw_rollback | sw_two_phase | sw_prompt)) { (sw_commit | sw_rollback | sw_two_phase | sw_prompt))
{
TDR_reconnect_multiple(handle, id, name, switches); TDR_reconnect_multiple(handle, id, name, switches);
ptr += length; ptr += length;
break; break;
@ -357,7 +359,7 @@ void TDR_list_limbo(FRBRD *handle, TEXT * name, ULONG switches)
ALICE_print(72, 0, 0, 0, 0, 0); /* msg 72: More limbo transactions than fit. Try again */ ALICE_print(72, 0, 0, 0, 0, 0); /* msg 72: More limbo transactions than fit. Try again */
case gds_info_end: case gds_info_end:
flag = FALSE; flag = false;
break; break;
default: default:
@ -381,13 +383,15 @@ void TDR_list_limbo(FRBRD *handle, TEXT * name, ULONG switches)
// gfix user. // gfix user.
// //
BOOLEAN TDR_reconnect_multiple(FRBRD *handle, bool TDR_reconnect_multiple(FRBRD *handle,
SLONG id, TEXT * name, ULONG switches) SLONG id,
TEXT * name,
ULONG switches)
{ {
TDR trans, ptr; TDR trans, ptr;
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
USHORT advice; USHORT advice;
BOOLEAN error = FALSE; bool error = false;
// get the state of all the associated transactions // get the state of all the associated transactions
@ -488,7 +492,7 @@ BOOLEAN TDR_reconnect_multiple(FRBRD *handle,
else else
{ {
ALICE_print(84, 0, 0, 0, 0, 0); /* msg 84: unexpected end of input */ ALICE_print(84, 0, 0, 0, 0, 0); /* msg 84: unexpected end of input */
error = TRUE; error = true;
} }
// shutdown all the databases for cleanliness' sake // shutdown all the databases for cleanliness' sake
@ -510,7 +514,7 @@ BOOLEAN TDR_reconnect_multiple(FRBRD *handle,
static void print_description(TDR trans) static void print_description(TDR trans)
{ {
TDR ptr; TDR ptr;
BOOLEAN prepared_seen; bool prepared_seen;
#ifdef SUPERSERVER #ifdef SUPERSERVER
int i; int i;
@ -528,7 +532,7 @@ static void print_description(TDR trans)
ALICE_print(92, 0, 0, 0, 0, 0); /* msg 92: Multidatabase transaction: */ ALICE_print(92, 0, 0, 0, 0, 0); /* msg 92: Multidatabase transaction: */
} }
prepared_seen = FALSE; prepared_seen = false;
for (ptr = trans; ptr; ptr = ptr->tdr_next) for (ptr = trans; ptr; ptr = ptr->tdr_next)
{ {
if (ptr->tdr_host_site) if (ptr->tdr_host_site)
@ -575,7 +579,7 @@ static void print_description(TDR trans)
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_state); SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_state);
SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_state_limbo); SVC_putc(tdgbl->service_blk, (UCHAR) isc_spb_tra_state_limbo);
#endif #endif
prepared_seen = TRUE; prepared_seen = true;
break; break;
case TRA_commit: case TRA_commit:
@ -717,7 +721,7 @@ static ULONG ask(void)
switches = 0; switches = 0;
while (TRUE) { while (true) {
ALICE_print(85, 0, 0, 0, 0, 0); /* msg 85: Commit, rollback, or neither (c, r, or n)? */ ALICE_print(85, 0, 0, 0, 0, 0); /* msg 85: Commit, rollback, or neither (c, r, or n)? */
if (tdgbl->sw_service) if (tdgbl->sw_service)
ib_putc('\001', ib_stdout); ib_putc('\001', ib_stdout);
@ -768,7 +772,8 @@ static void reattach_database(TDR trans)
reinterpret_cast < const char *>(trans->tdr_host_site->str_data))) reinterpret_cast < const char *>(trans->tdr_host_site->str_data)))
{ {
if (TDR_attach_database(status_vector, trans, if (TDR_attach_database(status_vector, trans,
reinterpret_cast<char*>(trans->tdr_fullpath->str_data))) reinterpret_cast<char*>
(trans->tdr_fullpath->str_data)))
{ {
return; return;
} }
@ -789,9 +794,11 @@ static void reattach_database(TDR trans)
for (q = trans->tdr_fullpath->str_data; *q;) for (q = trans->tdr_fullpath->str_data; *q;)
*p++ = *q++; *p++ = *q++;
*q = 0; *q = 0;
if (TDR_attach_database if (TDR_attach_database(status_vector, trans,
(status_vector, trans, reinterpret_cast < char *>(buffer)))
reinterpret_cast < char *>(buffer))) return; {
return;
}
} }
// attaching using the old method didn't work; // attaching using the old method didn't work;
@ -807,9 +814,11 @@ static void reattach_database(TDR trans)
for (q = (UCHAR *) trans->tdr_filename; *q;) for (q = (UCHAR *) trans->tdr_filename; *q;)
*p++ = *q++; *p++ = *q++;
*q = 0; *q = 0;
if (TDR_attach_database if (TDR_attach_database (status_vector, trans,
(status_vector, trans, reinterpret_cast < char *>(buffer)))
reinterpret_cast < char *>(buffer))) return; {
return;
}
} }
// we have failed to reattach; notify the user // we have failed to reattach; notify the user
@ -828,8 +837,7 @@ static void reattach_database(TDR trans)
p = buffer; p = buffer;
while (*p == ' ') while (*p == ' ')
*p++; *p++;
if (TDR_attach_database(status_vector, if (TDR_attach_database(status_vector, trans,
trans,
reinterpret_cast<char*>(p))) reinterpret_cast<char*>(p)))
{ {
string = FB_NEW_RPT(*tdgbl->ALICE_default_pool, string = FB_NEW_RPT(*tdgbl->ALICE_default_pool,
@ -868,8 +876,10 @@ static void reattach_databases(TDR trans)
// Commit or rollback a named transaction. // Commit or rollback a named transaction.
// //
static BOOLEAN reconnect(FRBRD *handle, static bool reconnect(FRBRD *handle,
SLONG number, TEXT * name, ULONG switches) SLONG number,
TEXT * name,
ULONG switches)
{ {
FRBRD *transaction; FRBRD *transaction;
SLONG id; SLONG id;
@ -879,17 +889,20 @@ static BOOLEAN reconnect(FRBRD *handle,
transaction = NULL; transaction = NULL;
if (gds__reconnect_transaction(status_vector, &handle, &transaction, if (gds__reconnect_transaction(status_vector, &handle, &transaction,
sizeof(id), reinterpret_cast <char *>(&id))) { sizeof(id), reinterpret_cast <char *>(&id))) {
ALICE_print(90, name, 0, 0, 0, 0); /* msg 90: failed to reconnect to a transaction in database %s */ ALICE_print(90, name, 0, 0, 0, 0);
// msg 90: failed to reconnect to a transaction in database %s
ALICE_print_status(status_vector); ALICE_print_status(status_vector);
return TRUE; return true;
} }
if (!(switches & (sw_commit | sw_rollback))) { if (!(switches & (sw_commit | sw_rollback))) {
ALICE_print(91, reinterpret_cast < char *>(number), 0, 0, 0, 0); /* msg 91: Transaction %ld: */ ALICE_print(91, reinterpret_cast < char *>(number), 0, 0, 0, 0);
// msg 91: Transaction %ld:
switches = ask(); switches = ask();
if (switches == (ULONG) - 1) { if (switches == (ULONG) - 1) {
ALICE_print(84, 0, 0, 0, 0, 0); /* msg 84: unexpected end of input */ ALICE_print(84, 0, 0, 0, 0, 0);
return TRUE; // msg 84: unexpected end of input
return true;
} }
} }
@ -898,13 +911,13 @@ static BOOLEAN reconnect(FRBRD *handle,
else if (switches & sw_rollback) else if (switches & sw_rollback)
gds__rollback_transaction(status_vector, &transaction); gds__rollback_transaction(status_vector, &transaction);
else else
return FALSE; return false;
if (status_vector[1]) { if (status_vector[1]) {
ALICE_print_status(status_vector); ALICE_print_status(status_vector);
return TRUE; return true;
} }
return FALSE; return false;
} }

View File

@ -25,10 +25,10 @@
#define ALICE_TDR_PROTO_H #define ALICE_TDR_PROTO_H
void TDR_list_limbo(FRBRD*, TEXT*, ULONG); void TDR_list_limbo(FRBRD*, TEXT*, ULONG);
BOOLEAN TDR_reconnect_multiple(FRBRD*, SLONG, TEXT*, ULONG); bool TDR_reconnect_multiple(FRBRD*, SLONG, TEXT*, ULONG);
void TDR_shutdown_databases(TDR); void TDR_shutdown_databases(TDR);
USHORT TDR_analyze(TDR); USHORT TDR_analyze(TDR);
BOOLEAN TDR_attach_database(ISC_STATUS*, TDR, TEXT*); bool TDR_attach_database(ISC_STATUS*, TDR, TEXT*);
void TDR_get_states(TDR); void TDR_get_states(TDR);
#endif /* ALICE_TDR_PROTO_H */ #endif /* ALICE_TDR_PROTO_H */

View File

@ -143,7 +143,7 @@ static int output_svc(SLONG, UCHAR *);
static void burp_output(const SCHAR *, ...) ATTRIBUTE_FORMAT(1,2); static void burp_output(const SCHAR *, ...) ATTRIBUTE_FORMAT(1,2);
#ifndef SUPERSERVER #ifndef SUPERSERVER
static int api_gbak(int, char**, USHORT, TEXT*, TEXT*, TEXT *, BOOLEAN, BOOLEAN); static int api_gbak(int, char**, USHORT, TEXT*, TEXT*, TEXT *, bool, bool);
#endif #endif
#define QUIT 0 #define QUIT 0
@ -158,7 +158,7 @@ static int api_gbak(int, char**, USHORT, TEXT*, TEXT*, TEXT *, BOOLEAN, BOOLEAN)
#define GBYTE MBYTE * KBYTE #define GBYTE MBYTE * KBYTE
#if defined (WIN95) #if defined (WIN95)
static BOOL fAnsiCP = FALSE; static bool fAnsiCP = false;
#define TRANSLATE_CP(a) if (!fAnsiCP) AnsiToOem(a, a) #define TRANSLATE_CP(a) if (!fAnsiCP) AnsiToOem(a, a)
#else #else
#define TRANSLATE_CP(a) #define TRANSLATE_CP(a)
@ -275,7 +275,9 @@ int CLIB_ROUTINE main(int argc, char* argv[])
USHORT total; USHORT total;
TEXT **end, **argvp, *string, *p, *q, c; TEXT **end, **argvp, *string, *p, *q, c;
IN_SW_TAB in_sw_tab; IN_SW_TAB in_sw_tab;
BOOLEAN flag_restore, flag_verbose, err; bool flag_restore = false;
bool flag_verbose = false;
bool err = false;
TEXT *sw_user, *sw_password, *sw_service; TEXT *sw_user, *sw_password, *sw_service;
TEXT *d_user, *d_password, *d_service; TEXT *d_user, *d_password, *d_service;
@ -286,7 +288,6 @@ int CLIB_ROUTINE main(int argc, char* argv[])
/* Initialize data */ /* Initialize data */
total = 0; total = 0;
flag_restore = flag_verbose = err = FALSE;
sw_user = sw_password = sw_service = d_user = d_password = d_service = NULL; sw_user = sw_password = sw_service = d_user = d_password = d_service = NULL;
/* Parse the command line for the -USER, -PASSWORD, -SERVICE, /* Parse the command line for the -USER, -PASSWORD, -SERVICE,
@ -317,11 +318,11 @@ int CLIB_ROUTINE main(int argc, char* argv[])
case IN_SW_BURP_C: /* create database */ case IN_SW_BURP_C: /* create database */
case IN_SW_BURP_R: /* replace database */ case IN_SW_BURP_R: /* replace database */
total += strlen(string) + 1; total += strlen(string) + 1;
flag_restore = TRUE; flag_restore = true;
break; break;
case IN_SW_BURP_USER: /* default user name */ case IN_SW_BURP_USER: /* default user name */
if (argvp >= end) if (argvp >= end)
err = TRUE; err = true;
else { else {
sw_user = string; sw_user = string;
d_user = *argvp++; d_user = *argvp++;
@ -329,7 +330,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
break; break;
case IN_SW_BURP_PASS: /* default password */ case IN_SW_BURP_PASS: /* default password */
if (argvp >= end) if (argvp >= end)
err = TRUE; err = true;
else { else {
sw_password = string; sw_password = string;
d_password = *argvp++; d_password = *argvp++;
@ -337,7 +338,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
break; break;
case IN_SW_BURP_SE: /* service name */ case IN_SW_BURP_SE: /* service name */
if (argvp >= end) { if (argvp >= end) {
err = TRUE; err = true;
} else { } else {
sw_service = string; sw_service = string;
d_service = *argvp++; d_service = *argvp++;
@ -345,7 +346,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
break; break;
case IN_SW_BURP_V: /* verify actions */ case IN_SW_BURP_V: /* verify actions */
total += strlen(string) + 1; total += strlen(string) + 1;
flag_verbose = TRUE; flag_verbose = true;
break; break;
default: default:
total += strlen(string) + 1; total += strlen(string) + 1;
@ -527,7 +528,7 @@ int BURP_gbak(int argc,
redir_err = atol(argv[4]); redir_err = atol(argv[4]);
#ifdef WIN_NT #ifdef WIN_NT
#if defined (WIN95) #if defined (WIN95)
fAnsiCP = TRUE; fAnsiCP = true;
#endif #endif
redir_in = _open_osfhandle(redir_in, 0); redir_in = _open_osfhandle(redir_in, 0);
redir_out = _open_osfhandle(redir_out, 0); redir_out = _open_osfhandle(redir_out, 0);
@ -1953,14 +1954,14 @@ static ULONG get_size( SCHAR * string, FIL file)
**********************************************/ **********************************************/
SCHAR *num, c; SCHAR *num, c;
ULONG size; ULONG size;
BOOLEAN digit; bool digit;
file->fil_size_code = size_n; file->fil_size_code = size_n;
for (size = 0, digit = FALSE, num = string; c = *num++;) { for (size = 0, digit = false, num = string; c = *num++;) {
if (isdigit(c)) { if (isdigit(c)) {
size = size * 10 + (c - '0'); size = size * 10 + (c - '0');
digit = TRUE; digit = true;
} }
else { else {
if (isalpha(c)) { if (isalpha(c)) {
@ -2004,8 +2005,8 @@ static int api_gbak(int argc,
TEXT * password, TEXT * password,
TEXT * user, TEXT * user,
TEXT * service, TEXT * service,
BOOLEAN restore, bool restore,
BOOLEAN verbose) bool verbose)
{ {
/********************************************** /**********************************************
* *

View File

@ -108,9 +108,9 @@ static int get_text(UCHAR*, SSHORT);
static void prompt_for_name(SCHAR*, int); static void prompt_for_name(SCHAR*, int);
static void put_asciz(SCHAR, SCHAR*); static void put_asciz(SCHAR, SCHAR*);
static void put_numeric(SCHAR, int); static void put_numeric(SCHAR, int);
static bool read_header(DESC, ULONG*, USHORT*, USHORT); static bool read_header(DESC, ULONG*, USHORT*, bool);
static bool write_header(DESC, ULONG, USHORT); static bool write_header(DESC, ULONG, bool);
static DESC next_volume(DESC, int, USHORT); static DESC next_volume(DESC, int, bool);
//____________________________________________________________ //____________________________________________________________
@ -218,7 +218,7 @@ void MVOL_init_read(UCHAR* database_name,
tdgbl->mvol_io_buffer = BURP_ALLOC(temp_buffer_size); tdgbl->mvol_io_buffer = BURP_ALLOC(temp_buffer_size);
tdgbl->gbl_backup_start_time[0] = 0; tdgbl->gbl_backup_start_time[0] = 0;
read_header(tdgbl->file_desc, &temp_buffer_size, format, TRUE); read_header(tdgbl->file_desc, &temp_buffer_size, format, true);
if (temp_buffer_size > tdgbl->mvol_actual_buffer_size) if (temp_buffer_size > tdgbl->mvol_actual_buffer_size)
{ {
@ -270,14 +270,14 @@ void MVOL_init_write(UCHAR* database_name,
BURP_ALLOC(temp_buffer_size + MAX_HEADER_SIZE); BURP_ALLOC(temp_buffer_size + MAX_HEADER_SIZE);
tdgbl->mvol_io_cnt = tdgbl->mvol_actual_buffer_size; tdgbl->mvol_io_cnt = tdgbl->mvol_actual_buffer_size;
while (!write_header(tdgbl->file_desc, temp_buffer_size, FALSE)) while (!write_header(tdgbl->file_desc, temp_buffer_size, false))
{ {
if (tdgbl->action->act_action == ACT_backup_split) if (tdgbl->action->act_action == ACT_backup_split)
{ {
BURP_error(269, tdgbl->action->act_file->fil_name, 0, 0, 0, 0); BURP_error(269, tdgbl->action->act_file->fil_name, 0, 0, 0, 0);
/* msg 269 can't write a header record to file %s */ /* msg 269 can't write a header record to file %s */
} }
tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_WRITE, FALSE); tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_WRITE, false);
} }
tdgbl->mvol_actual_buffer_size = temp_buffer_size; tdgbl->mvol_actual_buffer_size = temp_buffer_size;
@ -313,7 +313,7 @@ int MVOL_read(int* cnt, UCHAR** ptr)
{ {
if (!tdgbl->mvol_io_cnt || errno == EIO) if (!tdgbl->mvol_io_cnt || errno == EIO)
{ {
tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_READ, FALSE); tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_READ, false);
if (tdgbl->mvol_io_cnt > 0) if (tdgbl->mvol_io_cnt > 0)
{ {
break; break;
@ -371,7 +371,7 @@ int MVOL_read(int* cnt, UCHAR** ptr)
{ {
if (!tdgbl->mvol_io_cnt) if (!tdgbl->mvol_io_cnt)
{ {
tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_READ, FALSE); tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_READ, false);
if (tdgbl->mvol_io_cnt > 0) if (tdgbl->mvol_io_cnt > 0)
break; break;
} }
@ -554,7 +554,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr)
{ {
UCHAR *ptr; UCHAR *ptr;
ULONG left, cnt, size_to_write; ULONG left, cnt, size_to_write;
USHORT full_buffer; bool full_buffer;
TGBL tdgbl; TGBL tdgbl;
FIL file; FIL file;
@ -684,9 +684,9 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr)
} }
left += tdgbl->mvol_io_data - tdgbl->mvol_io_header; left += tdgbl->mvol_io_data - tdgbl->mvol_io_header;
if (left >= tdgbl->mvol_io_buffer_size) if (left >= tdgbl->mvol_io_buffer_size)
full_buffer = TRUE; full_buffer = true;
else else
full_buffer = FALSE; full_buffer = false;
tdgbl->file_desc = tdgbl->file_desc =
next_volume(tdgbl->file_desc, MODE_WRITE, full_buffer); next_volume(tdgbl->file_desc, MODE_WRITE, full_buffer);
if (full_buffer) if (full_buffer)
@ -870,7 +870,9 @@ static int get_text(UCHAR* text, SSHORT length)
// Get specification for the next volume (tape). // Get specification for the next volume (tape).
// Try to open it. Return file descriptor. // Try to open it. Return file descriptor.
// //
static DESC next_volume( DESC handle, int mode, USHORT full_buffer) static DESC next_volume(DESC handle,
int mode,
bool full_buffer)
{ {
SCHAR new_file[MAX_FILE_NAME_LENGTH]; SCHAR new_file[MAX_FILE_NAME_LENGTH];
DESC new_desc; DESC new_desc;
@ -967,7 +969,7 @@ static DESC next_volume( DESC handle, int mode, USHORT full_buffer)
{ {
/* File is open for read only. Read the header. */ /* File is open for read only. Read the header. */
if (!read_header(new_desc, &temp_buffer_size, &format, FALSE)) if (!read_header(new_desc, &temp_buffer_size, &format, false))
{ {
BURP_print(224, new_file, 0, 0, 0, 0); BURP_print(224, new_file, 0, 0, 0, 0);
continue; continue;
@ -1148,7 +1150,7 @@ static void put_numeric( SCHAR attribute, int value)
static bool read_header(DESC handle, static bool read_header(DESC handle,
ULONG* buffer_size, ULONG* buffer_size,
USHORT* format, USHORT* format,
USHORT init_flag) bool init_flag)
{ {
int attribute, temp; int attribute, temp;
SSHORT l; SSHORT l;
@ -1283,7 +1285,7 @@ static bool read_header(DESC handle,
// //
static bool write_header(DESC handle, static bool write_header(DESC handle,
ULONG backup_buffer_size, ULONG backup_buffer_size,
USHORT full_buffer) bool full_buffer)
{ {
ULONG vax_value; ULONG vax_value;
USHORT i; USHORT i;

View File

@ -126,10 +126,10 @@ static int free_file_list(B_FIL);
static int final_flush_io_buff(UCHAR *, SLONG, FILE_DESC); static int final_flush_io_buff(UCHAR *, SLONG, FILE_DESC);
static int final_read_and_write(FILE_DESC, FILE_DESC, static int final_read_and_write(FILE_DESC, FILE_DESC,
TEXT *, SLONG, UCHAR **, BOOLEAN *); TEXT *, SLONG, UCHAR **, bool *);
static int flush_io_buff(UCHAR *, SLONG, static int flush_io_buff(UCHAR *, SLONG,
FILE_DESC, double, SLONG *, BOOLEAN *); FILE_DESC, double, SLONG *, bool *);
static int get_file_name(SCHAR *, double, B_FIL *); static int get_file_name(SCHAR *, double, B_FIL *);
@ -147,7 +147,7 @@ static int print_clo(TEXT *);
static int read_and_write(FILE_DESC, FILE_DESC, static int read_and_write(FILE_DESC, FILE_DESC,
TEXT *, SLONG, TEXT *, SLONG,
double, UCHAR **, BOOLEAN *, double *, SLONG *); double, UCHAR **, bool *, double *, SLONG *);
static int read_and_write_for_join(FILE_DESC, TEXT *, static int read_and_write_for_join(FILE_DESC, TEXT *,
UCHAR **, SLONG, SLONG *); UCHAR **, SLONG, SLONG *);
@ -156,12 +156,12 @@ static int write_header(B_FIL, HEADER_REC, FILE_DESC, TEXT *);
/***************************************************** /*****************************************************
** **
** M A I N P R O G R A M ** M A I N P R O G R A M
** **
****************************************************** ******************************************************
*/ */
int main( int argc, char *argv[]) int main( int argc, char *argv[])
{ {
@ -169,9 +169,12 @@ int main( int argc, char *argv[])
SCHAR **end, *prog_name, *string; SCHAR **end, *prog_name, *string;
IN_SW_TAB in_sw_tab; IN_SW_TAB in_sw_tab;
USHORT sw_replace; USHORT sw_replace;
B_FIL file_ptr, file_list, prev_file; B_FIL file_ptr;
BOOLEAN file_nm_sw = FALSE; B_FIL file_list;
SLONG ret_cd, file_num = 0; B_FIL prev_file;
bool file_nm_sw = false;
SLONG ret_cd;
SLONG file_num = 0;
double file_size; double file_size;
FILE_DESC input_file_desc; FILE_DESC input_file_desc;
@ -181,7 +184,7 @@ int main( int argc, char *argv[])
ib_fprintf(ib_stderr, "%s: No Command Line Option Specified\n", ib_fprintf(ib_stderr, "%s: No Command Line Option Specified\n",
argv[0]); argv[0]);
ret_cd = print_clo(prog_name); ret_cd = print_clo(prog_name);
return FB_FAILURE; return 1;
} }
/************************ /************************
@ -191,7 +194,7 @@ int main( int argc, char *argv[])
file_ptr = file_list = prev_file = NULL; file_ptr = file_list = prev_file = NULL;
file_size = -1; file_size = -1;
sw_replace = FALSE; sw_replace = 0;
end = argv + argc; end = argv + argc;
++argv; ++argv;
@ -218,12 +221,12 @@ int main( int argc, char *argv[])
ret_cd = free_file_list(file_list); ret_cd = free_file_list(file_list);
return FB_FAILURE; return FB_FAILURE;
} }
} /* end of processing (*string == '-') */ } // end of processing (*string == '-')
else { /* processing function specific command line options */ else { // processing function specific command line options
switch (sw_replace) { switch (sw_replace) {
case (IN_SW_SPIT_SP): case (IN_SW_SPIT_SP):
if (file_nm_sw == FALSE) { /* process file name */ if (file_nm_sw == false) { // process file name
file_size = 0; file_size = 0;
file_num = file_num + 1; file_num = file_num + 1;
@ -255,7 +258,7 @@ int main( int argc, char *argv[])
return FB_FAILURE; return FB_FAILURE;
} }
file_nm_sw = TRUE; file_nm_sw = true;
file_ptr->b_fil_number = file_num; file_ptr->b_fil_number = file_num;
if (file_list == NULL) if (file_list == NULL)
@ -268,7 +271,7 @@ int main( int argc, char *argv[])
} /* processing file name */ } /* processing file name */
else { /* processing file size */ else { /* processing file size */
file_nm_sw = FALSE; file_nm_sw = false;
ret_cd = get_file_size(prog_name, string, &file_size); ret_cd = get_file_size(prog_name, string, &file_size);
if (ret_cd == FB_FAILURE) { if (ret_cd == FB_FAILURE) {
ret_cd = free_file_list(file_list); ret_cd = free_file_list(file_list);
@ -310,7 +313,7 @@ int main( int argc, char *argv[])
} /* processing function specific command line options */ } /* processing function specific command line options */
} /* while (argv < end) */ } /* while (argv < end) */
if ((file_list == NULL) && (sw_replace != FALSE)) { if ((file_list == NULL) && (sw_replace)) {
ib_fprintf(ib_stderr, ib_fprintf(ib_stderr,
"%s: invalid option '%s', rest of parameters is missing\n", "%s: invalid option '%s', rest of parameters is missing\n",
prog_name, string); prog_name, string);
@ -361,7 +364,7 @@ int main( int argc, char *argv[])
static int get_function_option(SCHAR* prog_name, static int get_function_option(SCHAR* prog_name,
USHORT* sw_replace, USHORT * sw_replace,
SCHAR* string, SCHAR* string,
IN_SW_TAB in_sw_table) IN_SW_TAB in_sw_table)
{ {
@ -379,7 +382,6 @@ static int get_function_option(SCHAR* prog_name,
*/ */
SCHAR c, *p, *q; SCHAR c, *p, *q;
USHORT op_specified;
IN_SW_TAB in_sw_tab; IN_SW_TAB in_sw_tab;
SLONG ret_cd; SLONG ret_cd;
@ -389,15 +391,13 @@ static int get_function_option(SCHAR* prog_name,
return FB_FAILURE; return FB_FAILURE;
} }
op_specified = *sw_replace;
for (in_sw_tab = in_sw_table; q = in_sw_tab->in_sw_name; in_sw_tab++) { for (in_sw_tab = in_sw_table; q = in_sw_tab->in_sw_name; in_sw_tab++) {
for (p = string + 1; c = *p++;) for (p = string + 1; c = *p++;)
if (UPPER(c) != *q++) if (UPPER(c) != *q++)
break; break;
if (!c) { if (!c) {
if (*sw_replace == FALSE) { if (*sw_replace == 0) {
*sw_replace = in_sw_tab->in_sw; *sw_replace = (in_sw_tab->in_sw);
return FB_SUCCESS; return FB_SUCCESS;
} }
else { else {
@ -569,7 +569,8 @@ static int gen_multy_bakup_files(B_FIL file_list,
FILE_DESC output_fl_desc; FILE_DESC output_fl_desc;
SLONG byte_write, clock, indx, io_size, remaining_io_len, ret_cd, pos; SLONG byte_write, clock, indx, io_size, remaining_io_len, ret_cd, pos;
B_FIL fl_ptr = file_list; B_FIL fl_ptr = file_list;
BOOLEAN end_of_input = FALSE, flush_done = FALSE; bool end_of_input = false;
bool flush_done = false;
TEXT *file_name, header_str[HEADER_REC_LEN], num_arr[5]; TEXT *file_name, header_str[HEADER_REC_LEN], num_arr[5];
UCHAR *remaining_io; UCHAR *remaining_io;
HEADER_REC hdr_rec; HEADER_REC hdr_rec;
@ -633,7 +634,7 @@ static int gen_multy_bakup_files(B_FIL file_list,
for (indx = 0; indx < sizeof(hdr_rec.fl_name); indx++) for (indx = 0; indx < sizeof(hdr_rec.fl_name); indx++)
hdr_rec.fl_name[indx] = BLANK; hdr_rec.fl_name[indx] = BLANK;
while (TRUE) { while (true) {
if (fl_ptr != NULL) { if (fl_ptr != NULL) {
byte_read = 0; byte_read = 0;
byte_write = 0; byte_write = 0;
@ -671,7 +672,7 @@ static int gen_multy_bakup_files(B_FIL file_list,
io_size = IO_BUFFER_SIZE; io_size = IO_BUFFER_SIZE;
if (fl_ptr == NULL) { if (fl_ptr == NULL) {
while (end_of_input == FALSE) { while (end_of_input == false) {
ret_cd = final_read_and_write(input_file_desc, output_fl_desc, ret_cd = final_read_and_write(input_file_desc, output_fl_desc,
file_name, io_size, &io_buffer, file_name, io_size, &io_buffer,
&end_of_input); &end_of_input);
@ -680,7 +681,7 @@ static int gen_multy_bakup_files(B_FIL file_list,
return FB_FAILURE; return FB_FAILURE;
} }
if (end_of_input == TRUE) { if (end_of_input == true) {
free(io_buffer); free(io_buffer);
return FB_SUCCESS; return FB_SUCCESS;
} }
@ -708,7 +709,7 @@ static int gen_multy_bakup_files(B_FIL file_list,
remaining_io = io_buffer + byte_write; remaining_io = io_buffer + byte_write;
remaining_io_len = IO_BUFFER_SIZE - byte_write; remaining_io_len = IO_BUFFER_SIZE - byte_write;
while ((flush_done == FALSE) while ((flush_done == false)
&& (fl_ptr != NULL)) { && (fl_ptr != NULL)) {
if ((fl_ptr->b_fil_next == NULL) if ((fl_ptr->b_fil_next == NULL)
&& (fl_ptr->b_fil_size == 0)) && (fl_ptr->b_fil_size == 0))
@ -765,7 +766,7 @@ static int gen_multy_bakup_files(B_FIL file_list,
free(io_buffer); free(io_buffer);
return FB_FAILURE; return FB_FAILURE;
} }
if (flush_done == TRUE) { if (flush_done == true) {
file_size = file_size - byte_write; file_size = file_size - byte_write;
byte_write = 0; byte_write = 0;
} }
@ -783,13 +784,13 @@ static int gen_multy_bakup_files(B_FIL file_list,
break; break;
} }
if (end_of_input == TRUE) { if (end_of_input == true) {
free(io_buffer); free(io_buffer);
return FB_SUCCESS; return FB_SUCCESS;
} }
} }
} }
} /* end of while ( TRUE ) */ } // end of while ( true )
} }
@ -799,7 +800,7 @@ static int read_and_write(FILE_DESC input_file_desc,
SLONG io_size, SLONG io_size,
double file_size, double file_size,
UCHAR ** io_buffer, UCHAR ** io_buffer,
BOOLEAN * end_of_input, bool * end_of_input,
double *byte_read, double *byte_read,
SLONG * byte_write) SLONG * byte_write)
{ {
@ -839,7 +840,7 @@ static int read_and_write(FILE_DESC input_file_desc,
switch (read_cnt) { switch (read_cnt) {
case (0): /* no more data to be read */ case (0): /* no more data to be read */
close(output_fl_desc); close(output_fl_desc);
*end_of_input = TRUE; *end_of_input = true;
*byte_read = *byte_read + read_cnt; *byte_read = *byte_read + read_cnt;
return FB_SUCCESS; return FB_SUCCESS;
break; break;
@ -883,7 +884,7 @@ static int final_read_and_write(FILE_DESC input_file_desc,
TEXT * file_name, TEXT * file_name,
SLONG io_size, SLONG io_size,
UCHAR ** io_buffer, UCHAR ** io_buffer,
BOOLEAN * end_of_input) bool * end_of_input)
{ {
/******************************************************************** /********************************************************************
@ -907,7 +908,7 @@ static int final_read_and_write(FILE_DESC input_file_desc,
switch (read_cnt) { switch (read_cnt) {
case (0): /* no more data to be read */ case (0): /* no more data to be read */
close(output_fl_desc); close(output_fl_desc);
*end_of_input = TRUE; *end_of_input = true;
return FB_SUCCESS; return FB_SUCCESS;
break; break;
@ -1086,7 +1087,7 @@ SLONG cnt, SLONG * total_int)
read_cnt = read(input_fl_desc, *io_buffer, IO_BUFFER_SIZE); read_cnt = read(input_fl_desc, *io_buffer, IO_BUFFER_SIZE);
while (TRUE) { while (true) {
switch (read_cnt) { switch (read_cnt) {
case (0): /* no more data to be read */ case (0): /* no more data to be read */
close(input_fl_desc); close(input_fl_desc);
@ -1117,7 +1118,7 @@ SLONG cnt, SLONG * total_int)
read_cnt = read(input_fl_desc, *io_buffer, IO_BUFFER_SIZE); read_cnt = read(input_fl_desc, *io_buffer, IO_BUFFER_SIZE);
} /* end of while (TRUE) loop */ } // end of while (true) loop
} }
@ -1141,7 +1142,7 @@ static int conv_ntoc( SLONG numeric_in, TEXT char_out[])
i = numeric_in; i = numeric_in;
indx = 3; indx = 3;
while (TRUE) { while (true) {
mod = i % 10; mod = i % 10;
switch (mod) { switch (mod) {
case (0): case (0):
@ -1262,7 +1263,7 @@ static int flush_io_buff(UCHAR* remaining_io,
FILE_DESC output_fl_desc, FILE_DESC output_fl_desc,
double file_size, double file_size,
SLONG* byte_write, SLONG* byte_write,
BOOLEAN* flush_done) bool* flush_done)
{ {
/******************************************************************** /********************************************************************
** **
@ -1276,16 +1277,16 @@ static int flush_io_buff(UCHAR* remaining_io,
** **
** when the file_size is truly has space to write out the remaining data ** when the file_size is truly has space to write out the remaining data
** then ** then
** set and returns flush_done TRUE ** set and returns flush_done true
** otherwise ** otherwise
** closes the output file, set and returns flush_done FALSE. ** closes the output file, set and returns flush_done false.
** otherwise ** otherwise
** we can only writes out as much data as file_size indicated ** we can only writes out as much data as file_size indicated
** if it was able to write out the remaining data ** if it was able to write out the remaining data
** then ** then
** set and returns flush_done TRUE ** set and returns flush_done true
** otherwise ** otherwise
** closes the output file, set and returns flush_done FALSE. ** closes the output file, set and returns flush_done false.
** **
********************************************************************* *********************************************************************
*/ */
@ -1304,17 +1305,17 @@ static int flush_io_buff(UCHAR* remaining_io,
switch (write_cnt) { switch (write_cnt) {
case (-1): /* write failed */ case (-1): /* write failed */
close(output_fl_desc); close(output_fl_desc);
*flush_done = FALSE; *flush_done = false;
return FB_FAILURE; return FB_FAILURE;
break; break;
default: default:
if (write_cnt == remaining_io_len) /* write ok */ if (write_cnt == remaining_io_len) /* write ok */
*flush_done = TRUE; *flush_done = true;
else { /* could not write out all remaining data */ else { /* could not write out all remaining data */
close(output_fl_desc); close(output_fl_desc);
*flush_done = FALSE; *flush_done = false;
} }
*byte_write = write_cnt; *byte_write = write_cnt;
return FB_SUCCESS; return FB_SUCCESS;

View File

@ -134,15 +134,15 @@ int CLIB_ROUTINE main( int argc, char *argv[])
first switch can be "-svc" (lower case!) or it can be "-svc_re" followed first switch can be "-svc" (lower case!) or it can be "-svc_re" followed
by 3 file descriptors to use in re-directing ib_stdin, ib_stdout, and ib_stderr. */ by 3 file descriptors to use in re-directing ib_stdin, ib_stdout, and ib_stderr. */
DDL_service = FALSE; DDL_service = false;
if (argc > 1 && !strcmp(argv[1], "-svc")) { if (argc > 1 && !strcmp(argv[1], "-svc")) {
DDL_service = TRUE; DDL_service = true;
argv++; argv++;
argc--; argc--;
} }
else if (argc > 4 && !strcmp(argv[1], "-svc_re")) { else if (argc > 4 && !strcmp(argv[1], "-svc_re")) {
DDL_service = TRUE; DDL_service = true;
redir_in = atol(argv[2]); redir_in = atol(argv[2]);
redir_out = atol(argv[3]); redir_out = atol(argv[3]);
redir_err = atol(argv[4]); redir_err = atol(argv[4]);
@ -167,7 +167,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
DDL_file_name = NULL; DDL_file_name = NULL;
DB_file_name = NULL; DB_file_name = NULL;
DDL_drop_database = DDL_quit = DDL_extract = DDL_dynamic = DDL_trace = DDL_drop_database = DDL_quit = DDL_extract = DDL_dynamic = DDL_trace =
DDL_version = FALSE; DDL_version = false;
DDL_default_user = DDL_default_password = NULL; DDL_default_user = DDL_default_password = NULL;
file_name_1[0] = file_name_2[0] = 0; file_name_1[0] = file_name_2[0] = 0;
@ -211,7 +211,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
} }
switch (in_sw) { switch (in_sw) {
case IN_SW_GDEF_D: case IN_SW_GDEF_D:
DDL_dynamic = TRUE; DDL_dynamic = true;
DYN_file_name[0] = 0; DYN_file_name[0] = 0;
if (argc == 1) if (argc == 1)
break; break;
@ -252,20 +252,20 @@ int CLIB_ROUTINE main( int argc, char *argv[])
break; break;
case IN_SW_GDEF_G: case IN_SW_GDEF_G:
DDL_extract = TRUE; DDL_extract = true;
break; break;
case IN_SW_GDEF_R: case IN_SW_GDEF_R:
DDL_replace = TRUE; DDL_replace = true;
break; break;
case IN_SW_GDEF_T: case IN_SW_GDEF_T:
DDL_trace = TRUE; DDL_trace = true;
break; break;
case IN_SW_GDEF_Z: case IN_SW_GDEF_Z:
DDL_msg_put(0, GDS_VERSION, 0, 0, 0, 0); /* msg 0: gdef version %s\n */ DDL_msg_put(0, GDS_VERSION, 0, 0, 0, 0); /* msg 0: gdef version %s\n */
DDL_version = TRUE; DDL_version = true;
break; break;
case IN_SW_GDEF_PASSWORD: case IN_SW_GDEF_PASSWORD:
@ -378,8 +378,10 @@ int CLIB_ROUTINE main( int argc, char *argv[])
DDL_msg_partial(9, 0, 0, 0, 0, 0); /* msg 9: \n1 error during input. */ DDL_msg_partial(9, 0, 0, 0, 0, 0); /* msg 9: \n1 error during input. */
else else
DDL_msg_partial(8, 0, 0, 0, 0, 0); /* msg 8: \nNo errors. */ DDL_msg_partial(8, 0, 0, 0, 0, 0); /* msg 8: \nNo errors. */
if (DDL_yes_no(10)) /* msg 10 : save changes before exiting? */ if (DDL_yes_no(10)){ // msg 10 : save changes before exiting?
DDL_quit = DDL_errors = 0; DDL_quit = false;
DDL_errors = 0;
}
} }
/* Reverse the set of actions */ /* Reverse the set of actions */
@ -649,7 +651,7 @@ void DDL_push( DUDLEY_NOD object, LLS * pointer)
} }
int DDL_yes_no( USHORT number) bool DDL_yes_no( USHORT number)
{ {
/************************************** /**************************************
* *
@ -693,11 +695,11 @@ int DDL_yes_no( USHORT number)
if (c != '\n' && c != EOF) if (c != '\n' && c != EOF)
while ((d = ib_getc(ib_stdin)) != '\n' && d != EOF); while ((d = ib_getc(ib_stdin)) != '\n' && d != EOF);
if (!count && c == EOF) if (!count && c == EOF)
return FALSE; return false;
if (UPPER(c) == UPPER(yes_ans[0])) if (UPPER(c) == UPPER(yes_ans[0]))
return TRUE; return true;
if (UPPER(c) == UPPER(no_ans[0])) if (UPPER(c) == UPPER(no_ans[0]))
return FALSE; return false;
if (!reprompt if (!reprompt
&& gds__msg_format(0, DDL_MSG_FAC, re_num, sizeof(reprompt), && gds__msg_format(0, DDL_MSG_FAC, re_num, sizeof(reprompt),
reprompt, NULL, NULL, NULL, NULL, NULL) <= 0) reprompt, NULL, NULL, NULL, NULL, NULL) <= 0)

View File

@ -286,9 +286,9 @@ typedef struct funcarg {
typedef struct dudley_idx { typedef struct dudley_idx {
USHORT idx_count; /* Number of fields */ USHORT idx_count; /* Number of fields */
UCHAR idx_unique; /* TRUE if unique index */ bool idx_unique; /* true if unique index */
UCHAR idx_inactive; /* FALSE if index is active */ bool idx_inactive; /* false if index is active */
UCHAR idx_type; /* 1 = descending */ bool idx_type; /* true descending */
USHORT idx_flags; /* Indicate which attributes have changed */ USHORT idx_flags; /* Indicate which attributes have changed */
struct sym *idx_name; /* Index name */ struct sym *idx_name; /* Index name */
struct sym *idx_relation; /* Relation in question */ struct sym *idx_relation; /* Relation in question */
@ -296,9 +296,6 @@ typedef struct dudley_idx {
struct sym *idx_field[1]; /* Fields */ struct sym *idx_field[1]; /* Fields */
} *DUDLEY_IDX; } *DUDLEY_IDX;
#define IDX_type_none 0
#define IDX_type_descend 1
#define IDX_active_flag 1 #define IDX_active_flag 1
#define IDX_unique_flag 2 #define IDX_unique_flag 2
#define IDX_null_description 4 #define IDX_null_description 4
@ -612,10 +609,19 @@ typedef enum lan_t {
#endif #endif
EXTERN enum lan_t language; EXTERN enum lan_t language;
EXTERN USHORT DDL_eof, DDL_errors, DDL_line, DDL_interactive, DDL_quit, EXTERN bool DDL_eof;
DDL_dynamic, DDL_drop_database, DDL_service; EXTERN USHORT DDL_errors;
EXTERN UCHAR DDL_replace, DDL_description, DDL_extract, DDL_trace, EXTERN USHORT DDL_line;
DDL_version; EXTERN bool DDL_interactive;
EXTERN bool DDL_quit;
EXTERN bool DDL_dynamic;
EXTERN bool DDL_drop_database;
EXTERN bool DDL_service;
EXTERN bool DDL_replace;
EXTERN bool DDL_description;
EXTERN bool DDL_extract;
EXTERN bool DDL_trace;
EXTERN bool DDL_version;
EXTERN TEXT *DDL_file_name, DYN_file_name[256], *DB_file_name, EXTERN TEXT *DDL_file_name, DYN_file_name[256], *DB_file_name,
DDL_file_string[256], DB_file_string[256]; DDL_file_string[256], DB_file_string[256];
EXTERN TEXT *DDL_default_user, *DDL_default_password; EXTERN TEXT *DDL_default_user, *DDL_default_password;

View File

@ -35,6 +35,6 @@ extern void DDL_msg_partial(USHORT, TEXT *, TEXT *, TEXT *, TEXT *, TEXT *);
extern void DDL_msg_put(USHORT, TEXT *, TEXT *, TEXT *, TEXT *, TEXT *); extern void DDL_msg_put(USHORT, TEXT *, TEXT *, TEXT *, TEXT *, TEXT *);
extern DUDLEY_NOD DDL_pop(LLS *); extern DUDLEY_NOD DDL_pop(LLS *);
extern void DDL_push(DUDLEY_NOD, LLS *); extern void DDL_push(DUDLEY_NOD, LLS *);
extern int DDL_yes_no(USHORT); extern bool DDL_yes_no(USHORT);
#endif /* _DUDLEY_DDL_PROTO_H_ */ #endif /* _DUDLEY_DDL_PROTO_H_ */

View File

@ -889,7 +889,7 @@ void EXE_modify_database( DBB dbb)
} }
int EXE_relation( DUDLEY_REL relation) bool EXE_relation( DUDLEY_REL relation)
{ {
/************************************** /**************************************
* *
@ -903,14 +903,13 @@ int EXE_relation( DUDLEY_REL relation)
* relation block; * relation block;
* *
**************************************/ **************************************/
USHORT result; bool result = false;
SYM symbol; SYM symbol;
symbol = relation->rel_name; symbol = relation->rel_name;
result = FALSE;
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ symbol->sym_string FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ symbol->sym_string
result = TRUE; result = true;
END_FOR; END_FOR;
FOR X IN RDB$RELATION_FIELDS WITH X.RDB$RELATION_NAME EQ symbol->sym_string FOR X IN RDB$RELATION_FIELDS WITH X.RDB$RELATION_NAME EQ symbol->sym_string
@ -935,14 +934,12 @@ static void add_cache( DBB dbb)
* *
**************************************/ **************************************/
FIL file; FIL file;
USHORT result; bool result = false;
result = FALSE;
FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache
result = TRUE; result = true;
DDL_err(323, FIL.RDB$FILE_NAME, NULL, NULL, NULL, NULL); DDL_err(323, FIL.RDB$FILE_NAME, NULL, NULL, NULL, NULL);
/* msg 323: a shared cache file %s already exists */ // msg 323: a shared cache file %s already exists
END_FOR; END_FOR;
if (result) if (result)
@ -1359,19 +1356,20 @@ static void add_index( DUDLEY_IDX index)
* *
**************************************/ **************************************/
SYM *symbol; SYM *symbol;
USHORT i, size, error, if_any; USHORT i;
USHORT size;
bool error = false;
bool if_any = false;
DUDLEY_FLD field; DUDLEY_FLD field;
error = if_any = FALSE;
FOR X IN RDB$RELATIONS WITH FOR X IN RDB$RELATIONS WITH
X.RDB$RELATION_NAME = index->idx_relation->sym_string X.RDB$RELATION_NAME = index->idx_relation->sym_string
if (!X.RDB$VIEW_BLR.NULL) { if (!X.RDB$VIEW_BLR.NULL) {
DDL_err(42, index->idx_relation->sym_string, NULL, NULL, NULL, NULL); DDL_err(42, index->idx_relation->sym_string, NULL, NULL, NULL, NULL);
/* msg 42: %s is a view and can not be indexed */ // msg 42: %s is a view and can not be indexed
error = TRUE; error = true;
} }
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (error) if (error)
@ -1420,10 +1418,10 @@ static void add_index( DUDLEY_IDX index)
STORE X IN RDB$INDICES MOVE_SYMBOL(index->idx_name, X.RDB$INDEX_NAME); STORE X IN RDB$INDICES MOVE_SYMBOL(index->idx_name, X.RDB$INDEX_NAME);
MOVE_SYMBOL(index->idx_relation, X.RDB$RELATION_NAME); MOVE_SYMBOL(index->idx_relation, X.RDB$RELATION_NAME);
X.RDB$SEGMENT_COUNT = index->idx_count; X.RDB$SEGMENT_COUNT = index->idx_count;
X.RDB$UNIQUE_FLAG = index->idx_unique; X.RDB$UNIQUE_FLAG = (index->idx_unique) ? TRUE : FALSE;
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE; X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
if (index->idx_type) { if (index->idx_type) {
X.RDB$INDEX_TYPE = index->idx_type; X.RDB$INDEX_TYPE = (index->idx_type) ? TRUE : FALSE;
X.RDB$INDEX_TYPE.NULL = FALSE; X.RDB$INDEX_TYPE.NULL = FALSE;
} }
else else
@ -1443,7 +1441,7 @@ static void add_index( DUDLEY_IDX index)
{ {
DDL_db_error(gds_status, 48, index->idx_name->sym_string, NULL, NULL, DDL_db_error(gds_status, 48, index->idx_name->sym_string, NULL, NULL,
NULL, NULL); NULL, NULL);
/* msg 48: error creating index %s */ // msg 48: error creating index %s
return; return;
} }
END_ERROR; END_ERROR;
@ -1528,7 +1526,7 @@ static void add_log_files( DBB dbb)
if (!DDL_errors) { if (!DDL_errors) {
COMMIT ON_ERROR DDL_db_error(gds_status, 321, NULL, NULL, NULL, NULL, NULL); COMMIT ON_ERROR DDL_db_error(gds_status, 321, NULL, NULL, NULL, NULL, NULL);
/* msg 321: error commiting new write ahead log declarations */ // msg 321: error commiting new write ahead log declarations
ROLLBACK; ROLLBACK;
END_ERROR; END_ERROR;
START_TRANSACTION; START_TRANSACTION;
@ -1599,13 +1597,12 @@ static void add_security_class( SCL sec_class)
* *
**************************************/ **************************************/
SYM name; SYM name;
USHORT if_any; bool if_any = false;
name = sec_class->scl_name; name = sec_class->scl_name;
if_any = FALSE;
FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string
if_any = TRUE; if_any = true;
DDL_err(50, name->sym_string, NULL, NULL, NULL, NULL); DDL_err(50, name->sym_string, NULL, NULL, NULL, NULL);
/* msg 50: security class %s already exists */ /* msg 50: security class %s already exists */
END_FOR; END_FOR;
@ -1743,17 +1740,16 @@ static void add_user_privilege( USERPRIV upriv)
* *
**************************************/ **************************************/
TEXT grantor[32], priv[7]; TEXT grantor[32], priv[7];
USHORT if_any, privflag; bool if_any = false;
USHORT privflag;
USRE usr; /* user entry */ USRE usr; /* user entry */
UPFE upf; /* user privilege field entry */ UPFE upf; /* user privilege field entry */
if_any = FALSE;
/* rdb$owner_name doesn't get filled in until we store the relation */ /* rdb$owner_name doesn't get filled in until we store the relation */
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ upriv->userpriv_relation->sym_string FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ upriv->userpriv_relation->sym_string
strcpy(grantor, X.RDB$OWNER_NAME); strcpy(grantor, X.RDB$OWNER_NAME);
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) { if (!if_any) {
@ -2018,9 +2014,7 @@ static bool check_function( SYM name)
* Check function for existence. * Check function for existence.
* *
**************************************/ **************************************/
bool if_any; bool if_any = false;
if_any = false;
FOR X IN RDB$FUNCTIONS WITH X.RDB$FUNCTION_NAME EQ name->sym_string FOR X IN RDB$FUNCTIONS WITH X.RDB$FUNCTION_NAME EQ name->sym_string
if_any = true; if_any = true;
@ -2055,14 +2049,14 @@ static bool check_range(DUDLEY_FLD field)
MOVE_SYMBOL(field->fld_name, name); MOVE_SYMBOL(field->fld_name, name);
dims = field->fld_dimension; dims = field->fld_dimension;
/* existance: if neither is an array, life is good // existance: if neither is an array, life is good
else if there are dimensions they'd better match */ // else if there are dimensions they'd better match
FOR X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name FOR X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name
if (!dims) { if (!dims) {
if (!X.RDB$DIMENSIONS.NULL) if (!X.RDB$DIMENSIONS.NULL)
DDL_err(302, name, NULL, NULL, NULL, NULL); DDL_err(302, name, NULL, NULL, NULL, NULL);
/* msg 302: Include complete field specification to change datatype of array %s */ // msg 302: Include complete field specification to change datatype of array %s
else else
match = true; match = true;
} }
@ -2103,9 +2097,7 @@ static bool check_relation( SYM name)
* Check relation for existence. * Check relation for existence.
* *
**************************************/ **************************************/
bool if_any; bool if_any = false;
if_any = false;
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->sym_string FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->sym_string
if_any = true; if_any = true;
@ -2148,9 +2140,7 @@ static FRBRD *create_blob( SLONG * blob_id, USHORT bpb_length, UCHAR * bpb)
* *
**************************************/ **************************************/
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
FRBRD *blob; FRBRD *blob = NULL;
blob = NULL;
if (gds__create_blob2(status_vector, &DB, &gds_trans, &blob, if (gds__create_blob2(status_vector, &DB, &gds_trans, &blob,
(GDS__QUAD*) blob_id, bpb_length, (SCHAR*) bpb)) { (GDS__QUAD*) blob_id, bpb_length, (SCHAR*) bpb)) {
@ -2175,13 +2165,11 @@ static void drop_cache( DBB dbb)
* Get rid of shared cache file in the database. * Get rid of shared cache file in the database.
* *
**************************************/ **************************************/
USHORT found; bool found = false;
found = FALSE;
FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache
ERASE FIL; ERASE FIL;
found = TRUE; found = true;
END_FOR; END_FOR;
if (!found) if (!found)
@ -2192,7 +2180,7 @@ static void drop_cache( DBB dbb)
COMMIT COMMIT
ON_ERROR ON_ERROR
DDL_db_error(gds_status, 326, NULL, NULL, NULL, NULL, NULL); DDL_db_error(gds_status, 326, NULL, NULL, NULL, NULL, NULL);
/* msg 326: error commiting deletion of shared cache file */ // msg 326: error commiting deletion of shared cache file
ROLLBACK; ROLLBACK;
END_ERROR; END_ERROR;
START_TRANSACTION; START_TRANSACTION;
@ -2219,10 +2207,10 @@ static void drop_field( DUDLEY_FLD field)
* *
**************************************/ **************************************/
DUDLEY_REL relation; DUDLEY_REL relation;
USHORT error, if_any; bool error = false;
bool if_any = false;
relation = field->fld_relation; relation = field->fld_relation;
error = if_any = FALSE;
FOR X IN RDB$RELATION_FIELDS CROSS Y IN RDB$RELATION_FIELDS CROSS FOR X IN RDB$RELATION_FIELDS CROSS Y IN RDB$RELATION_FIELDS CROSS
Z IN RDB$VIEW_RELATIONS WITH Z IN RDB$VIEW_RELATIONS WITH
@ -2238,8 +2226,8 @@ static void drop_field( DUDLEY_FLD field)
relation->rel_name->sym_string, relation->rel_name->sym_string,
Y.RDB$RELATION_NAME, Y.RDB$RELATION_NAME,
NULL, NULL); NULL, NULL);
/* msg 60: field %s from relation %s is referenced in view %s */ // msg 60: field %s from relation %s is referenced in view %s
error = TRUE; error = true;
END_FOR; END_FOR;
if (error) if (error)
@ -2249,7 +2237,7 @@ static void drop_field( DUDLEY_FLD field)
X.RDB$RELATION_NAME EQ relation->rel_name->sym_string AND X.RDB$RELATION_NAME EQ relation->rel_name->sym_string AND
X.RDB$FIELD_NAME EQ field->fld_name->sym_string X.RDB$FIELD_NAME EQ field->fld_name->sym_string
FOR Y IN RDB$RELATION_FIELDS WITH FOR Y IN RDB$RELATION_FIELDS WITH
Y.RDB$FIELD_NAME = X.RDB$BASE_FIELD if_any = TRUE; Y.RDB$FIELD_NAME = X.RDB$BASE_FIELD if_any = true;
END_FOR END_FOR
if (!if_any) { if (!if_any) {
@ -2260,12 +2248,11 @@ static void drop_field( DUDLEY_FLD field)
END_FOR; END_FOR;
} }
ERASE X; ERASE X;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
DDL_err(61, DDL_err(61, field->fld_name->sym_string,
field->fld_name->sym_string,
relation->rel_name->sym_string, NULL, NULL, NULL); relation->rel_name->sym_string, NULL, NULL, NULL);
/* msg 61: field %s doesn't exists in relation %s */ /* msg 61: field %s doesn't exists in relation %s */
} }
@ -2283,13 +2270,11 @@ static void drop_filter( FILTER filter)
* Get rid of a filter. * Get rid of a filter.
* *
**************************************/ **************************************/
USHORT if_any; bool if_any = false;
if_any = FALSE;
FOR F IN RDB$FILTERS WITH F.RDB$FUNCTION_NAME EQ filter->filter_name->sym_string FOR F IN RDB$FILTERS WITH F.RDB$FUNCTION_NAME EQ filter->filter_name->sym_string
ERASE F; ERASE F;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -2311,10 +2296,9 @@ static void drop_function( FUNC function)
* *
**************************************/ **************************************/
TEXT *name; TEXT *name;
USHORT if_any; bool if_any = false;
name = function->func_name->sym_string; name = function->func_name->sym_string;
if_any = FALSE;
/* Clean out function argument first. */ /* Clean out function argument first. */
@ -2324,7 +2308,7 @@ static void drop_function( FUNC function)
FOR FUNC IN RDB$FUNCTIONS WITH FUNC.RDB$FUNCTION_NAME EQ name FOR FUNC IN RDB$FUNCTIONS WITH FUNC.RDB$FUNCTION_NAME EQ name
ERASE FUNC; ERASE FUNC;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -2346,10 +2330,8 @@ static void drop_global_field( DUDLEY_FLD field)
* *
**************************************/ **************************************/
SCHAR *p; SCHAR *p;
USHORT if_any, error; bool if_any = false;
bool error = false;
if_any = FALSE;
error = FALSE;
FOR Y IN RDB$RELATION_FIELDS WITH FOR Y IN RDB$RELATION_FIELDS WITH
Y.RDB$FIELD_SOURCE EQ field->fld_name->sym_string Y.RDB$FIELD_SOURCE EQ field->fld_name->sym_string
@ -2362,11 +2344,10 @@ static void drop_global_field( DUDLEY_FLD field)
for (p = Y.RDB$FIELD_NAME; *p && *p != ' '; p++); for (p = Y.RDB$FIELD_NAME; *p && *p != ' '; p++);
*p = 0; *p = 0;
DDL_err(64, DDL_err(64, Y.RDB$FIELD_SOURCE,
Y.RDB$FIELD_SOURCE,
Y.RDB$RELATION_NAME, Y.RDB$FIELD_NAME, NULL, NULL); Y.RDB$RELATION_NAME, Y.RDB$FIELD_NAME, NULL, NULL);
/* msg 64: field %s is used in relation %s (local name %s) and can not be dropped */ // msg 64: field %s is used in relation %s (local name %s) and can not be dropped
error = TRUE; error = true;
END_FOR; END_FOR;
if (error) if (error)
@ -2385,8 +2366,10 @@ static void drop_global_field( DUDLEY_FLD field)
FOR X IN RDB$FIELDS WITH FOR X IN RDB$FIELDS WITH
X.RDB$FIELD_NAME EQ field->fld_name->sym_string X.RDB$FIELD_NAME EQ field->fld_name->sym_string
ERASE X; ERASE X;
if_any = TRUE; if_any = true;
END_FOR if (!if_any) END_FOR
if (!if_any)
DDL_err(65, field->fld_name->sym_string, NULL, NULL, NULL, NULL); DDL_err(65, field->fld_name->sym_string, NULL, NULL, NULL, NULL);
/* msg 65: field %s doesn't exist */ /* msg 65: field %s doesn't exist */
} }
@ -2405,10 +2388,9 @@ static void drop_index( DUDLEY_IDX index)
* *
**************************************/ **************************************/
TEXT *name; TEXT *name;
USHORT if_any; bool if_any = false;
name = index->idx_name->sym_string; name = index->idx_name->sym_string;
if_any = FALSE;
/* Clean out index segments first. */ /* Clean out index segments first. */
@ -2418,7 +2400,7 @@ static void drop_index( DUDLEY_IDX index)
FOR IDX IN RDB$INDICES WITH IDX.RDB$INDEX_NAME EQ name FOR IDX IN RDB$INDICES WITH IDX.RDB$INDEX_NAME EQ name
ERASE IDX; ERASE IDX;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -2440,10 +2422,9 @@ static void drop_relation( DUDLEY_REL relation)
* *
**************************************/ **************************************/
TEXT *name; TEXT *name;
USHORT if_any; bool if_any = false;
name = relation->rel_name->sym_string; name = relation->rel_name->sym_string;
if_any = FALSE;
FOR X IN RDB$VIEW_RELATIONS WITH X.RDB$RELATION_NAME EQ name FOR X IN RDB$VIEW_RELATIONS WITH X.RDB$RELATION_NAME EQ name
DDL_err(67, name, X.RDB$VIEW_NAME, NULL, NULL, NULL); DDL_err(67, name, X.RDB$VIEW_NAME, NULL, NULL, NULL);
@ -2456,10 +2437,10 @@ static void drop_relation( DUDLEY_REL relation)
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name
if (X.RDB$SYSTEM_FLAG == 1) { if (X.RDB$SYSTEM_FLAG == 1) {
DDL_err(68, name, NULL, NULL, NULL, NULL); DDL_err(68, name, NULL, NULL, NULL, NULL);
/* msg 68: can't drop system relation %s */ // msg 68: can't drop system relation %s
return; return;
} }
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) { if (!if_any) {
@ -2516,14 +2497,13 @@ static void drop_security_class( SCL scl_class)
* *
**************************************/ **************************************/
SYM name; SYM name;
USHORT if_any; bool if_any = false;
name = scl_class->scl_name; name = scl_class->scl_name;
if_any = FALSE;
FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string
ERASE X; ERASE X;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -2592,11 +2572,11 @@ static void drop_trigger( DUDLEY_TRG trigger)
* *
**************************************/ **************************************/
TEXT *name; TEXT *name;
USHORT if_any, others; bool if_any = false;
bool others = false;
BASED_ON RDB$TRIGGERS.RDB$RELATION_NAME relation_name; BASED_ON RDB$TRIGGERS.RDB$RELATION_NAME relation_name;
name = trigger->trg_name->sym_string; name = trigger->trg_name->sym_string;
if_any = others = FALSE;
/* Clean out possible trigger messages first. */ /* Clean out possible trigger messages first. */
@ -2607,7 +2587,7 @@ static void drop_trigger( DUDLEY_TRG trigger)
FOR X IN RDB$TRIGGERS WITH X.RDB$TRIGGER_NAME EQ name FOR X IN RDB$TRIGGERS WITH X.RDB$TRIGGER_NAME EQ name
gds__vtov(X.RDB$RELATION_NAME, relation_name, sizeof(relation_name)); gds__vtov(X.RDB$RELATION_NAME, relation_name, sizeof(relation_name));
ERASE X; ERASE X;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -2620,7 +2600,7 @@ static void drop_trigger( DUDLEY_TRG trigger)
FOR F IN RDB$RELATION_FIELDS CROSS T IN RDB$TRIGGERS OVER FOR F IN RDB$RELATION_FIELDS CROSS T IN RDB$TRIGGERS OVER
RDB$RELATION_NAME WITH RDB$RELATION_NAME WITH
F.RDB$RELATION_NAME = V.RDB$VIEW_NAME F.RDB$RELATION_NAME = V.RDB$VIEW_NAME
others = TRUE; others = true;
END_FOR; END_FOR;
if (!others) { if (!others) {
@ -2647,20 +2627,17 @@ static void drop_trigger_msg( TRGMSG trigmsg)
* Drop a trigger message. * Drop a trigger message.
* *
**************************************/ **************************************/
USHORT if_any; bool if_any = false;
if_any = FALSE;
FOR FIRST 1 X IN RDB$TRIGGER_MESSAGES WITH FOR FIRST 1 X IN RDB$TRIGGER_MESSAGES WITH
X.RDB$TRIGGER_NAME EQ trigmsg->trgmsg_trg_name->sym_string AND X.RDB$TRIGGER_NAME EQ trigmsg->trgmsg_trg_name->sym_string AND
X.RDB$MESSAGE_NUMBER = trigmsg->trgmsg_number; X.RDB$MESSAGE_NUMBER = trigmsg->trgmsg_number;
ERASE X; ERASE X;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
DDL_err(74, DDL_err(74, (TEXT *)(SLONG) trigmsg->trgmsg_number,
(TEXT *)(SLONG) trigmsg->trgmsg_number,
trigmsg->trgmsg_trg_name->sym_string, NULL, NULL, NULL); trigmsg->trgmsg_trg_name->sym_string, NULL, NULL, NULL);
/* msg 74: Trigger message number %d for trigger %s doesn't exist */ /* msg 74: Trigger message number %d for trigger %s doesn't exist */
} }
@ -2678,7 +2655,7 @@ static void drop_type( TYP fldtype)
* Drop a list of types or all types of an existing field. * Drop a list of types or all types of an existing field.
* *
**************************************/ **************************************/
USHORT if_any; bool if_any = false;
if (fldtype->typ_name->sym_length == 3 && if (fldtype->typ_name->sym_length == 3 &&
!strncmp(fldtype->typ_name->sym_string, "ALL", 3)) { !strncmp(fldtype->typ_name->sym_string, "ALL", 3)) {
@ -2690,13 +2667,11 @@ static void drop_type( TYP fldtype)
return; return;
} }
if_any = FALSE;
FOR X IN RDB$TYPES WITH FOR X IN RDB$TYPES WITH
X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string AND X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string AND
X.RDB$TYPE_NAME EQ fldtype->typ_name->sym_string X.RDB$TYPE_NAME EQ fldtype->typ_name->sym_string
ERASE X; ERASE X;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -2788,11 +2763,10 @@ static void erase_userpriv( USERPRIV upriv, TEXT * priv, USRE usr, UPFE upf)
* *
**************************************/ **************************************/
TEXT *fldname, *relname, *usrname; TEXT *fldname, *relname, *usrname;
USHORT if_any; bool if_any = false;
usrname = usr->usre_name->sym_string; usrname = usr->usre_name->sym_string;
relname = upriv->userpriv_relation->sym_string; relname = upriv->userpriv_relation->sym_string;
if_any = FALSE;
/* for UPDATE privilege the field is specified */ /* for UPDATE privilege the field is specified */
@ -2807,7 +2781,7 @@ static void erase_userpriv( USERPRIV upriv, TEXT * priv, USRE usr, UPFE upf)
X.RDB$OBJECT_TYPE EQ obj_relation X.RDB$OBJECT_TYPE EQ obj_relation
ERASE X; ERASE X;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
DDL_err(76, priv, fldname, relname, usrname, NULL); DDL_err(76, priv, fldname, relname, usrname, NULL);
@ -2822,7 +2796,7 @@ static void erase_userpriv( USERPRIV upriv, TEXT * priv, USRE usr, UPFE upf)
X.RDB$OBJECT_TYPE EQ obj_relation X.RDB$OBJECT_TYPE EQ obj_relation
ERASE X; ERASE X;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
DDL_err(77, priv, relname, usrname, NULL, NULL); DDL_err(77, priv, relname, usrname, NULL, NULL);
@ -2843,9 +2817,7 @@ static void get_field_desc( DUDLEY_FLD field)
* Get description for existing field. * Get description for existing field.
* *
**************************************/ **************************************/
USHORT if_any; bool if_any = false;
if_any = FALSE;
FOR DUDLEY_FLD IN RDB$RELATION_FIELDS CROSS SRC IN RDB$FIELDS FOR DUDLEY_FLD IN RDB$RELATION_FIELDS CROSS SRC IN RDB$FIELDS
WITH DUDLEY_FLD.RDB$FIELD_NAME = field->fld_name->sym_string WITH DUDLEY_FLD.RDB$FIELD_NAME = field->fld_name->sym_string
@ -2857,7 +2829,7 @@ static void get_field_desc( DUDLEY_FLD field)
field->fld_scale = SRC.RDB$FIELD_SCALE; field->fld_scale = SRC.RDB$FIELD_SCALE;
field->fld_segment_length = SRC.RDB$SEGMENT_LENGTH; field->fld_segment_length = SRC.RDB$SEGMENT_LENGTH;
field->fld_sub_type = SRC.RDB$FIELD_SUB_TYPE; field->fld_sub_type = SRC.RDB$FIELD_SUB_TYPE;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -2914,8 +2886,9 @@ static void get_log_names(SCHAR * db_name,
**************************************/ **************************************/
SCHAR next_log[512], expanded_name[512]; SCHAR next_log[512], expanded_name[512];
SCHAR *cl, *nl; SCHAR *cl, *nl;
int log_count, ret_val; int log_count;
SSHORT not_archived; int ret_val;
bool not_archived;
SLONG last_log_flag, next_offset; SLONG last_log_flag, next_offset;
SLONG log_seqno, log_length; SLONG log_seqno, log_length;
SSHORT loop; SSHORT loop;
@ -2926,14 +2899,16 @@ static void get_log_names(SCHAR * db_name,
/* loop up to 10 times to allow the file to be archived */ /* loop up to 10 times to allow the file to be archived */
while (TRUE) { while (true) {
loop++; loop++;
if (WALF_get_linked_logs_info(gds_status, expanded_name, cur_log, if (!WALF_get_linked_logs_info(gds_status, expanded_name, cur_log,
part_offset, &log_count, next_log, part_offset, &log_count, next_log,
&next_offset, &last_log_flag, &next_offset, &last_log_flag,
&not_archived) != FB_SUCCESS) &not_archived))
{
DDL_error_abort(gds_status, 328, NULL, NULL, NULL, NULL, NULL); DDL_error_abort(gds_status, 328, NULL, NULL, NULL, NULL, NULL);
/* msg 328: error in reading list of log files */ // msg 328: error in reading list of log files
}
if ((!not_archived) || force) if ((!not_archived) || force)
break; break;
@ -2965,7 +2940,8 @@ static void get_log_names(SCHAR * db_name,
if (ret_val == FB_FAILURE) if (ret_val == FB_FAILURE)
DDL_error_abort(gds_status, 328, NULL, NULL, NULL, NULL, NULL); DDL_error_abort(gds_status, 328, NULL, NULL, NULL, NULL, NULL);
/* msg 328: error in reading list of log files */ // msg 328: error in reading list of log files
if (ret_val < 0) if (ret_val < 0)
break; break;
@ -3547,12 +3523,11 @@ static void modify_field( DUDLEY_FLD field)
* *
**************************************/ **************************************/
SYM name; SYM name;
USHORT if_any; bool if_any = false;
DUDLEY_REL relation; DUDLEY_REL relation;
relation = field->fld_relation; relation = field->fld_relation;
name = field->fld_name; name = field->fld_name;
if_any = FALSE;
FOR FIRST 1 X IN RDB$RELATION_FIELDS WITH FOR FIRST 1 X IN RDB$RELATION_FIELDS WITH
X.RDB$FIELD_NAME EQ name->sym_string AND X.RDB$FIELD_NAME EQ name->sym_string AND
@ -3601,7 +3576,7 @@ static void modify_field( DUDLEY_FLD field)
} }
END_MODIFY END_MODIFY
if_any = TRUE; if_any = true;
END_FOR END_FOR
if (!if_any) if (!if_any)
DDL_err(82, name->sym_string, NULL, NULL, NULL, NULL); DDL_err(82, name->sym_string, NULL, NULL, NULL, NULL);
@ -3622,10 +3597,9 @@ static void modify_global_field( DUDLEY_FLD field)
* *
**************************************/ **************************************/
SYM name; SYM name;
USHORT if_any; bool if_any = false;
name = field->fld_name; name = field->fld_name;
if_any = FALSE;
FOR FIRST 1 X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name->sym_string FOR FIRST 1 X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name->sym_string
MODIFY X USING MODIFY X USING
@ -3701,7 +3675,7 @@ static void modify_global_field( DUDLEY_FLD field)
X.RDB$QUERY_HEADER.NULL = FALSE; X.RDB$QUERY_HEADER.NULL = FALSE;
} }
END_MODIFY END_MODIFY
if_any = TRUE; if_any = true;
END_FOR END_FOR
if (!if_any) if (!if_any)
@ -3723,18 +3697,16 @@ static void modify_index( DUDLEY_IDX index)
* Modify an index. * Modify an index.
* *
**************************************/ **************************************/
USHORT if_any; bool if_any = false;
if_any = FALSE;
FOR X IN RDB$INDICES WITH X.RDB$INDEX_NAME = index->idx_name->sym_string FOR X IN RDB$INDICES WITH X.RDB$INDEX_NAME = index->idx_name->sym_string
MODIFY X USING MODIFY X USING
if (index->idx_flags & IDX_active_flag) { if (index->idx_flags & IDX_active_flag) {
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE; X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
if (index->idx_flags & IDX_unique_flag) if (index->idx_flags & IDX_unique_flag)
X.RDB$UNIQUE_FLAG = index->idx_unique; X.RDB$UNIQUE_FLAG = (index->idx_unique) ? TRUE : FALSE;
if (index->idx_flags & IDX_type_flag) { if (index->idx_flags & IDX_type_flag) {
X.RDB$INDEX_TYPE = index->idx_type; X.RDB$INDEX_TYPE = (index->idx_type) ? TRUE : FALSE;
X.RDB$INDEX_TYPE.NULL = FALSE; X.RDB$INDEX_TYPE.NULL = FALSE;
} }
if (index->idx_flags & IDX_null_description) if (index->idx_flags & IDX_null_description)
@ -3747,7 +3719,7 @@ static void modify_index( DUDLEY_IDX index)
X.RDB$STATISTICS = -1.0; X.RDB$STATISTICS = -1.0;
} }
END_MODIFY; END_MODIFY;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -3771,13 +3743,12 @@ static void modify_relation( DUDLEY_REL relation)
* *
**************************************/ **************************************/
SYM name; SYM name;
USHORT if_any; bool if_any = false;
if (!(relation->rel_flags & rel_marked_for_modify)) { if (!(relation->rel_flags & rel_marked_for_modify)) {
return; return;
} }
name = relation->rel_name; name = relation->rel_name;
if_any = FALSE;
FOR FIRST 1 X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->sym_string FOR FIRST 1 X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->sym_string
MODIFY X USING MODIFY X USING
@ -3802,7 +3773,7 @@ static void modify_relation( DUDLEY_REL relation)
MOVE_SYMBOL(relation->rel_filename, X.RDB$EXTERNAL_FILE); MOVE_SYMBOL(relation->rel_filename, X.RDB$EXTERNAL_FILE);
} }
END_MODIFY END_MODIFY
if_any = TRUE; if_any = true;
END_FOR END_FOR
if (!if_any) if (!if_any)
@ -3823,12 +3794,10 @@ static void modify_trigger( DUDLEY_TRG trigger)
* modify a trigger in rdb$triggers. * modify a trigger in rdb$triggers.
* *
**************************************/ **************************************/
USHORT if_any; bool if_any = false;
DUDLEY_REL relation; DUDLEY_REL relation;
TEXT buffer[32], *p, *q; TEXT buffer[32], *p, *q;
if_any = FALSE;
FOR FIRST 1 X IN RDB$TRIGGERS WITH FOR FIRST 1 X IN RDB$TRIGGERS WITH
X.RDB$TRIGGER_NAME EQ trigger->trg_name->sym_string X.RDB$TRIGGER_NAME EQ trigger->trg_name->sym_string
MODIFY X USING MODIFY X USING
@ -3863,7 +3832,7 @@ static void modify_trigger( DUDLEY_TRG trigger)
store_text(trigger->trg_description, (SLONG*) &X.RDB$DESCRIPTION); store_text(trigger->trg_description, (SLONG*) &X.RDB$DESCRIPTION);
} }
END_MODIFY; END_MODIFY;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -3884,9 +3853,7 @@ static void modify_trigger_msg( TRGMSG trigmsg)
* Modify a trigger message. * Modify a trigger message.
* *
**************************************/ **************************************/
USHORT if_any; bool if_any = false;
if_any = FALSE;
FOR FIRST 1 X IN RDB$TRIGGER_MESSAGES WITH FOR FIRST 1 X IN RDB$TRIGGER_MESSAGES WITH
X.RDB$TRIGGER_NAME EQ trigmsg->trgmsg_trg_name->sym_string AND X.RDB$TRIGGER_NAME EQ trigmsg->trgmsg_trg_name->sym_string AND
@ -3894,7 +3861,7 @@ static void modify_trigger_msg( TRGMSG trigmsg)
MODIFY X USING MODIFY X USING
MOVE_SYMBOL(trigmsg->trgmsg_text, X.RDB$MESSAGE); MOVE_SYMBOL(trigmsg->trgmsg_text, X.RDB$MESSAGE);
END_MODIFY; END_MODIFY;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)
@ -3914,9 +3881,7 @@ static void modify_type( TYP fldtype)
* Modify type value or description of a type for a field. * Modify type value or description of a type for a field.
* *
**************************************/ **************************************/
USHORT if_any; bool if_any = false;
if_any = FALSE;
FOR FIRST 1 X IN RDB$TYPES WITH FOR FIRST 1 X IN RDB$TYPES WITH
X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string AND X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string AND
@ -3928,7 +3893,7 @@ static void modify_type( TYP fldtype)
store_text(fldtype->typ_description, (SLONG*) &X.RDB$DESCRIPTION); store_text(fldtype->typ_description, (SLONG*) &X.RDB$DESCRIPTION);
} }
END_MODIFY; END_MODIFY;
if_any = TRUE; if_any = true;
END_FOR; END_FOR;
if (!if_any) if (!if_any)

View File

@ -30,6 +30,6 @@ extern void EXE_drop_database(DBB);
extern void EXE_execute(void); extern void EXE_execute(void);
extern void EXE_fini(DBB); extern void EXE_fini(DBB);
extern void EXE_modify_database(DBB); extern void EXE_modify_database(DBB);
extern int EXE_relation(DUDLEY_REL); extern bool EXE_relation(DUDLEY_REL);
#endif /* _DUDLEY_EXE_PROTO_H_ */ #endif /* _DUDLEY_EXE_PROTO_H_ */

View File

@ -37,17 +37,17 @@
extern jmp_buf parse_env; extern jmp_buf parse_env;
static CON make_numeric_constant(TEXT *, USHORT); static CON make_numeric_constant(TEXT *, USHORT);
static DUDLEY_NOD parse_add(USHORT *, USHORT *); static DUDLEY_NOD parse_add(USHORT *, bool *);
static DUDLEY_NOD parse_and(USHORT *); static DUDLEY_NOD parse_and(USHORT *);
static DUDLEY_NOD parse_field(void); static DUDLEY_NOD parse_field(void);
static DUDLEY_NOD parse_from(USHORT *, USHORT *); static DUDLEY_NOD parse_from(USHORT *, bool *);
static DUDLEY_NOD parse_function(void); static DUDLEY_NOD parse_function(void);
static DUDLEY_NOD parse_gen_id(void); static DUDLEY_NOD parse_gen_id(void);
static CON parse_literal(void); static CON parse_literal(void);
static void parse_matching_paren(void); static void parse_matching_paren(void);
static DUDLEY_NOD parse_multiply(USHORT *, USHORT *); static DUDLEY_NOD parse_multiply(USHORT *, bool *);
static DUDLEY_NOD parse_not(USHORT *); static DUDLEY_NOD parse_not(USHORT *);
static DUDLEY_NOD parse_primitive_value(USHORT *, USHORT *); static DUDLEY_NOD parse_primitive_value(USHORT *, bool *);
static DUDLEY_CTX parse_relation(void); static DUDLEY_CTX parse_relation(void);
static DUDLEY_NOD parse_relational(USHORT *); static DUDLEY_NOD parse_relational(USHORT *);
static DUDLEY_NOD parse_sort(void); static DUDLEY_NOD parse_sort(void);
@ -109,7 +109,7 @@ DUDLEY_NOD EXPR_boolean(USHORT * paren_count)
} }
DUDLEY_NOD EXPR_rse(USHORT view_flag) DUDLEY_NOD EXPR_rse(bool view_flag)
{ {
/************************************** /**************************************
* *
@ -134,9 +134,9 @@ DUDLEY_NOD EXPR_rse(USHORT view_flag)
LEX_real(); LEX_real();
if (MATCH(KW_FIRST)) if (MATCH(KW_FIRST))
node->nod_arg[s_rse_first] = EXPR_value(0, 0); node->nod_arg[s_rse_first] = EXPR_value(0, NULL);
while (TRUE) { while (true) {
LLS_PUSH(parse_relation(), &stack); LLS_PUSH(parse_relation(), &stack);
if (MATCH(KW_OVER)) { if (MATCH(KW_OVER)) {
for (;;) { for (;;) {
@ -235,7 +235,7 @@ DUDLEY_NOD EXPR_statement(void)
} }
else if (MATCH(KW_FOR)) { else if (MATCH(KW_FOR)) {
node = SYNTAX_NODE(nod_for, 2); node = SYNTAX_NODE(nod_for, 2);
node->nod_arg[s_for_rse] = EXPR_rse(FALSE); node->nod_arg[s_for_rse] = EXPR_rse(false);
stack = NULL; stack = NULL;
while (!MATCH(KW_END_FOR)) while (!MATCH(KW_END_FOR))
LLS_PUSH(EXPR_statement(), &stack); LLS_PUSH(EXPR_statement(), &stack);
@ -277,14 +277,14 @@ DUDLEY_NOD EXPR_statement(void)
else if (MATCH(KW_POST)) { else if (MATCH(KW_POST)) {
node = SYNTAX_NODE(nod_post, 1); node = SYNTAX_NODE(nod_post, 1);
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[0] = EXPR_value(0, 0); node->nod_arg[0] = EXPR_value(0, NULL);
} }
else { else {
node = SYNTAX_NODE(nod_assignment, 2); node = SYNTAX_NODE(nod_assignment, 2);
node->nod_arg[1] = parse_field(); node->nod_arg[1] = parse_field();
if (!MATCH(KW_EQUALS)) if (!MATCH(KW_EQUALS))
PARSE_error(236, DDL_token.tok_string, NULL); /* msg 236: expected =, encountered \"%s\" */ PARSE_error(236, DDL_token.tok_string, NULL); /* msg 236: expected =, encountered \"%s\" */
node->nod_arg[0] = EXPR_value(0, 0); node->nod_arg[0] = EXPR_value(0, NULL);
} }
MATCH(KW_SEMI); MATCH(KW_SEMI);
@ -293,7 +293,8 @@ DUDLEY_NOD EXPR_statement(void)
} }
DUDLEY_NOD EXPR_value(USHORT * paren_count, USHORT * bool_flag) DUDLEY_NOD EXPR_value(USHORT * paren_count,
bool * bool_flag)
{ {
/************************************** /**************************************
* *
@ -307,20 +308,21 @@ DUDLEY_NOD EXPR_value(USHORT * paren_count, USHORT * bool_flag)
* *
**************************************/ **************************************/
DUDLEY_NOD node, arg; DUDLEY_NOD node, arg;
USHORT local_count, local_flag; USHORT local_count;
bool local_flag;
if (!paren_count) { if (!paren_count) {
local_count = 0; local_count = 0;
paren_count = &local_count; paren_count = &local_count;
} }
if (!bool_flag) { if (!bool_flag) {
local_flag = FALSE; local_flag = false;
bool_flag = &local_flag; bool_flag = &local_flag;
} }
node = parse_add(paren_count, bool_flag); node = parse_add(paren_count, bool_flag);
while (TRUE) { while (true) {
if (!MATCH(KW_BAR)) { if (!MATCH(KW_BAR)) {
parse_terminating_parens(paren_count, &local_count); parse_terminating_parens(paren_count, &local_count);
return node; return node;
@ -420,7 +422,8 @@ static CON make_numeric_constant( TEXT * string, USHORT length)
} }
static DUDLEY_NOD parse_add( USHORT * paren_count, USHORT * bool_flag) static DUDLEY_NOD parse_add(USHORT * paren_count,
bool * bool_flag)
{ {
/************************************** /**************************************
* *
@ -438,7 +441,7 @@ static DUDLEY_NOD parse_add( USHORT * paren_count, USHORT * bool_flag)
node = parse_multiply(paren_count, bool_flag); node = parse_multiply(paren_count, bool_flag);
while (TRUE) { while (true) {
if (MATCH(KW_PLUS)) if (MATCH(KW_PLUS))
operatr = nod_add; operatr = nod_add;
else if (MATCH(KW_MINUS)) else if (MATCH(KW_MINUS))
@ -497,7 +500,7 @@ static DUDLEY_NOD parse_field(void)
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
LEX_real(); LEX_real();
LLS_PUSH(PARSE_symbol(tok_ident), &stack); LLS_PUSH(PARSE_symbol(tok_ident), &stack);
if (!MATCH(KW_DOT)) if (!MATCH(KW_DOT))
@ -514,7 +517,7 @@ static DUDLEY_NOD parse_field(void)
stack = NULL; stack = NULL;
for (;;) { for (;;) {
LLS_PUSH(EXPR_value(0, 0), &stack); LLS_PUSH(EXPR_value(0, NULL), &stack);
if (MATCH(KW_R_BRCKET)) if (MATCH(KW_R_BRCKET))
break; break;
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
@ -529,7 +532,8 @@ static DUDLEY_NOD parse_field(void)
} }
static DUDLEY_NOD parse_from( USHORT * paren_count, USHORT * bool_flag) static DUDLEY_NOD parse_from(USHORT * paren_count,
bool * bool_flag)
{ {
/************************************** /**************************************
* *
@ -544,7 +548,7 @@ static DUDLEY_NOD parse_from( USHORT * paren_count, USHORT * bool_flag)
DUDLEY_NOD node, value; DUDLEY_NOD node, value;
if (MATCH(KW_FIRST)) { if (MATCH(KW_FIRST)) {
value = parse_primitive_value(0, 0); value = parse_primitive_value(0, NULL);
if (!MATCH(KW_FROM)) if (!MATCH(KW_FROM))
PARSE_error(239, DDL_token.tok_string, NULL); PARSE_error(239, DDL_token.tok_string, NULL);
/* msg 239: expected FROM rse clause, encountered \"%s\" */ /* msg 239: expected FROM rse clause, encountered \"%s\" */
@ -557,10 +561,10 @@ static DUDLEY_NOD parse_from( USHORT * paren_count, USHORT * bool_flag)
node = SYNTAX_NODE(nod_from, s_stt_count); node = SYNTAX_NODE(nod_from, s_stt_count);
node->nod_arg[s_stt_value] = value; node->nod_arg[s_stt_value] = value;
node->nod_arg[s_stt_rse] = EXPR_rse(FALSE); node->nod_arg[s_stt_rse] = EXPR_rse(false);
if (MATCH(KW_ELSE)) if (MATCH(KW_ELSE))
node->nod_arg[s_stt_default] = EXPR_value(0, 0); node->nod_arg[s_stt_default] = EXPR_value(0, NULL);
return node; return node;
} }
@ -599,7 +603,7 @@ static DUDLEY_NOD parse_function(void)
if (MATCH(KW_LEFT_PAREN) && !MATCH(KW_RIGHT_PAREN)) if (MATCH(KW_LEFT_PAREN) && !MATCH(KW_RIGHT_PAREN))
for (;;) { for (;;) {
LLS_PUSH(EXPR_value(0, 0), &stack); LLS_PUSH(EXPR_value(0, NULL), &stack);
if (MATCH(KW_RIGHT_PAREN)) if (MATCH(KW_RIGHT_PAREN))
break; break;
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
@ -638,7 +642,7 @@ static DUDLEY_NOD parse_gen_id(void)
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[1] = (DUDLEY_NOD) PARSE_symbol(tok_ident); node->nod_arg[1] = (DUDLEY_NOD) PARSE_symbol(tok_ident);
MATCH(KW_COMMA); MATCH(KW_COMMA);
node->nod_arg[0] = EXPR_value(0, 0); node->nod_arg[0] = EXPR_value(0, NULL);
parse_matching_paren(); parse_matching_paren();
return node; return node;
@ -708,7 +712,8 @@ static void parse_matching_paren(void)
} }
static DUDLEY_NOD parse_multiply( USHORT * paren_count, USHORT * bool_flag) static DUDLEY_NOD parse_multiply(USHORT * paren_count,
bool * bool_flag)
{ {
/************************************** /**************************************
* *
@ -725,7 +730,7 @@ static DUDLEY_NOD parse_multiply( USHORT * paren_count, USHORT * bool_flag)
node = parse_from(paren_count, bool_flag); node = parse_from(paren_count, bool_flag);
while (TRUE) { while (true) {
if (MATCH(KW_ASTERISK)) if (MATCH(KW_ASTERISK))
operatr = nod_multiply; operatr = nod_multiply;
else if (MATCH(KW_SLASH)) else if (MATCH(KW_SLASH))
@ -766,7 +771,8 @@ static DUDLEY_NOD parse_not( USHORT * paren_count)
} }
static DUDLEY_NOD parse_primitive_value( USHORT * paren_count, USHORT * bool_flag) static DUDLEY_NOD parse_primitive_value(USHORT * paren_count,
bool * bool_flag)
{ {
/************************************** /**************************************
* *
@ -803,7 +809,7 @@ static DUDLEY_NOD parse_primitive_value( USHORT * paren_count, USHORT * bool_fla
case KW_MINUS: case KW_MINUS:
LEX_token(); LEX_token();
sub = parse_primitive_value(paren_count, 0); sub = parse_primitive_value(paren_count, NULL);
if (sub->nod_type == nod_literal) { if (sub->nod_type == nod_literal) {
constant = (CON) sub->nod_arg[0]; constant = (CON) sub->nod_arg[0];
p = (TEXT *) constant->con_desc.dsc_address; p = (TEXT *) constant->con_desc.dsc_address;
@ -844,7 +850,7 @@ static DUDLEY_NOD parse_primitive_value( USHORT * paren_count, USHORT * bool_fla
case KW_UPPERCASE: case KW_UPPERCASE:
LEX_token(); LEX_token();
sub = parse_primitive_value(0, 0); sub = parse_primitive_value(0, NULL);
node = SYNTAX_NODE(nod_uppercase, 1); node = SYNTAX_NODE(nod_uppercase, 1);
node->nod_arg[0] = sub; node->nod_arg[0] = sub;
break; break;
@ -907,21 +913,19 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
* *
**************************************/ **************************************/
DUDLEY_NOD node, expr1, expr2, or_node; DUDLEY_NOD node, expr1, expr2, or_node;
USHORT negation; bool negation;
enum nod_t operatr, *rel_ops; enum nod_t operatr, *rel_ops;
USHORT local_flag; bool local_flag = true;
local_flag = TRUE;
if (MATCH(KW_ANY)) { if (MATCH(KW_ANY)) {
node = SYNTAX_NODE(nod_any, 1); node = SYNTAX_NODE(nod_any, 1);
node->nod_arg[0] = EXPR_rse(FALSE); node->nod_arg[0] = EXPR_rse(false);
return node; return node;
} }
if (MATCH(KW_UNIQUE)) { if (MATCH(KW_UNIQUE)) {
node = SYNTAX_NODE(nod_unique, 1); node = SYNTAX_NODE(nod_unique, 1);
node->nod_arg[0] = EXPR_rse(FALSE); node->nod_arg[0] = EXPR_rse(false);
return node; return node;
} }
@ -929,12 +933,12 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
if (KEYWORD(KW_RIGHT_PAREN)) if (KEYWORD(KW_RIGHT_PAREN))
return expr1; return expr1;
negation = FALSE; negation = false;
node = NULL; node = NULL;
LEX_real(); LEX_real();
if (MATCH(KW_NOT)) { if (MATCH(KW_NOT)) {
negation = TRUE; negation = true;
LEX_real(); LEX_real();
} }
@ -942,32 +946,32 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
case KW_EQUALS: case KW_EQUALS:
case KW_EQ: case KW_EQ:
operatr = (negation) ? nod_neq : nod_eql; operatr = (negation) ? nod_neq : nod_eql;
negation = FALSE; negation = false;
break; break;
case KW_NE: case KW_NE:
operatr = (negation) ? nod_eql : nod_neq; operatr = (negation) ? nod_eql : nod_neq;
negation = FALSE; negation = false;
break; break;
case KW_GT: case KW_GT:
operatr = (negation) ? nod_leq : nod_gtr; operatr = (negation) ? nod_leq : nod_gtr;
negation = FALSE; negation = false;
break; break;
case KW_GE: case KW_GE:
operatr = (negation) ? nod_lss : nod_geq; operatr = (negation) ? nod_lss : nod_geq;
negation = FALSE; negation = false;
break; break;
case KW_LE: case KW_LE:
operatr = (negation) ? nod_gtr : nod_leq; operatr = (negation) ? nod_gtr : nod_leq;
negation = FALSE; negation = false;
break; break;
case KW_LT: case KW_LT:
operatr = (negation) ? nod_geq : nod_lss; operatr = (negation) ? nod_geq : nod_lss;
negation = FALSE; negation = false;
break; break;
case KW_CONTAINING: case KW_CONTAINING:
@ -976,11 +980,11 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
case KW_MATCHES: case KW_MATCHES:
LEX_token(); LEX_token();
expr2 = EXPR_value(0, 0); expr2 = EXPR_value(0, NULL);
if (MATCH(KW_USING)) { if (MATCH(KW_USING)) {
operatr = nod_sleuth; operatr = nod_sleuth;
node = SYNTAX_NODE(operatr, 3); node = SYNTAX_NODE(operatr, 3);
node->nod_arg[2] = EXPR_value(0, 0); node->nod_arg[2] = EXPR_value(0, NULL);
} }
else { else {
operatr = nod_matches; operatr = nod_matches;
@ -995,7 +999,7 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
MATCH(KW_WITH); MATCH(KW_WITH);
node = SYNTAX_NODE(nod_starts, 2); node = SYNTAX_NODE(nod_starts, 2);
node->nod_arg[0] = expr1; node->nod_arg[0] = expr1;
node->nod_arg[1] = EXPR_value(0, 0); node->nod_arg[1] = EXPR_value(0, NULL);
break; break;
case KW_MISSING: case KW_MISSING:
@ -1008,9 +1012,9 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
LEX_token(); LEX_token();
node = SYNTAX_NODE(nod_between, 3); node = SYNTAX_NODE(nod_between, 3);
node->nod_arg[0] = expr1; node->nod_arg[0] = expr1;
node->nod_arg[1] = EXPR_value(0, 0); node->nod_arg[1] = EXPR_value(0, NULL);
MATCH(KW_AND); MATCH(KW_AND);
node->nod_arg[2] = EXPR_value(0, 0); node->nod_arg[2] = EXPR_value(0, NULL);
break; break;
default: default:
@ -1079,13 +1083,13 @@ static DUDLEY_NOD parse_sort(void)
direction = 0; direction = 0;
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
LEX_real(); LEX_real();
if (MATCH(KW_ASCENDING)) if (MATCH(KW_ASCENDING))
direction = 0; direction = 0;
else if (MATCH(KW_DESCENDING)) else if (MATCH(KW_DESCENDING))
direction = 1; direction = 1;
LLS_PUSH(EXPR_value(0, 0), &stack); LLS_PUSH(EXPR_value(0, NULL), &stack);
LLS_PUSH((SLONG) direction, &stack); LLS_PUSH((SLONG) direction, &stack);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
@ -1121,12 +1125,12 @@ static DUDLEY_NOD parse_statistical(void)
node = SYNTAX_NODE(types->nod_t_node, s_stt_count); node = SYNTAX_NODE(types->nod_t_node, s_stt_count);
if (node->nod_type != nod_count) if (node->nod_type != nod_count)
node->nod_arg[s_stt_value] = EXPR_value(0, 0); node->nod_arg[s_stt_value] = EXPR_value(0, NULL);
if (!MATCH(KW_OF)) if (!MATCH(KW_OF))
PARSE_error(246, DDL_token.tok_string, NULL); /* msg 246: expected OF, encountered \"%s\" */ PARSE_error(246, DDL_token.tok_string, NULL); /* msg 246: expected OF, encountered \"%s\" */
node->nod_arg[s_stt_rse] = EXPR_rse(FALSE); node->nod_arg[s_stt_rse] = EXPR_rse(false);
return node; return node;
} }

View File

@ -25,8 +25,8 @@
#define _DUDLEY_EXPR_PROTO_H_ #define _DUDLEY_EXPR_PROTO_H_
extern DUDLEY_NOD EXPR_boolean(USHORT *); extern DUDLEY_NOD EXPR_boolean(USHORT *);
extern DUDLEY_NOD EXPR_rse(USHORT); extern DUDLEY_NOD EXPR_rse(bool);
extern DUDLEY_NOD EXPR_statement(void); extern DUDLEY_NOD EXPR_statement(void);
extern DUDLEY_NOD EXPR_value(USHORT *, USHORT *); extern DUDLEY_NOD EXPR_value(USHORT *, bool *);
#endif /* _DUDLEY_EXPR_PROTO_H_ */ #endif /* _DUDLEY_EXPR_PROTO_H_ */

View File

@ -68,7 +68,7 @@ static void extract_rfr(const TEXT *);
static void extract_security(void); static void extract_security(void);
static void extract_triggers(void); static void extract_triggers(void);
static void extract_trig_msgs(const TEXT *); static void extract_trig_msgs(const TEXT *);
static void extract_view(const TEXT*, SLONG*, SLONG*, bool, bool, USHORT, bool*); static void extract_view(const TEXT*, SLONG*, SLONG*, bool, bool, bool, bool*);
static void extract_views(void); static void extract_views(void);
static void field_attributes(SLONG *, const TEXT *, SLONG *, const TEXT *, SSHORT); static void field_attributes(SLONG *, const TEXT *, SLONG *, const TEXT *, SSHORT);
static void format_acl(const SCHAR *); static void format_acl(const SCHAR *);
@ -1066,7 +1066,7 @@ static void extract_indexes(void)
if (EXT_capabilities & EXT_v3) if (EXT_capabilities & EXT_v3)
FOR ACT IN RDB$INDICES WITH ACT.RDB$INDEX_NAME = index FOR ACT IN RDB$INDICES WITH ACT.RDB$INDEX_NAME = index
if (ACT.RDB$INDEX_TYPE == IDX_type_descend) if (ACT.RDB$INDEX_TYPE)
ib_fprintf(output_file, "\ndescending"); ib_fprintf(output_file, "\ndescending");
END_FOR; END_FOR;
@ -1420,8 +1420,8 @@ static void extract_view(const TEXT * rel_name,
SLONG * description, SLONG * description,
bool source_null, bool source_null,
bool desc_null, bool desc_null,
USHORT system_flag, bool system_flag,
bool* first) bool * first)
{ {
/************************************** /**************************************
* *
@ -1477,7 +1477,8 @@ static void extract_views(void)
* and write it to the output file. * and write it to the output file.
* *
**************************************/ **************************************/
bool source_null, desc_null; bool source_null;
bool desc_null;
TEXT s[32]; TEXT s[32];
bool first = true; bool first = true;
@ -1489,18 +1490,18 @@ static void extract_views(void)
(V.RDB$SYSTEM_FLAG NE 1 OR V.RDB$SYSTEM_FLAG MISSING) AND (V.RDB$SYSTEM_FLAG NE 1 OR V.RDB$SYSTEM_FLAG MISSING) AND
V.RDB$VIEW_BLR NOT MISSING V.RDB$VIEW_BLR NOT MISSING
SORTED BY V.RDB$RELATION_NAME SORTED BY V.RDB$RELATION_NAME
source_null = V.RDB$VIEW_SOURCE.NULL ? true : false; source_null = (V.RDB$VIEW_SOURCE.NULL);
desc_null = blob_null(V.RDB$DESCRIPTION) ? true : false; desc_null = (blob_null(V.RDB$DESCRIPTION));
extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE, extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE,
(SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null, (SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null,
V.RDB$SYSTEM_FLAG, &first); (V.RDB$SYSTEM_FLAG), &first);
END_FOR; END_FOR;
return; return;
} }
/* In V3 there are dependencies that can help us to output the views in // In V3 there are dependencies that can help us to output the views in
the correct order. But first let's just save the names of the views. */ // the correct order. But first let's just save the names of the views.
view* view_list = NULL; view* view_list = NULL;
@ -1531,9 +1532,9 @@ static void extract_views(void)
bool do_this_one = true; bool do_this_one = true;
const TEXT* view_name = (*view_ptr)->view_name; const TEXT* view_name = (*view_ptr)->view_name;
/* fields of rdb$dependencies have been renamed for V4.0 // fields of rdb$dependencies have been renamed for V4.0
This means if we are extracting a pre V3 definition, views // This means if we are extracting a pre V3 definition, views
will not be spit out in the optimal order. */ // will not be spit out in the optimal order. */
if (EXT_capabilities & EXT_v4) { if (EXT_capabilities & EXT_v4) {
FOR D IN RDB$DEPENDENCIES WITH FOR D IN RDB$DEPENDENCIES WITH
@ -1551,11 +1552,11 @@ static void extract_views(void)
if (do_this_one) { if (do_this_one) {
FOR V IN RDB$RELATIONS WITH FOR V IN RDB$RELATIONS WITH
V.RDB$RELATION_NAME EQ view_name V.RDB$RELATION_NAME EQ view_name
source_null = V.RDB$VIEW_SOURCE.NULL ? true : false; source_null = (V.RDB$VIEW_SOURCE.NULL);
desc_null = blob_null(V.RDB$DESCRIPTION) ? true : false; desc_null = (blob_null(V.RDB$DESCRIPTION));
extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE, extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE,
(SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null, (SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null,
V.RDB$SYSTEM_FLAG, &first); (V.RDB$SYSTEM_FLAG), &first);
END_FOR; END_FOR;
did_any = true; did_any = true;
@ -1566,16 +1567,16 @@ static void extract_views(void)
} }
} while (did_any); } while (did_any);
/* If any views remain, we can't figure out an order so just dump them */ // If any views remain, we can't figure out an order so just dump them
for (view* viewp = view_list; viewp; viewp = viewp->view_next) { for (view* viewp = view_list; viewp; viewp = viewp->view_next) {
FOR V IN RDB$RELATIONS WITH FOR V IN RDB$RELATIONS WITH
V.RDB$RELATION_NAME EQ viewp->view_name V.RDB$RELATION_NAME EQ viewp->view_name
source_null = V.RDB$VIEW_SOURCE.NULL ? true : false; source_null = (V.RDB$VIEW_SOURCE.NULL);
desc_null = blob_null(V.RDB$DESCRIPTION) ? true : false; desc_null = (blob_null(V.RDB$DESCRIPTION));
extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE, extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE,
(SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null, (SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null,
V.RDB$SYSTEM_FLAG, &first); (V.RDB$SYSTEM_FLAG), &first);
END_FOR; END_FOR;
} }

View File

@ -250,7 +250,7 @@ void LEX_init( void *file)
input_file = (IB_FILE *) file; input_file = (IB_FILE *) file;
DDL_char = DDL_buffer; DDL_char = DDL_buffer;
DDL_token.tok_position = 0; DDL_token.tok_position = 0;
DDL_description = FALSE; DDL_description = false;
DDL_line = 1; DDL_line = 1;
} }
@ -464,7 +464,7 @@ static int nextchar(void)
if (DDL_interactive) if (DDL_interactive)
ib_printf("\n"); ib_printf("\n");
#endif #endif
DDL_eof = TRUE; DDL_eof = true;
return EOF; return EOF;
} }
DDL_char = DDL_buffer; DDL_char = DDL_buffer;

View File

@ -95,7 +95,7 @@ jmp_buf parse_env;
extern TEXT *DDL_prompt; extern TEXT *DDL_prompt;
static bool check_filename(SYM, USHORT); static bool check_filename(SYM, bool);
static SYM copy_symbol(SYM); static SYM copy_symbol(SYM);
static DUDLEY_FLD create_global_field(DUDLEY_FLD); static DUDLEY_FLD create_global_field(DUDLEY_FLD);
#ifdef FLINT_CACHE #ifdef FLINT_CACHE
@ -197,7 +197,7 @@ void PARSE_actions(void)
} }
} }
else { else {
DDL_drop_database = FALSE; DDL_drop_database = false;
parse_action(); parse_action();
} }
} }
@ -347,7 +347,7 @@ DUDLEY_NOD PARSE_make_node(enum nod_t type, USHORT count)
} }
int PARSE_match( enum kwwords keyword) bool PARSE_match( enum kwwords keyword)
{ {
/************************************** /**************************************
* *
@ -364,17 +364,17 @@ int PARSE_match( enum kwwords keyword)
if (KEYWORD(keyword)) { if (KEYWORD(keyword)) {
LEX_token(); LEX_token();
return TRUE; return true;
} }
for (symbol = DDL_token.tok_symbol; symbol; symbol = symbol->sym_homonym) for (symbol = DDL_token.tok_symbol; symbol; symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_keyword && if (symbol->sym_type == SYM_keyword &&
symbol->sym_keyword == (int) keyword) { symbol->sym_keyword == (int) keyword) {
LEX_token(); LEX_token();
return TRUE; return true;
} }
return FALSE; return false;
} }
@ -509,7 +509,8 @@ SYM PARSE_symbol(enum tok_t type)
} }
static bool check_filename( SYM name, USHORT decnet_flag) static bool check_filename(SYM name,
bool decnet_flag)
{ {
/************************************** /**************************************
* *
@ -654,7 +655,7 @@ static FIL define_cache(void)
file = (FIL) DDL_alloc(sizeof(struct fil)); file = (FIL) DDL_alloc(sizeof(struct fil));
file->fil_name = PARSE_symbol(tok_quoted); file->fil_name = PARSE_symbol(tok_quoted);
if (!check_filename(file->fil_name, FALSE)) if (!check_filename(file->fil_name, false))
PARSE_error(322, 0, 0); /* msg 322: a node name is not permitted in a shared cache file name */ PARSE_error(322, 0, 0); /* msg 322: a node name is not permitted in a shared cache file name */
if (MATCH(KW_LENGTH)) { if (MATCH(KW_LENGTH)) {
@ -694,7 +695,7 @@ static void define_database( enum act_t action_type)
/* parse options for the database parameter block */ /* parse options for the database parameter block */
while (TRUE) { while (true) {
if (MATCH(KW_LENGTH)) { if (MATCH(KW_LENGTH)) {
database->dbb_length = PARSE_number(); database->dbb_length = PARSE_number();
MATCH(KW_PAGES); MATCH(KW_PAGES);
@ -715,13 +716,13 @@ static void define_database( enum act_t action_type)
if (MATCH(KW_CASCADE)) if (MATCH(KW_CASCADE))
database->dbb_flags |= DBB_cascade; database->dbb_flags |= DBB_cascade;
EXE_drop_database(database); EXE_drop_database(database);
DDL_drop_database = TRUE; DDL_drop_database = true;
return; return;
} }
/* parse add/drop items */ /* parse add/drop items */
while (TRUE) { while (true) {
MATCH(KW_ADD); MATCH(KW_ADD);
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
database->dbb_description = parse_description(); database->dbb_description = parse_description();
@ -782,7 +783,7 @@ static void define_database( enum act_t action_type)
if (MATCH(KW_LEFT_PAREN)) { if (MATCH(KW_LEFT_PAREN)) {
database->dbb_flags |= DBB_log_preallocated; database->dbb_flags |= DBB_log_preallocated;
while (TRUE) { while (true) {
file = define_log_file(DBB_log_preallocated); file = define_log_file(DBB_log_preallocated);
file->fil_next = database->dbb_logfiles; file->fil_next = database->dbb_logfiles;
database->dbb_logfiles = file; database->dbb_logfiles = file;
@ -873,10 +874,10 @@ static FIL define_file(void)
file = (FIL) DDL_alloc(sizeof(struct fil)); file = (FIL) DDL_alloc(sizeof(struct fil));
file->fil_name = PARSE_symbol(tok_quoted); file->fil_name = PARSE_symbol(tok_quoted);
if (!check_filename(file->fil_name, FALSE)) if (!check_filename(file->fil_name, false))
PARSE_error(297, 0, 0); /* msg 297: A node name is not permitted in a shadow or secondary file name */ PARSE_error(297, 0, 0); /* msg 297: A node name is not permitted in a shadow or secondary file name */
while (TRUE) { while (true) {
if (MATCH(KW_LENGTH)) { if (MATCH(KW_LENGTH)) {
file->fil_length = PARSE_number(); file->fil_length = PARSE_number();
MATCH(KW_PAGES); MATCH(KW_PAGES);
@ -914,7 +915,7 @@ static void define_filter(void)
filter = (FILTER) DDL_alloc(sizeof(struct filter)); filter = (FILTER) DDL_alloc(sizeof(struct filter));
filter->filter_name = PARSE_symbol(tok_ident); filter->filter_name = PARSE_symbol(tok_ident);
while (TRUE) { while (true) {
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
filter->filter_description = parse_description(); filter->filter_description = parse_description();
else if (MATCH(KW_INPUT_TYPE)) else if (MATCH(KW_INPUT_TYPE))
@ -960,7 +961,7 @@ static void define_function(void)
function = PARSE_function(FALSE); function = PARSE_function(FALSE);
while (TRUE) { while (true) {
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
function->func_description = parse_description(); function->func_description = parse_description();
else if (MATCH(KW_FUNCTION_MODULE_NAME)) else if (MATCH(KW_FUNCTION_MODULE_NAME))
@ -985,7 +986,7 @@ static void define_function(void)
position = 1; position = 1;
while (TRUE) { while (true) {
if (KEYWORD(KW_SEMI)) if (KEYWORD(KW_SEMI))
break; break;
function_arg = parse_function_arg(function, (USHORT*) &position); function_arg = parse_function_arg(function, (USHORT*) &position);
@ -1039,31 +1040,31 @@ static void define_index(void)
**************************************/ **************************************/
LLS stack; LLS stack;
SYM index_name, rel_name, *ptr; SYM index_name, rel_name, *ptr;
TXT description; TXT description = NULL;
SSHORT count, unique, inactive, descending; SSHORT count;
bool unique = false;
bool inactive = false;
bool descending = false;
index_name = PARSE_symbol(tok_ident); index_name = PARSE_symbol(tok_ident);
MATCH(KW_FOR); MATCH(KW_FOR);
rel_name = PARSE_symbol(tok_ident); rel_name = PARSE_symbol(tok_ident);
unique = inactive = descending = FALSE; while (true) {
description = NULL;
while (TRUE) {
if (MATCH(KW_DUPLICATES)) if (MATCH(KW_DUPLICATES))
unique = FALSE; unique = false;
else if (MATCH(KW_UNIQUE)) else if (MATCH(KW_UNIQUE))
unique = TRUE; unique = true;
else if (KEYWORD(KW_DESCRIPTION)) else if (KEYWORD(KW_DESCRIPTION))
description = parse_description(); description = parse_description();
else if (MATCH(KW_ACTIVE)) else if (MATCH(KW_ACTIVE))
inactive = FALSE; inactive = false;
else if (MATCH(KW_INACTIVE)) else if (MATCH(KW_INACTIVE))
inactive = TRUE; inactive = true;
else if (MATCH(KW_ASCENDING)) else if (MATCH(KW_ASCENDING))
descending = IDX_type_none; descending = false;
else if (MATCH(KW_DESCENDING)) else if (MATCH(KW_DESCENDING))
descending = IDX_type_descend; descending = true;
else else
break; break;
} }
@ -1072,7 +1073,7 @@ static void define_index(void)
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
LLS_PUSH(PARSE_symbol(tok_ident), &stack); LLS_PUSH(PARSE_symbol(tok_ident), &stack);
count++; count++;
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
@ -1115,10 +1116,10 @@ static FIL define_log_file( USHORT log_type)
file = (FIL) DDL_alloc(sizeof(struct fil)); file = (FIL) DDL_alloc(sizeof(struct fil));
file->fil_name = PARSE_symbol(tok_quoted); file->fil_name = PARSE_symbol(tok_quoted);
if (!check_filename(file->fil_name, FALSE)) if (!check_filename(file->fil_name, false))
PARSE_error(297, 0, 0); /* msg 297: A node name is not permitted in a shadow or secondary file name */ PARSE_error(297, 0, 0); /* msg 297: A node name is not permitted in a shadow or secondary file name */
while (TRUE) { while (true) {
if (MATCH(KW_SIZE)) { if (MATCH(KW_SIZE)) {
MATCH(KW_EQUALS); MATCH(KW_EQUALS);
file->fil_length = PARSE_number(); file->fil_length = PARSE_number();
@ -1228,20 +1229,24 @@ static void define_relation(void)
relation = PARSE_relation(); relation = PARSE_relation();
if (!(relation->rel_flags & rel_marked_for_delete) && if (!(relation->rel_flags & rel_marked_for_delete) &&
((relation->rel_flags & rel_marked_for_creation) ((relation->rel_flags & rel_marked_for_creation)
|| EXE_relation(relation))) PARSE_error(137, || EXE_relation(relation)))
relation->rel_name->sym_string, 0); /* msg 137: relation %s already exists */ {
PARSE_error(137, relation->rel_name->sym_string, 0);
// msg 137: relation %s already exists
}
if (MATCH(KW_EXTERNAL_FILE)) { if (MATCH(KW_EXTERNAL_FILE)) {
relation->rel_filename = PARSE_symbol(tok_quoted); relation->rel_filename = PARSE_symbol(tok_quoted);
if (!check_filename(relation->rel_filename, TRUE)) if (!check_filename(relation->rel_filename, true))
PARSE_error(298, 0, 0); /* msg 298: A non-Decnet node name is not permitted in an external file name */ PARSE_error(298, 0, 0);
// msg 298: A non-Decnet node name is not permitted in an external file name
} }
rel_actions = action = make_action(act_a_relation, (DBB) relation); rel_actions = action = make_action(act_a_relation, (DBB) relation);
action->act_flags |= ACT_ignore; action->act_flags |= ACT_ignore;
position = 1; position = 1;
while (TRUE) while (true)
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
relation->rel_description = parse_description(); relation->rel_description = parse_description();
else if (MATCH(KW_SECURITY_CLASS)) else if (MATCH(KW_SECURITY_CLASS))
@ -1255,7 +1260,7 @@ static void define_relation(void)
/* Gobble fields */ /* Gobble fields */
while (TRUE) { while (true) {
MATCH(KW_ADD); MATCH(KW_ADD);
MATCH(KW_FIELD); MATCH(KW_FIELD);
field = (DUDLEY_FLD) DDL_alloc(FLD_LEN); field = (DUDLEY_FLD) DDL_alloc(FLD_LEN);
@ -1294,7 +1299,7 @@ static void define_relation(void)
have been defined would have to be ignored. Everything has gone well so have been defined would have to be ignored. Everything has gone well so
turn them on. */ turn them on. */
while (TRUE) { while (true) {
action->act_flags &= ~ACT_ignore; action->act_flags &= ~ACT_ignore;
if (action == rel_actions) if (action == rel_actions)
break; break;
@ -1329,7 +1334,7 @@ static void define_security_class(void)
/* Pick up entries. Use the users's order */ /* Pick up entries. Use the users's order */
while (TRUE) { while (true) {
if (!(element = parse_identifier())) if (!(element = parse_identifier()))
return; return;
for (next = &class_->scl_entries; *next; next = &(*next)->sce_next); for (next = &class_->scl_entries; *next; next = &(*next)->sce_next);
@ -1386,7 +1391,7 @@ static void define_shadow(void)
shadow->fil_conditional = 1; shadow->fil_conditional = 1;
shadow->fil_name = PARSE_symbol(tok_quoted); shadow->fil_name = PARSE_symbol(tok_quoted);
if (!check_filename(shadow->fil_name, FALSE)) if (!check_filename(shadow->fil_name, false))
PARSE_error(297, 0, 0); /* msg 297: A node name is not permitted in a shadow or secondary file name */ PARSE_error(297, 0, 0); /* msg 297: A node name is not permitted in a shadow or secondary file name */
if (MATCH(KW_LENGTH)) { if (MATCH(KW_LENGTH)) {
@ -1394,7 +1399,7 @@ static void define_shadow(void)
MATCH(KW_PAGES); MATCH(KW_PAGES);
} }
while (TRUE) { while (true) {
if (MATCH(KW_FILE)) { if (MATCH(KW_FILE)) {
file = define_file(); file = define_file();
file->fil_next = shadow; file->fil_next = shadow;
@ -1430,7 +1435,6 @@ static void define_trigger(void)
DUDLEY_TRG trigger; DUDLEY_TRG trigger;
TRGMSG trigmsg; TRGMSG trigmsg;
int flags, trg_state, trg_sequence; int flags, trg_state, trg_sequence;
USHORT action, end;
if (MATCH(KW_FOR)) { if (MATCH(KW_FOR)) {
define_old_trigger(); define_old_trigger();
@ -1454,18 +1458,19 @@ static void define_trigger(void)
PARSE_error(141, DDL_token.tok_string, 0); PARSE_error(141, DDL_token.tok_string, 0);
/* msg 141: expected STORE, MODIFY, ERASE, encountered \"%s\" */ /* msg 141: expected STORE, MODIFY, ERASE, encountered \"%s\" */
action = end = FALSE; bool action = false;
bool end = false;
while (!KEYWORD(KW_SEMI)) { while (!KEYWORD(KW_SEMI)) {
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
trigger->trg_description = parse_description(); trigger->trg_description = parse_description();
else if (MATCH(KW_END_TRIGGER)) else if (MATCH(KW_END_TRIGGER))
action = end = TRUE; action = end = true;
else if (!action) { else if (!action) {
trigger->trg_source = start_text(); trigger->trg_source = start_text();
trigger->trg_statement = EXPR_statement(); trigger->trg_statement = EXPR_statement();
end_text(trigger->trg_source); end_text(trigger->trg_source);
action = TRUE; action = true;
} }
else if (MATCH(KW_MESSAGE)) { else if (MATCH(KW_MESSAGE)) {
trigmsg = (TRGMSG) DDL_alloc(sizeof(struct trgmsg)); trigmsg = (TRGMSG) DDL_alloc(sizeof(struct trgmsg));
@ -1521,7 +1526,7 @@ static void define_type(void)
MATCH(KW_FOR); MATCH(KW_FOR);
fldname = PARSE_symbol(tok_ident); fldname = PARSE_symbol(tok_ident);
while (TRUE) { while (true) {
fldtype = (TYP) DDL_alloc(sizeof(struct typ)); fldtype = (TYP) DDL_alloc(sizeof(struct typ));
fldtype->typ_field_name = fldname; fldtype->typ_field_name = fldname;
fldtype->typ_name = PARSE_symbol(tok_ident); fldtype->typ_name = PARSE_symbol(tok_ident);
@ -1563,8 +1568,11 @@ static void define_view(void)
relation = PARSE_relation(); relation = PARSE_relation();
if (!(relation->rel_flags & rel_marked_for_delete) && if (!(relation->rel_flags & rel_marked_for_delete) &&
((relation->rel_flags & rel_marked_for_creation) ((relation->rel_flags & rel_marked_for_creation)
|| EXE_relation(relation))) PARSE_error(300, || EXE_relation(relation)))
relation->rel_name->sym_string, 0); /* msg 300: relation %s already exists */ {
PARSE_error(300, relation->rel_name->sym_string, 0);
// msg 300: relation %s already exists
}
MATCH(KW_OF); MATCH(KW_OF);
@ -1572,7 +1580,7 @@ static void define_view(void)
contexts = NULL; contexts = NULL;
relation->rel_view_source = start_text(); relation->rel_view_source = start_text();
relation->rel_rse = EXPR_rse(TRUE); relation->rel_rse = EXPR_rse(true);
end_text(relation->rel_view_source); end_text(relation->rel_view_source);
/* add my context to the context stack */ /* add my context to the context stack */
@ -1587,7 +1595,7 @@ static void define_view(void)
/* Pick up various fields and clauses */ /* Pick up various fields and clauses */
while (TRUE) { while (true) {
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
relation->rel_description = parse_description(); relation->rel_description = parse_description();
else if (MATCH(KW_SECURITY_CLASS)) else if (MATCH(KW_SECURITY_CLASS))
@ -1605,7 +1613,7 @@ static void define_view(void)
position = 1; position = 1;
ptr = &relation->rel_fields; ptr = &relation->rel_fields;
while (TRUE) { while (true) {
MATCH(KW_ADD); MATCH(KW_ADD);
MATCH(KW_FIELD); MATCH(KW_FIELD);
field = (DUDLEY_FLD) DDL_alloc(FLD_LEN); field = (DUDLEY_FLD) DDL_alloc(FLD_LEN);
@ -1640,7 +1648,7 @@ static void define_view(void)
if (!(MATCH(KW_LEFT_PAREN))) if (!(MATCH(KW_LEFT_PAREN)))
PARSE_error(148, 0, 0); /* msg 148: computed by expression must be parenthesized */ PARSE_error(148, 0, 0); /* msg 148: computed by expression must be parenthesized */
field->fld_compute_src = start_text(); field->fld_compute_src = start_text();
field->fld_computed = EXPR_value(0, 0); field->fld_computed = EXPR_value(0, NULL);
end_text(field->fld_compute_src); end_text(field->fld_compute_src);
if (!(MATCH(KW_RIGHT_PAREN))) if (!(MATCH(KW_RIGHT_PAREN)))
PARSE_error(149, 0, 0); /* msg 149: unmatched parenthesis */ PARSE_error(149, 0, 0); /* msg 149: unmatched parenthesis */
@ -1673,7 +1681,7 @@ static void define_view(void)
have been defined would have to be ignored. Everything has gone well so have been defined would have to be ignored. Everything has gone well so
turn them on. */ turn them on. */
while (TRUE) { while (true) {
action->act_flags &= ~ACT_ignore; action->act_flags &= ~ACT_ignore;
if (action == rel_actions) if (action == rel_actions)
break; break;
@ -1855,16 +1863,16 @@ static void drop_trigger(void)
* *
**************************************/ **************************************/
SYM name; SYM name;
SSHORT old_style; bool old_style;
DUDLEY_REL relation; DUDLEY_REL relation;
DUDLEY_TRG trigger; DUDLEY_TRG trigger;
if (MATCH(KW_FOR)) { if (MATCH(KW_FOR)) {
relation = PARSE_relation(); relation = PARSE_relation();
old_style = TRUE; old_style = true;
} }
else { else {
old_style = FALSE; old_style = false;
name = PARSE_symbol(tok_ident); name = PARSE_symbol(tok_ident);
} }
@ -1921,7 +1929,7 @@ static void drop_type(void)
} }
else { else {
fldname = PARSE_symbol(tok_ident); fldname = PARSE_symbol(tok_ident);
while (TRUE) { while (true) {
fldtype = (TYP) DDL_alloc(sizeof(struct typ)); fldtype = (TYP) DDL_alloc(sizeof(struct typ));
fldtype->typ_field_name = fldname; fldtype->typ_field_name = fldname;
fldtype->typ_name = PARSE_symbol(tok_ident); fldtype->typ_name = PARSE_symbol(tok_ident);
@ -2128,7 +2136,7 @@ static void grant_user_privilege(void)
upriv = (USERPRIV) DDL_alloc(sizeof(struct userpriv)); upriv = (USERPRIV) DDL_alloc(sizeof(struct userpriv));
upriv->userpriv_flags = 0; upriv->userpriv_flags = 0;
while (TRUE) { while (true) {
/* ALL is translated to mean four individual privileges */ /* ALL is translated to mean four individual privileges */
if (MATCH(KW_ALL)) { if (MATCH(KW_ALL)) {
@ -2192,7 +2200,7 @@ static void grant_user_privilege(void)
/* get the userlist */ /* get the userlist */
while (TRUE) { while (true) {
usr = (USRE) DDL_alloc(sizeof(struct usre)); usr = (USRE) DDL_alloc(sizeof(struct usre));
usr->usre_name = PARSE_symbol(tok_ident); usr->usre_name = PARSE_symbol(tok_ident);
usr->usre_next = upriv->userpriv_userlist; usr->usre_next = upriv->userpriv_userlist;
@ -2516,29 +2524,29 @@ static void modify_index(void)
DUDLEY_IDX index = (DUDLEY_IDX) DDL_alloc(IDX_LEN(1)); // 0 is invalid DUDLEY_IDX index = (DUDLEY_IDX) DDL_alloc(IDX_LEN(1)); // 0 is invalid
index->idx_name = PARSE_symbol(tok_ident); index->idx_name = PARSE_symbol(tok_ident);
while (TRUE) { while (true) {
if (MATCH(KW_DUPLICATES)) { if (MATCH(KW_DUPLICATES)) {
index->idx_unique = FALSE; index->idx_unique = false;
index->idx_flags |= IDX_unique_flag; index->idx_flags |= IDX_unique_flag;
} }
else if (MATCH(KW_UNIQUE)) { else if (MATCH(KW_UNIQUE)) {
index->idx_unique = TRUE; index->idx_unique = true;
index->idx_flags |= IDX_unique_flag; index->idx_flags |= IDX_unique_flag;
} }
else if (MATCH(KW_ACTIVE)) { else if (MATCH(KW_ACTIVE)) {
index->idx_inactive = FALSE; index->idx_inactive = false;
index->idx_flags |= IDX_active_flag; index->idx_flags |= IDX_active_flag;
} }
else if (MATCH(KW_INACTIVE)) { else if (MATCH(KW_INACTIVE)) {
index->idx_inactive = TRUE; index->idx_inactive = true;
index->idx_flags |= IDX_active_flag; index->idx_flags |= IDX_active_flag;
} }
else if (MATCH(KW_ASCENDING)) { else if (MATCH(KW_ASCENDING)) {
index->idx_type = IDX_type_none; index->idx_type = false;
index->idx_flags |= IDX_type_flag; index->idx_flags |= IDX_type_flag;
} }
else if (MATCH(KW_DESCENDING)) { else if (MATCH(KW_DESCENDING)) {
index->idx_type = IDX_type_descend; index->idx_type = true;
index->idx_flags |= IDX_type_flag; index->idx_flags |= IDX_type_flag;
} }
else if (KEYWORD(KW_DESCRIPTION)) { else if (KEYWORD(KW_DESCRIPTION)) {
@ -2574,33 +2582,32 @@ static void modify_relation(void)
**************************************/ **************************************/
DUDLEY_REL relation; DUDLEY_REL relation;
DUDLEY_FLD field, global; DUDLEY_FLD field, global;
TEXT modify_relation;
relation = PARSE_relation(); relation = PARSE_relation();
make_action(act_m_relation, (DBB) relation); make_action(act_m_relation, (DBB) relation);
if (MATCH(KW_EXTERNAL_FILE)) { if (MATCH(KW_EXTERNAL_FILE)) {
relation->rel_filename = PARSE_symbol(tok_quoted); relation->rel_filename = PARSE_symbol(tok_quoted);
if (!check_filename(relation->rel_filename, TRUE)) if (!check_filename(relation->rel_filename, true))
PARSE_error(298, 0, 0); /* msg 298: A non-Decnet node name is not permitted in an external file name */ PARSE_error(298, 0, 0); /* msg 298: A non-Decnet node name is not permitted in an external file name */
} }
modify_relation = FALSE; bool modify_relation = false;
while (TRUE) { while (true) {
if (KEYWORD(KW_DESCRIPTION)) { if (KEYWORD(KW_DESCRIPTION)) {
relation->rel_description = parse_description(); relation->rel_description = parse_description();
modify_relation = TRUE; modify_relation = true;
} }
else if (MATCH(KW_SECURITY_CLASS)) else if (MATCH(KW_SECURITY_CLASS))
{ {
modify_relation = TRUE; modify_relation = true;
relation->rel_security_class = PARSE_symbol(tok_ident); relation->rel_security_class = PARSE_symbol(tok_ident);
} }
else if (MATCH(KW_SYSTEM_FLAG)) { else if (MATCH(KW_SYSTEM_FLAG)) {
relation->rel_system = get_system_flag(); relation->rel_system = get_system_flag();
relation->rel_flags |= rel_explicit_system; relation->rel_flags |= rel_explicit_system;
modify_relation = TRUE; modify_relation = true;
} }
else else
break; break;
@ -2609,7 +2616,7 @@ static void modify_relation(void)
/* Act on field actions */ /* Act on field actions */
if (!KEYWORD(KW_SEMI)) if (!KEYWORD(KW_SEMI))
while (TRUE) { while (true) {
if (MATCH(KW_ADD)) { if (MATCH(KW_ADD)) {
MATCH(KW_FIELD); MATCH(KW_FIELD);
{ {
@ -2651,7 +2658,7 @@ static void modify_relation(void)
else if (MATCH(KW_DROP)) { else if (MATCH(KW_DROP)) {
if (MATCH(KW_SECURITY_CLASS)) { if (MATCH(KW_SECURITY_CLASS)) {
relation->rel_flags |= rel_null_security_class; relation->rel_flags |= rel_null_security_class;
modify_relation = TRUE; modify_relation = true;
MATCH(KW_COMMA); MATCH(KW_COMMA);
if (KEYWORD(KW_SEMI)) if (KEYWORD(KW_SEMI))
break; break;
@ -2659,7 +2666,7 @@ static void modify_relation(void)
continue; continue;
} }
else if (MATCH(KW_DESCRIP)) { else if (MATCH(KW_DESCRIP)) {
modify_relation = TRUE; modify_relation = true;
relation->rel_flags |= rel_null_description; relation->rel_flags |= rel_null_description;
MATCH(KW_COMMA); MATCH(KW_COMMA);
if (KEYWORD(KW_SEMI)) if (KEYWORD(KW_SEMI))
@ -2715,7 +2722,7 @@ static void modify_security_class(void)
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
class_->scl_description = parse_description(); class_->scl_description = parse_description();
while (TRUE) { while (true) {
if (!(element = parse_identifier())) if (!(element = parse_identifier()))
return; return;
score = score_entry(element); score = score_entry(element);
@ -2752,11 +2759,10 @@ static void modify_trigger(void)
DUDLEY_TRG trigger; DUDLEY_TRG trigger;
TRGMSG trigmsg; TRGMSG trigmsg;
TRGMSG_T msg_type; TRGMSG_T msg_type;
SLONG flags, type, sequence;
SYM name; SYM name;
SCHAR action, end; bool action = false;
bool end = false;
action = end = FALSE;
msg_type = trgmsg_none; msg_type = trgmsg_none;
if (MATCH(KW_FOR)) { /* modify trigger for ... is the old syntax */ if (MATCH(KW_FOR)) { /* modify trigger for ... is the old syntax */
@ -2768,9 +2774,11 @@ static void modify_trigger(void)
for (name = DDL_token.tok_symbol; for (name = DDL_token.tok_symbol;
name && (name->sym_type != SYM_trigger); name = name->sym_homonym); name && (name->sym_type != SYM_trigger); name = name->sym_homonym);
{
if (!name) if (!name)
PARSE_error(176, DDL_token.tok_string, 0); PARSE_error(176, DDL_token.tok_string, 0);
/* msg 176: expected trigger name, encountered \"%s\" */ // msg 176: expected trigger name, encountered \"%s\"
}
trigger = (DUDLEY_TRG) name->sym_object; trigger = (DUDLEY_TRG) name->sym_object;
LEX_token(); LEX_token();
@ -2785,7 +2793,9 @@ static void modify_trigger(void)
else else
relation = trigger->trg_relation; relation = trigger->trg_relation;
flags = type = sequence = 0; SLONG flags = 0;
SLONG type = 0;
SLONG sequence = 0;
get_trigger_attributes((int*) &flags, (int*) &type, (int*) &sequence); get_trigger_attributes((int*) &flags, (int*) &type, (int*) &sequence);
while (!KEYWORD(KW_SEMI)) { while (!KEYWORD(KW_SEMI)) {
@ -2813,12 +2823,12 @@ static void modify_trigger(void)
msg_type = trgmsg_none; msg_type = trgmsg_none;
} }
else if (MATCH(KW_END_TRIGGER)) else if (MATCH(KW_END_TRIGGER))
end = TRUE; end = true;
else if (KEYWORD(KW_DESCRIPTION)) else if (KEYWORD(KW_DESCRIPTION))
trigger->trg_description = parse_description(); trigger->trg_description = parse_description();
else if (!action && !end) { else if (!action && !end) {
modify_trigger_action(trigger, relation); modify_trigger_action(trigger, relation);
action = TRUE; action = true;
} }
else else
PARSE_error(179, DDL_token.tok_string, 0); PARSE_error(179, DDL_token.tok_string, 0);
@ -2868,7 +2878,7 @@ static void modify_type(void)
MATCH(KW_FOR); MATCH(KW_FOR);
fldname = PARSE_symbol(tok_ident); fldname = PARSE_symbol(tok_ident);
while (TRUE) { while (true) {
fldtype = (TYP) DDL_alloc(sizeof(struct typ)); fldtype = (TYP) DDL_alloc(sizeof(struct typ));
fldtype->typ_field_name = fldname; fldtype->typ_field_name = fldname;
fldtype->typ_name = PARSE_symbol(tok_ident); fldtype->typ_name = PARSE_symbol(tok_ident);
@ -2898,25 +2908,24 @@ static void modify_view(void)
**************************************/ **************************************/
DUDLEY_REL relation; DUDLEY_REL relation;
DUDLEY_FLD field; DUDLEY_FLD field;
USHORT view_modify; bool view_modify = false;
relation = PARSE_relation(); relation = PARSE_relation();
make_action(act_m_relation, (DBB) relation); make_action(act_m_relation, (DBB) relation);
view_modify = FALSE;
while (TRUE) { while (true) {
if (KEYWORD(KW_DESCRIPTION)) { if (KEYWORD(KW_DESCRIPTION)) {
relation->rel_description = parse_description(); relation->rel_description = parse_description();
view_modify = TRUE; view_modify = true;
} }
else if (MATCH(KW_SECURITY_CLASS)) { else if (MATCH(KW_SECURITY_CLASS)) {
relation->rel_security_class = PARSE_symbol(tok_ident); relation->rel_security_class = PARSE_symbol(tok_ident);
view_modify = TRUE; view_modify = true;
} }
else if (MATCH(KW_SYSTEM_FLAG)) { else if (MATCH(KW_SYSTEM_FLAG)) {
relation->rel_system = get_system_flag(); relation->rel_system = get_system_flag();
relation->rel_flags |= rel_explicit_system; relation->rel_flags |= rel_explicit_system;
view_modify = TRUE; view_modify = true;
} }
else else
break; break;
@ -2925,7 +2934,7 @@ static void modify_view(void)
/* Act on field actions */ /* Act on field actions */
if (!KEYWORD(KW_SEMI)) if (!KEYWORD(KW_SEMI))
while (TRUE) { while (true) {
if (MATCH(KW_MODIFY)) { if (MATCH(KW_MODIFY)) {
MATCH(KW_FIELD); MATCH(KW_FIELD);
field = (DUDLEY_FLD) DDL_alloc(FLD_LEN); field = (DUDLEY_FLD) DDL_alloc(FLD_LEN);
@ -2939,7 +2948,7 @@ static void modify_view(void)
} }
else if (MATCH(KW_DROP)) { else if (MATCH(KW_DROP)) {
if (MATCH(KW_DESCRIP)) { if (MATCH(KW_DESCRIP)) {
view_modify = TRUE; view_modify = true;
relation->rel_flags |= rel_null_description; relation->rel_flags |= rel_null_description;
if (KEYWORD(KW_SEMI)) if (KEYWORD(KW_SEMI))
@ -2948,7 +2957,7 @@ static void modify_view(void)
continue; continue;
} }
else if (MATCH(KW_SECURITY_CLASS)) { else if (MATCH(KW_SECURITY_CLASS)) {
view_modify = TRUE; view_modify = true;
relation->rel_flags |= rel_null_security_class; relation->rel_flags |= rel_null_security_class;
if (KEYWORD(KW_SEMI)) if (KEYWORD(KW_SEMI))
@ -2988,7 +2997,7 @@ static bool parse_action(void)
************************************** **************************************
* *
* Functional description * Functional description
* Parse a single action. If an token flush is required, return TRUE. * Parse a single action. If an token flush is required, return true.
* *
**************************************/ **************************************/
@ -3144,16 +3153,16 @@ static bool parse_action(void)
return true; return true;
} }
else if (DDL_interactive && KEYWORD(KW_EXIT)) { else if (DDL_interactive && KEYWORD(KW_EXIT)) {
DDL_eof = TRUE; DDL_eof = true;
return false; return false;
} }
else if (DDL_interactive && KEYWORD(KW_QUIT)) { else if (DDL_interactive && KEYWORD(KW_QUIT)) {
DDL_quit = DDL_eof = TRUE; DDL_quit = DDL_eof = true;
return false; return false;
} }
PARSE_error(186, DDL_token.tok_string, 0); /* msg 186: expected command, encountered \"%s\" */ PARSE_error(186, DDL_token.tok_string, 0); /* msg 186: expected command, encountered \"%s\" */
return FALSE; return false;
} // try } // try
catch (const std::exception&) { catch (const std::exception&) {
@ -3233,7 +3242,7 @@ static TXT parse_description(void)
**************************************/ **************************************/
TXT description; TXT description;
DDL_description = TRUE; DDL_description = true;
description = start_text(); description = start_text();
description->txt_position = DDL_token.tok_position; description->txt_position = DDL_token.tok_position;
@ -3245,7 +3254,7 @@ static TXT parse_description(void)
end_text(description); end_text(description);
MATCH(KW_END_DESCRIPTION); MATCH(KW_END_DESCRIPTION);
DDL_description = FALSE; DDL_description = false;
return description; return description;
} }
@ -3328,7 +3337,7 @@ static void parse_field_clauses( DUDLEY_FLD field)
/* Pick up purely optional clauses */ /* Pick up purely optional clauses */
while (TRUE) while (true)
switch (PARSE_keyword()) { switch (PARSE_keyword()) {
case KW_POSITION: case KW_POSITION:
LEX_token(); LEX_token();
@ -3393,7 +3402,7 @@ static void parse_field_clauses( DUDLEY_FLD field)
if (!(MATCH(KW_LEFT_PAREN))) if (!(MATCH(KW_LEFT_PAREN)))
PARSE_error(194, 0, 0); /* msg 194: computed by expression must be parenthesized */ PARSE_error(194, 0, 0); /* msg 194: computed by expression must be parenthesized */
field->fld_compute_src = start_text(); field->fld_compute_src = start_text();
field->fld_computed = EXPR_value(0, 0); field->fld_computed = EXPR_value(0, NULL);
end_text(field->fld_compute_src); end_text(field->fld_compute_src);
if (!(MATCH(KW_RIGHT_PAREN))) if (!(MATCH(KW_RIGHT_PAREN)))
PARSE_error(195, 0, 0); /* msg 195: unmatched parenthesis */ PARSE_error(195, 0, 0); /* msg 195: unmatched parenthesis */
@ -3403,7 +3412,7 @@ static void parse_field_clauses( DUDLEY_FLD field)
LEX_token(); LEX_token();
MATCH(KW_VALUE); MATCH(KW_VALUE);
MATCH(KW_IS); MATCH(KW_IS);
field->fld_missing = EXPR_value(0, 0); field->fld_missing = EXPR_value(0, NULL);
break; break;
case KW_VALID_IF: case KW_VALID_IF:
@ -3435,7 +3444,7 @@ static void parse_field_clauses( DUDLEY_FLD field)
LEX_token(); LEX_token();
MATCH(KW_VALUE); MATCH(KW_VALUE);
MATCH(KW_IS); MATCH(KW_IS);
field->fld_default = EXPR_value(0, 0); field->fld_default = EXPR_value(0, NULL);
break; break;
case KW_DESCRIPTION: case KW_DESCRIPTION:
@ -3959,7 +3968,7 @@ static void revoke_user_privilege(void)
upriv = (USERPRIV) DDL_alloc(sizeof(struct userpriv)); upriv = (USERPRIV) DDL_alloc(sizeof(struct userpriv));
while (TRUE) { while (true) {
if (MATCH(KW_ALL)) { if (MATCH(KW_ALL)) {
/* optional keyword following ALL */ /* optional keyword following ALL */
@ -4007,7 +4016,7 @@ static void revoke_user_privilege(void)
PARSE_error(214, DDL_token.tok_string, 0); /* msg 214: expected ON, encountered \"%s\" */ PARSE_error(214, DDL_token.tok_string, 0); /* msg 214: expected ON, encountered \"%s\" */
break; break;
} }
} /* while (TRUE) */ } // while (true)
if (!upriv->userpriv_flags) if (!upriv->userpriv_flags)
PARSE_error(215, 0, 0); /* msg 215: REVOKE privilege was not specified */ PARSE_error(215, 0, 0); /* msg 215: REVOKE privilege was not specified */
@ -4017,7 +4026,7 @@ static void revoke_user_privilege(void)
PARSE_error(216, DDL_token.tok_string, 0); /* msg 216: expected FROM, encountered \"%s\" */ PARSE_error(216, DDL_token.tok_string, 0); /* msg 216: expected FROM, encountered \"%s\" */
/* get the userlist */ /* get the userlist */
while (TRUE) { while (true) {
usr = (USRE) DDL_alloc(sizeof(struct usre)); usr = (USRE) DDL_alloc(sizeof(struct usre));
usr->usre_name = PARSE_symbol(tok_ident); usr->usre_name = PARSE_symbol(tok_ident);
usr->usre_next = upriv->userpriv_userlist; usr->usre_next = upriv->userpriv_userlist;
@ -4083,7 +4092,7 @@ static DUDLEY_NOD set_generator(void)
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[1] = (DUDLEY_NOD) PARSE_symbol(tok_ident); node->nod_arg[1] = (DUDLEY_NOD) PARSE_symbol(tok_ident);
MATCH(KW_TO); MATCH(KW_TO);
node->nod_arg[0] = EXPR_value(0, 0); node->nod_arg[0] = EXPR_value(0, NULL);
parse_end(); parse_end();
make_action(act_s_generator, (DBB) node); make_action(act_s_generator, (DBB) node);

View File

@ -32,7 +32,7 @@ extern FUNC PARSE_function(int);
extern enum kwwords PARSE_keyword(void); extern enum kwwords PARSE_keyword(void);
extern DUDLEY_NOD PARSE_make_list(LLS); extern DUDLEY_NOD PARSE_make_list(LLS);
extern DUDLEY_NOD PARSE_make_node(enum nod_t, USHORT); extern DUDLEY_NOD PARSE_make_node(enum nod_t, USHORT);
extern int PARSE_match(enum kwwords); extern bool PARSE_match(enum kwwords);
extern int PARSE_number(void); extern int PARSE_number(void);
extern DUDLEY_REL PARSE_relation(void); extern DUDLEY_REL PARSE_relation(void);
extern SYM PARSE_symbol(enum tok_t); extern SYM PARSE_symbol(enum tok_t);

View File

@ -347,7 +347,8 @@ static void add_dimensions( STR dyn, DUDLEY_FLD field)
STUFF(gds_dyn_end); STUFF(gds_dyn_end);
for (range = field->fld_ranges, n = 0; n < field->fld_dimension; for (range = field->fld_ranges, n = 0; n < field->fld_dimension;
range += 2, ++n) { range += 2, ++n)
{
put_number(dyn, gds_dyn_def_dimension, n); put_number(dyn, gds_dyn_def_dimension, n);
put_symbol(dyn, gds_dyn_fld_name, field->fld_name); put_symbol(dyn, gds_dyn_fld_name, field->fld_name);
put_number(dyn, gds_dyn_dim_lower, (SSHORT) range[0]); put_number(dyn, gds_dyn_dim_lower, (SSHORT) range[0]);
@ -637,13 +638,10 @@ static void add_index( STR dyn, DUDLEY_IDX index)
put_symbol(dyn, gds_dyn_def_idx, index->idx_name); put_symbol(dyn, gds_dyn_def_idx, index->idx_name);
put_symbol(dyn, gds_dyn_rel_name, index->idx_relation); put_symbol(dyn, gds_dyn_rel_name, index->idx_relation);
put_number(dyn, gds_dyn_idx_unique, index->idx_unique); put_number(dyn, gds_dyn_idx_unique, (index->idx_unique) ? TRUE : FALSE);
if (index->idx_inactive) put_number(dyn, gds_dyn_idx_inactive, (index->idx_inactive) ? TRUE : FALSE);
put_number(dyn, gds_dyn_idx_inactive, TRUE);
else
put_number(dyn, gds_dyn_idx_inactive, FALSE);
if (index->idx_type) if (index->idx_type)
put_number(dyn, gds_dyn_idx_type, index->idx_type); put_number(dyn, gds_dyn_idx_type, (index->idx_type) ? TRUE : FALSE);
put_text(dyn, gds_dyn_description, index->idx_description); put_text(dyn, gds_dyn_description, index->idx_description);
@ -1376,14 +1374,14 @@ static void modify_index( STR dyn, DUDLEY_IDX index)
put_symbol(dyn, gds_dyn_mod_idx, index->idx_name); put_symbol(dyn, gds_dyn_mod_idx, index->idx_name);
if (index->idx_flags & IDX_unique_flag) if (index->idx_flags & IDX_unique_flag)
put_number(dyn, gds_dyn_idx_unique, index->idx_unique); put_number(dyn, gds_dyn_idx_unique, (index->idx_unique) ? TRUE : FALSE);
if (index->idx_flags & IDX_active_flag) if (index->idx_flags & IDX_active_flag)
put_number(dyn, gds_dyn_idx_inactive, put_number(dyn, gds_dyn_idx_inactive,
(index->idx_inactive) ? TRUE : FALSE); (index->idx_inactive) ? TRUE : FALSE);
if (index->idx_flags & IDX_type_flag) if (index->idx_flags & IDX_type_flag)
put_number(dyn, gds_dyn_idx_type, index->idx_type); put_number(dyn, gds_dyn_idx_type, (index->idx_type) ? TRUE : FALSE);
if (index->idx_flags & IDX_null_description) { if (index->idx_flags & IDX_null_description) {
CHECK_DYN(3); CHECK_DYN(3);

View File

@ -36,9 +36,9 @@
#include "../jrd/jrn_proto.h" #include "../jrd/jrn_proto.h"
#include "../jrd/llio_proto.h" #include "../jrd/llio_proto.h"
static USHORT copy_file(SLONG, SLONG, SLONG); static bool copy_file(SLONG, SLONG, SLONG);
static void error_exit(ISC_STATUS *, JRN *, SLONG, SLONG, SLONG); static void error_exit(ISC_STATUS *, JRN *, SLONG, SLONG, SLONG);
static USHORT open_file(TEXT *, SLONG, USHORT, SLONG *); static bool open_file(TEXT *, SLONG, USHORT, SLONG *);
int CLIB_ROUTINE main(int argc, int CLIB_ROUTINE main(int argc,
@ -61,7 +61,7 @@ int CLIB_ROUTINE main(int argc,
SLONG s_fd, d_fd; SLONG s_fd, d_fd;
SLONG p_offset; SLONG p_offset;
USHORT j_length; USHORT j_length;
USHORT ret_val; bool ret_val;
SLONG size; SLONG size;
SLONG db_id; SLONG db_id;
ISC_STATUS_ARRAY status; ISC_STATUS_ARRAY status;
@ -89,11 +89,11 @@ int CLIB_ROUTINE main(int argc,
// Check in with database // Check in with database
if (open_file(s_file, p_offset, LLIO_OPEN_R, &s_fd) == FB_FAILURE) if (!open_file(s_file, p_offset, LLIO_OPEN_R, &s_fd))
error_exit(status, &journal, db_id, file_id, 236); error_exit(status, &journal, db_id, file_id, 236);
// msg 236: Archive process unable to open log file. // msg 236: Archive process unable to open log file.
if (open_file(d_file, 0L, LLIO_OPEN_NEW_RW, &d_fd) == FB_FAILURE) { if (!open_file(d_file, 0L, LLIO_OPEN_NEW_RW, &d_fd)) {
LLIO_close(0, s_fd); LLIO_close(0, s_fd);
error_exit(status, &journal, db_id, file_id, 237); error_exit(status, &journal, db_id, file_id, 237);
// msg 237: Archive process unable to create archive file. // msg 237: Archive process unable to create archive file.
@ -101,10 +101,10 @@ int CLIB_ROUTINE main(int argc,
ret_val = copy_file(s_fd, d_fd, size); ret_val = copy_file(s_fd, d_fd, size);
ret_val |= LLIO_close(0, s_fd); ret_val |= (LLIO_close(0, s_fd) == FB_SUCCESS);
ret_val |= LLIO_close(0, d_fd); ret_val |= (LLIO_close(0, d_fd) == FB_SUCCESS);
if (ret_val) if (!ret_val)
error_exit(status, &journal, db_id, file_id, 238); error_exit(status, &journal, db_id, file_id, 238);
// msg 238: Archive process unable to close log and/or archive files. // msg 238: Archive process unable to close log and/or archive files.
@ -118,7 +118,7 @@ int CLIB_ROUTINE main(int argc,
} }
static USHORT copy_file(SLONG s_fd, static bool copy_file(SLONG s_fd,
SLONG d_fd, SLONG d_fd,
SLONG size) SLONG size)
{ {
@ -130,6 +130,7 @@ static USHORT copy_file(SLONG s_fd,
* *
* Functional description * Functional description
* copy source file to destination file * copy source file to destination file
* Return true on success, false on failure
* *
**************************************/ **************************************/
UCHAR buff[1024]; UCHAR buff[1024];
@ -148,16 +149,16 @@ static USHORT copy_file(SLONG s_fd,
if (LLIO_read(0, s_fd, 0, 0L, LLIO_SEEK_NONE, buff, l, &read) || if (LLIO_read(0, s_fd, 0, 0L, LLIO_SEEK_NONE, buff, l, &read) ||
l != read) l != read)
{ {
return FB_FAILURE; return false;
} }
if (LLIO_write(0, d_fd, 0, 0L, LLIO_SEEK_NONE, buff, l, &written) || if (LLIO_write(0, d_fd, 0, 0L, LLIO_SEEK_NONE, buff, l, &written) ||
l != written) l != written)
{ {
return FB_FAILURE; return false;
} }
} }
return FB_SUCCESS; return true;
} }
@ -182,7 +183,7 @@ static void error_exit(ISC_STATUS * status_vector,
} }
static USHORT open_file(TEXT * full_name, static bool open_file(TEXT * full_name,
SLONG p_offset, SLONG p_offset,
USHORT mode, USHORT mode,
SLONG * fd) SLONG * fd)
@ -195,17 +196,18 @@ static USHORT open_file(TEXT * full_name,
* *
* Functional description * Functional description
* open a file with a given mask * open a file with a given mask
* Return file descriptor. * Return true if success false if failure.
* The output file descriptor return in fd parameter.
* *
**************************************/ **************************************/
if (LLIO_open(0, full_name, mode, FALSE, fd)) if (LLIO_open(0, full_name, mode, FALSE, fd))
return FB_FAILURE; return false;
if (p_offset) { if (p_offset) {
if (LLIO_seek(0, *fd, 0, p_offset, LLIO_SEEK_BEGIN)) if (LLIO_seek(0, *fd, 0, p_offset, LLIO_SEEK_BEGIN))
return FB_FAILURE; return false;
} }
return FB_SUCCESS; return true;
} }

View File

@ -2094,7 +2094,7 @@ static int open_journal(SCHAR * dbname,
**************************************/ **************************************/
int i, n; int i, n;
SCHAR buf[MAX_PATH_LENGTH]; SCHAR buf[MAX_PATH_LENGTH];
SSHORT stop_flag; bool stop_flag;
SLONG *until_ptr; SLONG *until_ptr;
WALR_handle = 0; WALR_handle = 0;
@ -2109,7 +2109,7 @@ static int open_journal(SCHAR * dbname,
GJRN_printf(20, files[i], NULL, NULL, NULL); GJRN_printf(20, files[i], NULL, NULL, NULL);
} }
stop_flag = (sw_partial && !sw_activate) ? TRUE : FALSE; stop_flag = (sw_partial && !sw_activate);
until_ptr = sw_until ? until : 0; until_ptr = sw_until ? until : 0;
n = WALR_open(wal_status, &WALR_handle, dbname, num_files, n = WALR_open(wal_status, &WALR_handle, dbname, num_files,

View File

@ -910,7 +910,7 @@ static void delete_wal(void)
WALF_set_log_header_flag(status, (char*) database->djb_db_name, WALF_set_log_header_flag(status, (char*) database->djb_db_name,
J.LOG_NAME, J.PARTITION_OFFSET, J.LOG_NAME, J.PARTITION_OFFSET,
WALFH_KEEP_FOR_LONG_TERM_RECV, 0); WALFH_KEEP_FOR_LONG_TERM_RECV, false);
MODIFY J USING MODIFY J USING
strcpy(J.DELETE_STATUS, LOG_DELETED); strcpy(J.DELETE_STATUS, LOG_DELETED);
END_MODIFY END_MODIFY
@ -1907,7 +1907,7 @@ static void process_archive_end(CNCT connection,
FOR J IN JOURNAL_FILES WITH J.FILE_ID EQ file_id FOR J IN JOURNAL_FILES WITH J.FILE_ID EQ file_id
WALF_set_log_header_flag(status, db, J.LOG_NAME, WALF_set_log_header_flag(status, db, J.LOG_NAME,
J.PARTITION_OFFSET, J.PARTITION_OFFSET,
WALFH_KEEP_FOR_LONG_TERM_RECV, 0); WALFH_KEEP_FOR_LONG_TERM_RECV, false);
strcpy(file_name, J.LOG_NAME); strcpy(file_name, J.LOG_NAME);
build_indexed_name(name, arch, J.FILE_SEQUENCE); build_indexed_name(name, arch, J.FILE_SEQUENCE);
MODIFY J USING MODIFY J USING

View File

@ -553,7 +553,7 @@ void AIL_enable(
PAG_add_clump(HEADER_PAGE, HDR_backup_info, d_len, data, CLUMP_ADD, 1); PAG_add_clump(HEADER_PAGE, HDR_backup_info, d_len, data, CLUMP_ADD, 1);
WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal, WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal,
reinterpret_cast < long *>(&seqno), reinterpret_cast < long *>(&seqno),
reinterpret_cast < long *>(&offset), FALSE); reinterpret_cast < long *>(&offset), false);
} }
@ -901,7 +901,7 @@ void AIL_journal_tid(void)
CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, &window);
SLONG offset; SLONG offset;
WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal, &seqno, &offset, FALSE); WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal, &seqno, &offset, false);
} }
@ -1029,7 +1029,7 @@ void AIL_recover_page(SLONG page_no, PAG page)
* page * page
*/ */
WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal, &seqno, &offset, FALSE); WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal, &seqno, &offset, false);
window.win_page = LOG_PAGE; window.win_page = LOG_PAGE;
window.win_flags = 0; window.win_flags = 0;
@ -1135,9 +1135,9 @@ void AIL_shutdown(
tdbb = GET_THREAD_DATA; tdbb = GET_THREAD_DATA;
dbb = tdbb->tdbb_database; dbb = tdbb->tdbb_database;
WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal, seqno, offset, FALSE); WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal, seqno, offset, false);
WAL_shutdown(tdbb->tdbb_status_vector, dbb->dbb_wal, seqno, walname, WAL_shutdown(tdbb->tdbb_status_vector, dbb->dbb_wal, seqno, walname,
p_offset, offset, force_archive); p_offset, offset, (force_archive));
AIL_fini(); AIL_fini();
} }

View File

@ -929,7 +929,7 @@ return 1;
userInfo.user_name[l] = UPPER(user_data->user_name[l]); userInfo.user_name[l] = UPPER(user_data->user_name[l]);
userInfo.user_name[l] = '\0'; userInfo.user_name[l] = '\0';
userInfo.user_name_entered = TRUE; userInfo.user_name_entered = true;
} }
else { else {
status[0] = isc_arg_gds; status[0] = isc_arg_gds;
@ -952,8 +952,8 @@ return 1;
userInfo.password[l] = user_data->password[l]; userInfo.password[l] = user_data->password[l];
userInfo.password[l] = '\0'; userInfo.password[l] = '\0';
userInfo.password_entered = TRUE; userInfo.password_entered = true;
userInfo.password_specified = TRUE; userInfo.password_specified = true;
} }
else { else {
status[0] = isc_arg_gds; status[0] = isc_arg_gds;
@ -964,47 +964,47 @@ return 1;
if ((user_data->sec_flags & sec_uid_spec) if ((user_data->sec_flags & sec_uid_spec)
&& (userInfo.uid_entered = user_data->uid)) { && (userInfo.uid_entered = (user_data->uid))) {
userInfo.uid = user_data->uid; userInfo.uid = user_data->uid;
userInfo.uid_specified = TRUE; userInfo.uid_specified = true;
} }
else { else {
userInfo.uid_specified = FALSE; userInfo.uid_specified = false;
userInfo.uid_entered = FALSE; userInfo.uid_entered = false;
} }
if ((user_data->sec_flags & sec_gid_spec) if ((user_data->sec_flags & sec_gid_spec)
&& (userInfo.gid_entered = user_data->gid)) { && (userInfo.gid_entered = (user_data->gid))) {
userInfo.gid = user_data->gid; userInfo.gid = user_data->gid;
userInfo.gid_specified = TRUE; userInfo.gid_specified = true;
} }
else { else {
userInfo.gid_specified = FALSE; userInfo.gid_specified = false;
userInfo.gid_entered = FALSE; userInfo.gid_entered = false;
} }
if ((user_data->sec_flags & sec_group_name_spec) && user_data->group_name) { if ((user_data->sec_flags & sec_group_name_spec) && user_data->group_name) {
int l = MIN(ALT_NAME_LEN - 1, strlen(user_data->group_name)); int l = MIN(ALT_NAME_LEN - 1, strlen(user_data->group_name));
strncpy(userInfo.group_name, user_data->group_name, l); strncpy(userInfo.group_name, user_data->group_name, l);
userInfo.group_name[l] = '\0'; userInfo.group_name[l] = '\0';
userInfo.group_name_entered = TRUE; userInfo.group_name_entered = true;
userInfo.group_name_specified = TRUE; userInfo.group_name_specified = true;
} }
else { else {
userInfo.group_name_entered = FALSE; userInfo.group_name_entered = false;
userInfo.group_name_specified = FALSE; userInfo.group_name_specified = false;
} }
if ((user_data->sec_flags & sec_first_name_spec) && user_data->first_name) { if ((user_data->sec_flags & sec_first_name_spec) && user_data->first_name) {
int l = MIN(NAME_LEN - 1, strlen(user_data->first_name)); int l = MIN(NAME_LEN - 1, strlen(user_data->first_name));
strncpy(userInfo.first_name, user_data->first_name, l); strncpy(userInfo.first_name, user_data->first_name, l);
userInfo.first_name[l] = '\0'; userInfo.first_name[l] = '\0';
userInfo.first_name_entered = TRUE; userInfo.first_name_entered = true;
userInfo.first_name_specified = TRUE; userInfo.first_name_specified = true;
} }
else { else {
userInfo.first_name_entered = FALSE; userInfo.first_name_entered = false;
userInfo.first_name_specified = FALSE; userInfo.first_name_specified = false;
} }
if ((user_data->sec_flags & sec_middle_name_spec) if ((user_data->sec_flags & sec_middle_name_spec)
@ -1012,24 +1012,24 @@ return 1;
int l = MIN(NAME_LEN - 1, strlen(user_data->middle_name)); int l = MIN(NAME_LEN - 1, strlen(user_data->middle_name));
strncpy(userInfo.middle_name, user_data->middle_name, l); strncpy(userInfo.middle_name, user_data->middle_name, l);
userInfo.middle_name[l] = '\0'; userInfo.middle_name[l] = '\0';
userInfo.middle_name_entered = TRUE; userInfo.middle_name_entered = true;
userInfo.middle_name_specified = TRUE; userInfo.middle_name_specified = true;
} }
else { else {
userInfo.middle_name_entered = FALSE; userInfo.middle_name_entered = false;
userInfo.middle_name_specified = FALSE; userInfo.middle_name_specified = false;
} }
if ((user_data->sec_flags & sec_last_name_spec) && user_data->last_name) { if ((user_data->sec_flags & sec_last_name_spec) && user_data->last_name) {
int l = MIN(NAME_LEN - 1, strlen(user_data->last_name)); int l = MIN(NAME_LEN - 1, strlen(user_data->last_name));
strncpy(userInfo.last_name, user_data->last_name, l); strncpy(userInfo.last_name, user_data->last_name, l);
userInfo.last_name[l] = '\0'; userInfo.last_name[l] = '\0';
userInfo.last_name_entered = TRUE; userInfo.last_name_entered = true;
userInfo.last_name_specified = TRUE; userInfo.last_name_specified = true;
} }
else { else {
userInfo.last_name_entered = FALSE; userInfo.last_name_entered = false;
userInfo.last_name_specified = FALSE; userInfo.last_name_specified = false;
} }
db_handle = open_security_db(status, db_handle = open_security_db(status,
@ -1114,7 +1114,7 @@ return 1;
userInfo.user_name[l] = UPPER(user_data->user_name[l]); userInfo.user_name[l] = UPPER(user_data->user_name[l]);
userInfo.user_name[l] = '\0'; userInfo.user_name[l] = '\0';
userInfo.user_name_entered = TRUE; userInfo.user_name_entered = true;
} }
else { else {
status[0] = isc_arg_gds; status[0] = isc_arg_gds;
@ -1179,7 +1179,7 @@ return 1;
userInfo.user_name[l] = UPPER(user_data->user_name[l]); userInfo.user_name[l] = UPPER(user_data->user_name[l]);
userInfo.user_name[l] = '\0'; userInfo.user_name[l] = '\0';
userInfo.user_name_entered = TRUE; userInfo.user_name_entered = true;
} }
else { else {
status[0] = isc_arg_gds; status[0] = isc_arg_gds;
@ -1202,81 +1202,81 @@ return 1;
userInfo.password[l] = user_data->password[l]; userInfo.password[l] = user_data->password[l];
userInfo.password[l] = '\0'; userInfo.password[l] = '\0';
userInfo.password_entered = TRUE; userInfo.password_entered = true;
userInfo.password_specified = TRUE; userInfo.password_specified = true;
} }
else { else {
userInfo.password_specified = FALSE; userInfo.password_specified = false;
userInfo.password_entered = FALSE; userInfo.password_entered = false;
} }
if (user_data->sec_flags & sec_uid_spec) { if (user_data->sec_flags & sec_uid_spec) {
userInfo.uid = user_data->uid; userInfo.uid = user_data->uid;
userInfo.uid_specified = TRUE; userInfo.uid_specified = true;
userInfo.uid_entered = TRUE; userInfo.uid_entered = true;
} }
else { else {
userInfo.uid_specified = FALSE; userInfo.uid_specified = false;
userInfo.uid_entered = FALSE; userInfo.uid_entered = false;
} }
if (user_data->sec_flags & sec_gid_spec) { if (user_data->sec_flags & sec_gid_spec) {
userInfo.gid = user_data->gid; userInfo.gid = user_data->gid;
userInfo.gid_specified = TRUE; userInfo.gid_specified = true;
userInfo.gid_entered = TRUE; userInfo.gid_entered = true;
} }
else { else {
userInfo.gid_specified = FALSE; userInfo.gid_specified = false;
userInfo.gid_entered = FALSE; userInfo.gid_entered = false;
} }
if (user_data->sec_flags & sec_group_name_spec) { if (user_data->sec_flags & sec_group_name_spec) {
int l = MIN(ALT_NAME_LEN - 1, strlen(user_data->group_name)); int l = MIN(ALT_NAME_LEN - 1, strlen(user_data->group_name));
strncpy(userInfo.group_name, user_data->group_name, l); strncpy(userInfo.group_name, user_data->group_name, l);
userInfo.group_name[l] = '\0'; userInfo.group_name[l] = '\0';
userInfo.group_name_entered = TRUE; userInfo.group_name_entered = true;
userInfo.group_name_specified = TRUE; userInfo.group_name_specified = true;
} }
else { else {
userInfo.group_name_entered = FALSE; userInfo.group_name_entered = false;
userInfo.group_name_specified = FALSE; userInfo.group_name_specified = false;
} }
if (user_data->sec_flags & sec_first_name_spec) { if (user_data->sec_flags & sec_first_name_spec) {
int l = MIN(NAME_LEN - 1, strlen(user_data->first_name)); int l = MIN(NAME_LEN - 1, strlen(user_data->first_name));
strncpy(userInfo.first_name, user_data->first_name, l); strncpy(userInfo.first_name, user_data->first_name, l);
userInfo.first_name[l] = '\0'; userInfo.first_name[l] = '\0';
userInfo.first_name_entered = TRUE; userInfo.first_name_entered = true;
userInfo.first_name_specified = TRUE; userInfo.first_name_specified = true;
} }
else { else {
userInfo.first_name_entered = FALSE; userInfo.first_name_entered = false;
userInfo.first_name_specified = FALSE; userInfo.first_name_specified = false;
} }
if (user_data->sec_flags & sec_middle_name_spec) { if (user_data->sec_flags & sec_middle_name_spec) {
int l = MIN(NAME_LEN - 1, strlen(user_data->middle_name)); int l = MIN(NAME_LEN - 1, strlen(user_data->middle_name));
strncpy(userInfo.middle_name, user_data->middle_name, l); strncpy(userInfo.middle_name, user_data->middle_name, l);
userInfo.middle_name[l] = '\0'; userInfo.middle_name[l] = '\0';
userInfo.middle_name_entered = TRUE; userInfo.middle_name_entered = true;
userInfo.middle_name_specified = TRUE; userInfo.middle_name_specified = true;
} }
else { else {
userInfo.middle_name_entered = FALSE; userInfo.middle_name_entered = false;
userInfo.middle_name_specified = FALSE; userInfo.middle_name_specified = false;
} }
if (user_data->sec_flags & sec_last_name_spec) { if (user_data->sec_flags & sec_last_name_spec) {
int l = MIN(NAME_LEN - 1, strlen(user_data->last_name)); int l = MIN(NAME_LEN - 1, strlen(user_data->last_name));
strncpy(userInfo.last_name, user_data->last_name, l); strncpy(userInfo.last_name, user_data->last_name, l);
userInfo.last_name[l] = '\0'; userInfo.last_name[l] = '\0';
userInfo.last_name_entered = TRUE; userInfo.last_name_entered = true;
userInfo.last_name_specified = TRUE; userInfo.last_name_specified = true;
} }
else { else {
userInfo.last_name_entered = FALSE; userInfo.last_name_entered = false;
userInfo.last_name_specified = FALSE; userInfo.last_name_specified = false;
} }
db_handle = open_security_db(status, db_handle = open_security_db(status,

View File

@ -3539,7 +3539,7 @@ static void THREAD_ROUTINE cache_writer(DBB dbb)
#ifdef SUPERSERVER_V2 #ifdef SUPERSERVER_V2
SLONG commit_mask; SLONG commit_mask;
#endif #endif
SSHORT start_chkpt; bool start_chkpt;
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
SCHAR walname[256]; SCHAR walname[256];
EVENT writer_event; EVENT writer_event;
@ -5871,10 +5871,9 @@ static BOOLEAN write_page(
AST_CHECK; AST_CHECK;
dbb->dbb_writes++; dbb->dbb_writes++;
if (dbb->dbb_wal) if (dbb->dbb_wal)
WAL_flush(status, WAL_flush(status, dbb->dbb_wal,
dbb->dbb_wal,
reinterpret_cast < long *>(&page->pag_seqno), reinterpret_cast < long *>(&page->pag_seqno),
reinterpret_cast < long *>(&page->pag_offset), TRUE); reinterpret_cast < long *>(&page->pag_offset), true);
#ifdef DEBUG_SAVE_BDB_PAGE #ifdef DEBUG_SAVE_BDB_PAGE
/* Save page number into page->pag_offset before computing the checksum */ /* Save page number into page->pag_offset before computing the checksum */

View File

@ -1041,11 +1041,10 @@ USHORT activate_shadow, SLONG * timestamp, SLONG page_no, PAG page)
/* Open wal files */ /* Open wal files */
WALRS_handle = 0; WALRS_handle = 0;
ret_val = ret_val = WALR_open(tdbb->tdbb_status_vector,
WALR_open(tdbb->tdbb_status_vector,
reinterpret_cast < walrs ** >(&WALRS_handle), dbname, 1, reinterpret_cast < walrs ** >(&WALRS_handle), dbname, 1,
&start_logname, &cp1->cp_p_offset, cp1->cp_offset, &start_logname, &cp1->cp_p_offset, cp1->cp_offset,
timestamp, FALSE); timestamp, false);
if (ret_val == -1) if (ret_val == -1)
return; /* reached EOF */ return; /* reached EOF */
else if (ret_val != FB_SUCCESS) else if (ret_val != FB_SUCCESS)

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: all.cpp,v 1.15 2003-09-10 11:48:07 robocop Exp $ $Id: all.cpp,v 1.16 2003-09-10 17:50:39 brodsom Exp $
*/ */
/*************************************************** /***************************************************
@ -109,7 +109,7 @@ BLK ALLQ_alloc( PLB pool, UCHAR type, int count)
/* Find best fit. Best fit is defined to be the free block of SHORTest /* Find best fit. Best fit is defined to be the free block of SHORTest
tail. If there isn't a fit, extend the pool and try, try again. */ tail. If there isn't a fit, extend the pool and try, try again. */
while (TRUE) { while (true) {
best = NULL; best = NULL;
best_tail = 32767; best_tail = 32767;
for (ptr = &pool->plb_free; (free = *ptr); ptr = &free->frb_next) for (ptr = &pool->plb_free; (free = *ptr); ptr = &free->frb_next)

View File

@ -72,7 +72,9 @@
jmp_buf QLI_env; // Error return environment jmp_buf QLI_env; // Error return environment
TEXT *QLI_error; TEXT *QLI_error;
USHORT sw_verify, sw_trace, sw_buffers; bool sw_verify;
bool sw_trace;
USHORT sw_buffers;
#ifdef PYXIS #ifdef PYXIS
USHORT sw_forms; USHORT sw_forms;
#endif #endif
@ -89,21 +91,21 @@ USHORT QLI_columns = 80;
extern TEXT *QLI_prompt; extern TEXT *QLI_prompt;
static void enable_signals(void); static void enable_signals(void);
static USHORT process_statement(USHORT); static bool process_statement(bool);
static void CLIB_ROUTINE signal_arith_excp(USHORT, USHORT, USHORT); static void CLIB_ROUTINE signal_arith_excp(USHORT, USHORT, USHORT);
static void CLIB_ROUTINE signal_quit(void); static void CLIB_ROUTINE signal_quit(void);
static BOOLEAN yes_no(USHORT, TEXT *); static bool yes_no(USHORT, TEXT *);
typedef struct answer_t { typedef struct answer_t {
TEXT answer[30]; TEXT answer[30];
BOOLEAN value; bool value;
} *ANS; } *ANS;
static int yes_no_loaded = 0; static int yes_no_loaded = 0;
static struct answer_t answer_table[] = { static struct answer_t answer_table[] = {
{ "", FALSE }, // NO { "", false }, /* NO */
{ "", TRUE }, // YES { "", true }, /* YES */
{ NULL, 0 } { NULL, false }
}; };
@ -124,9 +126,12 @@ int CLIB_ROUTINE main( int argc, char **argv)
SCHAR home_directory[256]; SCHAR home_directory[256];
#endif #endif
PLB temp; PLB temp;
USHORT flush_flag, banner_flag, version_flag, got_started; bool flush_flag;
bool banner_flag;
bool version_flag;
bool got_started;
#ifdef VMS #ifdef VMS
USHORT vms_tryagain_flag; bool vms_tryagain_flag;
#endif #endif
SLONG debug_value; SLONG debug_value;
jmp_buf env; jmp_buf env;
@ -151,8 +156,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
application_file = NULL; application_file = NULL;
ALLQ_init(); ALLQ_init();
LEX_init(); LEX_init();
version_flag = flush_flag = FALSE; version_flag = flush_flag = false;
banner_flag = TRUE; banner_flag = true;
sw_buffers = 0; sw_buffers = 0;
strcpy(QLI_prompt_string, "QLI> "); strcpy(QLI_prompt_string, "QLI> ");
strcpy(QLI_cont_string, "CON> "); strcpy(QLI_cont_string, "CON> ");
@ -173,7 +178,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
for (arg_end = argv + argc, argv++; argv < arg_end;) { for (arg_end = argv + argc, argv++; argv < arg_end;) {
p = *argv++; p = *argv++;
if (*p++ != '-') { if (*p++ != '-') {
banner_flag = FALSE; banner_flag = false;
LEX_pop_line(); LEX_pop_line();
LEX_push_string(p - 1); LEX_push_string(p - 1);
continue; continue;
@ -202,7 +207,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
break; break;
case 'N': case 'N':
banner_flag = FALSE; banner_flag = false;
break; break;
case 'P': case 'P':
@ -216,7 +221,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
break; break;
case 'T': case 'T':
sw_trace = TRUE; sw_trace = true;
break; break;
case 'U': case 'U':
@ -230,7 +235,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
break; break;
case 'V': case 'V':
sw_verify = TRUE; sw_verify = true;
break; break;
case 'X': case 'X':
@ -246,7 +251,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
break; break;
case 'Z': case 'Z':
version_flag = TRUE; version_flag = true;
break; break;
default: default:
@ -264,34 +269,36 @@ int CLIB_ROUTINE main( int argc, char **argv)
ERRQ_msg_put(25, GDS_VERSION, NULL, NULL, NULL, NULL); /* Msg25 qli version %s */ ERRQ_msg_put(25, GDS_VERSION, NULL, NULL, NULL, NULL); /* Msg25 qli version %s */
if (application_file) if (application_file)
LEX_push_file(application_file, TRUE); LEX_push_file(application_file, true);
if (startup_file) if (startup_file)
LEX_push_file(startup_file, FALSE); LEX_push_file(startup_file, false);
#ifdef VMS #ifdef VMS
vms_tryagain_flag = FALSE; vms_tryagain_flag = false;
if (startup_file) if (startup_file)
vms_tryagain_flag = LEX_push_file(startup_file, FALSE); vms_tryagain_flag = LEX_push_file(startup_file, false);
/* If default value of startup file wasn't altered by the use of -i, /* If default value of startup file wasn't altered by the use of -i,
and LEX returned FALSE (above), try the old logical name, QLI_INIT */ and LEX returned FALSE (above), try the old logical name, QLI_INIT */
if (!vms_tryagain_flag && startup_file if (!vms_tryagain_flag && startup_file
&& !(strcmp(startup_file, STARTUP_FILE))) LEX_push_file("QLI_INIT", && !(strcmp(startup_file, STARTUP_FILE)))
FALSE); {
LEX_push_file("QLI_INIT", false);
}
#endif #endif
for (got_started = 0; !got_started;) for (got_started = false; !got_started;)
{ {
got_started = 1; got_started = true;
try { try {
memcpy(QLI_env, env, sizeof(QLI_env)); memcpy(QLI_env, env, sizeof(QLI_env));
PAR_token(); PAR_token();
} }
catch (const std::exception&) { catch (const std::exception&) {
// try again /* try again */
got_started = 0; got_started = false;
ERRQ_pending(); ERRQ_pending();
} }
} }
@ -351,7 +358,7 @@ static void enable_signals(void)
} }
static USHORT process_statement( USHORT flush_flag) static bool process_statement(bool flush_flag)
{ {
/************************************** /**************************************
* *
@ -361,7 +368,7 @@ static USHORT process_statement( USHORT flush_flag)
* *
* Functional description * Functional description
* Parse, compile, and execute a single statement. If an input flush * Parse, compile, and execute a single statement. If an input flush
* is required, return TRUE (or status), otherwise return FALSE. * is required, return true (or status), otherwise return false.
* *
**************************************/ **************************************/
SYN syntax_tree; SYN syntax_tree;
@ -417,7 +424,7 @@ static USHORT process_statement( USHORT flush_flag)
PAR_real(); PAR_real();
if (!QLI_line) if (!QLI_line)
return FALSE; return false;
EXEC_poll_abort(); EXEC_poll_abort();
@ -432,7 +439,7 @@ static USHORT process_statement( USHORT flush_flag)
QLI_prompt = QLI_cont_string; QLI_prompt = QLI_cont_string;
if (!(syntax_tree = PARQ_parse())) if (!(syntax_tree = PARQ_parse()))
return FALSE; return false;
EXEC_poll_abort(); EXEC_poll_abort();
@ -440,7 +447,7 @@ static USHORT process_statement( USHORT flush_flag)
if (syntax_tree->syn_type == nod_exit) { if (syntax_tree->syn_type == nod_exit) {
QLI_line = NULL; QLI_line = NULL;
return FALSE; return false;
} }
/* If the statement was quit, ask the user if he want to rollback */ /* If the statement was quit, ask the user if he want to rollback */
@ -453,24 +460,24 @@ static USHORT process_statement( USHORT flush_flag)
MET_transaction(nod_rollback, dbb); MET_transaction(nod_rollback, dbb);
else else
MET_transaction(nod_commit, dbb); MET_transaction(nod_commit, dbb);
return FALSE; return false;
} }
/* Expand the statement. It will return NULL is the statement was /* Expand the statement. It will return NULL is the statement was
a command. An error will be unwound */ a command. An error will be unwound */
if (!(expanded_tree = (BLK) EXP_expand(syntax_tree))) if (!(expanded_tree = (BLK) EXP_expand(syntax_tree)))
return FALSE; return false;
// Compile the statement // Compile the statement
if (!(execution_tree = (BLK) CMPQ_compile((qli_nod*) expanded_tree))) if (!(execution_tree = (BLK) CMPQ_compile((qli_nod*) expanded_tree)))
return FALSE; return false;
// Generate any BLR needed to support the request // Generate any BLR needed to support the request
if (!GEN_generate(( (qli_nod*) execution_tree))) if (!GEN_generate(( (qli_nod*) execution_tree)))
return FALSE; return false;
if (QLI_statistics) if (QLI_statistics)
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
@ -513,7 +520,7 @@ static USHORT process_statement( USHORT flush_flag)
GEN_release(); GEN_release();
return FALSE; return false;
} // try } // try
catch (const Firebird::status_exception& e) { catch (const Firebird::status_exception& e) {
@ -611,7 +618,7 @@ static void CLIB_ROUTINE signal_quit(void)
} }
static BOOLEAN yes_no( USHORT number, TEXT * arg1) static bool yes_no(USHORT number, TEXT * arg1)
{ {
/************************************** /**************************************
* *
@ -638,16 +645,16 @@ static BOOLEAN yes_no( USHORT number, TEXT * arg1)
strcpy(answer_table[1].answer, "YES"); strcpy(answer_table[1].answer, "YES");
} }
while (TRUE) { while (true) {
buffer[0] = 0; buffer[0] = 0;
if (!LEX_get_line(prompt, buffer, sizeof(buffer))) if (!LEX_get_line(prompt, buffer, sizeof(buffer)))
return TRUE; return true;
for (response = answer_table; (TEXT *) response->answer; response++) { for (response = answer_table; (TEXT *) response->answer; response++) {
p = buffer; p = buffer;
while (*p == ' ') while (*p == ' ')
p++; p++;
if (*p == EOF) if (*p == EOF)
return TRUE; return true;
for (q = response->answer; *p && UPPER(*p) == *q++; p++); for (q = response->answer; *p && UPPER(*p) == *q++; p++);
if (!*p || *p == '\n') if (!*p || *p == '\n')
return response->value; return response->value;

View File

@ -894,7 +894,7 @@ static void execute_for( QLI_NOD node)
/* Receive messages in a loop until the end of file field comes up /* Receive messages in a loop until the end of file field comes up
true. */ true. */
while (TRUE) { while (true) {
desc = EXEC_receive(message, (PAR) node->nod_arg[e_for_eof]); desc = EXEC_receive(message, (PAR) node->nod_arg[e_for_eof]);
if (*(USHORT *) desc->dsc_address) if (*(USHORT *) desc->dsc_address)
break; break;

View File

@ -43,8 +43,8 @@ extern USHORT QLI_columns, QLI_lines;
#define MAKE_NODE(type,count) make_node (type, count) #define MAKE_NODE(type,count) make_node (type, count)
static int compare_names(NAM, SYM); static bool compare_names(NAM, SYM);
static int compare_symbols(SYM, SYM); static bool compare_symbols(SYM, SYM);
static SYM copy_symbol(SYM); static SYM copy_symbol(SYM);
static void declare_global(QLI_FLD, SYN); static void declare_global(QLI_FLD, SYN);
static SYN decompile_field(QLI_FLD, QLI_CTX); static SYN decompile_field(QLI_FLD, QLI_CTX);
@ -87,9 +87,9 @@ static void expand_values(SYN, LLS);
static QLI_CTX find_context(NAM, LLS); static QLI_CTX find_context(NAM, LLS);
static int generate_fields(QLI_CTX, LLS, SYN); static int generate_fields(QLI_CTX, LLS, SYN);
static int generate_items(SYN, LLS, LLS, QLI_NOD); static int generate_items(SYN, LLS, LLS, QLI_NOD);
static SLONG global_agg(SYN, SYN); static bool global_agg(SYN, SYN);
static int invalid_nod_field(QLI_NOD, QLI_NOD); static bool invalid_nod_field(QLI_NOD, QLI_NOD);
static int invalid_syn_field(SYN, SYN); static bool invalid_syn_field(SYN, SYN);
static QLI_NOD make_and(QLI_NOD, QLI_NOD); static QLI_NOD make_and(QLI_NOD, QLI_NOD);
static QLI_NOD make_assignment(QLI_NOD, QLI_NOD, LLS); static QLI_NOD make_assignment(QLI_NOD, QLI_NOD, LLS);
#ifdef PYXIS #ifdef PYXIS
@ -100,7 +100,7 @@ static QLI_NOD make_field(QLI_FLD, QLI_CTX);
static QLI_NOD make_list(LLS); static QLI_NOD make_list(LLS);
static QLI_NOD make_node(NOD_T, USHORT); static QLI_NOD make_node(NOD_T, USHORT);
static QLI_NOD negate(QLI_NOD); static QLI_NOD negate(QLI_NOD);
static QLI_NOD possible_literal(SYN, LLS, USHORT); static QLI_NOD possible_literal(SYN, LLS, bool);
static QLI_NOD post_map(QLI_NOD, QLI_CTX); static QLI_NOD post_map(QLI_NOD, QLI_CTX);
static QLI_FLD resolve(SYN, LLS, QLI_CTX *); static QLI_FLD resolve(SYN, LLS, QLI_CTX *);
#ifdef PYXIS #ifdef PYXIS
@ -289,7 +289,7 @@ QLI_NOD EXP_expand( SYN node)
} }
static int compare_names( NAM name, SYM symbol) static bool compare_names( NAM name, SYM symbol)
{ {
/************************************** /**************************************
* *
@ -298,14 +298,14 @@ static int compare_names( NAM name, SYM symbol)
************************************** **************************************
* *
* Functional description * Functional description
* Compare a name node to a symbol. If they are equal, return TRUE. * Compare a name node to a symbol. If they are equal, return true.
* *
**************************************/ **************************************/
USHORT l; USHORT l;
TEXT *p, *q; TEXT *p, *q;
if (!symbol || (l = name->nam_length) != symbol->sym_length) if (!symbol || (l = name->nam_length) != symbol->sym_length)
return FALSE; return false;
p = symbol->sym_string; p = symbol->sym_string;
q = name->nam_string; q = name->nam_string;
@ -313,14 +313,14 @@ static int compare_names( NAM name, SYM symbol)
if (l) if (l)
do do
if (*p++ != *q++) if (*p++ != *q++)
return FALSE; return false;
while (--l); while (--l);
return TRUE; return true;
} }
static int compare_symbols( SYM symbol1, SYM symbol2) static bool compare_symbols( SYM symbol1, SYM symbol2)
{ {
/************************************** /**************************************
* *
@ -336,10 +336,10 @@ static int compare_symbols( SYM symbol1, SYM symbol2)
TEXT *p, *q; TEXT *p, *q;
if (!symbol1 || !symbol2) if (!symbol1 || !symbol2)
return FALSE; return false;
if ((l = symbol1->sym_length) != symbol2->sym_length) if ((l = symbol1->sym_length) != symbol2->sym_length)
return FALSE; return false;
p = symbol1->sym_string; p = symbol1->sym_string;
q = symbol2->sym_string; q = symbol2->sym_string;
@ -347,10 +347,10 @@ static int compare_symbols( SYM symbol1, SYM symbol2)
if (l) if (l)
do do
if (*p++ != *q++) if (*p++ != *q++)
return FALSE; return false;
while (--l); while (--l);
return TRUE; return true;
} }
@ -633,7 +633,7 @@ static QLI_NOD expand_boolean( SYN input, LLS stack)
*ptr++ = value = expand_expression(input->syn_arg[0], stack); *ptr++ = value = expand_expression(input->syn_arg[0], stack);
for (i = 1; i < input->syn_count; i++, ptr++) for (i = 1; i < input->syn_count; i++, ptr++)
if (!(*ptr = possible_literal(input->syn_arg[i], stack, TRUE))) if (!(*ptr = possible_literal(input->syn_arg[i], stack, true)))
*ptr = expand_expression(input->syn_arg[i], stack); *ptr = expand_expression(input->syn_arg[i], stack);
// Try to match any prompts against fields to determine prompt length // Try to match any prompts against fields to determine prompt length
@ -1561,7 +1561,7 @@ static QLI_NOD expand_output( SYN input, LLS right, PRT * print)
output = MAKE_NODE(nod_output, e_out_count); output = MAKE_NODE(nod_output, e_out_count);
LLS_PUSH(output, &output_stack); LLS_PUSH(output, &output_stack);
if (!(node = possible_literal(input->syn_arg[s_out_file], right, FALSE))) if (!(node = possible_literal(input->syn_arg[s_out_file], right, false)))
node = expand_expression(input->syn_arg[s_out_file], right); node = expand_expression(input->syn_arg[s_out_file], right);
output->nod_arg[e_out_file] = node; output->nod_arg[e_out_file] = node;
@ -1964,33 +1964,34 @@ static QLI_NOD expand_restructure( SYN input, LLS right, LLS left)
// First look for an exact field name match // First look for an exact field name match
for (fld = ctx->ctx_relation->rel_fields; fld; for (fld = ctx->ctx_relation->rel_fields; fld;
fld = fld = fld->fld_next)
fld->fld_next) if (compare_symbols(field->fld_name, {
fld->fld_name)) break; if (compare_symbols(field->fld_name, fld->fld_name))
break;
}
/* Next try, target field name matching source query name */ /* Next try, target field name matching source query name */
if (!fld) if (!fld)
for (fld = ctx->ctx_relation->rel_fields; fld; for (fld = ctx->ctx_relation->rel_fields; fld;
fld = fld = fld->fld_next)
fld->fld_next) if (compare_symbols(field->fld_name, {
fld-> if (compare_symbols(field->fld_name, fld->fld_query_name))
fld_query_name))
break; break;
}
/* If nothing yet, look for any old match */ /* If nothing yet, look for any old match */
if (!fld) if (!fld)
for (fld = ctx->ctx_relation->rel_fields; fld; for (fld = ctx->ctx_relation->rel_fields; fld;
fld = fld = fld->fld_next)
fld->fld_next) if (compare_symbols(field-> {
fld_query_name, if (compare_symbols(field-> fld_query_name,
fld->fld_name) fld->fld_name)
|| compare_symbols(field-> || compare_symbols(field->fld_query_name,
fld_query_name, fld->fld_query_name))
fld-> {
fld_query_name))
break; break;
}
}
if (fld) { if (fld) {
assignment = MAKE_NODE(nod_assign, e_asn_count); assignment = MAKE_NODE(nod_assign, e_asn_count);
@ -2692,7 +2693,7 @@ static int generate_items( SYN symbol, LLS right, LLS items, QLI_NOD rse)
} }
static SLONG global_agg( SYN item, SYN group_list) static bool global_agg( SYN item, SYN group_list)
{ {
/************************************** /**************************************
* *
@ -2712,10 +2713,8 @@ static SLONG global_agg( SYN item, SYN group_list)
* *
**************************************/ **************************************/
SYN *ptr, *end; SYN *ptr, *end;
int normal_field, aggregate; bool normal_field = false;
bool aggregate = false;
normal_field = FALSE;
aggregate = FALSE;
switch (item->syn_type) { switch (item->syn_type) {
case nod_agg_average: case nod_agg_average:
@ -2725,7 +2724,7 @@ static SLONG global_agg( SYN item, SYN group_list)
case nod_agg_count: case nod_agg_count:
case nod_running_total: case nod_running_total:
case nod_running_count: case nod_running_count:
return TRUE; return true;
case nod_upcase: case nod_upcase:
case nod_add: case nod_add:
@ -2741,9 +2740,9 @@ static SLONG global_agg( SYN item, SYN group_list)
if ((*ptr)->syn_type == nod_constant) if ((*ptr)->syn_type == nod_constant)
continue; continue;
if (global_agg(*ptr, group_list)) if (global_agg(*ptr, group_list))
aggregate = TRUE; aggregate = true;
else if (!group_list || invalid_syn_field(*ptr, group_list)) else if (!group_list || invalid_syn_field(*ptr, group_list))
normal_field = TRUE; normal_field = true;
} }
} }
@ -2758,7 +2757,7 @@ static SLONG global_agg( SYN item, SYN group_list)
} }
static int invalid_nod_field( QLI_NOD node, QLI_NOD list) static bool invalid_nod_field( QLI_NOD node, QLI_NOD list)
{ {
/************************************** /**************************************
* *
@ -2777,23 +2776,22 @@ static int invalid_nod_field( QLI_NOD node, QLI_NOD list)
**************************************/ **************************************/
QLI_FLD field; QLI_FLD field;
QLI_CTX context; QLI_CTX context;
SCHAR invalid; bool invalid = false;
QLI_NOD *ptr, *end; QLI_NOD *ptr, *end;
if (!list) if (!list)
return TRUE; return true;
invalid = FALSE;
if (node->nod_type == nod_field) { if (node->nod_type == nod_field) {
field = (QLI_FLD) node->nod_arg[e_fld_field]; field = (QLI_FLD) node->nod_arg[e_fld_field];
context = (QLI_CTX) node->nod_arg[e_fld_context]; context = (QLI_CTX) node->nod_arg[e_fld_context];
for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end; for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end; ptr++)
ptr++)
if (field == (QLI_FLD) (*ptr)->nod_arg[e_fld_field] if (field == (QLI_FLD) (*ptr)->nod_arg[e_fld_field]
&& context == (QLI_CTX) (*ptr)->nod_arg[e_fld_context]) && context == (QLI_CTX) (*ptr)->nod_arg[e_fld_context])
return FALSE; {
return TRUE; return false;
}
return true;
} }
else else
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end;
@ -2818,7 +2816,7 @@ static int invalid_nod_field( QLI_NOD node, QLI_NOD list)
} }
static int invalid_syn_field( SYN syn_node, SYN list) static bool invalid_syn_field( SYN syn_node, SYN list)
{ {
/************************************** /**************************************
* *
@ -2842,16 +2840,13 @@ static int invalid_syn_field( SYN syn_node, SYN list)
SYN element, *ptr, *end; SYN element, *ptr, *end;
NAM gname, fname, gctx, fctx; NAM gname, fname, gctx, fctx;
SSHORT count; SSHORT count;
SCHAR invalid; bool invalid = false;
if (syn_node->syn_type == nod_star) if (syn_node->syn_type == nod_star)
return FALSE; return false;
if (!list) if (!list)
return TRUE; return true;
invalid = FALSE;
if (syn_node->syn_type == nod_field) { if (syn_node->syn_type == nod_field) {
fctx = NULL; fctx = NULL;
@ -2871,10 +2866,12 @@ static int invalid_syn_field( SYN syn_node, SYN list)
} }
if (!strcmp(fname->nam_string, gname->nam_string)) if (!strcmp(fname->nam_string, gname->nam_string))
if (!gctx || !fctx if (!gctx || !fctx
|| (!strcmp(fctx->nam_string, gctx->nam_string))) return || (!strcmp(fctx->nam_string, gctx->nam_string)))
FALSE; {
return false;
} }
return TRUE; }
return true;
} }
else else
for (ptr = syn_node->syn_arg, end = ptr + syn_node->syn_count; for (ptr = syn_node->syn_arg, end = ptr + syn_node->syn_count;
@ -3189,7 +3186,9 @@ static QLI_NOD negate( QLI_NOD expr)
} }
static QLI_NOD possible_literal( SYN input, LLS stack, USHORT upper_flag) static QLI_NOD possible_literal(SYN input,
LLS stack,
bool upper_flag)
{ {
/************************************** /**************************************
* *
@ -3346,12 +3345,14 @@ static QLI_FLD resolve( SYN node, LLS stack, QLI_CTX * out_context)
case CTX_VARIABLE: case CTX_VARIABLE:
if (ptr == base) if (ptr == base)
for (field = context->ctx_variable; field; for (field = context->ctx_variable; field;
field = field = field->fld_next)
field->fld_next) if (compare_names(name, field->fld_name) {
|| compare_names(name, if (compare_names(name, field->fld_name)
field-> || compare_names(name, field->fld_query_name))
fld_query_name)) {
return field; return field;
}
}
break; break;
case CTX_RELATION: case CTX_RELATION:
@ -3364,7 +3365,8 @@ static QLI_FLD resolve( SYN node, LLS stack, QLI_CTX * out_context)
for (field = relation->rel_fields; field; field = field->fld_next) for (field = relation->rel_fields; field; field = field->fld_next)
if (compare_names(name, field->fld_name) || if (compare_names(name, field->fld_name) ||
compare_names(name, field->fld_query_name)) { compare_names(name, field->fld_query_name))
{
if (ptr == base) if (ptr == base)
return field; return field;
name = *--ptr; name = *--ptr;
@ -3429,12 +3431,13 @@ static QLI_FLD resolve_name( SYM name, LLS stack, QLI_CTX * out_context)
break; break;
case CTX_VARIABLE: case CTX_VARIABLE:
for (field = context->ctx_variable; field; for (field = context->ctx_variable; field;
field = field = field->fld_next)
field->fld_next) if (compare_symbols(name, field->fld_name) {
|| compare_symbols(name, if (compare_symbols(name, field->fld_name)
field-> || compare_symbols(name, field->fld_query_name))
fld_query_name)) {
return field; return field;
}
break; break;
case CTX_RELATION: case CTX_RELATION:
@ -3443,7 +3446,9 @@ static QLI_FLD resolve_name( SYM name, LLS stack, QLI_CTX * out_context)
for (field = relation->rel_fields; field; field = field->fld_next) for (field = relation->rel_fields; field; field = field->fld_next)
if (compare_symbols(name, field->fld_name) || if (compare_symbols(name, field->fld_name) ||
compare_symbols(name, field->fld_query_name)) compare_symbols(name, field->fld_query_name))
{
return field; return field;
}
break; break;
} }
@ -3468,17 +3473,16 @@ static void resolve_really( QLI_FLD variable, SYN field_node)
* *
**************************************/ **************************************/
USHORT offset; USHORT offset;
BOOLEAN resolved, local; bool resolved = false;
NAM fld_name, rel_name, db_name; bool local = false;
NAM fld_name = NULL;
NAM rel_name = NULL;
NAM db_name = NULL;
SYM symbol; SYM symbol;
QLI_FLD field; QLI_FLD field = NULL;
QLI_REL relation; QLI_REL relation;
DBB dbb; DBB dbb;
db_name = rel_name = fld_name = NULL;
field = NULL;
resolved = local = FALSE;
/* For ease, break down the syntax block. /* For ease, break down the syntax block.
It should contain at least one name; two names are a potential ambiguity: It should contain at least one name; two names are a potential ambiguity:
check for a dbb (<db>.<glo_fld>), then for a rel (<rel>.<fld>). */ check for a dbb (<db>.<glo_fld>), then for a rel (<rel>.<fld>). */
@ -3493,37 +3497,41 @@ static void resolve_really( QLI_FLD variable, SYN field_node)
} }
if (field_node->syn_count == 1) if (field_node->syn_count == 1)
resolved = MET_declare(0, variable, fld_name); resolved = (MET_declare(0, variable, fld_name));
else if (field_node->syn_count == 2) { else if (field_node->syn_count == 2) {
for (symbol = rel_name->nam_symbol; symbol; for (symbol = rel_name->nam_symbol; symbol;
symbol = symbol =
symbol->sym_homonym) if (symbol->sym_type == SYM_database) { symbol->sym_homonym) if (symbol->sym_type == SYM_database) {
dbb = (DBB) symbol->sym_object; dbb = (DBB) symbol->sym_object;
resolved = MET_declare(dbb, variable, fld_name); resolved = (MET_declare(dbb, variable, fld_name));
break; // should be only one db in homonym list break; // should be only one db in homonym list
} }
if (!resolved) { if (!resolved) {
for (dbb = QLI_databases; dbb && !resolved; dbb = dbb->dbb_next) for (dbb = QLI_databases; dbb && !resolved; dbb = dbb->dbb_next)
for (symbol = rel_name->nam_symbol; symbol; for (symbol = rel_name->nam_symbol; symbol;
symbol = symbol = symbol->sym_homonym)
symbol->sym_homonym) if (symbol->sym_type == SYM_relation {
&& (relation = if (symbol->sym_type == SYM_relation
(QLI_REL) symbol->sym_object) && (relation = (QLI_REL) symbol->sym_object)
&& relation->rel_database == && relation->rel_database == dbb)
dbb) { {
if (!relation->rel_fields) if (!relation->rel_fields)
MET_fields(relation); MET_fields(relation);
for (field = relation->rel_fields; field; for (field = relation->rel_fields; field;
field = field->fld_next) if (resolved = local = field = field->fld_next)
compare_names {
(fld_name, if (resolved = local = compare_names (fld_name,
field-> field->fld_name))
fld_name)) break; {
break;
}
}
break; // should be only one rel in homonym list for each db break; // should be only one rel in homonym list for each db
} }
} }
} }
}
else { else {
relation = variable->fld_relation; relation = variable->fld_relation;
if (!relation->rel_fields) if (!relation->rel_fields)

View File

@ -31,8 +31,7 @@
#define HASH_SIZE 224 #define HASH_SIZE 224
static int hash(SCHAR *, int); static int hash(SCHAR *, int);
static BOOLEAN scompare(SCHAR *, int, SCHAR *, static bool scompare(SCHAR *, int, SCHAR *, int);
int);
static SYM hash_table[HASH_SIZE]; static SYM hash_table[HASH_SIZE];
static SYM key_symbols; static SYM key_symbols;
@ -220,10 +219,10 @@ static int hash( SCHAR * string, int length)
} }
static BOOLEAN scompare( static bool scompare(SCHAR * string1,
SCHAR * string1,
int length1, int length1,
SCHAR * string2, int length2) SCHAR * string2,
int length2)
{ {
/************************************** /**************************************
* *
@ -238,11 +237,11 @@ static BOOLEAN scompare(
SCHAR c1, c2; SCHAR c1, c2;
if (length1 != length2) if (length1 != length2)
return FALSE; return false;
while (length1--) while (length1--)
if ((c1 = *string1++) != (c2 = *string2++) && UPPER(c1) != UPPER(c2)) if ((c1 = *string1++) != (c2 = *string2++) && UPPER(c1) != UPPER(c2))
return FALSE; return false;
return TRUE; return true;
} }

View File

@ -73,13 +73,14 @@
#define FOPEN_INPUT_TYPE "r" #define FOPEN_INPUT_TYPE "r"
#endif #endif
extern USHORT sw_verify, sw_trace; extern bool sw_verify;
extern bool sw_trace;
static BOOLEAN get_line(IB_FILE *, TEXT *, USHORT); static bool get_line(IB_FILE *, TEXT *, USHORT);
static int nextchar(BOOLEAN); static int nextchar(bool);
static void next_line(BOOLEAN); static void next_line(bool);
static void retchar(SSHORT); static void retchar(SSHORT);
static BOOLEAN scan_number(SSHORT, TEXT **); static bool scan_number(SSHORT, TEXT **);
static int skip_white(void); static int skip_white(void);
static LLS QLI_statements; static LLS QLI_statements;
@ -137,7 +138,7 @@ static SCHAR classes[256] = {
int LEX_active_procedure(void) bool LEX_active_procedure(void)
{ {
/************************************** /**************************************
* *
@ -146,13 +147,13 @@ int LEX_active_procedure(void)
************************************** **************************************
* *
* Functional description * Functional description
* Return TRUE if we're running out of a * Return true if we're running out of a
* procedure and FALSE otherwise. Somebody * procedure and false otherwise. Somebody
* somewhere may care. * somewhere may care.
* *
**************************************/ **************************************/
return (QLI_line->line_type == line_blob) ? TRUE : FALSE; return (QLI_line->line_type == line_blob);
} }
@ -195,7 +196,7 @@ void LEX_edit( SLONG start, SLONG stop)
ib_fclose(scratch); ib_fclose(scratch);
if (gds__edit(filename, TRUE)) if (gds__edit(filename, TRUE))
LEX_push_file(filename, TRUE); LEX_push_file(filename, true);
unlink(filename); unlink(filename);
@ -237,7 +238,7 @@ TOK LEX_edit_string(void)
*p++ = c; *p++ = c;
if (classes[c] & CHR_quote) if (classes[c] & CHR_quote)
for (;;) { for (;;) {
if ((d = nextchar(FALSE)) == '\n') { if ((d = nextchar(false)) == '\n') {
retchar(d); retchar(d);
break; break;
} }
@ -245,7 +246,7 @@ TOK LEX_edit_string(void)
if (d == c) if (d == c)
break; break;
} }
c = nextchar(TRUE); c = nextchar(true);
} }
retchar(c); retchar(c);
@ -310,12 +311,12 @@ TOK LEX_filename(void)
/* Look for white space or end of line, allowing embedded quoted strings. */ /* Look for white space or end of line, allowing embedded quoted strings. */
for (;;) { for (;;) {
c = nextchar(TRUE); c = nextchar(true);
class_ = classes[c]; class_ = classes[c];
if (c == '"' && c != save) { if (c == '"' && c != save) {
*p++ = c; *p++ = c;
for (;;) { for (;;) {
c = nextchar(TRUE); c = nextchar(true);
class_ = classes[c]; class_ = classes[c];
if ((class_ & CHR_eol) || c == '"') if ((class_ & CHR_eol) || c == '"')
break; break;
@ -409,7 +410,9 @@ void LEX_flush(void)
#ifdef UNIX_LINE #ifdef UNIX_LINE
int LEX_get_line( TEXT * prompt, TEXT * buffer, int size) bool LEX_get_line(TEXT * prompt,
TEXT * buffer,
int size)
{ {
/************************************** /**************************************
* *
@ -419,13 +422,13 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
* *
* Functional description * Functional description
* Give a prompt and read a line. If the line is terminated by * Give a prompt and read a line. If the line is terminated by
* an EOL, return TRUE. If the buffer is exhausted and non-blanks * an EOL, return true. If the buffer is exhausted and non-blanks
* would be discarded, return an error. If EOF is detected, * would be discarded, return an error. If EOF is detected,
* return FALSE. Regardless, a null terminated string is returned. * return false. Regardless, a null terminated string is returned.
* *
**************************************/ **************************************/
TEXT *p; TEXT *p;
USHORT overflow_flag; bool overflow_flag = false;
SSHORT c; SSHORT c;
// UNIX flavor // UNIX flavor
@ -435,9 +438,8 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
errno = 0; errno = 0;
p = buffer; p = buffer;
overflow_flag = FALSE;
while (TRUE) { while (true) {
c = ib_getc(input_file); c = ib_getc(input_file);
if (c == EOF) { if (c == EOF) {
if (SYSCALL_INTERRUPTED(errno) && !QLI_abort) { if (SYSCALL_INTERRUPTED(errno) && !QLI_abort) {
@ -461,14 +463,14 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
if (--size > 0) if (--size > 0)
*p++ = c; *p++ = c;
else if (c != ' ' && c != '\n') else if (c != ' ' && c != '\n')
overflow_flag = TRUE; overflow_flag = true;
if (c == '\n') if (c == '\n')
break; break;
} }
*p = 0; *p = 0;
if (c == EOF) if (c == EOF)
return FALSE; return false;
if (overflow_flag) { if (overflow_flag) {
buffer[0] = 0; buffer[0] = 0;
@ -478,13 +480,15 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
if (sw_verify) if (sw_verify)
ib_fputs(buffer, ib_stdout); ib_fputs(buffer, ib_stdout);
return TRUE; return true;
} }
#endif #endif
#ifdef VMS #ifdef VMS
int LEX_get_line( TEXT * prompt, TEXT * buffer, int size) bool LEX_get_line(TEXT * prompt,
TEXT * buffer,
int size)
{ {
/************************************** /**************************************
* *
@ -494,9 +498,9 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
* *
* Functional description * Functional description
* Give a prompt and read a line. If the line is terminated by * Give a prompt and read a line. If the line is terminated by
* an EOL, return TRUE. If the buffer is exhausted and non-blanks * an EOL, return true. If the buffer is exhausted and non-blanks
* would be discarded, return an error. If EOF is detected, * would be discarded, return an error. If EOF is detected,
* return FALSE. Regardless, a null terminated string is returned. * return false. Regardless, a null terminated string is returned.
* *
**************************************/ **************************************/
struct dsc$descriptor_s line_desc, prompt_desc; struct dsc$descriptor_s line_desc, prompt_desc;
@ -527,7 +531,7 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
if (!(status & 1)) { if (!(status & 1)) {
if (status != LIB$_INPSTRTRU) if (status != LIB$_INPSTRTRU)
return FALSE; return false;
buffer[0] = 0; buffer[0] = 0;
IBERROR(476); // Msg 476 input line too long IBERROR(476); // Msg 476 input line too long
} }
@ -541,7 +545,7 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
lib$put_output(&line_desc); lib$put_output(&line_desc);
} }
return TRUE; return true;
} }
#endif #endif
@ -662,7 +666,8 @@ void LEX_procedure( DBB database, FRBRD *blob)
} }
int LEX_push_file( TEXT * filename, int error_flag) bool LEX_push_file(TEXT * filename,
bool error_flag)
{ {
/************************************** /**************************************
* *
@ -685,7 +690,7 @@ int LEX_push_file( TEXT * filename, int error_flag)
if (!(file = ib_fopen(buffer, FOPEN_INPUT_TYPE))) { if (!(file = ib_fopen(buffer, FOPEN_INPUT_TYPE))) {
if (error_flag) if (error_flag)
ERRQ_msg_put(67, filename, NULL, NULL, NULL, NULL); /* Msg 67 can't open command file \"%s\"\n */ ERRQ_msg_put(67, filename, NULL, NULL, NULL, NULL); /* Msg 67 can't open command file \"%s\"\n */
return FALSE; return false;
} }
} }
@ -699,11 +704,11 @@ int LEX_push_file( TEXT * filename, int error_flag)
line->line_next = QLI_line; line->line_next = QLI_line;
QLI_line = line; QLI_line = line;
return TRUE; return true;
} }
int LEX_push_string( TEXT * string) bool LEX_push_string( TEXT * string)
{ {
/************************************** /**************************************
* *
@ -726,7 +731,7 @@ int LEX_push_string( TEXT * string)
line->line_next = QLI_line; line->line_next = QLI_line;
QLI_line = line; QLI_line = line;
return TRUE; return true;
} }
@ -844,7 +849,7 @@ TOK LEX_token(void)
if (c != '\n' || QLI_line->line_type != line_blob) if (c != '\n' || QLI_line->line_type != line_blob)
break; break;
prior = QLI_line; prior = QLI_line;
next_line(TRUE); next_line(true);
if (prior == QLI_line) if (prior == QLI_line)
break; break;
} }
@ -868,7 +873,7 @@ TOK LEX_token(void)
class_ = classes[c]; class_ = classes[c];
if (class_ & CHR_letter) { if (class_ & CHR_letter) {
while (classes[c = nextchar(TRUE)] & CHR_ident) while (classes[c = nextchar(true)] & CHR_ident)
*p++ = c; *p++ = c;
retchar(c); retchar(c);
token->tok_type = tok_ident; token->tok_type = tok_ident;
@ -877,8 +882,8 @@ TOK LEX_token(void)
token->tok_type = tok_number; token->tok_type = tok_number;
else if (class_ & CHR_quote) { else if (class_ & CHR_quote) {
token->tok_type = tok_quoted; token->tok_type = tok_quoted;
while (TRUE) { while (true) {
if (!(next = nextchar(FALSE)) || next == '\n') { if (!(next = nextchar(false)) || next == '\n') {
retchar(next); retchar(next);
IBERROR(63); // Msg 63 unterminated quoted string IBERROR(63); // Msg 63 unterminated quoted string
break; break;
@ -890,11 +895,11 @@ TOK LEX_token(void)
/* If there are 2 quotes in a row, interpret 2nd as a literal */ /* If there are 2 quotes in a row, interpret 2nd as a literal */
if (next == c) { if (next == c) {
peek = nextchar(FALSE); peek = nextchar(false);
retchar(peek); retchar(peek);
if (peek != c) if (peek != c)
break; break;
nextchar(FALSE); nextchar(false);
} }
} }
} }
@ -907,7 +912,7 @@ TOK LEX_token(void)
} }
else { else {
token->tok_type = tok_punct; token->tok_type = tok_punct;
*p++ = nextchar(TRUE); *p++ = nextchar(true);
if (!HSH_lookup(token->tok_string, 2)) if (!HSH_lookup(token->tok_string, 2))
retchar(*--p); retchar(*--p);
} }
@ -938,7 +943,9 @@ TOK LEX_token(void)
} }
static BOOLEAN get_line( IB_FILE * file, TEXT * buffer, USHORT size) static bool get_line(IB_FILE * file,
TEXT * buffer,
USHORT size)
{ {
/************************************** /**************************************
* *
@ -948,22 +955,21 @@ static BOOLEAN get_line( IB_FILE * file, TEXT * buffer, USHORT size)
* *
* Functional description * Functional description
* Read a line. If the line is terminated by * Read a line. If the line is terminated by
* an EOL, return TRUE. If the buffer is exhausted and non-blanks * an EOL, return true. If the buffer is exhausted and non-blanks
* would be discarded, return an error. If EOF is detected, * would be discarded, return an error. If EOF is detected,
* return FALSE. Regardless, a null terminated string is returned. * return false. Regardless, a null terminated string is returned.
* *
**************************************/ **************************************/
TEXT *p; TEXT *p;
SLONG length; SLONG length;
USHORT overflow_flag; bool overflow_flag = false;
SSHORT c; SSHORT c;
errno = 0; errno = 0;
p = buffer; p = buffer;
overflow_flag = FALSE;
length = size; length = size;
while (TRUE) { while (true) {
c = ib_getc(file); c = ib_getc(file);
if (c == EOF) { if (c == EOF) {
if (SYSCALL_INTERRUPTED(errno) && !QLI_abort) { if (SYSCALL_INTERRUPTED(errno) && !QLI_abort) {
@ -978,14 +984,14 @@ static BOOLEAN get_line( IB_FILE * file, TEXT * buffer, USHORT size)
if (--length > 0) if (--length > 0)
*p++ = c; *p++ = c;
else if (c != ' ' && c != '\n') else if (c != ' ' && c != '\n')
overflow_flag = TRUE; overflow_flag = true;
if (c == '\n') if (c == '\n')
break; break;
} }
*p = 0; *p = 0;
if (c == EOF) if (c == EOF)
return FALSE; return false;
if (overflow_flag) if (overflow_flag)
IBERROR(477); // Msg 477 input line too long IBERROR(477); // Msg 477 input line too long
@ -993,11 +999,11 @@ static BOOLEAN get_line( IB_FILE * file, TEXT * buffer, USHORT size)
if (sw_verify) if (sw_verify)
ib_fputs(buffer, ib_stdout); ib_fputs(buffer, ib_stdout);
return TRUE; return true;
} }
static int nextchar( BOOLEAN eof_ok) static int nextchar(bool eof_ok)
{ {
/************************************** /**************************************
* *
@ -1026,7 +1032,7 @@ static int nextchar( BOOLEAN eof_ok)
} }
static void next_line( BOOLEAN eof_ok) static void next_line(bool eof_ok)
{ {
/************************************** /**************************************
* *
@ -1039,10 +1045,10 @@ static void next_line( BOOLEAN eof_ok)
* *
**************************************/ **************************************/
TEXT *p, *q, filename[256]; TEXT *p, *q, filename[256];
SSHORT flag; bool flag;
while (QLI_line) { while (QLI_line) {
flag = FALSE; flag = false;
/* Get next line from where ever. If it comes from either the terminal /* Get next line from where ever. If it comes from either the terminal
or command file, check for another command file. */ or command file, check for another command file. */
@ -1052,15 +1058,14 @@ static void next_line( BOOLEAN eof_ok)
if ((p = QLI_line->line_ptr) != QLI_line->line_data if ((p = QLI_line->line_ptr) != QLI_line->line_data
&& p[-1] == '\n' && *p) && p[-1] == '\n' && *p)
flag = TRUE; flag = true;
else { else {
// Initialize line block for retrieval // Initialize line block for retrieval
p = QLI_line->line_data; p = QLI_line->line_data;
QLI_line->line_ptr = QLI_line->line_data; QLI_line->line_ptr = QLI_line->line_data;
flag = flag = PRO_get_line(QLI_line->line_source, p,
PRO_get_line(QLI_line->line_source, p,
QLI_line->line_size); QLI_line->line_size);
if (flag && QLI_echo) if (flag && QLI_echo)
ib_printf("%s", QLI_line->line_data); ib_printf("%s", QLI_line->line_data);
@ -1075,8 +1080,7 @@ static void next_line( BOOLEAN eof_ok)
if (QLI_line->line_type == line_stdin) if (QLI_line->line_type == line_stdin)
flag = LEX_get_line(QLI_prompt, p, (int) QLI_line->line_size); flag = LEX_get_line(QLI_prompt, p, (int) QLI_line->line_size);
else if (QLI_line->line_type == line_file) { else if (QLI_line->line_type == line_file) {
flag = flag = get_line((FILE*) QLI_line->line_source, p, QLI_line->line_size);
get_line((FILE*) QLI_line->line_source, p, QLI_line->line_size);
if (QLI_echo) if (QLI_echo)
ib_printf("%s", QLI_line->line_data); ib_printf("%s", QLI_line->line_data);
} }
@ -1087,7 +1091,7 @@ static void next_line( BOOLEAN eof_ok)
*q++ = *p++; *q++ = *p++;
*q = 0; *q = 0;
QLI_line->line_ptr = (TEXT *) p; QLI_line->line_ptr = (TEXT *) p;
LEX_push_file(filename, TRUE); LEX_push_file(filename, true);
continue; continue;
} }
} }
@ -1168,7 +1172,8 @@ static void retchar( SSHORT c)
} }
static BOOLEAN scan_number( SSHORT c, TEXT ** ptr) static bool scan_number(SSHORT c,
TEXT ** ptr)
{ {
/************************************** /**************************************
* *
@ -1181,30 +1186,29 @@ static BOOLEAN scan_number( SSHORT c, TEXT ** ptr)
* *
**************************************/ **************************************/
TEXT *p; TEXT *p;
SSHORT dot; bool dot = false;
p = *ptr; p = *ptr;
dot = FALSE;
/* If this is a leading decimal point, check that the next /* If this is a leading decimal point, check that the next
character is really a digit, otherwise backout */ character is really a digit, otherwise backout */
if (c == '.') { if (c == '.') {
retchar(c = nextchar(TRUE)); retchar(c = nextchar(true));
if (!(classes[c] & CHR_digit)) if (!(classes[c] & CHR_digit))
return FALSE; return false;
dot = TRUE; dot = true;
} }
// Gobble up digits up to a single decimal point // Gobble up digits up to a single decimal point
for (;;) { for (;;) {
c = nextchar(TRUE); c = nextchar(true);
if (classes[c] & CHR_digit) if (classes[c] & CHR_digit)
*p++ = c; *p++ = c;
else if (!dot && c == '.') { else if (!dot && c == '.') {
*p++ = c; *p++ = c;
dot = TRUE; dot = true;
} }
else else
break; break;
@ -1214,21 +1218,21 @@ static BOOLEAN scan_number( SSHORT c, TEXT ** ptr)
if (UPPER(c) == 'E') { if (UPPER(c) == 'E') {
*p++ = c; *p++ = c;
c = nextchar(TRUE); c = nextchar(true);
if (c == '+' || c == '-') { if (c == '+' || c == '-') {
*p++ = c; *p++ = c;
c = nextchar(TRUE); c = nextchar(true);
} }
while (classes[c] & CHR_digit) { while (classes[c] & CHR_digit) {
*p++ = c; *p++ = c;
c = nextchar(TRUE); c = nextchar(true);
} }
} }
retchar(c); retchar(c);
*ptr = p; *ptr = p;
return TRUE; return true;
} }
@ -1246,18 +1250,18 @@ static int skip_white(void)
**************************************/ **************************************/
SSHORT c, next, class_; SSHORT c, next, class_;
while (TRUE) { while (true) {
c = nextchar(TRUE); c = nextchar(true);
class_ = classes[c]; class_ = classes[c];
if (class_ & CHR_white) if (class_ & CHR_white)
continue; continue;
if (c == '/') { if (c == '/') {
if ((next = nextchar(TRUE)) != '*') { if ((next = nextchar(true)) != '*') {
retchar(next); retchar(next);
return c; return c;
} }
c = nextchar(FALSE); c = nextchar(false);
while ((next = nextchar(FALSE)) && !(c == '*' && next == '/')) while ((next = nextchar(false)) && !(c == '*' && next == '/'))
c = next; c = next;
continue; continue;
} }

View File

@ -24,19 +24,19 @@
#ifndef _QLI_LEX_PROTO_H_ #ifndef _QLI_LEX_PROTO_H_
#define _QLI_LEX_PROTO_H_ #define _QLI_LEX_PROTO_H_
extern int LEX_active_procedure (void); extern bool LEX_active_procedure (void);
extern void LEX_edit (SLONG, SLONG); extern void LEX_edit (SLONG, SLONG);
extern struct tok *LEX_edit_string (void); extern struct tok *LEX_edit_string (void);
extern struct tok *LEX_filename (void); extern struct tok *LEX_filename (void);
extern void LEX_fini (void); extern void LEX_fini (void);
extern void LEX_flush (void); extern void LEX_flush (void);
extern int LEX_get_line (TEXT *, TEXT *, int); extern bool LEX_get_line (TEXT *, TEXT *, int);
extern void LEX_init (void); extern void LEX_init (void);
extern void LEX_mark_statement (void); extern void LEX_mark_statement (void);
extern void LEX_pop_line (void); extern void LEX_pop_line (void);
extern void LEX_procedure (struct dbb *, FRBRD *); extern void LEX_procedure (struct dbb *, FRBRD *);
extern int LEX_push_file (TEXT *, int); extern bool LEX_push_file (TEXT *, bool);
extern int LEX_push_string (TEXT *); extern bool LEX_push_string (TEXT *);
extern void LEX_put_procedure (FRBRD *, SLONG, SLONG); extern void LEX_put_procedure (FRBRD *, SLONG, SLONG);
extern void LEX_real (void); extern void LEX_real (void);
extern struct lls *LEX_statement_list (void); extern struct lls *LEX_statement_list (void);

View File

@ -61,14 +61,14 @@ static void add_field(QLI_REL, QLI_FLD, USHORT);
static void add_sql_field(QLI_REL, QLI_FLD, USHORT, RLB); static void add_sql_field(QLI_REL, QLI_FLD, USHORT, RLB);
static int blob_copy(RLB, QLI_REL, SLONG *); static int blob_copy(RLB, QLI_REL, SLONG *);
static void change_field(QLI_REL, QLI_FLD); static void change_field(QLI_REL, QLI_FLD);
static int check_global_field(DBB, QLI_FLD, TEXT *); static bool check_global_field(DBB, QLI_FLD, TEXT *);
static int check_relation(QLI_REL); static bool check_relation(QLI_REL);
static int clone_fields(QLI_REL, QLI_REL); static int clone_fields(QLI_REL, QLI_REL);
static int clone_global_fields(QLI_REL, QLI_REL); static int clone_global_fields(QLI_REL, QLI_REL);
static void define_global_field(DBB, QLI_FLD, SYM); static void define_global_field(DBB, QLI_FLD, SYM);
static void delete_fields(QLI_REL); static void delete_fields(QLI_REL);
static ISC_STATUS detach(ISC_STATUS *, DBB); static ISC_STATUS detach(ISC_STATUS *, DBB);
static int execute_dynamic_ddl(DBB, RLB); static void execute_dynamic_ddl(DBB, RLB);
static int field_length(USHORT, USHORT); static int field_length(USHORT, USHORT);
static void get_database_type(DBB); static void get_database_type(DBB);
static void get_log_names(DBB, SCHAR *, LLS *, SCHAR *, SLONG, SSHORT, static void get_log_names(DBB, SCHAR *, LLS *, SCHAR *, SLONG, SSHORT,
@ -1766,7 +1766,7 @@ static void add_field( QLI_REL relation, QLI_FLD field, USHORT position)
**************************************/ **************************************/
DBB database; DBB database;
SYM relation_name, field_name, symbol, global_field; SYM relation_name, field_name, symbol, global_field;
USHORT global_flag; bool global_flag;
database = relation->rel_database; database = relation->rel_database;
relation_name = relation->rel_symbol; relation_name = relation->rel_symbol;
@ -1790,9 +1790,9 @@ static void add_field( QLI_REL relation, QLI_FLD field, USHORT position)
/* Check global field. Define it if it doesn't exist. */ /* Check global field. Define it if it doesn't exist. */
global_flag = FALSE; global_flag = false;
if (!check_global_field(database, field, global_field->sym_string)) { if (!check_global_field(database, field, global_field->sym_string)) {
global_flag = TRUE; global_flag = true;
define_global_field(database, field, global_field); define_global_field(database, field, global_field);
} }
@ -2052,7 +2052,9 @@ static void change_field( QLI_REL relation, QLI_FLD field)
} }
static int check_global_field( DBB database, QLI_FLD field, TEXT * name) static bool check_global_field(DBB database,
QLI_FLD field,
TEXT * name)
{ {
/************************************** /**************************************
* *
@ -2067,11 +2069,9 @@ static int check_global_field( DBB database, QLI_FLD field, TEXT * name)
* If it is not fully defined, flesh it out from the global. * If it is not fully defined, flesh it out from the global.
* *
**************************************/ **************************************/
BOOLEAN previously_defined; bool previously_defined = false;
SLONG *blob; SLONG *blob;
previously_defined = FALSE;
FOR(REQUEST_HANDLE database->dbb_requests[REQ_field_def]) FOR(REQUEST_HANDLE database->dbb_requests[REQ_field_def])
X IN DB.RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name X IN DB.RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name
@ -2116,7 +2116,7 @@ static int check_global_field( DBB database, QLI_FLD field, TEXT * name)
} }
} }
} }
previously_defined = TRUE; previously_defined = true;
END_FOR END_FOR
ON_ERROR ON_ERROR
ERRQ_database_error(database, gds_status); ERRQ_database_error(database, gds_status);
@ -2126,7 +2126,7 @@ static int check_global_field( DBB database, QLI_FLD field, TEXT * name)
} }
static int check_relation( QLI_REL relation) static bool check_relation( QLI_REL relation)
{ {
/************************************** /**************************************
* *
@ -2138,18 +2138,16 @@ static int check_relation( QLI_REL relation)
* Check the existence of the named relation. * Check the existence of the named relation.
* *
**************************************/ **************************************/
BOOLEAN previously_defined; bool previously_defined = false;
FRBRD *spare; FRBRD *spare;
previously_defined = FALSE;
spare = DB; spare = DB;
DB = relation->rel_database->dbb_handle; DB = relation->rel_database->dbb_handle;
FOR(REQUEST_HANDLE relation->rel_database->dbb_requests[REQ_relation_def] FOR(REQUEST_HANDLE relation->rel_database->dbb_requests[REQ_relation_def]
TRANSACTION_HANDLE relation->rel_database->dbb_meta_trans) TRANSACTION_HANDLE relation->rel_database->dbb_meta_trans)
X IN DB.RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ relation->rel_symbol->sym_string X IN DB.RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ relation->rel_symbol->sym_string
previously_defined = TRUE; previously_defined = true;
END_FOR END_FOR
ON_ERROR ON_ERROR
ERRQ_database_error(relation->rel_database, gds_status); ERRQ_database_error(relation->rel_database, gds_status);
@ -2658,7 +2656,8 @@ static void delete_fields( QLI_REL relation)
} }
static ISC_STATUS detach( ISC_STATUS * status_vector, DBB dbb) static ISC_STATUS detach(ISC_STATUS * status_vector,
DBB dbb)
{ {
/************************************** /**************************************
* *
@ -2675,7 +2674,7 @@ static ISC_STATUS detach( ISC_STATUS * status_vector, DBB dbb)
ISC_STATUS_ARRAY alt_vector; ISC_STATUS_ARRAY alt_vector;
if (!dbb->dbb_handle) if (!dbb->dbb_handle)
return FB_SUCCESS; return NULL;
status = status_vector; status = status_vector;
@ -2697,7 +2696,7 @@ static ISC_STATUS detach( ISC_STATUS * status_vector, DBB dbb)
} }
static int execute_dynamic_ddl( DBB database, RLB rlb) static void execute_dynamic_ddl( DBB database, RLB rlb)
{ {
/************************************** /**************************************
* *
@ -2724,7 +2723,6 @@ static int execute_dynamic_ddl( DBB database, RLB rlb)
RELEASE_RLB; RELEASE_RLB;
return FB_SUCCESS;
} }
@ -2832,8 +2830,9 @@ static void get_log_names(
**************************************/ **************************************/
SCHAR next_log[512]; SCHAR next_log[512];
SCHAR *cl, *nl; SCHAR *cl, *nl;
int log_count, ret_val; int log_count;
SSHORT not_archived; int ret_val;
bool not_archived;
SLONG last_log_flag, next_offset; SLONG last_log_flag, next_offset;
SLONG log_seqno, log_length; SLONG log_seqno, log_length;
SSHORT loop; SSHORT loop;
@ -2843,12 +2842,14 @@ static void get_log_names(
// loop up to 10 times to allow the file to be archived // loop up to 10 times to allow the file to be archived
while (TRUE) { while (true) {
loop++; loop++;
if (WALF_get_linked_logs_info if (!WALF_get_linked_logs_info
(gds_status, db_name, cur_log, part_offset, &log_count, next_log, (gds_status, db_name, cur_log, part_offset, &log_count, next_log,
&next_offset, &last_log_flag, &not_archived) != FB_SUCCESS) &next_offset, &last_log_flag, &not_archived))
{
ERRQ_database_error(dbb, gds_status); ERRQ_database_error(dbb, gds_status);
}
if ((!not_archived) || force) if ((!not_archived) || force)
break; break;

View File

@ -1374,7 +1374,7 @@ static void string_to_date( TEXT * string, USHORT length, SLONG date[2])
} }
*t = 0; *t = 0;
month_ptr = months; month_ptr = months;
while (TRUE) { while (true) {
if (!*month_ptr) { if (!*month_ptr) {
while (++p < end) while (++p < end)
if (*p != ' ' && *p != '\t' && *p != 0) if (*p != ' ' && *p != '\t' && *p != 0)

View File

@ -733,7 +733,7 @@ static SYN parse_add( USHORT * paren_count, USHORT * bool_flag)
node = parse_multiply(paren_count, bool_flag); node = parse_multiply(paren_count, bool_flag);
while (TRUE) { while (true) {
if (MATCH(KW_PLUS)) if (MATCH(KW_PLUS))
operatr = nod_add; operatr = nod_add;
else if (MATCH(KW_MINUS)) else if (MATCH(KW_MINUS))
@ -1158,7 +1158,7 @@ static SYN parse_def_index(void)
PAR_real(); PAR_real();
while (TRUE) { while (true) {
PAR_real(); PAR_real();
if (MATCH(KW_UNIQUE)) if (MATCH(KW_UNIQUE))
node->syn_flags |= s_dfi_flag_unique; node->syn_flags |= s_dfi_flag_unique;
@ -1763,7 +1763,7 @@ static SYN parse_field_name( SYN * fld_ptr)
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
if (MATCH(KW_ASTERISK)) { if (MATCH(KW_ASTERISK)) {
if (!stack) if (!stack)
SYNTAX_ERROR(181); // Msg181 field name or asterisk expression SYNTAX_ERROR(181); // Msg181 field name or asterisk expression
@ -1940,7 +1940,7 @@ static TEXT *parse_header(void)
p = header; p = header;
while (TRUE) { while (true) {
PAR_real(); PAR_real();
if ((QLI_token->tok_keyword != KW_MINUS) && if ((QLI_token->tok_keyword != KW_MINUS) &&
(QLI_token->tok_type != tok_quoted)) SYNTAX_ERROR(184); // Msg184 quoted header segment (QLI_token->tok_type != tok_quoted)) SYNTAX_ERROR(184); // Msg184 quoted header segment
@ -2111,7 +2111,7 @@ static SYN parse_insert(void)
PAR_real(); PAR_real();
if (MATCH(KW_LEFT_PAREN)) if (MATCH(KW_LEFT_PAREN))
while (TRUE) { while (true) {
LLS_PUSH(parse_field_name(0), &fields); LLS_PUSH(parse_field_name(0), &fields);
if (MATCH(KW_RIGHT_PAREN)) if (MATCH(KW_RIGHT_PAREN))
break; break;
@ -2134,7 +2134,7 @@ static SYN parse_insert(void)
SYNTAX_ERROR(188); // Msg188 VALUES list or SELECT clause SYNTAX_ERROR(188); // Msg188 VALUES list or SELECT clause
while (TRUE) { while (true) {
if (distinct || MATCH(KW_DISTINCT)) { if (distinct || MATCH(KW_DISTINCT)) {
LLS_PUSH(parse_value(0, 0), &distinct); LLS_PUSH(parse_value(0, 0), &distinct);
LLS_PUSH(distinct->lls_object, &values); LLS_PUSH(distinct->lls_object, &values);
@ -2453,7 +2453,7 @@ static SYN parse_modify(void)
node->syn_arg[s_mod_statement] = parse_statement(); node->syn_arg[s_mod_statement] = parse_statement();
else if (!KEYWORD(KW_SEMI)) { else if (!KEYWORD(KW_SEMI)) {
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
LLS_PUSH(parse_field_name(0), &stack); LLS_PUSH(parse_field_name(0), &stack);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
@ -2487,7 +2487,7 @@ static SYN parse_modify_index(void)
node->syn_arg[s_mfi_name] = (SYN) parse_name(); node->syn_arg[s_mfi_name] = (SYN) parse_name();
PAR_real(); PAR_real();
while (TRUE) { while (true) {
if (MATCH(KW_UNIQUE)) if (MATCH(KW_UNIQUE))
node->syn_flags |= (s_dfi_flag_selectivity | s_dfi_flag_unique); node->syn_flags |= (s_dfi_flag_selectivity | s_dfi_flag_unique);
else if (MATCH(KW_DUPLICATE)) { else if (MATCH(KW_DUPLICATE)) {
@ -2596,7 +2596,7 @@ static SYN parse_multiply( USHORT * paren_count, USHORT * bool_flag)
node = parse_from(paren_count, bool_flag); node = parse_from(paren_count, bool_flag);
while (TRUE) { while (true) {
if (MATCH(KW_ASTERISK)) if (MATCH(KW_ASTERISK))
operatr = nod_multiply; operatr = nod_multiply;
else if (MATCH(KW_SLASH)) else if (MATCH(KW_SLASH))
@ -2891,7 +2891,7 @@ static SYN parse_print_list(void)
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
if (MATCH(KW_SKIP)) if (MATCH(KW_SKIP))
op = nod_skip; op = nod_skip;
else if (MATCH(KW_SPACE)) else if (MATCH(KW_SPACE))
@ -3178,7 +3178,7 @@ static SYN parse_ready( NOD_T node_type)
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
LEX_filename(); LEX_filename();
if (!(l = QLI_token->tok_length)) if (!(l = QLI_token->tok_length))
ERRQ_error(204, NULL, NULL, NULL, NULL, NULL); // Msg204 database file name required on READY ERRQ_error(204, NULL, NULL, NULL, NULL, NULL); // Msg204 database file name required on READY
@ -3724,13 +3724,13 @@ static SYN parse_rse(void)
if (MATCH(KW_FIRST)) if (MATCH(KW_FIRST))
first = parse_value(0, 0); first = parse_value(0, 0);
while (TRUE) { while (true) {
count++; count++;
LLS_PUSH(parse_relation(), &stack); LLS_PUSH(parse_relation(), &stack);
over = NULL; over = NULL;
if (MATCH(KW_OVER)) { if (MATCH(KW_OVER)) {
field_stack = NULL; field_stack = NULL;
while (TRUE) { while (true) {
LLS_PUSH(parse_field_name(0), &field_stack); LLS_PUSH(parse_field_name(0), &field_stack);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
@ -3752,7 +3752,7 @@ static SYN parse_rse(void)
// Pick up various other clauses // Pick up various other clauses
while (TRUE) { while (true) {
if (MATCH(KW_WITH)) { if (MATCH(KW_WITH)) {
if (!sw_with) { if (!sw_with) {
sw_with++; sw_with++;
@ -3786,7 +3786,7 @@ static SYN parse_rse(void)
PAR_real(); PAR_real();
MATCH(KW_BY); MATCH(KW_BY);
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
LLS_PUSH(parse_udf_or_field(), &stack); LLS_PUSH(parse_udf_or_field(), &stack);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
@ -3827,7 +3827,7 @@ static SYN parse_select(void)
if (!MATCH(KW_ASTERISK)) { if (!MATCH(KW_ASTERISK)) {
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
item = SYNTAX_NODE(nod_print_item, s_itm_count); item = SYNTAX_NODE(nod_print_item, s_itm_count);
item->syn_arg[s_itm_value] = parse_value(0, 0); item->syn_arg[s_itm_value] = parse_value(0, 0);
LLS_PUSH(item, &stack); LLS_PUSH(item, &stack);
@ -3873,7 +3873,7 @@ static SYN parse_set(void)
stack = NULL; stack = NULL;
count = 0; count = 0;
while (TRUE) { while (true) {
PAR_real(); PAR_real();
value = TRUE; value = TRUE;
if (MATCH(KW_NO)) { if (MATCH(KW_NO)) {
@ -4063,7 +4063,7 @@ static SYN parse_show(void)
stack = NULL; stack = NULL;
count = 0; count = 0;
while (TRUE) { while (true) {
PAR_real(); PAR_real();
value = NULL; value = NULL;
symbol = QLI_token->tok_symbol; symbol = QLI_token->tok_symbol;
@ -4321,7 +4321,7 @@ static SYN parse_sort(void)
direction = sensitive = 0; direction = sensitive = 0;
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
PAR_real(); PAR_real();
if (!sql_flag) { if (!sql_flag) {
if (MATCH(KW_ASCENDING)) { if (MATCH(KW_ASCENDING)) {
@ -4441,7 +4441,7 @@ static SYN parse_sql_create(void)
if (KEYWORD(KW_UNIQUE) || KEYWORD(KW_ASCENDING) if (KEYWORD(KW_UNIQUE) || KEYWORD(KW_ASCENDING)
|| KEYWORD(KW_DESCENDING) || KEYWORD(KW_INDEX)) { || KEYWORD(KW_DESCENDING) || KEYWORD(KW_INDEX)) {
unique = descending = FALSE; unique = descending = FALSE;
while (TRUE) { while (true) {
if (MATCH(KW_UNIQUE)) if (MATCH(KW_UNIQUE))
unique = TRUE; unique = TRUE;
else if (MATCH(KW_ASCENDING)) else if (MATCH(KW_ASCENDING))
@ -4642,7 +4642,7 @@ static SYN parse_sql_grant_revoke( USHORT type)
privileges |= PRV_all; privileges |= PRV_all;
} }
else else
while (TRUE) { while (true) {
PAR_real(); PAR_real();
if (MATCH(KW_SELECT)) { if (MATCH(KW_SELECT)) {
privileges |= PRV_select; privileges |= PRV_select;
@ -4708,7 +4708,7 @@ static SYN parse_sql_grant_revoke( USHORT type)
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
PAR_real(); PAR_real();
LLS_PUSH(parse_name(), &stack); LLS_PUSH(parse_name(), &stack);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
@ -4999,7 +4999,7 @@ static SYN parse_sql_rse(void)
// Parse FROM list of relations // Parse FROM list of relations
while (TRUE) { while (true) {
count++; count++;
LLS_PUSH(parse_sql_joined_relation(0), &stack); LLS_PUSH(parse_sql_joined_relation(0), &stack);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
@ -5027,7 +5027,7 @@ static SYN parse_sql_rse(void)
PAR_real(); PAR_real();
MATCH(KW_BY); MATCH(KW_BY);
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
LLS_PUSH(parse_udf_or_field(), &stack); LLS_PUSH(parse_udf_or_field(), &stack);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
@ -5220,7 +5220,7 @@ static SYN parse_statement(void)
case KW_BEGIN: case KW_BEGIN:
stack = NULL; stack = NULL;
PAR_token(); PAR_token();
while (TRUE) { while (true) {
PAR_real(); PAR_real();
if (MATCH(KW_END)) if (MATCH(KW_END))
break; break;
@ -5447,7 +5447,7 @@ static SYN parse_transaction( NOD_T node_type)
PAR_token(); PAR_token();
if (!KEYWORD(KW_SEMI)) if (!KEYWORD(KW_SEMI))
while (TRUE) { while (true) {
for (symbol = QLI_token->tok_symbol; symbol; for (symbol = QLI_token->tok_symbol; symbol;
symbol = symbol->sym_homonym) symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_database) break; if (symbol->sym_type == SYM_database) break;
@ -5518,7 +5518,7 @@ static SYN parse_update(void)
stack = NULL; stack = NULL;
while (TRUE) { while (true) {
LLS_PUSH(parse_assignment(), &stack); LLS_PUSH(parse_assignment(), &stack);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
@ -5563,7 +5563,7 @@ static SYN parse_value( USHORT * paren_count, USHORT * bool_flag)
node = parse_add(paren_count, bool_flag); node = parse_add(paren_count, bool_flag);
while (TRUE) { while (true) {
if (!MATCH(KW_BAR)) { if (!MATCH(KW_BAR)) {
parse_terminating_parens(paren_count, &local_count); parse_terminating_parens(paren_count, &local_count);
return node; return node;

View File

@ -552,7 +552,8 @@ static void edit_date( DSC * desc, PICS picture, TEXT ** output)
DSC temp_desc; DSC temp_desc;
TEXT c, d, *p, *out, *month, *weekday, *year, *nmonth, *day, TEXT c, d, *p, *out, *month, *weekday, *year, *nmonth, *day,
*hours, temp[256], *meridian, *julians; *hours, temp[256], *meridian, *julians;
USHORT sig_day, blank; bool sig_day;
bool blank;
struct tm times; struct tm times;
temp_desc.dsc_dtype = dtype_timestamp; temp_desc.dsc_dtype = dtype_timestamp;
@ -607,8 +608,8 @@ static void edit_date( DSC * desc, PICS picture, TEXT ** output)
picture->pic_pointer = picture->pic_string; picture->pic_pointer = picture->pic_string;
picture->pic_count = 0; picture->pic_count = 0;
out = *output; out = *output;
sig_day = FALSE; sig_day = false;
blank = TRUE; blank = true;
for (;;) { for (;;) {
c = generate(picture); c = generate(picture);
@ -635,7 +636,7 @@ static void edit_date( DSC * desc, PICS picture, TEXT ** output)
if (!sig_day && d == '0' && blank) if (!sig_day && d == '0' && blank)
*out++ = ' '; *out++ = ' ';
else { else {
sig_day = TRUE; sig_day = true;
*out++ = d; *out++ = d;
} }
break; break;
@ -675,7 +676,7 @@ static void edit_date( DSC * desc, PICS picture, TEXT ** output)
break; break;
} }
if (c != 'B') if (c != 'B')
blank = FALSE; blank = false;
} }
*output = out; *output = out;
@ -696,27 +697,21 @@ static void edit_float( DSC * desc, PICS picture, TEXT ** output)
* *
**************************************/ **************************************/
TEXT c, d, e, *p, *out, temp[512]; TEXT c, d, e, *p, *out, temp[512];
BOOLEAN negative, is_signed; bool negative = false;
bool is_signed = false;
USHORT l, width, decimal_digits, w_digits, f_digits; USHORT l, width, decimal_digits, w_digits, f_digits;
double number; double number;
#ifdef VMS #ifdef VMS
BOOLEAN hack_for_vms_flag; bool hack_for_vms_flag = false;
#endif #endif
#ifdef WIN_NT #ifdef WIN_NT
BOOLEAN hack_for_nt_flag; bool hack_for_nt_flag = false;
#endif #endif
negative = is_signed = FALSE;
#ifdef VMS
hack_for_vms_flag = FALSE;
#endif
#ifdef WIN_NT
hack_for_nt_flag = FALSE;
#endif
number = MOVQ_get_double(desc); number = MOVQ_get_double(desc);
if (number < 0) { if (number < 0) {
negative = TRUE; negative = true;
number = -number; number = -number;
} }
@ -733,10 +728,10 @@ static void edit_float( DSC * desc, PICS picture, TEXT ** output)
sprintf(temp, "%*.*e", width, decimal_digits, number); sprintf(temp, "%*.*e", width, decimal_digits, number);
#ifdef VMS #ifdef VMS
if (!decimal_digits) if (!decimal_digits)
hack_for_vms_flag = TRUE; hack_for_vms_flag = true;
#endif #endif
#ifdef WIN_NT #ifdef WIN_NT
hack_for_nt_flag = TRUE; hack_for_nt_flag = true;
#endif #endif
} }
else if (number == 0) else if (number == 0)
@ -768,10 +763,10 @@ static void edit_float( DSC * desc, PICS picture, TEXT ** output)
sprintf(temp, "%.*e", decimal_digits, number); sprintf(temp, "%.*e", decimal_digits, number);
#ifdef VMS #ifdef VMS
if (!decimal_digits) if (!decimal_digits)
hack_for_vms_flag = TRUE; hack_for_vms_flag = true;
#endif #endif
#ifdef WIN_NT #ifdef WIN_NT
hack_for_nt_flag = TRUE; hack_for_nt_flag = true;
#endif #endif
} }
} }
@ -827,7 +822,7 @@ static void edit_float( DSC * desc, PICS picture, TEXT ** output)
*out++ = '-'; *out++ = '-';
else else
*out++ = ' '; *out++ = ' ';
is_signed = TRUE; is_signed = true;
} }
else if (*p) else if (*p)
*out++ = *p++; *out++ = *p++;
@ -880,7 +875,7 @@ static void edit_float( DSC * desc, PICS picture, TEXT ** output)
*out++ = '-'; *out++ = '-';
else else
*out++ = c; *out++ = c;
is_signed = TRUE; is_signed = true;
} }
else if (*p == '-' || c == '+') else if (*p == '-' || c == '+')
*out++ = *p++; *out++ = *p++;
@ -913,23 +908,33 @@ static void edit_numeric( DSC * desc, PICS picture, TEXT ** output)
* output pointer. * output pointer.
* *
**************************************/ **************************************/
TEXT c, d, float_char, temp[512], *p, *float_ptr, *out, *hex, *digits; TEXT c;
USHORT power, negative, signif, hex_overflow, overflow, l; TEXT d;
TEXT float_char;
TEXT temp[512];
TEXT *p;
TEXT *float_ptr = NULL;
TEXT *out;
TEXT *hex;
TEXT *digits;
bool negative = false;
bool signif = false;
bool hex_overflow = false;
bool overflow = false;
USHORT power, l;
SSHORT scale; SSHORT scale;
SLONG n; SLONG n;
double check, number; double check, number;
out = *output; out = *output;
float_ptr = NULL; float_ptr = NULL;
negative = signif = FALSE;
hex_overflow = overflow = FALSE;
number = MOVQ_get_double(desc); number = MOVQ_get_double(desc);
if (number < 0) { if (number < 0) {
number = -number; number = -number;
negative = TRUE; negative = true;
if (!(picture->pic_flags & PIC_signed)) if (!(picture->pic_flags & PIC_signed))
overflow = TRUE; overflow = true;
} }
if (scale = picture->pic_fractions) if (scale = picture->pic_fractions)
@ -948,7 +953,7 @@ static void edit_numeric( DSC * desc, PICS picture, TEXT ** output)
for (check = number, power = picture->pic_digits; power; --power) for (check = number, power = picture->pic_digits; power; --power)
check /= 10.; check /= 10.;
if (check >= 1) if (check >= 1)
overflow = TRUE; overflow = true;
else { else {
sprintf(digits, "%0*.0f", picture->pic_digits, number); sprintf(digits, "%0*.0f", picture->pic_digits, number);
p = digits + strlen(digits); p = digits + strlen(digits);
@ -962,7 +967,7 @@ static void edit_numeric( DSC * desc, PICS picture, TEXT ** output)
for (check = number, power = picture->pic_hex_digits; power; --power) for (check = number, power = picture->pic_hex_digits; power; --power)
check /= 16.; check /= 16.;
if (check >= 1) if (check >= 1)
hex_overflow = TRUE; hex_overflow = true;
else { else {
n = number; n = number;
while (p-- > hex) { while (p-- > hex) {
@ -989,7 +994,7 @@ static void edit_numeric( DSC * desc, PICS picture, TEXT ** output)
} }
switch (c) { switch (c) {
case '9': case '9':
signif = TRUE; signif = true;
*out++ = *digits++; *out++ = *digits++;
break; break;
@ -1003,7 +1008,7 @@ static void edit_numeric( DSC * desc, PICS picture, TEXT ** output)
d = (c == 'H') ? *hex++ : *digits++; d = (c == 'H') ? *hex++ : *digits++;
if (signif || d != '0') { if (signif || d != '0') {
*out++ = d; *out++ = d;
signif = TRUE; signif = true;
} }
else else
*out++ = (c == '*') ? '*' : ' '; *out++ = (c == '*') ? '*' : ' ';
@ -1025,7 +1030,7 @@ static void edit_numeric( DSC * desc, PICS picture, TEXT ** output)
d = *digits++; d = *digits++;
if (signif || d != '0') { if (signif || d != '0') {
*out++ = d; *out++ = d;
signif = TRUE; signif = true;
break; break;
} }
*float_ptr = ' '; *float_ptr = ' ';
@ -1052,7 +1057,7 @@ static void edit_numeric( DSC * desc, PICS picture, TEXT ** output)
break; break;
case '.': case '.':
signif = TRUE; signif = true;
*out++ = c; *out++ = c;
break; break;

View File

@ -97,10 +97,12 @@ void PRO_commit( DBB database)
if ((database->dbb_capabilities & DBB_cap_multi_trans) && if ((database->dbb_capabilities & DBB_cap_multi_trans) &&
!(LEX_active_procedure())) !(LEX_active_procedure()))
{
if (gds__commit_transaction(status_vector, &database->dbb_proc_trans)) { if (gds__commit_transaction(status_vector, &database->dbb_proc_trans)) {
PRO_rollback(database); PRO_rollback(database);
ERRQ_database_error(database, status_vector); ERRQ_database_error(database, status_vector);
} }
}
} }
@ -350,7 +352,9 @@ FRBRD *PRO_fetch_procedure( DBB database, TEXT * proc)
} }
int PRO_get_line( FRBRD *blob, TEXT * buffer, USHORT size) bool PRO_get_line(FRBRD *blob,
TEXT * buffer,
USHORT size)
{ {
/************************************** /**************************************
* *
@ -371,7 +375,7 @@ int PRO_get_line( FRBRD *blob, TEXT * buffer, USHORT size)
&blob, &length, size, buffer); &blob, &length, size, buffer);
if (status_vector[1] && status_vector[1] != gds_segment) if (status_vector[1] && status_vector[1] != gds_segment)
return FALSE; return false;
p = buffer + length; p = buffer + length;
@ -380,7 +384,7 @@ int PRO_get_line( FRBRD *blob, TEXT * buffer, USHORT size)
*p = 0; *p = 0;
return TRUE; return true;
} }
@ -865,7 +869,7 @@ static int upcase_name( TEXT * name, TEXT * buffer)
l = 0; l = 0;
while (TRUE) { while (true) {
c = *name++; c = *name++;
*buffer++ = UPPER(c); *buffer++ = UPPER(c);
if (!c) if (!c)

View File

@ -31,7 +31,7 @@ extern void PRO_create (struct dbb *, TEXT *);
extern int PRO_delete_procedure (struct dbb *, TEXT *); extern int PRO_delete_procedure (struct dbb *, TEXT *);
extern void PRO_edit_procedure (struct dbb *, TEXT *); extern void PRO_edit_procedure (struct dbb *, TEXT *);
extern FRBRD *PRO_fetch_procedure (struct dbb *, TEXT *); extern FRBRD *PRO_fetch_procedure (struct dbb *, TEXT *);
extern int PRO_get_line (FRBRD *, TEXT *, USHORT); extern bool PRO_get_line (FRBRD *, TEXT *, USHORT);
extern void PRO_invoke (struct dbb *, TEXT *); extern void PRO_invoke (struct dbb *, TEXT *);
extern FRBRD *PRO_open_blob (struct dbb *, SLONG *); extern FRBRD *PRO_open_blob (struct dbb *, SLONG *);
extern int PRO_rename_procedure (struct dbb *, TEXT *, TEXT *); extern int PRO_rename_procedure (struct dbb *, TEXT *, TEXT *);

View File

@ -37,9 +37,9 @@
static void bottom_break(BRK, PRT); static void bottom_break(BRK, PRT);
static void increment_break(BRK); static void increment_break(BRK);
static void initialize_break(BRK); static void initialize_break(BRK);
static int test_break(BRK, RPT, QLI_MSG); static bool test_break(BRK, RPT, QLI_MSG);
static void top_break(BRK, PRT); static void top_break(BRK, PRT);
static void top_of_page(PRT, BOOLEAN); static void top_of_page(PRT, bool);
#define SWAP(a,b) {temp = a; a = b; b = temp;} #define SWAP(a,b) {temp = a; a = b; b = temp;}
@ -110,7 +110,7 @@ void RPT_report( QLI_NOD loop)
if (control = report->rpt_top_rpt) if (control = report->rpt_top_rpt)
FMT_print((QLI_NOD) control->brk_line, print); FMT_print((QLI_NOD) control->brk_line, print);
top_of_page(print, TRUE); top_of_page(print, true);
initialize_break(report->rpt_bottom_breaks); initialize_break(report->rpt_bottom_breaks);
initialize_break(report->rpt_bottom_page); initialize_break(report->rpt_bottom_page);
@ -126,6 +126,7 @@ void RPT_report( QLI_NOD loop)
for (control = report->rpt_bottom_breaks; control; for (control = report->rpt_bottom_breaks; control;
control = control->brk_next) control = control->brk_next)
{
if (test_break(control, report, message)) { if (test_break(control, report, message)) {
SWAP(message->msg_buffer, report->rpt_buffer); SWAP(message->msg_buffer, report->rpt_buffer);
bottom_break(control, print); bottom_break(control, print);
@ -133,18 +134,21 @@ void RPT_report( QLI_NOD loop)
initialize_break(control); initialize_break(control);
break; break;
} }
}
if (print->prt_lines_remaining <= 0) if (print->prt_lines_remaining <= 0)
top_of_page(print, FALSE); top_of_page(print, false);
/* Now check for top breaks. */ /* Now check for top breaks. */
for (control = report->rpt_top_breaks; control; for (control = report->rpt_top_breaks; control;
control = control->brk_next) control = control->brk_next)
{
if (test_break(control, report, message)) { if (test_break(control, report, message)) {
top_break(control, print); top_break(control, print);
break; break;
} }
}
/* Increment statisticals and print detail line, if any */ /* Increment statisticals and print detail line, if any */
@ -241,7 +245,9 @@ static void initialize_break( BRK control)
} }
static int test_break( BRK control, RPT report, QLI_MSG message) static bool test_break(BRK control,
RPT report,
QLI_MSG message)
{ {
/************************************** /**************************************
* *
@ -288,10 +294,10 @@ static int test_break( BRK control, RPT report, QLI_MSG message)
if (l) if (l)
do do
if (*p1++ != *p2++) if (*p1++ != *p2++)
return TRUE; return true;
while (--l); while (--l);
return FALSE; return false;
} }
@ -317,7 +323,8 @@ static void top_break( BRK control, PRT print)
} }
static void top_of_page( PRT print, BOOLEAN first_flag) static void top_of_page(PRT print,
bool first_flag)
{ {
/************************************** /**************************************
* *

View File

@ -235,22 +235,22 @@ int UTIL_gsec(int argc,
tdsec->tsec_env = &env; tdsec->tsec_env = &env;
tdsec->tsec_output_proc = output_proc; tdsec->tsec_output_proc = output_proc;
tdsec->tsec_output_data = output_data; tdsec->tsec_output_data = output_data;
tdsec->tsec_interactive = TRUE; tdsec->tsec_interactive = true;
tdsec->tsec_service_gsec = FALSE; tdsec->tsec_service_gsec = false;
tdsec->tsec_service_thd = FALSE; tdsec->tsec_service_thd = false;
tdsec->tsec_service_blk = NULL; tdsec->tsec_service_blk = NULL;
tdsec->tsec_status = tdsec->tsec_status_vector; tdsec->tsec_status = tdsec->tsec_status_vector;
user_data = tdsec->tsec_user_data; user_data = tdsec->tsec_user_data;
if (argc > 1 && !strcmp(argv[1], "-svc")) { if (argc > 1 && !strcmp(argv[1], "-svc")) {
tdsec->tsec_service_gsec = TRUE; tdsec->tsec_service_gsec = true;
argv++; argv++;
argc--; argc--;
} }
#ifdef SUPERSERVER #ifdef SUPERSERVER
else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) { else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) {
tdsec->tsec_service_gsec = TRUE; tdsec->tsec_service_gsec = true;
tdsec->tsec_service_thd = TRUE; tdsec->tsec_service_thd = true;
tdsec->tsec_service_blk = (SVC) output_data; tdsec->tsec_service_blk = (SVC) output_data;
tdsec->tsec_status = tdsec->tsec_service_blk->svc_status; tdsec->tsec_status = tdsec->tsec_service_blk->svc_status;
argv++; argv++;
@ -258,7 +258,7 @@ int UTIL_gsec(int argc,
} }
#endif #endif
else if (argc > 4 && !strcmp(argv[1], "-svc_re")) { else if (argc > 4 && !strcmp(argv[1], "-svc_re")) {
tdsec->tsec_service_gsec = TRUE; tdsec->tsec_service_gsec = true;
redir_in = atol(argv[2]); redir_in = atol(argv[2]);
redir_out = atol(argv[3]); redir_out = atol(argv[3]);
redir_err = atol(argv[4]); redir_err = atol(argv[4]);
@ -579,7 +579,7 @@ static bool get_switches(
user_data = tdsec->tsec_user_data; user_data = tdsec->tsec_user_data;
*quitflag = false; *quitflag = false;
last_sw = IN_SW_GSEC_0; last_sw = IN_SW_GSEC_0;
tdsec->tsec_sw_version = FALSE; tdsec->tsec_sw_version = false;
for (--argc; argc > 0; argc--) { for (--argc; argc > 0; argc--) {
string = *++argv; string = *++argv;
if (*string == '?') if (*string == '?')
@ -605,7 +605,7 @@ static bool get_switches(
return false; return false;
} }
user_data->user_name[l] = '\0'; user_data->user_name[l] = '\0';
user_data->user_name_entered = TRUE; user_data->user_name_entered = true;
break; break;
case IN_SW_GSEC_PASSWORD: case IN_SW_GSEC_PASSWORD:
for (l = 0; l < 9 && string[l] && string[l] != ' '; l++) for (l = 0; l < 9 && string[l] && string[l] != ' '; l++)
@ -615,51 +615,51 @@ static bool get_switches(
/* warning password maximum 8 significant bytes used */ /* warning password maximum 8 significant bytes used */
} }
user_data->password[l] = '\0'; user_data->password[l] = '\0';
user_data->password_entered = TRUE; user_data->password_entered = true;
break; break;
case IN_SW_GSEC_UID: case IN_SW_GSEC_UID:
user_data->uid = atoi(string); user_data->uid = atoi(string);
user_data->uid_entered = TRUE; user_data->uid_entered = true;
break; break;
case IN_SW_GSEC_GID: case IN_SW_GSEC_GID:
user_data->gid = atoi(string); user_data->gid = atoi(string);
user_data->gid_entered = TRUE; user_data->gid_entered = true;
break; break;
case IN_SW_GSEC_SYSU: case IN_SW_GSEC_SYSU:
strncpy(user_data->sys_user_name, string, 128); strncpy(user_data->sys_user_name, string, 128);
user_data->sys_user_entered = TRUE; user_data->sys_user_entered = true;
break; break;
case IN_SW_GSEC_GROUP: case IN_SW_GSEC_GROUP:
strncpy(user_data->group_name, string, 128); strncpy(user_data->group_name, string, 128);
user_data->group_name_entered = TRUE; user_data->group_name_entered = true;
break; break;
case IN_SW_GSEC_FNAME: case IN_SW_GSEC_FNAME:
strncpy(user_data->first_name, string, 17); strncpy(user_data->first_name, string, 17);
user_data->first_name_entered = TRUE; user_data->first_name_entered = true;
break; break;
case IN_SW_GSEC_MNAME: case IN_SW_GSEC_MNAME:
strncpy(user_data->middle_name, string, 17); strncpy(user_data->middle_name, string, 17);
user_data->middle_name_entered = TRUE; user_data->middle_name_entered = true;
break; break;
case IN_SW_GSEC_LNAME: case IN_SW_GSEC_LNAME:
strncpy(user_data->last_name, string, 17); strncpy(user_data->last_name, string, 17);
user_data->last_name_entered = TRUE; user_data->last_name_entered = true;
break; break;
case IN_SW_GSEC_DATABASE: case IN_SW_GSEC_DATABASE:
strncpy(user_data->database_name, string, 512); strncpy(user_data->database_name, string, 512);
user_data->database_entered = TRUE; user_data->database_entered = true;
break; break;
case IN_SW_GSEC_DBA_USER_NAME: case IN_SW_GSEC_DBA_USER_NAME:
strncpy(user_data->dba_user_name, string, 133); strncpy(user_data->dba_user_name, string, 133);
user_data->dba_user_name_entered = TRUE; user_data->dba_user_name_entered = true;
break; break;
case IN_SW_GSEC_DBA_PASSWORD: case IN_SW_GSEC_DBA_PASSWORD:
strncpy(user_data->dba_password, string, 33); strncpy(user_data->dba_password, string, 33);
user_data->dba_password_entered = TRUE; user_data->dba_password_entered = true;
break; break;
case IN_SW_GSEC_SQL_ROLE_NAME: case IN_SW_GSEC_SQL_ROLE_NAME:
strncpy(user_data->sql_role_name, string, 33); strncpy(user_data->sql_role_name, string, 33);
user_data->sql_role_name_entered = TRUE; user_data->sql_role_name_entered = true;
break; break;
case IN_SW_GSEC_Z: case IN_SW_GSEC_Z:
case IN_SW_GSEC_0: case IN_SW_GSEC_0:
@ -747,7 +747,7 @@ static bool get_switches(
break; break;
} }
user_data->user_name[0] = '\0'; user_data->user_name[0] = '\0';
tdsec->tsec_interactive = FALSE; tdsec->tsec_interactive = false;
break; break;
case IN_SW_GSEC_PASSWORD: case IN_SW_GSEC_PASSWORD:
case IN_SW_GSEC_UID: case IN_SW_GSEC_UID:
@ -768,7 +768,7 @@ static bool get_switches(
err_msg_no = GsecMsg31; err_msg_no = GsecMsg31;
break; break;
} }
user_data->password_specified = TRUE; user_data->password_specified = true;
user_data->password[0] = '\0'; user_data->password[0] = '\0';
break; break;
case IN_SW_GSEC_UID: case IN_SW_GSEC_UID:
@ -776,7 +776,7 @@ static bool get_switches(
err_msg_no = GsecMsg32; err_msg_no = GsecMsg32;
break; break;
} }
user_data->uid_specified = TRUE; user_data->uid_specified = true;
user_data->uid = 0; user_data->uid = 0;
break; break;
case IN_SW_GSEC_GID: case IN_SW_GSEC_GID:
@ -784,7 +784,7 @@ static bool get_switches(
err_msg_no = GsecMsg33; err_msg_no = GsecMsg33;
break; break;
} }
user_data->gid_specified = TRUE; user_data->gid_specified = true;
user_data->gid = 0; user_data->gid = 0;
break; break;
case IN_SW_GSEC_SYSU: case IN_SW_GSEC_SYSU:
@ -792,7 +792,7 @@ static bool get_switches(
err_msg_no = GsecMsg34; err_msg_no = GsecMsg34;
break; break;
} }
user_data->sys_user_specified = TRUE; user_data->sys_user_specified = true;
user_data->sys_user_name[0] = '\0'; user_data->sys_user_name[0] = '\0';
break; break;
case IN_SW_GSEC_GROUP: case IN_SW_GSEC_GROUP:
@ -800,7 +800,7 @@ static bool get_switches(
err_msg_no = GsecMsg35; err_msg_no = GsecMsg35;
break; break;
} }
user_data->group_name_specified = TRUE; user_data->group_name_specified = true;
user_data->group_name[0] = '\0'; user_data->group_name[0] = '\0';
break; break;
case IN_SW_GSEC_FNAME: case IN_SW_GSEC_FNAME:
@ -808,7 +808,7 @@ static bool get_switches(
err_msg_no = GsecMsg36; err_msg_no = GsecMsg36;
break; break;
} }
user_data->first_name_specified = TRUE; user_data->first_name_specified = true;
user_data->first_name[0] = '\0'; user_data->first_name[0] = '\0';
break; break;
case IN_SW_GSEC_MNAME: case IN_SW_GSEC_MNAME:
@ -816,7 +816,7 @@ static bool get_switches(
err_msg_no = GsecMsg37; err_msg_no = GsecMsg37;
break; break;
} }
user_data->middle_name_specified = TRUE; user_data->middle_name_specified = true;
user_data->middle_name[0] = '\0'; user_data->middle_name[0] = '\0';
break; break;
case IN_SW_GSEC_LNAME: case IN_SW_GSEC_LNAME:
@ -824,7 +824,7 @@ static bool get_switches(
err_msg_no = GsecMsg38; err_msg_no = GsecMsg38;
break; break;
} }
user_data->last_name_specified = TRUE; user_data->last_name_specified = true;
user_data->last_name[0] = '\0'; user_data->last_name[0] = '\0';
break; break;
case IN_SW_GSEC_DATABASE: case IN_SW_GSEC_DATABASE:
@ -832,7 +832,7 @@ static bool get_switches(
err_msg_no = GsecMsg78; err_msg_no = GsecMsg78;
break; break;
} }
user_data->database_specified = TRUE; user_data->database_specified = true;
user_data->database_name[0] = '\0'; user_data->database_name[0] = '\0';
break; break;
case IN_SW_GSEC_DBA_USER_NAME: case IN_SW_GSEC_DBA_USER_NAME:
@ -840,7 +840,7 @@ static bool get_switches(
err_msg_no = GsecMsg79; err_msg_no = GsecMsg79;
break; break;
} }
user_data->dba_user_name_specified = TRUE; user_data->dba_user_name_specified = true;
user_data->dba_user_name[0] = '\0'; user_data->dba_user_name[0] = '\0';
break; break;
case IN_SW_GSEC_DBA_PASSWORD: case IN_SW_GSEC_DBA_PASSWORD:
@ -848,7 +848,7 @@ static bool get_switches(
err_msg_no = GsecMsg80; err_msg_no = GsecMsg80;
break; break;
} }
user_data->dba_password_specified = TRUE; user_data->dba_password_specified = true;
user_data->dba_password[0] = '\0'; user_data->dba_password[0] = '\0';
break; break;
case IN_SW_GSEC_SQL_ROLE_NAME: case IN_SW_GSEC_SQL_ROLE_NAME:
@ -856,7 +856,7 @@ static bool get_switches(
err_msg_no = GsecMsg81; err_msg_no = GsecMsg81;
break; break;
} }
user_data->sql_role_name_specified = TRUE; user_data->sql_role_name_specified = true;
user_data->sql_role_name[0] = '\0'; user_data->sql_role_name[0] = '\0';
break; break;
} }
@ -870,7 +870,7 @@ static bool get_switches(
SECURITY_msg_get(GsecMsg39, msg); SECURITY_msg_get(GsecMsg39, msg);
util_output("%s %s\n", msg, GDS_VERSION); util_output("%s %s\n", msg, GDS_VERSION);
} }
tdsec->tsec_sw_version = TRUE; tdsec->tsec_sw_version = true;
break; break;
case IN_SW_GSEC_0: case IN_SW_GSEC_0:
#ifdef SUPERSERVER #ifdef SUPERSERVER

View File

@ -86,43 +86,43 @@
typedef struct user_data { typedef struct user_data {
int operation; /* what's to be done */ int operation; /* what's to be done */
TEXT user_name [USER_NAME_LEN]; /* the user's name */ TEXT user_name [USER_NAME_LEN]; /* the user's name */
BOOLEAN user_name_entered; /* user name entered flag */ bool user_name_entered; /* user name entered flag */
int uid; /* the user's id */ int uid; /* the user's id */
BOOLEAN uid_entered; /* UID entered flag */ bool uid_entered; /* UID entered flag */
BOOLEAN uid_specified; /* UID specified flag */ bool uid_specified; /* UID specified flag */
int gid; /* the user's group id */ int gid; /* the user's group id */
BOOLEAN gid_entered; /* GID entered flag */ bool gid_entered; /* GID entered flag */
BOOLEAN gid_specified; /* GID specified flag */ bool gid_specified; /* GID specified flag */
TEXT sys_user_name [ALT_NAME_LEN]; /* the sys_user's name */ TEXT sys_user_name [ALT_NAME_LEN]; /* the sys_user's name */
BOOLEAN sys_user_entered; /* sys_user entered flag */ bool sys_user_entered; /* sys_user entered flag */
BOOLEAN sys_user_specified; /* sys_user specified flag */ bool sys_user_specified; /* sys_user specified flag */
TEXT group_name [ALT_NAME_LEN]; /* the group name */ TEXT group_name [ALT_NAME_LEN]; /* the group name */
BOOLEAN group_name_entered; /* group_name entered flag */ bool group_name_entered; /* group_name entered flag */
BOOLEAN group_name_specified; /* group_name specified flag */ bool group_name_specified; /* group_name specified flag */
TEXT password [NAME_LEN]; /* the user's password */ TEXT password [NAME_LEN]; /* the user's password */
BOOLEAN password_entered; /* password entered flag */ bool password_entered; /* password entered flag */
BOOLEAN password_specified; /* password specified flag */ bool password_specified; /* password specified flag */
TEXT first_name [NAME_LEN]; /* the user's first name */ TEXT first_name [NAME_LEN]; /* the user's first name */
BOOLEAN first_name_entered; /* first name entered flag */ bool first_name_entered; /* first name entered flag */
BOOLEAN first_name_specified; /* first name specified flag */ bool first_name_specified; /* first name specified flag */
TEXT middle_name [NAME_LEN]; /* the user's middle name */ TEXT middle_name [NAME_LEN]; /* the user's middle name */
BOOLEAN middle_name_entered; /* middle name entered flag */ bool middle_name_entered; /* middle name entered flag */
BOOLEAN middle_name_specified; /* middle name specified flag */ bool middle_name_specified; /* middle name specified flag */
TEXT last_name [NAME_LEN]; /* the user's last name */ TEXT last_name [NAME_LEN]; /* the user's last name */
BOOLEAN last_name_entered; /* last name entered flag */ bool last_name_entered; /* last name entered flag */
BOOLEAN last_name_specified; /* last name specified flag */ bool last_name_specified; /* last name specified flag */
TEXT dba_user_name [USER_NAME_LEN]; /* the user's name */ TEXT dba_user_name [USER_NAME_LEN]; /* the user's name */
BOOLEAN dba_user_name_entered; /* user name entered flag */ bool dba_user_name_entered; /* user name entered flag */
BOOLEAN dba_user_name_specified;/* database specified flag */ bool dba_user_name_specified;/* database specified flag */
TEXT dba_password [NAME_LEN]; /* the user's name */ TEXT dba_password [NAME_LEN]; /* the user's name */
BOOLEAN dba_password_entered; /* user name entered flag */ bool dba_password_entered; /* user name entered flag */
BOOLEAN dba_password_specified; /* database specified flag */ bool dba_password_specified; /* database specified flag */
TEXT sql_role_name [NAME_LEN]; /* the user's name */ TEXT sql_role_name [NAME_LEN]; /* the user's name */
BOOLEAN sql_role_name_entered; /* user name entered flag */ bool sql_role_name_entered; /* user name entered flag */
BOOLEAN sql_role_name_specified;/* database specified flag */ bool sql_role_name_specified;/* database specified flag */
TEXT database_name [512]; /* database pathname */ TEXT database_name [512]; /* database pathname */
BOOLEAN database_entered; /* database entered flag */ bool database_entered; /* database entered flag */
BOOLEAN database_specified; /* database specified flag */ bool database_specified; /* database specified flag */
} *USER_DATA; } *USER_DATA;
@ -133,10 +133,10 @@ typedef struct tsec {
jmp_buf* tsec_env; jmp_buf* tsec_env;
ISC_STATUS *tsec_status; ISC_STATUS *tsec_status;
ISC_STATUS_ARRAY tsec_status_vector; ISC_STATUS_ARRAY tsec_status_vector;
BOOLEAN tsec_interactive; bool tsec_interactive;
BOOLEAN tsec_sw_version; bool tsec_sw_version;
BOOLEAN tsec_service_gsec; bool tsec_service_gsec;
BOOLEAN tsec_service_thd; bool tsec_service_thd;
int(*tsec_output_proc)(SLONG, UCHAR*); int(*tsec_output_proc)(SLONG, UCHAR*);
SLONG tsec_output_data; SLONG tsec_output_data;
IB_FILE *tsec_output_file; IB_FILE *tsec_output_file;

View File

@ -120,7 +120,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
USHORT wal_buf_count; USHORT wal_buf_count;
USHORT wal_buflen; USHORT wal_buflen;
SLONG wal_ckpt_intrvl; SLONG wal_ckpt_intrvl;
SSHORT first_time_log; bool first_time_log;
SSHORT logcount; SSHORT logcount;
@ -148,7 +148,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
SCHAR last_logname[MAXPATHLEN]; SCHAR last_logname[MAXPATHLEN];
SLONG last_log_partition_offset; SLONG last_log_partition_offset;
SLONG last_log_flags; SLONG last_log_flags;
SSHORT any_log_to_be_archived; bool any_log_to_be_archived;
if (argc < 2) { if (argc < 2) {
ib_printf ib_printf
@ -164,11 +164,11 @@ int CLIB_ROUTINE main( int argc, char **argv)
wal_buflen = MIN_WALBUFLEN; wal_buflen = MIN_WALBUFLEN;
wal_ckpt_intrvl = 100; /* 100K bytes */ wal_ckpt_intrvl = 100; /* 100K bytes */
if (argc == 6) { if (argc == 6) {
first_time_log = TRUE; first_time_log = true;
sscanf(argv[5], "%ld", &new_log_seqno); sscanf(argv[5], "%ld", &new_log_seqno);
} }
else { else {
first_time_log = FALSE; first_time_log = false;
/* Set some default value for the log_seqno. If using an existing /* Set some default value for the log_seqno. If using an existing
log file, log_seqno will be set accordingly by the WAL writer */ log file, log_seqno will be set accordingly by the WAL writer */
new_log_seqno = 1L; new_log_seqno = 1L;
@ -313,8 +313,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
if (strcmp(buff, "Q") == 0) if (strcmp(buff, "Q") == 0)
break; break;
if (strcmp(buff, "F") == 0) { if (strcmp(buff, "F") == 0) {
WAL_flush(status_vector, WAL_handle, &log_seqno, &log_offset, WAL_flush(status_vector, WAL_handle, &log_seqno, &log_offset, false);
FALSE);
ib_printf("flushed_seqno=%ld, flushed_offset=%ld\n", log_seqno, ib_printf("flushed_seqno=%ld, flushed_offset=%ld\n", log_seqno,
log_offset); log_offset);
} }
@ -392,7 +391,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
ib_printf("Enter the partition offset: "); ib_printf("Enter the partition offset: ");
ib_scanf("%ld", &log_partition_offset); ib_scanf("%ld", &log_partition_offset);
ib_scanf("%c", &dbnum); /* get rid of the trailing '\n' character */ ib_scanf("%c", &dbnum); /* get rid of the trailing '\n' character */
any_log_to_be_archived = 0; any_log_to_be_archived = false;
WALF_get_linked_logs_info(status_vector, dbname, WALF_get_linked_logs_info(status_vector, dbname,
log_name, log_partition_offset, log_name, log_partition_offset,
&log_count, &log_count,
@ -419,7 +418,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
ib_scanf("%c", &dbnum); /* get rid of the trailing '\n' character */ ib_scanf("%c", &dbnum); /* get rid of the trailing '\n' character */
WALF_set_log_header_flag(status_vector, dbname, log_name, WALF_set_log_header_flag(status_vector, dbname, log_name,
log_partition_offset, log_flag, log_partition_offset, log_flag,
(set == 'S') ? TRUE : FALSE); (set == 'S'));
} }
else if (strcmp(buff, "J") == 0) { else if (strcmp(buff, "J") == 0) {
WAL_journal_enable(status_vector, WAL_handle, WAL_journal_enable(status_vector, WAL_handle,
@ -471,14 +470,13 @@ int CLIB_ROUTINE main( int argc, char **argv)
} }
} }
WAL_flush(status_vector, WAL_handle, &log_seqno, &log_offset, FALSE); WAL_flush(status_vector, WAL_handle, &log_seqno, &log_offset, false);
ib_printf("\nDo you want to shutdown the WAL writer(s) ? <y/n> "); ib_printf("\nDo you want to shutdown the WAL writer(s) ? <y/n> ");
ib_scanf("%c", &shutdown); ib_scanf("%c", &shutdown);
if (shutdown == 'y' || shutdown == 'Y') { if (shutdown == 'y' || shutdown == 'Y') {
WAL_shutdown(status_vector, WAL_handle, WAL_shutdown(status_vector, WAL_handle, &log_seqno, log_name,
&log_seqno, log_name, &log_partition_offset, &log_offset, &log_partition_offset, &log_offset, false);
FALSE);
ib_printf("At shutdown:\n"); ib_printf("At shutdown:\n");
ib_printf ib_printf
("log_seqno=%ld, logname=%s, log_partition_offset=%ld, shutdown offset=%ld\n", ("log_seqno=%ld, logname=%s, log_partition_offset=%ld, shutdown offset=%ld\n",
@ -751,7 +749,7 @@ log_count = 3;
WALRS_handle = NULL; WALRS_handle = NULL;
if ((ret = WALR_open(status_vector, &WALRS_handle, dbname, if ((ret = WALR_open(status_vector, &WALRS_handle, dbname,
log_count, lognames, log_p_offsets, log_count, lognames, log_p_offsets,
0L, NULL, FALSE)) != FB_SUCCESS) { 0L, NULL, false)) != FB_SUCCESS) {
if (ret == -1) { if (ret == -1) {
ib_printf("End of log...\n"); ib_printf("End of log...\n");
return FB_SUCCESS; return FB_SUCCESS;

View File

@ -93,12 +93,12 @@ static SSHORT grpc_wait_for_group_commit_finish(ISC_STATUS *, WAL, SSHORT,
GRP_COMMIT *); GRP_COMMIT *);
static void inform_wal_writer(WAL); static void inform_wal_writer(WAL);
static SSHORT next_buffer_available(WALS); static SSHORT next_buffer_available(WALS);
static void setup_buffer_for_writing(WAL, WALS, SSHORT); static void setup_buffer_for_writing(WAL, WALS, bool);
static SSHORT shutdown_writer(ISC_STATUS *, WAL, SSHORT); static SSHORT shutdown_writer(ISC_STATUS *, WAL, bool);
static SSHORT sync_with_wal_writer(ISC_STATUS *, WAL); static SSHORT sync_with_wal_writer(ISC_STATUS *, WAL);
static SSHORT wait_for_writer(ISC_STATUS *, WAL); static SSHORT wait_for_writer(ISC_STATUS *, WAL);
static SSHORT wal_put2(ISC_STATUS *, WAL, UCHAR *, USHORT, UCHAR *, USHORT, static SSHORT wal_put2(ISC_STATUS *, WAL, UCHAR *, USHORT, UCHAR *, USHORT,
SLONG *, SLONG *, SSHORT); SLONG *, SLONG *, bool);
#ifdef WIN_NT #ifdef WIN_NT
#define WAL_WRITER "bin/walw" #define WAL_WRITER "bin/walw"
@ -140,7 +140,7 @@ SSHORT WAL_attach( ISC_STATUS * status_vector, WAL * WAL_handle, SCHAR * dbname)
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
int ret = WALC_init(status_vector, WAL_handle, dbname, 0, int ret = WALC_init(status_vector, WAL_handle, dbname, 0,
NULL, 0L, FALSE, 1L, 0, NULL, FALSE); NULL, 0L, false, 1L, 0, NULL, false);
if (ret == FB_SUCCESS) { if (ret == FB_SUCCESS) {
if ((ret = WALC_check_writer(*WAL_handle)) != FB_SUCCESS) if ((ret = WALC_check_writer(*WAL_handle)) != FB_SUCCESS)
ret = fork_writer(status_vector, *WAL_handle); ret = fork_writer(status_vector, *WAL_handle);
@ -199,7 +199,7 @@ SSHORT WAL_checkpoint_finish(ISC_STATUS * status_vector,
UCHAR chkpt_rec[100]; UCHAR chkpt_rec[100];
wal_put2(status_vector, WAL_handle, chkpt_rec, 0, wal_put2(status_vector, WAL_handle, chkpt_rec, 0,
NULL, 0, log_seqno, log_offset, TRUE); NULL, 0, log_seqno, log_offset, true);
/* Now save the checkpoint record offset to be used by WAL writer later after /* Now save the checkpoint record offset to be used by WAL writer later after
it flushes the block containing the checkpoint record. We need to do this it flushes the block containing the checkpoint record. We need to do this
@ -213,7 +213,7 @@ SSHORT WAL_checkpoint_finish(ISC_STATUS * status_vector,
SLONG dummy_seqno; SLONG dummy_seqno;
SLONG dummy_offset; SLONG dummy_offset;
WAL_flush(status_vector, WAL_handle, &dummy_seqno, &dummy_offset, FALSE); WAL_flush(status_vector, WAL_handle, &dummy_seqno, &dummy_offset, false);
WALC_acquire(WAL_handle, &WAL_segment); WALC_acquire(WAL_handle, &WAL_segment);
*log_seqno = WAL_segment->wals_ckpted_log_seqno; *log_seqno = WAL_segment->wals_ckpted_log_seqno;
strcpy(logname, WAL_segment->wals_ckpt_logname); strcpy(logname, WAL_segment->wals_ckpt_logname);
@ -257,7 +257,8 @@ SSHORT WAL_checkpoint_force(ISC_STATUS * status_vector,
SSHORT WAL_checkpoint_start(ISC_STATUS * status_vector, SSHORT WAL_checkpoint_start(ISC_STATUS * status_vector,
WAL WAL_handle, SSHORT * ckpt_start) WAL WAL_handle,
bool * ckpt_start)
{ {
/************************************** /**************************************
* *
@ -267,7 +268,7 @@ SSHORT WAL_checkpoint_start(ISC_STATUS * status_vector,
* *
* Functional description * Functional description
* To inform the caller if checkpoint needs to be started. * To inform the caller if checkpoint needs to be started.
* Returns TRUE or FASLE through ckpt_start parameter. * Returns true or false through ckpt_start parameter.
* *
* Returns FB_SUCCESS or FB_FAILURE. * Returns FB_SUCCESS or FB_FAILURE.
* *
@ -276,10 +277,10 @@ SSHORT WAL_checkpoint_start(ISC_STATUS * status_vector,
WALC_acquire(WAL_handle, &WAL_segment); WALC_acquire(WAL_handle, &WAL_segment);
WAL_CHECK_BUG(WAL_handle, WAL_segment); WAL_CHECK_BUG(WAL_handle, WAL_segment);
*ckpt_start = FALSE; *ckpt_start = false;
if ((WAL_segment->wals_flags & WALS_CKPT_START) && if ((WAL_segment->wals_flags & WALS_CKPT_START) &&
!(WAL_segment->wals_flags & WALS_CKPT_RECORDED)) !(WAL_segment->wals_flags & WALS_CKPT_RECORDED))
*ckpt_start = TRUE; *ckpt_start = true;
WALC_release(WAL_handle); WALC_release(WAL_handle);
return FB_SUCCESS; return FB_SUCCESS;
@ -345,8 +346,10 @@ SSHORT WAL_commit(ISC_STATUS * status_vector,
WALS WAL_segment; WALS WAL_segment;
if (len && wal_put2(status_vector, WAL_handle, commit_logrec, len, if (len && wal_put2(status_vector, WAL_handle, commit_logrec, len,
NULL, 0, log_seqno, log_offset, 0) != FB_SUCCESS) NULL, 0, log_seqno, log_offset, false) != FB_SUCCESS)
{
return FB_FAILURE; return FB_FAILURE;
}
SSHORT ret = FB_SUCCESS; SSHORT ret = FB_SUCCESS;
@ -381,7 +384,7 @@ SSHORT WAL_commit(ISC_STATUS * status_vector,
SLONG dummy_seqno; SLONG dummy_seqno;
SLONG dummy_offset; SLONG dummy_offset;
return WAL_flush(status_vector, WAL_handle, return WAL_flush(status_vector, WAL_handle,
&dummy_seqno, &dummy_offset, FALSE); &dummy_seqno, &dummy_offset, false);
} }
SSHORT grpc_blknum = WAL_segment->wals_cur_grpc_blknum; SSHORT grpc_blknum = WAL_segment->wals_cur_grpc_blknum;
@ -421,10 +424,11 @@ void WAL_fini( ISC_STATUS * status_vector, WAL * WAL_handle)
} }
SSHORT WAL_flush( SSHORT WAL_flush(ISC_STATUS * status_vector,
ISC_STATUS * status_vector,
WAL WAL_handle, WAL WAL_handle,
SLONG * log_seqno, SLONG * log_offset, BOOLEAN conditional) SLONG * log_seqno,
SLONG * log_offset,
bool conditional)
{ {
/************************************** /**************************************
* *
@ -481,7 +485,7 @@ SSHORT WAL_flush(
switched to this buffer. */ switched to this buffer. */
if (CUR_BUF != -1 && (WAL_BLOCK(CUR_BUF))->walblk_cur_offset > 0) if (CUR_BUF != -1 && (WAL_BLOCK(CUR_BUF))->walblk_cur_offset > 0)
setup_buffer_for_writing(WAL_handle, WAL_segment, 0); setup_buffer_for_writing(WAL_handle, WAL_segment, false);
WAL_segment->wals_buf_waiters++; WAL_segment->wals_buf_waiters++;
inform_wal_writer(WAL_handle); inform_wal_writer(WAL_handle);
@ -516,8 +520,10 @@ SSHORT WAL_init(ISC_STATUS * status_vector,
USHORT db_page_len, USHORT db_page_len,
SCHAR * logname, SCHAR * logname,
SLONG log_partition_offset, SLONG log_partition_offset,
SSHORT first_time_log, bool first_time_log,
SLONG new_log_seqno, SSHORT wpb_length, SCHAR * wpb) SLONG new_log_seqno,
SSHORT wpb_length,
SCHAR * wpb)
{ {
/************************************** /**************************************
* *
@ -531,7 +537,7 @@ SSHORT WAL_init(ISC_STATUS * status_vector,
* *
* Initialize the WAL_handle. * Initialize the WAL_handle.
* *
* If first_time_log is TRUE then use the new_log_seqno * If first_time_log is true then use the new_log_seqno
* as the starting sequence number for the set of new log * as the starting sequence number for the set of new log
* files. * files.
* *
@ -541,15 +547,10 @@ SSHORT WAL_init(ISC_STATUS * status_vector,
**************************************/ **************************************/
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
SSHORT ret = WALC_init(status_vector, SSHORT ret = WALC_init(status_vector, WAL_handle, dbname, db_page_len,
WAL_handle, logname, log_partition_offset, first_time_log,
dbname, new_log_seqno, wpb_length,
db_page_len, reinterpret_cast < UCHAR * >(wpb), TRUE);
logname,
log_partition_offset,
first_time_log,
new_log_seqno,
wpb_length, reinterpret_cast < UCHAR * >(wpb), TRUE);
if (ret == FB_SUCCESS) { if (ret == FB_SUCCESS) {
if ((ret = fork_writer(status_vector, *WAL_handle)) != FB_SUCCESS) if ((ret = fork_writer(status_vector, *WAL_handle)) != FB_SUCCESS)
WALC_fini(local_status, WAL_handle); WALC_fini(local_status, WAL_handle);
@ -691,7 +692,7 @@ SSHORT WAL_put(ISC_STATUS * status_vector,
**************************************/ **************************************/
return wal_put2(status_vector, WAL_handle, return wal_put2(status_vector, WAL_handle,
logrec1, len1, logrec2, len2, log_seqno, log_offset, 0); logrec1, len1, logrec2, len2, log_seqno, log_offset, false);
} }
@ -709,7 +710,7 @@ bool WAL_rollover_happened(ISC_STATUS * status_vector,
* *
* Functional description * Functional description
* To inform the caller if rollover to a new log file has happened. * To inform the caller if rollover to a new log file has happened.
* Returns TRUE or FASLE. If TRUE then new_logname, * Returns true or false. If true then new_logname,
* new_log_partition_offset and new_seqno parameters are initialized * new_log_partition_offset and new_seqno parameters are initialized
* with the new information. The caller should invoke * with the new information. The caller should invoke
* WAL_rollover_recorded() after recording the rollover * WAL_rollover_recorded() after recording the rollover
@ -883,7 +884,8 @@ SSHORT WAL_shutdown(ISC_STATUS * status_vector,
SLONG * log_seqno, SLONG * log_seqno,
SCHAR * logname, SCHAR * logname,
SLONG * log_partition_offset, SLONG * log_partition_offset,
SLONG * shutdown_offset, SSHORT inform_close_to_jserver) SLONG * shutdown_offset,
bool inform_close_to_jserver)
{ {
/************************************** /**************************************
* *
@ -941,7 +943,7 @@ SSHORT WAL_shutdown_old_writer(ISC_STATUS * status_vector, SCHAR * dbname)
return FB_SUCCESS; /* Nobody is attached to the shared WAL segment */ return FB_SUCCESS; /* Nobody is attached to the shared WAL segment */
if (WALC_check_writer(WAL_handle) == FB_SUCCESS) if (WALC_check_writer(WAL_handle) == FB_SUCCESS)
shutdown_writer(status_vector, WAL_handle, (SSHORT) 0); shutdown_writer(status_vector, WAL_handle, false);
WAL_fini(status_vector, &WAL_handle); WAL_fini(status_vector, &WAL_handle);
@ -1191,9 +1193,8 @@ static SSHORT grpc_do_group_commit(
if (ret != FB_SUCCESS) if (ret != FB_SUCCESS)
return ret; return ret;
ret = ret = WAL_flush(status_vector, WAL_handle, &dummy_seqno, &dummy_offset,
WAL_flush(status_vector, WAL_handle, &dummy_seqno, &dummy_offset, false);
FALSE);
if (ret != FB_SUCCESS) if (ret != FB_SUCCESS)
return ret; return ret;
@ -1263,10 +1264,7 @@ static SSHORT grpc_wait_for_grouping(
SLONG value = ISC_event_clear(ptr); SLONG value = ISC_event_clear(ptr);
WALC_release(WAL_handle); WALC_release(WAL_handle);
ISC_event_wait(1, ISC_event_wait(1, &ptr, &value, WAL_handle->wal_grpc_wait_usecs,
&ptr,
&value,
WAL_handle->wal_grpc_wait_usecs,
WALC_alarm_handler, ptr); WALC_alarm_handler, ptr);
/* Now make sure that the other group-commit block is available */ /* Now make sure that the other group-commit block is available */
@ -1347,8 +1345,7 @@ static SSHORT grpc_wait_for_group_commit_finish(
ptr = &WAL_EVENTS[grpc->grp_commit_event_num]; ptr = &WAL_EVENTS[grpc->grp_commit_event_num];
value = ISC_event_clear(ptr); value = ISC_event_clear(ptr);
WALC_release(WAL_handle); WALC_release(WAL_handle);
while (ISC_event_wait(1, &ptr, &value, while (ISC_event_wait(1, &ptr, &value, WAL_handle->wal_grpc_wait_coord_usecs,
WAL_handle->wal_grpc_wait_coord_usecs,
WALC_alarm_handler, ptr) != FB_SUCCESS) WALC_alarm_handler, ptr) != FB_SUCCESS)
{ {
/* Check to make sure that the coordinator is still alive. */ /* Check to make sure that the coordinator is still alive. */
@ -1422,9 +1419,9 @@ static SSHORT next_buffer_available( WALS WAL_segment)
} }
static void setup_buffer_for_writing( static void setup_buffer_for_writing(WAL WAL_handle,
WAL WAL_handle, WALS WAL_segment,
WALS WAL_segment, SSHORT ckpt) bool ckpt)
{ {
/************************************** /**************************************
* *
@ -1437,7 +1434,7 @@ static void setup_buffer_for_writing(
* Inform the WAL writer that the current buffer is ready * Inform the WAL writer that the current buffer is ready
* to be flushed to disk. Assumes that acquire() has * to be flushed to disk. Assumes that acquire() has
* been done, before calling this routine. * been done, before calling this routine.
* If 'ckpt' flag is TRUE then this buffer finishes a checkpoint. * If 'ckpt' flag is true then this buffer finishes a checkpoint.
***************************************/ ***************************************/
WALBLK *wblk; WALBLK *wblk;
@ -1454,9 +1451,9 @@ static void setup_buffer_for_writing(
} }
static SSHORT shutdown_writer( static SSHORT shutdown_writer(ISC_STATUS * status_vector,
ISC_STATUS * status_vector, WAL WAL_handle,
WAL WAL_handle, SSHORT inform_close_to_jserver) bool inform_close_to_jserver)
{ {
/************************************** /**************************************
* *
@ -1562,8 +1559,7 @@ static SSHORT wait_for_writer( ISC_STATUS * status_vector, WAL WAL_handle)
value = ISC_event_clear(ptr); value = ISC_event_clear(ptr);
WALC_release(WAL_handle); WALC_release(WAL_handle);
ret = ret = ISC_event_wait(1, &ptr, &value, WAIT_TIME,
ISC_event_wait(1, &ptr, &value, WAIT_TIME,
WALC_alarm_handler, ptr); WALC_alarm_handler, ptr);
if (ret == FB_FAILURE) { if (ret == FB_FAILURE) {
/* We got out because of timeout. May be our condition is /* We got out because of timeout. May be our condition is
@ -1580,13 +1576,15 @@ static SSHORT wait_for_writer( ISC_STATUS * status_vector, WAL WAL_handle)
} }
static SSHORT wal_put2( static SSHORT wal_put2(ISC_STATUS * status_vector,
ISC_STATUS * status_vector,
WAL WAL_handle, WAL WAL_handle,
UCHAR * logrec1, UCHAR * logrec1,
USHORT len1, USHORT len1,
UCHAR * logrec2, UCHAR * logrec2,
USHORT len2, SLONG * log_seqno, SLONG * log_offset, SSHORT ckpt) USHORT len2,
SLONG * log_seqno,
SLONG * log_offset,
bool ckpt)
{ {
/************************************** /**************************************
* *
@ -1612,7 +1610,7 @@ USHORT len2, SLONG * log_seqno, SLONG * log_offset, SSHORT ckpt)
* series and the offset of this logrec in that file where * series and the offset of this logrec in that file where
* this log record would eventually be written. * this log record would eventually be written.
* *
* If 'ckpt' parameter is TRUE then steup the buffer with * If 'ckpt' parameter is true then steup the buffer with
* this logrec for writing and mark it as a checkpoint buffer. * this logrec for writing and mark it as a checkpoint buffer.
* The WAL writer will handle this checkpointed buffer in a special * The WAL writer will handle this checkpointed buffer in a special
* way. * way.
@ -1621,7 +1619,8 @@ USHORT len2, SLONG * log_seqno, SLONG * log_offset, SSHORT ckpt)
* *
**************************************/ **************************************/
int available_bytes; int available_bytes;
USHORT total_len, done = FALSE; USHORT total_len;
bool done = false;
WALBLK *wblk; WALBLK *wblk;
SLONG lsn; SLONG lsn;
SLONG offset; SLONG offset;
@ -1664,7 +1663,7 @@ USHORT len2, SLONG * log_seqno, SLONG * log_offset, SSHORT ckpt)
{ {
WAL_segment->wals_flags |= WALS_ROLLOVER_REQUIRED; WAL_segment->wals_flags |= WALS_ROLLOVER_REQUIRED;
if (wblk->walblk_cur_offset > BLK_HDROVHD) if (wblk->walblk_cur_offset > BLK_HDROVHD)
setup_buffer_for_writing(WAL_handle, WAL_segment, 0); setup_buffer_for_writing(WAL_handle, WAL_segment, false);
WAL_segment->wals_buf_waiters++; WAL_segment->wals_buf_waiters++;
wait_for_writer(status_vector, WAL_handle); wait_for_writer(status_vector, WAL_handle);
WAL_segment = WAL_handle->wal_segment; WAL_segment = WAL_handle->wal_segment;
@ -1680,15 +1679,14 @@ USHORT len2, SLONG * log_seqno, SLONG * log_offset, SSHORT ckpt)
/* Found a large enough buffer, use it. */ /* Found a large enough buffer, use it. */
lsn = WAL_segment->wals_log_seqno; lsn = WAL_segment->wals_log_seqno;
offset = offset = copy_buffer(WAL_segment, wblk, logrec1, len1, logrec2, len2);
copy_buffer(WAL_segment, wblk, logrec1, len1, logrec2, len2); done = true;
done = TRUE;
} }
else else
/* Assumption: One empty WAL buffer is long enough to fully accommodate /* Assumption: One empty WAL buffer is long enough to fully accommodate
any one log record. Let's try the next buffer. */ any one log record. Let's try the next buffer. */
setup_buffer_for_writing(WAL_handle, WAL_segment, 0); setup_buffer_for_writing(WAL_handle, WAL_segment, false);
} }
if (ckpt) if (ckpt)

View File

@ -32,12 +32,13 @@
extern SSHORT WAL_attach (ISC_STATUS *, struct wal **, SCHAR *); extern SSHORT WAL_attach (ISC_STATUS *, struct wal **, SCHAR *);
extern SSHORT WAL_checkpoint_finish (ISC_STATUS *, struct wal *, SLONG *, SCHAR *, SLONG *, SLONG *); extern SSHORT WAL_checkpoint_finish (ISC_STATUS *, struct wal *, SLONG *, SCHAR *, SLONG *, SLONG *);
extern SSHORT WAL_checkpoint_force (ISC_STATUS *, struct wal *, SLONG *, SCHAR *, SLONG *, SLONG *); extern SSHORT WAL_checkpoint_force (ISC_STATUS *, struct wal *, SLONG *, SCHAR *, SLONG *, SLONG *);
extern SSHORT WAL_checkpoint_start (ISC_STATUS *, struct wal *, SSHORT *); extern SSHORT WAL_checkpoint_start (ISC_STATUS *, struct wal *, bool *);
extern SSHORT WAL_checkpoint_recorded (ISC_STATUS *, struct wal *); extern SSHORT WAL_checkpoint_recorded (ISC_STATUS *, struct wal *);
extern SSHORT WAL_commit (ISC_STATUS *, struct wal *, UCHAR *, USHORT, SLONG *, SLONG *); extern SSHORT WAL_commit (ISC_STATUS *, struct wal *, UCHAR *, USHORT, SLONG *, SLONG *);
extern void WAL_fini (ISC_STATUS *, struct wal **); extern void WAL_fini (ISC_STATUS *, struct wal **);
extern SSHORT WAL_flush (ISC_STATUS *, struct wal *, SLONG *, SLONG *, BOOLEAN); extern SSHORT WAL_flush (ISC_STATUS *, struct wal *, SLONG *, SLONG *, bool);
extern SSHORT WAL_init (ISC_STATUS *, struct wal **, SCHAR *, USHORT, SCHAR *, SLONG, SSHORT, SLONG, SSHORT, SCHAR *); extern SSHORT WAL_init (ISC_STATUS *, struct wal **, SCHAR *, USHORT, SCHAR *,
SLONG, bool, SLONG, SSHORT, SCHAR *);
extern SSHORT WAL_journal_disable (ISC_STATUS *, struct wal *); extern SSHORT WAL_journal_disable (ISC_STATUS *, struct wal *);
extern SSHORT WAL_journal_enable (ISC_STATUS *, struct wal *, SCHAR *, USHORT, SCHAR *); extern SSHORT WAL_journal_enable (ISC_STATUS *, struct wal *, SCHAR *, USHORT, SCHAR *);
extern SSHORT WAL_put (ISC_STATUS *, struct wal *, UCHAR *, USHORT, UCHAR *, USHORT, SLONG *, SLONG *); extern SSHORT WAL_put (ISC_STATUS *, struct wal *, UCHAR *, USHORT, UCHAR *, USHORT, SLONG *, SLONG *);
@ -47,7 +48,8 @@ extern SSHORT WAL_set_checkpoint_length (ISC_STATUS *, struct wal *, SLONG);
extern void WAL_set_cleanup_flag (struct wal *); extern void WAL_set_cleanup_flag (struct wal *);
extern SSHORT WAL_set_grpc_wait_time (ISC_STATUS *, struct wal *, SLONG); extern SSHORT WAL_set_grpc_wait_time (ISC_STATUS *, struct wal *, SLONG);
extern SSHORT WAL_set_rollover_log (ISC_STATUS *, struct wal *, struct logfiles *); extern SSHORT WAL_set_rollover_log (ISC_STATUS *, struct wal *, struct logfiles *);
extern SSHORT WAL_shutdown (ISC_STATUS *, struct wal *, SLONG *, SCHAR *, SLONG *, SLONG *, SSHORT); extern SSHORT WAL_shutdown (ISC_STATUS *, struct wal *, SLONG *, SCHAR *,
SLONG *, SLONG *, bool);
extern SSHORT WAL_shutdown_old_writer (ISC_STATUS *, SCHAR *); extern SSHORT WAL_shutdown_old_writer (ISC_STATUS *, SCHAR *);
extern SSHORT WAL_status (ISC_STATUS *, struct wal *, SLONG *, SCHAR *, SLONG *, SLONG *, SLONG *, SCHAR *, SLONG *, SLONG *); extern SSHORT WAL_status (ISC_STATUS *, struct wal *, SLONG *, SCHAR *, SLONG *, SLONG *, SLONG *, SCHAR *, SLONG *, SLONG *);

View File

@ -82,8 +82,8 @@ typedef struct walc {
USHORT walc_db_page_len; USHORT walc_db_page_len;
TEXT *walc_logname; TEXT *walc_logname;
SLONG walc_log_partition_offset; SLONG walc_log_partition_offset;
SSHORT walc_first_time_log; bool walc_first_time_log;
SLONG walc_new_log_seqno; /* used when first_time_log is TRUE */ SLONG walc_new_log_seqno; // used when first_time_log is true
SSHORT walc_maxbufs; SSHORT walc_maxbufs;
USHORT walc_bufsize; USHORT walc_bufsize;
@ -362,9 +362,11 @@ SSHORT WALC_init(ISC_STATUS * status_vector,
USHORT db_page_len, USHORT db_page_len,
TEXT * logname, TEXT * logname,
SLONG log_partition_offset, SLONG log_partition_offset,
SSHORT first_time_log, bool first_time_log,
SLONG new_log_seqno, SLONG new_log_seqno,
SSHORT wpb_length, UCHAR * wpb, USHORT first_attach) SSHORT wpb_length,
UCHAR * wpb,
bool first_attach)
{ {
/************************************** /**************************************
* *
@ -376,7 +378,7 @@ SSHORT WALC_init(ISC_STATUS * status_vector,
* Initialize Write Ahead Log segment for the database. * Initialize Write Ahead Log segment for the database.
* Initialize WAL_handle for the process (thread). * Initialize WAL_handle for the process (thread).
* *
* If first_time_log is TRUE then use the new_log_seqno * If first_time_log is true then use the new_log_seqno
* as the starting sequence number for the set of new log * as the starting sequence number for the set of new log
* files. * files.
* *
@ -571,7 +573,9 @@ void WALC_save_status_strings( ISC_STATUS * vector)
} }
void WALC_setup_buffer_block( WALS WAL_segment, WALBLK * wblk, SSHORT ckpt) void WALC_setup_buffer_block(WALS WAL_segment,
WALBLK * wblk,
bool ckpt)
{ {
/************************************** /**************************************
* *
@ -581,7 +585,7 @@ void WALC_setup_buffer_block( WALS WAL_segment, WALBLK * wblk, SSHORT ckpt)
* *
* Functional description * Functional description
* Mark the passed buffer as ready to be written. * Mark the passed buffer as ready to be written.
* If 'ckpt' flag is TRUE then this buffer finishes a checkpoint. * If 'ckpt' flag is true then this buffer finishes a checkpoint.
* Assumes that acquire() has been done, before calling this routine. * Assumes that acquire() has been done, before calling this routine.
* *
***************************************/ ***************************************/

View File

@ -31,9 +31,10 @@ extern void WALC_build_dbg_filename (TEXT *, TEXT *);
extern void WALC_build_logname (TEXT *, TEXT *, SLONG); extern void WALC_build_logname (TEXT *, TEXT *, SLONG);
extern SSHORT WALC_check_writer (struct wal *); extern SSHORT WALC_check_writer (struct wal *);
extern void WALC_fini (ISC_STATUS *, struct wal **); extern void WALC_fini (ISC_STATUS *, struct wal **);
extern SSHORT WALC_init (ISC_STATUS *, struct wal **, TEXT *, USHORT, TEXT *, SLONG, SSHORT, SLONG, SSHORT, UCHAR *, USHORT); extern SSHORT WALC_init (ISC_STATUS *, struct wal **, TEXT *, USHORT, TEXT *,
SLONG, bool, SLONG, SSHORT, UCHAR *, bool);
extern void WALC_release (struct wal *); extern void WALC_release (struct wal *);
extern void WALC_save_status_strings (ISC_STATUS *); extern void WALC_save_status_strings (ISC_STATUS *);
extern void WALC_setup_buffer_block (struct wals *, struct walblk *, SSHORT); extern void WALC_setup_buffer_block (struct wals *, struct walblk *, bool);
#endif /* _WAL_WALC_PROTO_H_ */ #endif /* _WAL_WALC_PROTO_H_ */

View File

@ -65,8 +65,7 @@ SSHORT WALF_delink_log(ISC_STATUS * status_vector,
/* NOMEM: error return, FREE: by error returns & WALF_dispose_log_header() */ /* NOMEM: error return, FREE: by error returns & WALF_dispose_log_header() */
if (!log_header) if (!log_header)
return FB_FAILURE; return FB_FAILURE;
ret = ret = WALF_open_log_file(status_vector, dbname, logname,
WALF_open_log_file(status_vector, dbname, logname,
log_partition_offset, log_header, &log_fd); log_partition_offset, log_header, &log_fd);
if (ret != FB_SUCCESS) { if (ret != FB_SUCCESS) {
gds__free((SLONG *) log_header); gds__free((SLONG *) log_header);
@ -140,8 +139,7 @@ SSHORT WALF_delink_prev_log(ISC_STATUS * status_vector,
/* NOMEM: error return, FREE: by error returns & WALF_dispose_log_header() */ /* NOMEM: error return, FREE: by error returns & WALF_dispose_log_header() */
if (!log_header) if (!log_header)
return FB_FAILURE; return FB_FAILURE;
ret = ret = WALF_open_log_file(status_vector, dbname, logname,
WALF_open_log_file(status_vector, dbname, logname,
log_partition_offset, log_header, &log_fd); log_partition_offset, log_header, &log_fd);
if (ret != FB_SUCCESS) { if (ret != FB_SUCCESS) {
gds__free((SLONG *) log_header); gds__free((SLONG *) log_header);
@ -186,7 +184,7 @@ void WALF_dispose_log_header( WALFH log_header)
} }
SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector, bool WALF_get_linked_logs_info(ISC_STATUS * status_vector,
SCHAR * dbname, SCHAR * dbname,
SCHAR * starting_logname, SCHAR * starting_logname,
SLONG starting_log_partition_offset, SLONG starting_log_partition_offset,
@ -194,7 +192,7 @@ SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector,
SCHAR * last_logname, SCHAR * last_logname,
SLONG * last_log_partition_offset, SLONG * last_log_partition_offset,
SLONG * last_log_flags, SLONG * last_log_flags,
SSHORT * any_log_to_be_archived) bool * any_log_to_be_archived)
{ {
/************************************** /**************************************
* *
@ -210,7 +208,7 @@ SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector,
* If any log file in the chain (including the starting logname) * If any log file in the chain (including the starting logname)
* needs to be archived (i.e. its WALFH_KEEP_FOR_LONG_TERM_RECV * needs to be archived (i.e. its WALFH_KEEP_FOR_LONG_TERM_RECV
* is set), the parameter any_log_to_be_archived would be set to * is set), the parameter any_log_to_be_archived would be set to
* TRUE else it would be set to FALSE. * true else it would be set to false.
* *
* If there is any error, return FB_FAILURE else return FB_SUCCESS. * If there is any error, return FB_FAILURE else return FB_SUCCESS.
* In case of error, status_vector would be updated. * In case of error, status_vector would be updated.
@ -233,9 +231,11 @@ SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector,
if ((ret = WALF_get_log_info(status_vector, dbname, starting_logname, if ((ret = WALF_get_log_info(status_vector, dbname, starting_logname,
starting_log_partition_offset, starting_log_partition_offset,
&log_seqno, &log_length, &log_seqno, &log_length,
&log_flags)) != FB_SUCCESS) return FB_FAILURE; &log_flags)) != FB_SUCCESS)
*any_log_to_be_archived = {
((log_flags & WALFH_KEEP_FOR_LONG_TERM_RECV) ? TRUE : FALSE); return false;
}
*any_log_to_be_archived = (log_flags & WALFH_KEEP_FOR_LONG_TERM_RECV);
strcpy(log_name1, starting_logname); strcpy(log_name1, starting_logname);
curr_name = log_name1; curr_name = log_name1;
curr_log_partition_offset = starting_log_partition_offset; curr_log_partition_offset = starting_log_partition_offset;
@ -247,7 +247,9 @@ SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector,
(status_vector, dbname, curr_name, curr_log_partition_offset, (status_vector, dbname, curr_name, curr_log_partition_offset,
prev_name, &prev_log_partition_offset, &log_seqno, &log_length, prev_name, &prev_log_partition_offset, &log_seqno, &log_length,
&log_flags, -1) != FB_SUCCESS) &log_flags, -1) != FB_SUCCESS)
{
break; break;
}
log_count++; log_count++;
temp_name = prev_name; temp_name = prev_name;
prev_name = curr_name; prev_name = curr_name;
@ -255,7 +257,9 @@ SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector,
curr_log_partition_offset = prev_log_partition_offset; curr_log_partition_offset = prev_log_partition_offset;
if (!(*any_log_to_be_archived) && if (!(*any_log_to_be_archived) &&
(log_flags & WALFH_KEEP_FOR_LONG_TERM_RECV)) (log_flags & WALFH_KEEP_FOR_LONG_TERM_RECV))
*any_log_to_be_archived = TRUE; {
*any_log_to_be_archived = true;
}
} }
/* Now initialize the passed parameters with the oldest log info. */ /* Now initialize the passed parameters with the oldest log info. */
@ -265,7 +269,7 @@ SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector,
*last_log_partition_offset = curr_log_partition_offset; *last_log_partition_offset = curr_log_partition_offset;
*last_log_flags = log_flags; *last_log_flags = log_flags;
return FB_SUCCESS; return true;
} }
@ -274,7 +278,8 @@ SSHORT WALF_get_log_info(ISC_STATUS * status_vector,
SCHAR * logname, SCHAR * logname,
SLONG log_partition_offset, SLONG log_partition_offset,
SLONG * log_seqno, SLONG * log_seqno,
SLONG * log_length, SLONG * log_flag) SLONG * log_length,
SLONG * log_flag)
{ {
/************************************** /**************************************
* *
@ -285,7 +290,7 @@ SSHORT WALF_get_log_info(ISC_STATUS * status_vector,
* Functional description * Functional description
* Get the seqno, length and the header flag of the given log file. * Get the seqno, length and the header flag of the given log file.
* *
* If there is any error, return FB_FAILURE else return FB_SUCCESS. * If there is any error, return false else return true.
* In case of error, status_vector would be updated. * In case of error, status_vector would be updated.
* *
**************************************/ **************************************/
@ -296,13 +301,12 @@ SSHORT WALF_get_log_info(ISC_STATUS * status_vector,
log_header = (WALFH) gds__alloc(WALFH_LENGTH); log_header = (WALFH) gds__alloc(WALFH_LENGTH);
/* NOMEM: error return, FREE: by error returns & WALF_dispose_log_header() */ /* NOMEM: error return, FREE: by error returns & WALF_dispose_log_header() */
if (!log_header) if (!log_header)
return FB_FAILURE; return false;
ret = ret = WALF_open_log_file(status_vector, dbname, logname,
WALF_open_log_file(status_vector, dbname, logname,
log_partition_offset, log_header, &log_fd); log_partition_offset, log_header, &log_fd);
if (ret != FB_SUCCESS) { if (ret != FB_SUCCESS) {
gds__free((SLONG *) log_header); gds__free((SLONG *) log_header);
return FB_FAILURE; return false;
} }
*log_seqno = log_header->walfh_seqno; *log_seqno = log_header->walfh_seqno;
@ -324,7 +328,8 @@ SSHORT WALF_get_next_log_info(ISC_STATUS * status_vector,
SLONG * next_log_partition_offset, SLONG * next_log_partition_offset,
SLONG * next_log_seqno, SLONG * next_log_seqno,
SLONG * next_log_length, SLONG * next_log_length,
SLONG * next_log_flags, SSHORT direction) SLONG * next_log_flags,
SSHORT direction)
{ {
/************************************** /**************************************
* *
@ -354,8 +359,7 @@ SSHORT WALF_get_next_log_info(ISC_STATUS * status_vector,
if (!log_header) if (!log_header)
return FB_FAILURE; return FB_FAILURE;
ret = ret = WALF_open_log_file(status_vector, dbname, logname,
WALF_open_log_file(status_vector, dbname, logname,
log_partition_offset, log_header, &log_fd); log_partition_offset, log_header, &log_fd);
if (ret != FB_SUCCESS) { if (ret != FB_SUCCESS) {
gds__free((SLONG *) log_header); gds__free((SLONG *) log_header);
@ -736,7 +740,8 @@ SSHORT WALF_set_log_header_flag(ISC_STATUS * status_vector,
SCHAR * dbname, SCHAR * dbname,
SCHAR * logname, SCHAR * logname,
SLONG log_partition_offset, SLONG log_partition_offset,
SLONG flag, int set) SLONG flag,
bool set)
{ {
/************************************** /**************************************
* *
@ -747,7 +752,7 @@ SSHORT WALF_set_log_header_flag(ISC_STATUS * status_vector,
* Functional description * Functional description
* Update the walfh_flags field of the log header in the log * Update the walfh_flags field of the log header in the log
* file by the passed flag setting(s). If the parameter 'set' * file by the passed flag setting(s). If the parameter 'set'
* is TRUE, the flag bit(s) would be set else they would be reset. * is true, the flag bit(s) would be set else they would be reset.
* If there is any error, return FB_FAILURE else return FB_SUCCESS. * If there is any error, return FB_FAILURE else return FB_SUCCESS.
* In case of error, status_vector would be updated. * In case of error, status_vector would be updated.
* *

View File

@ -27,14 +27,15 @@
extern SSHORT WALF_delink_log (ISC_STATUS *, SCHAR *, SCHAR *, SLONG); extern SSHORT WALF_delink_log (ISC_STATUS *, SCHAR *, SCHAR *, SLONG);
extern SSHORT WALF_delink_prev_log (ISC_STATUS *, SCHAR *, SCHAR *, SLONG); extern SSHORT WALF_delink_prev_log (ISC_STATUS *, SCHAR *, SCHAR *, SLONG);
extern void WALF_dispose_log_header (struct walfh *); extern void WALF_dispose_log_header (struct walfh *);
extern SSHORT WALF_get_linked_logs_info (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, int *, SCHAR *, SLONG *, SLONG *, SSHORT *); extern bool WALF_get_linked_logs_info (ISC_STATUS *, SCHAR *, SCHAR *, SLONG,
int *, SCHAR *, SLONG *, SLONG *, bool *);
extern SSHORT WALF_get_log_info (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SLONG *, SLONG *, SLONG *); extern SSHORT WALF_get_log_info (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SLONG *, SLONG *, SLONG *);
extern SSHORT WALF_get_next_log_info (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SCHAR *, SLONG *, SLONG *, SLONG *, SLONG *, SSHORT); extern SSHORT WALF_get_next_log_info (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SCHAR *, SLONG *, SLONG *, SLONG *, SLONG *, SSHORT);
extern SSHORT WALF_get_all_next_logs_info (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, int, SCHAR *, int *, SCHAR * *, SLONG *, SLONG *, SLONG *, SLONG *, SSHORT); extern SSHORT WALF_get_all_next_logs_info (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, int, SCHAR *, int *, SCHAR * *, SLONG *, SLONG *, SLONG *, SLONG *, SSHORT);
extern SSHORT WALF_init_p_log (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SSHORT); extern SSHORT WALF_init_p_log (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SSHORT);
extern SSHORT WALF_open_partitioned_log_file (ISC_STATUS *, SCHAR *, SCHAR *, struct p_logfh *, SLONG *); extern SSHORT WALF_open_partitioned_log_file (ISC_STATUS *, SCHAR *, SCHAR *, struct p_logfh *, SLONG *);
extern SSHORT WALF_open_log_file (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, struct walfh *, SLONG *); extern SSHORT WALF_open_log_file (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, struct walfh *, SLONG *);
extern SSHORT WALF_set_log_header_flag (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SLONG, int); extern SSHORT WALF_set_log_header_flag (ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SLONG, bool);
extern SSHORT WALF_update_log_header (ISC_STATUS *, SCHAR *, SLONG, struct walfh *, SLONG); extern SSHORT WALF_update_log_header (ISC_STATUS *, SCHAR *, SLONG, struct walfh *, SLONG);
extern void WALF_upd_log_hdr_frm_walfh_data (struct walfh *, UCHAR *); extern void WALF_upd_log_hdr_frm_walfh_data (struct walfh *, UCHAR *);
extern SSHORT WALF_update_partitioned_log_hdr (ISC_STATUS *, SCHAR *, struct p_logfh *, SLONG); extern SSHORT WALF_update_partitioned_log_hdr (ISC_STATUS *, SCHAR *, struct p_logfh *, SLONG);

View File

@ -206,7 +206,8 @@ SSHORT WALR_open(ISC_STATUS * status_vector,
SCHAR ** lognames, SCHAR ** lognames,
SLONG * log_partitions_offsets, SLONG * log_partitions_offsets,
SLONG first_log_offset, SLONG first_log_offset,
SLONG * timestamp, SSHORT dont_scan_tail_logs) SLONG * timestamp,
bool dont_scan_tail_logs)
{ {
/************************************** /**************************************
* *

View File

@ -28,6 +28,7 @@ extern SSHORT WALR_close (ISC_STATUS *, struct walrs **);
extern SSHORT WALR_fixup_log_header (ISC_STATUS *, struct walrs *); extern SSHORT WALR_fixup_log_header (ISC_STATUS *, struct walrs *);
extern SSHORT WALR_get (ISC_STATUS *, struct walrs *, UCHAR *, USHORT *, SLONG *, SLONG *); extern SSHORT WALR_get (ISC_STATUS *, struct walrs *, UCHAR *, USHORT *, SLONG *, SLONG *);
extern SSHORT WALR_get_blk_timestamp (struct walrs *, SLONG *); extern SSHORT WALR_get_blk_timestamp (struct walrs *, SLONG *);
extern SSHORT WALR_open (ISC_STATUS *, struct walrs **, SCHAR *, int, SCHAR **, SLONG *, SLONG, SLONG *, SSHORT); extern SSHORT WALR_open (ISC_STATUS *, struct walrs **, SCHAR *, int, SCHAR **,
SLONG *, SLONG, SLONG *, bool);
#endif /* _WAL_WALR_PROTO_H_ */ #endif /* _WAL_WALR_PROTO_H_ */

View File

@ -128,8 +128,8 @@ typedef struct walwl
#define PRINT_TIME(fd,t) { time((time_t*) t); ib_fprintf (fd, "%s", ctime((time_t*) t)); } #define PRINT_TIME(fd,t) { time((time_t*) t); ib_fprintf (fd, "%s", ctime((time_t*) t)); }
static void close_log(ISC_STATUS *, WAL, SCHAR *, WALFH, SLONG); static void close_log(ISC_STATUS *, WAL, SCHAR *, WALFH, bool);
static SSHORT discard_prev_logs(ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SSHORT); static SSHORT discard_prev_logs(ISC_STATUS *, SCHAR *, SCHAR *, SLONG, bool);
static void finishup_checkpoint(WALS); static void finishup_checkpoint(WALS);
static SSHORT flush_all_buffers(ISC_STATUS *, WAL); static SSHORT flush_all_buffers(ISC_STATUS *, WAL);
static SSHORT get_logfile_index(WALS, SCHAR *); static SSHORT get_logfile_index(WALS, SCHAR *);
@ -153,9 +153,9 @@ static void report_walw_bug_or_error(ISC_STATUS *, struct wal *, SSHORT, ISC_STA
static SSHORT rollover_log(ISC_STATUS *, WAL, WALFH); static SSHORT rollover_log(ISC_STATUS *, WAL, WALFH);
static void setup_for_checkpoint(WALS); static void setup_for_checkpoint(WALS);
static SSHORT setup_log(ISC_STATUS *, WAL, SCHAR *, SLONG, SLONG, SLONG *, WALFH, static SSHORT setup_log(ISC_STATUS *, WAL, SCHAR *, SLONG, SLONG, SLONG *, WALFH,
SSHORT, SCHAR *, SLONG); bool, SCHAR *, SLONG);
static SSHORT setup_log_header_info(ISC_STATUS *, WAL, SCHAR *, SLONG, SLONG, static SSHORT setup_log_header_info(ISC_STATUS *, WAL, SCHAR *, SLONG, SLONG,
SLONG *, WALFH, SSHORT, SCHAR *, SLONG, SLONG *, WALFH, bool, SCHAR *, SLONG,
bool*); bool*);
static SSHORT write_log_header_and_reposition(ISC_STATUS *, SCHAR *, SLONG, static SSHORT write_log_header_and_reposition(ISC_STATUS *, SCHAR *, SLONG,
WALFH); WALFH);
@ -233,7 +233,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
WAL WAL_handle = NULL; WAL WAL_handle = NULL;
if (WALC_init(status_vector, &WAL_handle, dbname, 0, if (WALC_init(status_vector, &WAL_handle, dbname, 0,
NULL, 0L, FALSE, 1L, 0, NULL, FALSE) != FB_SUCCESS) { NULL, 0L, false, 1L, 0, NULL, false) != FB_SUCCESS)
{
gds__log_status(dbname, status_vector); gds__log_status(dbname, status_vector);
gds__print_status(status_vector); gds__print_status(status_vector);
exit(FINI_ERROR); exit(FINI_ERROR);
@ -351,7 +352,7 @@ static SSHORT walw_writer(ISC_STATUS * status_vector, WAL WAL_handle)
WALS WAL_segment; WALS WAL_segment;
WALBLK *wblk; WALBLK *wblk;
SSHORT bufnum; SSHORT bufnum;
SSHORT first_logfile; bool first_logfile;
int buffer_full; int buffer_full;
int journal_enable_or_disable; int journal_enable_or_disable;
int rollover_required; int rollover_required;
@ -394,8 +395,7 @@ static SSHORT walw_writer(ISC_STATUS * status_vector, WAL WAL_handle)
WAL_segment->wals_last_err = 0; WAL_segment->wals_last_err = 0;
WAL_CHECK_BUG_ERROR(WAL_handle, WAL_segment); WAL_CHECK_BUG_ERROR(WAL_handle, WAL_segment);
first_logfile = first_logfile = (WAL_segment->wals_flags & WALS_FIRST_TIME_LOG);
(WAL_segment->wals_flags & WALS_FIRST_TIME_LOG) ? TRUE : FALSE;
log_type = 0L; log_type = 0L;
if (first_logfile) { if (first_logfile) {
/* Initialize raw partitions which need root permission */ /* Initialize raw partitions which need root permission */
@ -489,7 +489,7 @@ static SSHORT walw_writer(ISC_STATUS * status_vector, WAL WAL_handle)
WALC_release(WAL_handle); WALC_release(WAL_handle);
acquired = false; acquired = false;
ISC_event_wait(1, &ptr, &value, WALW_WRITER_TIMEOUT_USECS, ISC_event_wait(1, &ptr, &value, WALW_WRITER_TIMEOUT_USECS,
WALC_alarm_handler, ptr); (WALC_alarm_handler), ptr);
continue; continue;
} }
@ -553,7 +553,7 @@ static SSHORT walw_writer(ISC_STATUS * status_vector, WAL WAL_handle)
discard_prev_logs(status_vector, WAL_segment->wals_dbname, discard_prev_logs(status_vector, WAL_segment->wals_dbname,
WAL_segment->wals_prev_ckpt_logname, WAL_segment->wals_prev_ckpt_logname,
WAL_segment->wals_prev_ckpt_log_p_offset, WAL_segment->wals_prev_ckpt_log_p_offset,
FALSE); false);
#ifdef SUPERSERVER #ifdef SUPERSERVER
/* In Netware, file handles are shared if the file is reopened in the /* In Netware, file handles are shared if the file is reopened in the
same thread. discard_prev_log() may open the current log file to same thread. discard_prev_log() may open the current log file to
@ -603,7 +603,7 @@ static SSHORT walw_writer(ISC_STATUS * status_vector, WAL WAL_handle)
log_header->walfh_hibsn = WAL_segment->wals_blkseqno - 1; log_header->walfh_hibsn = WAL_segment->wals_blkseqno - 1;
close_log(status_vector, WAL_handle, WAL_segment->wals_logname, close_log(status_vector, WAL_handle, WAL_segment->wals_logname,
log_header, log_header,
WAL_segment->wals_flags & WALS_INFORM_CLOSE_TO_JOURNAL); (WAL_segment->wals_flags & WALS_INFORM_CLOSE_TO_JOURNAL) );
write_wal_statistics(WAL_handle); write_wal_statistics(WAL_handle);
WAL_segment->wals_flags |= WALS_WRITER_DONE; WAL_segment->wals_flags |= WALS_WRITER_DONE;
WAL_segment->wals_writer_pid = 0; WAL_segment->wals_writer_pid = 0;
@ -627,10 +627,11 @@ static SSHORT walw_writer(ISC_STATUS * status_vector, WAL WAL_handle)
} }
static void close_log( static void close_log(ISC_STATUS * status_vector,
ISC_STATUS * status_vector,
WAL WAL_handle, WAL WAL_handle,
SCHAR * logname, WALFH log_header, SLONG journal_flag) SCHAR * logname,
WALFH log_header,
bool journal_flag)
{ {
/************************************** /**************************************
* *
@ -701,11 +702,11 @@ static void close_log(
} }
static SSHORT discard_prev_logs( static SSHORT discard_prev_logs(ISC_STATUS * status_vector,
ISC_STATUS * status_vector,
SCHAR * dbname, SCHAR * dbname,
SCHAR * starting_logname, SCHAR * starting_logname,
SLONG starting_log_partition_offset, SSHORT delete_flag) SLONG starting_log_partition_offset,
bool delete_flag)
{ {
/************************************** /**************************************
* *
@ -717,7 +718,7 @@ SLONG starting_log_partition_offset, SSHORT delete_flag)
* From the starting_logname backwards, excluding the starting * From the starting_logname backwards, excluding the starting
* one, mark all the log files as NOT needed for short-term * one, mark all the log files as NOT needed for short-term
* recovery. Delete those files if appropriate AND/OR if * recovery. Delete those files if appropriate AND/OR if
* delete_flag is TRUE. * delete_flag is true.
* *
* If there is any error, return FB_FAILURE else return FB_SUCCESS. * If there is any error, return FB_FAILURE else return FB_SUCCESS.
* In case of error, status_vector would be updated. * In case of error, status_vector would be updated.
@ -797,7 +798,7 @@ SLONG starting_log_partition_offset, SSHORT delete_flag)
file for short-term recovery. */ file for short-term recovery. */
WALF_set_log_header_flag(status_vector, dbname, log_name, WALF_set_log_header_flag(status_vector, dbname, log_name,
log_partition_offset, log_partition_offset,
WALFH_KEEP_FOR_SHORT_TERM_RECV, 0); WALFH_KEEP_FOR_SHORT_TERM_RECV, false);
} }
} }
@ -876,7 +877,7 @@ static SSHORT flush_all_buffers( ISC_STATUS * status_vector, WAL WAL_handle)
/* Prepare and flush the associated buffer to log file. */ /* Prepare and flush the associated buffer to log file. */
if (!wblk->walblk_flags & WALBLK_to_be_written) if (!wblk->walblk_flags & WALBLK_to_be_written)
WALC_setup_buffer_block(WAL_segment, wblk, 0); WALC_setup_buffer_block(WAL_segment, wblk, false);
prepare_wal_block(WAL_segment, wblk); prepare_wal_block(WAL_segment, wblk);
if ((ret = write_wal_block(status_vector, wblk, if ((ret = write_wal_block(status_vector, wblk,
@ -936,10 +937,10 @@ static SSHORT get_logfile_index( WALS WAL_segment, SCHAR * logname)
} }
static bool get_log_usability( static bool get_log_usability(ISC_STATUS * status_vector,
ISC_STATUS * status_vector,
SCHAR * dbname, SCHAR * dbname,
SCHAR * logname, SLONG log_partition_offset) SCHAR * logname,
SLONG log_partition_offset)
{ {
/************************************** /**************************************
* *
@ -948,7 +949,7 @@ static bool get_log_usability(
************************************** **************************************
* *
* Functional description * Functional description
* Returns TRUE if the given logname is usable else returns FALSE. * Returns true if the given logname is usable else returns false.
* If logname is usable, new_logname and new_offset are updated. * If logname is usable, new_logname and new_offset are updated.
* *
**************************************/ **************************************/
@ -1077,11 +1078,11 @@ SLONG * new_offset, SLONG * log_type)
} }
static SSHORT get_next_serial_logname( static SSHORT get_next_serial_logname(ISC_STATUS * status_vector,
ISC_STATUS * status_vector,
WALS WAL_segment, WALS WAL_segment,
SCHAR * new_logname, SCHAR * new_logname,
SLONG * new_offset, SLONG * log_type) SLONG * new_offset,
SLONG * log_type)
{ {
/************************************** /**************************************
* *
@ -1098,7 +1099,7 @@ SLONG * new_offset, SLONG * log_type)
SCHAR last_logname[MAXPATHLEN]; SCHAR last_logname[MAXPATHLEN];
SLONG last_log_partition_offset; SLONG last_log_partition_offset;
SLONG last_log_flags; SLONG last_log_flags;
SSHORT any_log_to_be_archived; bool any_log_to_be_archived;
SLONG fd; SLONG fd;
int retry_count; int retry_count;
#define MAX_RETRIES 1000 #define MAX_RETRIES 1000
@ -1120,7 +1121,8 @@ SLONG * new_offset, SLONG * log_type)
logf->logf_fname_seqno); logf->logf_fname_seqno);
logf->logf_fname_seqno++; logf->logf_fname_seqno++;
if (LLIO_open(status_vector, new_logname, LLIO_OPEN_NEW_RW, TRUE, &fd) if (LLIO_open(status_vector, new_logname, LLIO_OPEN_NEW_RW, TRUE, &fd)
== FB_SUCCESS) { == FB_SUCCESS)
{
/* Found one */ /* Found one */
LLIO_close(status_vector, fd); LLIO_close(status_vector, fd);
@ -1186,24 +1188,26 @@ static bool get_next_usable_partition(
* *
* Functional description * Functional description
* Tries to find a usable partition in the master_logname. * Tries to find a usable partition in the master_logname.
* Returns TRUE if a usable partition is found else returns FALSE. * Returns true if a usable partition is found else returns false.
* new_logname and new_offset are updated in case of success. * new_logname and new_offset are updated in case of success.
* *
**************************************/ **************************************/
SLONG p_log_fd; SLONG p_log_fd;
int i, j, count; int i;
int j;
int count;
bool found; bool found;
SLONG p_offset; SLONG p_offset;
P_LOGFH p_log_header = (P_LOGFH) gds__alloc(P_LOGFH_LENGTH); P_LOGFH p_log_header = (P_LOGFH) gds__alloc(P_LOGFH_LENGTH);
/* NOMEM: return failure, FREE: by returns in this procedure */ /* NOMEM: return failure, FREE: by returns in this procedure */
if (!p_log_header) if (!p_log_header)
return FALSE; return false;
if (WALF_open_partitioned_log_file(status_vector, dbname, master_logname, if (WALF_open_partitioned_log_file(status_vector, dbname, master_logname,
p_log_header, &p_log_fd) != FB_SUCCESS) { p_log_header, &p_log_fd) != FB_SUCCESS) {
gds__free((SLONG *) p_log_header); gds__free((SLONG *) p_log_header);
return FALSE; return false;
} }
/* Now check for a free partition */ /* Now check for a free partition */
@ -1270,7 +1274,8 @@ SLONG * new_offset, SLONG * log_type)
logf->logf_fname_seqno++; logf->logf_fname_seqno++;
if (LLIO_open if (LLIO_open
(status_vector, new_logname, LLIO_OPEN_NEW_RW, TRUE, (status_vector, new_logname, LLIO_OPEN_NEW_RW, TRUE,
&fd) == FB_SUCCESS) { &fd) == FB_SUCCESS)
{
LLIO_close(status_vector, fd); LLIO_close(status_vector, fd);
*new_offset = 0; *new_offset = 0;
break; break;
@ -1772,7 +1777,7 @@ static SSHORT rollover_log(
ret = setup_log(status_vector, WAL_handle, new_logname, ret = setup_log(status_vector, WAL_handle, new_logname,
new_log_partition_offset, log_type, new_log_partition_offset, log_type,
&new_log_fd, new_log_header, TRUE, &new_log_fd, new_log_header, true,
WAL_segment->wals_logname, WAL_segment->wals_logname,
WAL_segment->wals_log_partition_offset); WAL_segment->wals_log_partition_offset);
if (ret == FB_SUCCESS) { if (ret == FB_SUCCESS) {
@ -1804,7 +1809,7 @@ static SSHORT rollover_log(
log_header->walfh_length = saved_flushed_offset; log_header->walfh_length = saved_flushed_offset;
log_header->walfh_hibsn = WAL_segment->wals_blkseqno - 1; log_header->walfh_hibsn = WAL_segment->wals_blkseqno - 1;
close_log(status_vector, WAL_handle, saved_logname, log_header, TRUE); close_log(status_vector, WAL_handle, saved_logname, log_header, true);
/* This is a good place to inform the long term journal server /* This is a good place to inform the long term journal server
that we have rolled over to a new log file. Note that the close that we have rolled over to a new log file. Note that the close
@ -1881,15 +1886,16 @@ static void setup_for_checkpoint( WALS WAL_segment)
} }
static SSHORT setup_log( static SSHORT setup_log(ISC_STATUS * status_vector,
ISC_STATUS * status_vector,
WAL WAL_handle, WAL WAL_handle,
SCHAR * logname, SCHAR * logname,
SLONG log_partition_offset, SLONG log_partition_offset,
SLONG log_type, SLONG log_type,
SLONG * logfile_fd, SLONG * logfile_fd,
WALFH log_header, WALFH log_header,
SSHORT rollover, SCHAR * prev_logname, SLONG prev_log_partition_offset) bool rollover,
SCHAR * prev_logname,
SLONG prev_log_partition_offset)
{ {
/************************************** /**************************************
* *
@ -1962,18 +1968,17 @@ SSHORT rollover, SCHAR * prev_logname, SLONG prev_log_partition_offset)
} }
static SSHORT setup_log_header_info( static SSHORT setup_log_header_info(ISC_STATUS * status_vector,
ISC_STATUS * status_vector,
WAL WAL_handle, WAL WAL_handle,
SCHAR * logname, SCHAR * logname,
SLONG log_partition_offset, SLONG log_partition_offset,
SLONG log_type, SLONG log_type,
SLONG * logfile_fd, SLONG * logfile_fd,
WALFH log_header, WALFH log_header,
SSHORT rollover, bool rollover,
SCHAR * prev_logname, SCHAR * prev_logname,
SLONG prev_log_partition_offset, SLONG prev_log_partition_offset,
bool* takeover) bool * takeover)
{ {
/************************************** /**************************************
* *
@ -1984,7 +1989,7 @@ static SSHORT setup_log_header_info(
* Functional description * Functional description
* Open a given log file. * Open a given log file.
* Initialize the log file header information. * Initialize the log file header information.
* If 'rollover' flag is TRUE, then we are going to open a new log * If 'rollover' flag is true, then we are going to open a new log
* file. So use the 'prev_logname' as the previous log file * file. So use the 'prev_logname' as the previous log file
* name for the new log file. * name for the new log file.
* If we are opening an existing log file and it has a 'next' log * If we are opening an existing log file and it has a 'next' log
@ -1992,7 +1997,7 @@ static SSHORT setup_log_header_info(
* call. * call.
* *
* If we determine that this is a takeover situation, set the takeover * If we determine that this is a takeover situation, set the takeover
* parameter to TRUE. * parameter to true.
* *
* Returns FB_SUCCESS or FB_FAILURE. * Returns FB_SUCCESS or FB_FAILURE.
* *