8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 10:43:03 +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"
// 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 exit_code =
ALICE_gfix( service->svc_argc,
service->svc_argv,
output_thread,
(SLONG) service);
int exit_code = ALICE_gfix(service->svc_argc, service->svc_argv,
output_thread, (SLONG) service);
service->svc_handle = 0;
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,
char* argv[],
int(*output_proc)(SLONG, UCHAR*),
int(*output_proc) (SLONG, UCHAR*),
SLONG output_data)
{
IN_SW_TAB table = alice_in_sw_table;
USHORT error;
bool error;
TEXT* database;
TEXT string[512];
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
// by 3 file descriptors to use in re-directing ib_stdin, ib_stdout, and ib_stderr.
tdgbl->sw_service = FALSE;
tdgbl->sw_service_thd = FALSE;
tdgbl->sw_service = false;
tdgbl->sw_service_thd = false;
tdgbl->service_blk = NULL;
tdgbl->status =
/* TMN: cast away volatile */
(long *) tdgbl->status_vector;
if (argc > 1 && !strcmp(argv[1], "-svc")) {
tdgbl->sw_service = TRUE;
tdgbl->sw_service = true;
argv++;
argc--;
}
else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) {
tdgbl->sw_service = TRUE;
tdgbl->sw_service_thd = TRUE;
tdgbl->sw_service = true;
tdgbl->sw_service_thd = true;
tdgbl->service_blk = (SVC) output_data;
tdgbl->status = tdgbl->service_blk->svc_status;
argv++;
argc--;
}
else if (argc > 4 && !strcmp(argv[1], "-svc_re")) {
tdgbl->sw_service = TRUE;
tdgbl->sw_service = true;
tdgbl->output_proc = output_svc;
redir_in = atol(argv[2]);
redir_out = atol(argv[3]);
@ -304,7 +301,7 @@ int ALICE_gfix(int argc,
// Start by parsing switches
error = 0;
error = false;
switches = 0;
tdgbl->ALICE_data.ua_shutdown_delay = 0;
database = NULL;
@ -335,12 +332,12 @@ int ALICE_gfix(int argc,
if (!string[1]) {
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;
if (!p) {
ALICE_print(2, *--argv, 0, 0, 0, 0); /* msg 2: invalid switch %s */
error = TRUE;
error = true;
break;
}
@ -364,7 +361,7 @@ int ALICE_gfix(int argc,
if ((table->in_sw_incompatibilities & switches) ||
(table->in_sw_requires && !(table->in_sw_requires & switches))) {
ALICE_print(4, 0, 0, 0, 0, 0); /* msg 4: incompatible switch combination */
error = TRUE;
error = true;
break;
}
switches |= table->in_sw_value;
@ -449,9 +446,9 @@ int ALICE_gfix(int argc,
}
ALICE_down_case(*argv++, string);
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)) {
tdgbl->ALICE_data.ua_force = FALSE;
tdgbl->ALICE_data.ua_force = false;
} else {
ALICE_error(11); /* msg 11: "sync" or "async" required */
}
@ -463,9 +460,9 @@ int ALICE_gfix(int argc,
}
ALICE_down_case(*argv++, string);
if (!strcmp(string, "full")) {
tdgbl->ALICE_data.ua_use = TRUE;
tdgbl->ALICE_data.ua_use = true;
} else if (!strcmp(string, "reserve")) {
tdgbl->ALICE_data.ua_use = FALSE;
tdgbl->ALICE_data.ua_use = false;
} else {
ALICE_error(12); /* msg 12: "full" or "reserve" required */
}
@ -520,9 +517,9 @@ int ALICE_gfix(int argc,
}
ALICE_down_case(*argv++, string);
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)) {
tdgbl->ALICE_data.ua_read_only = FALSE;
tdgbl->ALICE_data.ua_read_only = false;
} else {
ALICE_error(110); /* msg 110: "read_only" or "read_write" required */
}
@ -548,7 +545,7 @@ int ALICE_gfix(int argc,
#ifndef SUPERSERVER
ALICE_print(20, 0, 0, 0, 0, 0); /* msg 20: please retry, specifying an option */
#endif
error = TRUE;
error = true;
}
if (error) {

View File

@ -62,9 +62,9 @@ typedef struct user_action
ULONG ua_switches;
UCHAR *ua_user;
UCHAR *ua_password;
UCHAR ua_use;
UCHAR ua_force;
BOOLEAN ua_read_only;
bool ua_use;
bool ua_force;
bool ua_read_only;
SLONG ua_shutdown_delay;
SLONG ua_sweep_interval;
SLONG ua_transaction;
@ -170,8 +170,8 @@ public:
isc_tr_handle tr_handle;
ISC_STATUS* status;
USHORT sw_redirect;
USHORT sw_service;
USHORT sw_service_thd;
bool sw_service;
bool sw_service_thd;
};
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"
// conditionals, as the engine now fully supports
@ -78,7 +78,8 @@ static TEXT val_errors[] =
int EXE_action(TEXT * database, ULONG switches)
{
UCHAR dpb[128];
USHORT dpb_length, error;
USHORT dpb_length;
bool error;
FRBRD *handle;
UCHAR error_string[128];
USHORT i;
@ -96,7 +97,7 @@ int EXE_action(TEXT * database, ULONG switches)
dpb_length = build_dpb(dpb, switches);
error = FALSE;
error = false;
handle = NULL;
gds__attach_database(tdgbl->status, 0, database, &handle, dpb_length,
reinterpret_cast <SCHAR *>(dpb));
@ -104,7 +105,7 @@ int EXE_action(TEXT * database, ULONG switches)
SVC_STARTED(tdgbl->service_blk);
if (tdgbl->status[1])
error = TRUE;
error = true;
if (tdgbl->status[2] == isc_arg_warning)
ALICE_print_status(tdgbl->status);
@ -137,7 +138,8 @@ int EXE_action(TEXT * database, ULONG switches)
int EXE_two_phase(TEXT * database, ULONG switches)
{
UCHAR dpb[128];
USHORT dpb_length, error;
USHORT dpb_length;
bool error;
FRBRD *handle;
USHORT i;
TGBL tdgbl;
@ -154,7 +156,7 @@ int EXE_two_phase(TEXT * database, ULONG switches)
dpb_length = build_dpb(dpb, switches);
error = FALSE;
error = false;
handle = NULL;
gds__attach_database(tdgbl->status, 0, database, &handle,
dpb_length, reinterpret_cast < char *>(dpb));
@ -162,12 +164,11 @@ int EXE_two_phase(TEXT * database, ULONG switches)
SVC_STARTED(tdgbl->service_blk);
if (tdgbl->status[1])
error = TRUE;
error = true;
else if (switches & sw_list)
TDR_list_limbo((handle), database, switches);
else if (switches & (sw_commit | sw_rollback | sw_two_phase))
error =
TDR_reconnect_multiple((handle),
error = TDR_reconnect_multiple((handle),
tdgbl->ALICE_data.ua_transaction, database,
switches);
@ -261,18 +262,18 @@ static USHORT build_dpb(UCHAR * dpb, ULONG switches)
else if (switches & sw_write) {
*d++ = gds_dpb_force_write;
*d++ = 1;
*d++ = tdgbl->ALICE_data.ua_force;
*d++ = tdgbl->ALICE_data.ua_force ? 1 : 0;
}
else if (switches & sw_use) {
*d++ = gds_dpb_no_reserve;
*d++ = 1;
*d++ = tdgbl->ALICE_data.ua_use;
*d++ = tdgbl->ALICE_data.ua_use ? 1 : 0;
}
else if (switches & sw_mode) {
*d++ = isc_dpb_set_db_readonly;
*d++ = 1;
*d++ = tdgbl->ALICE_data.ua_read_only;
*d++ = (tdgbl->ALICE_data.ua_read_only) ? 1 : 0;
}
else if (switches & sw_shut) {
*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
//
@ -54,7 +54,7 @@ static ULONG ask(void);
static void print_description(TDR);
static void reattach_database(TDR);
static void reattach_databases(TDR);
static BOOLEAN reconnect(FRBRD *, SLONG, TEXT *, ULONG);
static bool reconnect(FRBRD *, SLONG, TEXT *, ULONG);
#define NEWLINE "\n"
@ -175,8 +175,9 @@ USHORT TDR_analyze(TDR trans)
// Attempt to attach a database with a given pathname.
//
BOOLEAN TDR_attach_database(ISC_STATUS * status_vector,
TDR trans, TEXT * pathname)
bool TDR_attach_database(ISC_STATUS * status_vector,
TDR trans,
TEXT * pathname)
{
UCHAR dpb[128], *d, *q;
USHORT dpb_length;
@ -197,9 +198,7 @@ BOOLEAN TDR_attach_database(ISC_STATUS * status_vector,
if (tdgbl->ALICE_data.ua_user) {
*d++ = gds_dpb_user_name;
*d++ =
strlen(reinterpret_cast <
const char *>(tdgbl->ALICE_data.ua_user));
*d++ = strlen(reinterpret_cast <const char *>(tdgbl->ALICE_data.ua_user));
for (q = tdgbl->ALICE_data.ua_user; *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_status(status_vector);
}
return FALSE;
return false;
}
MET_set_capabilities(status_vector, trans);
@ -239,7 +238,7 @@ BOOLEAN TDR_attach_database(ISC_STATUS * status_vector,
if (tdgbl->ALICE_data.ua_debug)
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;
ISC_STATUS_ARRAY status_vector;
SLONG id;
USHORT item, flag, length;
USHORT item;
bool flag;
USHORT length;
TDR trans;
TGBL tdgbl;
@ -310,7 +311,7 @@ void TDR_list_limbo(FRBRD *handle, TEXT * name, ULONG switches)
}
ptr = buffer;
flag = TRUE;
flag = true;
while (flag) {
item = *ptr++;
@ -320,7 +321,8 @@ void TDR_list_limbo(FRBRD *handle, TEXT * name, ULONG switches)
case gds_info_limbo:
id = gds__vax_integer(ptr, length);
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);
ptr += length;
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 */
case gds_info_end:
flag = FALSE;
flag = false;
break;
default:
@ -381,13 +383,15 @@ void TDR_list_limbo(FRBRD *handle, TEXT * name, ULONG switches)
// gfix user.
//
BOOLEAN TDR_reconnect_multiple(FRBRD *handle,
SLONG id, TEXT * name, ULONG switches)
bool TDR_reconnect_multiple(FRBRD *handle,
SLONG id,
TEXT * name,
ULONG switches)
{
TDR trans, ptr;
ISC_STATUS_ARRAY status_vector;
USHORT advice;
BOOLEAN error = FALSE;
bool error = false;
// get the state of all the associated transactions
@ -488,7 +492,7 @@ BOOLEAN TDR_reconnect_multiple(FRBRD *handle,
else
{
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
@ -510,7 +514,7 @@ BOOLEAN TDR_reconnect_multiple(FRBRD *handle,
static void print_description(TDR trans)
{
TDR ptr;
BOOLEAN prepared_seen;
bool prepared_seen;
#ifdef SUPERSERVER
int i;
@ -528,7 +532,7 @@ static void print_description(TDR trans)
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)
{
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_limbo);
#endif
prepared_seen = TRUE;
prepared_seen = true;
break;
case TRA_commit:
@ -717,7 +721,7 @@ static ULONG ask(void)
switches = 0;
while (TRUE) {
while (true) {
ALICE_print(85, 0, 0, 0, 0, 0); /* msg 85: Commit, rollback, or neither (c, r, or n)? */
if (tdgbl->sw_service)
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)))
{
if (TDR_attach_database(status_vector, trans,
reinterpret_cast<char*>(trans->tdr_fullpath->str_data)))
reinterpret_cast<char*>
(trans->tdr_fullpath->str_data)))
{
return;
}
@ -789,9 +794,11 @@ static void reattach_database(TDR trans)
for (q = trans->tdr_fullpath->str_data; *q;)
*p++ = *q++;
*q = 0;
if (TDR_attach_database
(status_vector, trans,
reinterpret_cast < char *>(buffer))) return;
if (TDR_attach_database(status_vector, trans,
reinterpret_cast < char *>(buffer)))
{
return;
}
}
// 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;)
*p++ = *q++;
*q = 0;
if (TDR_attach_database
(status_vector, trans,
reinterpret_cast < char *>(buffer))) return;
if (TDR_attach_database (status_vector, trans,
reinterpret_cast < char *>(buffer)))
{
return;
}
}
// we have failed to reattach; notify the user
@ -828,8 +837,7 @@ static void reattach_database(TDR trans)
p = buffer;
while (*p == ' ')
*p++;
if (TDR_attach_database(status_vector,
trans,
if (TDR_attach_database(status_vector, trans,
reinterpret_cast<char*>(p)))
{
string = FB_NEW_RPT(*tdgbl->ALICE_default_pool,
@ -868,8 +876,10 @@ static void reattach_databases(TDR trans)
// Commit or rollback a named transaction.
//
static BOOLEAN reconnect(FRBRD *handle,
SLONG number, TEXT * name, ULONG switches)
static bool reconnect(FRBRD *handle,
SLONG number,
TEXT * name,
ULONG switches)
{
FRBRD *transaction;
SLONG id;
@ -879,17 +889,20 @@ static BOOLEAN reconnect(FRBRD *handle,
transaction = NULL;
if (gds__reconnect_transaction(status_vector, &handle, &transaction,
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);
return TRUE;
return true;
}
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();
if (switches == (ULONG) - 1) {
ALICE_print(84, 0, 0, 0, 0, 0); /* msg 84: unexpected end of input */
return TRUE;
ALICE_print(84, 0, 0, 0, 0, 0);
// msg 84: unexpected end of input
return true;
}
}
@ -898,13 +911,13 @@ static BOOLEAN reconnect(FRBRD *handle,
else if (switches & sw_rollback)
gds__rollback_transaction(status_vector, &transaction);
else
return FALSE;
return false;
if (status_vector[1]) {
ALICE_print_status(status_vector);
return TRUE;
return true;
}
return FALSE;
return false;
}

View File

@ -25,10 +25,10 @@
#define ALICE_TDR_PROTO_H
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);
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);
#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);
#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
#define QUIT 0
@ -158,7 +158,7 @@ static int api_gbak(int, char**, USHORT, TEXT*, TEXT*, TEXT *, BOOLEAN, BOOLEAN)
#define GBYTE MBYTE * KBYTE
#if defined (WIN95)
static BOOL fAnsiCP = FALSE;
static bool fAnsiCP = false;
#define TRANSLATE_CP(a) if (!fAnsiCP) AnsiToOem(a, a)
#else
#define TRANSLATE_CP(a)
@ -275,7 +275,9 @@ int CLIB_ROUTINE main(int argc, char* argv[])
USHORT total;
TEXT **end, **argvp, *string, *p, *q, c;
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 *d_user, *d_password, *d_service;
@ -286,7 +288,6 @@ int CLIB_ROUTINE main(int argc, char* argv[])
/* Initialize data */
total = 0;
flag_restore = flag_verbose = err = FALSE;
sw_user = sw_password = sw_service = d_user = d_password = d_service = NULL;
/* 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_R: /* replace database */
total += strlen(string) + 1;
flag_restore = TRUE;
flag_restore = true;
break;
case IN_SW_BURP_USER: /* default user name */
if (argvp >= end)
err = TRUE;
err = true;
else {
sw_user = string;
d_user = *argvp++;
@ -329,7 +330,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
break;
case IN_SW_BURP_PASS: /* default password */
if (argvp >= end)
err = TRUE;
err = true;
else {
sw_password = string;
d_password = *argvp++;
@ -337,7 +338,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
break;
case IN_SW_BURP_SE: /* service name */
if (argvp >= end) {
err = TRUE;
err = true;
} else {
sw_service = string;
d_service = *argvp++;
@ -345,7 +346,7 @@ int CLIB_ROUTINE main(int argc, char* argv[])
break;
case IN_SW_BURP_V: /* verify actions */
total += strlen(string) + 1;
flag_verbose = TRUE;
flag_verbose = true;
break;
default:
total += strlen(string) + 1;
@ -527,7 +528,7 @@ int BURP_gbak(int argc,
redir_err = atol(argv[4]);
#ifdef WIN_NT
#if defined (WIN95)
fAnsiCP = TRUE;
fAnsiCP = true;
#endif
redir_in = _open_osfhandle(redir_in, 0);
redir_out = _open_osfhandle(redir_out, 0);
@ -1953,14 +1954,14 @@ static ULONG get_size( SCHAR * string, FIL file)
**********************************************/
SCHAR *num, c;
ULONG size;
BOOLEAN digit;
bool digit;
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)) {
size = size * 10 + (c - '0');
digit = TRUE;
digit = true;
}
else {
if (isalpha(c)) {
@ -2004,8 +2005,8 @@ static int api_gbak(int argc,
TEXT * password,
TEXT * user,
TEXT * service,
BOOLEAN restore,
BOOLEAN verbose)
bool restore,
bool verbose)
{
/**********************************************
*

View File

@ -108,9 +108,9 @@ static int get_text(UCHAR*, SSHORT);
static void prompt_for_name(SCHAR*, int);
static void put_asciz(SCHAR, SCHAR*);
static void put_numeric(SCHAR, int);
static bool read_header(DESC, ULONG*, USHORT*, USHORT);
static bool write_header(DESC, ULONG, USHORT);
static DESC next_volume(DESC, int, USHORT);
static bool read_header(DESC, ULONG*, USHORT*, bool);
static bool write_header(DESC, ULONG, bool);
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->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)
{
@ -270,14 +270,14 @@ void MVOL_init_write(UCHAR* database_name,
BURP_ALLOC(temp_buffer_size + MAX_HEADER_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)
{
BURP_error(269, tdgbl->action->act_file->fil_name, 0, 0, 0, 0);
/* 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;
@ -313,7 +313,7 @@ int MVOL_read(int* cnt, UCHAR** ptr)
{
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)
{
break;
@ -371,7 +371,7 @@ int MVOL_read(int* cnt, UCHAR** ptr)
{
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)
break;
}
@ -554,7 +554,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr)
{
UCHAR *ptr;
ULONG left, cnt, size_to_write;
USHORT full_buffer;
bool full_buffer;
TGBL tdgbl;
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;
if (left >= tdgbl->mvol_io_buffer_size)
full_buffer = TRUE;
full_buffer = true;
else
full_buffer = FALSE;
full_buffer = false;
tdgbl->file_desc =
next_volume(tdgbl->file_desc, MODE_WRITE, full_buffer);
if (full_buffer)
@ -870,7 +870,9 @@ static int get_text(UCHAR* text, SSHORT length)
// Get specification for the next volume (tape).
// 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];
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. */
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);
continue;
@ -1148,7 +1150,7 @@ static void put_numeric( SCHAR attribute, int value)
static bool read_header(DESC handle,
ULONG* buffer_size,
USHORT* format,
USHORT init_flag)
bool init_flag)
{
int attribute, temp;
SSHORT l;
@ -1283,7 +1285,7 @@ static bool read_header(DESC handle,
//
static bool write_header(DESC handle,
ULONG backup_buffer_size,
USHORT full_buffer)
bool full_buffer)
{
ULONG vax_value;
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_read_and_write(FILE_DESC, FILE_DESC,
TEXT *, SLONG, UCHAR **, BOOLEAN *);
TEXT *, SLONG, UCHAR **, bool *);
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 *);
@ -147,7 +147,7 @@ static int print_clo(TEXT *);
static int read_and_write(FILE_DESC, FILE_DESC,
TEXT *, SLONG,
double, UCHAR **, BOOLEAN *, double *, SLONG *);
double, UCHAR **, bool *, double *, SLONG *);
static int read_and_write_for_join(FILE_DESC, TEXT *,
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[])
{
@ -169,9 +169,12 @@ int main( int argc, char *argv[])
SCHAR **end, *prog_name, *string;
IN_SW_TAB in_sw_tab;
USHORT sw_replace;
B_FIL file_ptr, file_list, prev_file;
BOOLEAN file_nm_sw = FALSE;
SLONG ret_cd, file_num = 0;
B_FIL file_ptr;
B_FIL file_list;
B_FIL prev_file;
bool file_nm_sw = false;
SLONG ret_cd;
SLONG file_num = 0;
double file_size;
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",
argv[0]);
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_size = -1;
sw_replace = FALSE;
sw_replace = 0;
end = argv + argc;
++argv;
@ -218,12 +221,12 @@ int main( int argc, char *argv[])
ret_cd = free_file_list(file_list);
return FB_FAILURE;
}
} /* end of processing (*string == '-') */
else { /* processing function specific command line options */
} // end of processing (*string == '-')
else { // processing function specific command line options
switch (sw_replace) {
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_num = file_num + 1;
@ -255,7 +258,7 @@ int main( int argc, char *argv[])
return FB_FAILURE;
}
file_nm_sw = TRUE;
file_nm_sw = true;
file_ptr->b_fil_number = file_num;
if (file_list == NULL)
@ -268,7 +271,7 @@ int main( int argc, char *argv[])
} /* processing file name */
else { /* processing file size */
file_nm_sw = FALSE;
file_nm_sw = false;
ret_cd = get_file_size(prog_name, string, &file_size);
if (ret_cd == FB_FAILURE) {
ret_cd = free_file_list(file_list);
@ -310,7 +313,7 @@ int main( int argc, char *argv[])
} /* processing function specific command line options */
} /* while (argv < end) */
if ((file_list == NULL) && (sw_replace != FALSE)) {
if ((file_list == NULL) && (sw_replace)) {
ib_fprintf(ib_stderr,
"%s: invalid option '%s', rest of parameters is missing\n",
prog_name, string);
@ -361,7 +364,7 @@ int main( int argc, char *argv[])
static int get_function_option(SCHAR* prog_name,
USHORT* sw_replace,
USHORT * sw_replace,
SCHAR* string,
IN_SW_TAB in_sw_table)
{
@ -379,7 +382,6 @@ static int get_function_option(SCHAR* prog_name,
*/
SCHAR c, *p, *q;
USHORT op_specified;
IN_SW_TAB in_sw_tab;
SLONG ret_cd;
@ -389,15 +391,13 @@ static int get_function_option(SCHAR* prog_name,
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 (p = string + 1; c = *p++;)
if (UPPER(c) != *q++)
break;
if (!c) {
if (*sw_replace == FALSE) {
*sw_replace = in_sw_tab->in_sw;
if (*sw_replace == 0) {
*sw_replace = (in_sw_tab->in_sw);
return FB_SUCCESS;
}
else {
@ -569,7 +569,8 @@ static int gen_multy_bakup_files(B_FIL file_list,
FILE_DESC output_fl_desc;
SLONG byte_write, clock, indx, io_size, remaining_io_len, ret_cd, pos;
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];
UCHAR *remaining_io;
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++)
hdr_rec.fl_name[indx] = BLANK;
while (TRUE) {
while (true) {
if (fl_ptr != NULL) {
byte_read = 0;
byte_write = 0;
@ -671,7 +672,7 @@ static int gen_multy_bakup_files(B_FIL file_list,
io_size = IO_BUFFER_SIZE;
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,
file_name, io_size, &io_buffer,
&end_of_input);
@ -680,7 +681,7 @@ static int gen_multy_bakup_files(B_FIL file_list,
return FB_FAILURE;
}
if (end_of_input == TRUE) {
if (end_of_input == true) {
free(io_buffer);
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_len = IO_BUFFER_SIZE - byte_write;
while ((flush_done == FALSE)
while ((flush_done == false)
&& (fl_ptr != NULL)) {
if ((fl_ptr->b_fil_next == NULL)
&& (fl_ptr->b_fil_size == 0))
@ -765,7 +766,7 @@ static int gen_multy_bakup_files(B_FIL file_list,
free(io_buffer);
return FB_FAILURE;
}
if (flush_done == TRUE) {
if (flush_done == true) {
file_size = file_size - byte_write;
byte_write = 0;
}
@ -783,13 +784,13 @@ static int gen_multy_bakup_files(B_FIL file_list,
break;
}
if (end_of_input == TRUE) {
if (end_of_input == true) {
free(io_buffer);
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,
double file_size,
UCHAR ** io_buffer,
BOOLEAN * end_of_input,
bool * end_of_input,
double *byte_read,
SLONG * byte_write)
{
@ -839,7 +840,7 @@ static int read_and_write(FILE_DESC input_file_desc,
switch (read_cnt) {
case (0): /* no more data to be read */
close(output_fl_desc);
*end_of_input = TRUE;
*end_of_input = true;
*byte_read = *byte_read + read_cnt;
return FB_SUCCESS;
break;
@ -883,7 +884,7 @@ static int final_read_and_write(FILE_DESC input_file_desc,
TEXT * file_name,
SLONG io_size,
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) {
case (0): /* no more data to be read */
close(output_fl_desc);
*end_of_input = TRUE;
*end_of_input = true;
return FB_SUCCESS;
break;
@ -1086,7 +1087,7 @@ SLONG cnt, SLONG * total_int)
read_cnt = read(input_fl_desc, *io_buffer, IO_BUFFER_SIZE);
while (TRUE) {
while (true) {
switch (read_cnt) {
case (0): /* no more data to be read */
close(input_fl_desc);
@ -1117,7 +1118,7 @@ SLONG cnt, SLONG * total_int)
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;
indx = 3;
while (TRUE) {
while (true) {
mod = i % 10;
switch (mod) {
case (0):
@ -1262,7 +1263,7 @@ static int flush_io_buff(UCHAR* remaining_io,
FILE_DESC output_fl_desc,
double file_size,
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
** then
** set and returns flush_done TRUE
** set and returns flush_done true
** otherwise
** closes the output file, set and returns flush_done FALSE.
** closes the output file, set and returns flush_done false.
** otherwise
** we can only writes out as much data as file_size indicated
** if it was able to write out the remaining data
** then
** set and returns flush_done TRUE
** set and returns flush_done true
** 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) {
case (-1): /* write failed */
close(output_fl_desc);
*flush_done = FALSE;
*flush_done = false;
return FB_FAILURE;
break;
default:
if (write_cnt == remaining_io_len) /* write ok */
*flush_done = TRUE;
*flush_done = true;
else { /* could not write out all remaining data */
close(output_fl_desc);
*flush_done = FALSE;
*flush_done = false;
}
*byte_write = write_cnt;
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
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")) {
DDL_service = TRUE;
DDL_service = true;
argv++;
argc--;
}
else if (argc > 4 && !strcmp(argv[1], "-svc_re")) {
DDL_service = TRUE;
DDL_service = true;
redir_in = atol(argv[2]);
redir_out = atol(argv[3]);
redir_err = atol(argv[4]);
@ -167,7 +167,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
DDL_file_name = NULL;
DB_file_name = NULL;
DDL_drop_database = DDL_quit = DDL_extract = DDL_dynamic = DDL_trace =
DDL_version = FALSE;
DDL_version = false;
DDL_default_user = DDL_default_password = NULL;
file_name_1[0] = file_name_2[0] = 0;
@ -211,7 +211,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
}
switch (in_sw) {
case IN_SW_GDEF_D:
DDL_dynamic = TRUE;
DDL_dynamic = true;
DYN_file_name[0] = 0;
if (argc == 1)
break;
@ -252,20 +252,20 @@ int CLIB_ROUTINE main( int argc, char *argv[])
break;
case IN_SW_GDEF_G:
DDL_extract = TRUE;
DDL_extract = true;
break;
case IN_SW_GDEF_R:
DDL_replace = TRUE;
DDL_replace = true;
break;
case IN_SW_GDEF_T:
DDL_trace = TRUE;
DDL_trace = true;
break;
case IN_SW_GDEF_Z:
DDL_msg_put(0, GDS_VERSION, 0, 0, 0, 0); /* msg 0: gdef version %s\n */
DDL_version = TRUE;
DDL_version = true;
break;
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. */
else
DDL_msg_partial(8, 0, 0, 0, 0, 0); /* msg 8: \nNo errors. */
if (DDL_yes_no(10)) /* msg 10 : save changes before exiting? */
DDL_quit = DDL_errors = 0;
if (DDL_yes_no(10)){ // msg 10 : save changes before exiting?
DDL_quit = false;
DDL_errors = 0;
}
}
/* 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)
while ((d = ib_getc(ib_stdin)) != '\n' && d != EOF);
if (!count && c == EOF)
return FALSE;
return false;
if (UPPER(c) == UPPER(yes_ans[0]))
return TRUE;
return true;
if (UPPER(c) == UPPER(no_ans[0]))
return FALSE;
return false;
if (!reprompt
&& gds__msg_format(0, DDL_MSG_FAC, re_num, sizeof(reprompt),
reprompt, NULL, NULL, NULL, NULL, NULL) <= 0)

View File

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

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;
*
**************************************/
USHORT result;
bool result = false;
SYM symbol;
symbol = relation->rel_name;
result = FALSE;
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ symbol->sym_string
result = TRUE;
result = true;
END_FOR;
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;
USHORT result;
result = FALSE;
bool result = false;
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);
/* msg 323: a shared cache file %s already exists */
// msg 323: a shared cache file %s already exists
END_FOR;
if (result)
@ -1359,19 +1356,20 @@ static void add_index( DUDLEY_IDX index)
*
**************************************/
SYM *symbol;
USHORT i, size, error, if_any;
USHORT i;
USHORT size;
bool error = false;
bool if_any = false;
DUDLEY_FLD field;
error = if_any = FALSE;
FOR X IN RDB$RELATIONS WITH
X.RDB$RELATION_NAME = index->idx_relation->sym_string
if (!X.RDB$VIEW_BLR.NULL) {
DDL_err(42, index->idx_relation->sym_string, NULL, NULL, NULL, NULL);
/* msg 42: %s is a view and can not be indexed */
error = TRUE;
// msg 42: %s is a view and can not be indexed
error = true;
}
if_any = TRUE;
if_any = true;
END_FOR;
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);
MOVE_SYMBOL(index->idx_relation, X.RDB$RELATION_NAME);
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;
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;
}
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,
NULL, NULL);
/* msg 48: error creating index %s */
// msg 48: error creating index %s
return;
}
END_ERROR;
@ -1528,7 +1526,7 @@ static void add_log_files( DBB dbb)
if (!DDL_errors) {
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;
END_ERROR;
START_TRANSACTION;
@ -1599,13 +1597,12 @@ static void add_security_class( SCL sec_class)
*
**************************************/
SYM name;
USHORT if_any;
bool if_any = false;
name = sec_class->scl_name;
if_any = FALSE;
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);
/* msg 50: security class %s already exists */
END_FOR;
@ -1743,17 +1740,16 @@ static void add_user_privilege( USERPRIV upriv)
*
**************************************/
TEXT grantor[32], priv[7];
USHORT if_any, privflag;
bool if_any = false;
USHORT privflag;
USRE usr; /* user entry */
UPFE upf; /* user privilege field entry */
if_any = FALSE;
/* 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
strcpy(grantor, X.RDB$OWNER_NAME);
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any) {
@ -2018,9 +2014,7 @@ static bool check_function( SYM name)
* Check function for existence.
*
**************************************/
bool if_any;
if_any = false;
bool if_any = false;
FOR X IN RDB$FUNCTIONS WITH X.RDB$FUNCTION_NAME EQ name->sym_string
if_any = true;
@ -2055,14 +2049,14 @@ static bool check_range(DUDLEY_FLD field)
MOVE_SYMBOL(field->fld_name, name);
dims = field->fld_dimension;
/* existance: if neither is an array, life is good
else if there are dimensions they'd better match */
// existance: if neither is an array, life is good
// else if there are dimensions they'd better match
FOR X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name
if (!dims) {
if (!X.RDB$DIMENSIONS.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
match = true;
}
@ -2103,9 +2097,7 @@ static bool check_relation( SYM name)
* Check relation for existence.
*
**************************************/
bool if_any;
if_any = false;
bool if_any = false;
FOR X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->sym_string
if_any = true;
@ -2148,9 +2140,7 @@ static FRBRD *create_blob( SLONG * blob_id, USHORT bpb_length, UCHAR * bpb)
*
**************************************/
ISC_STATUS_ARRAY status_vector;
FRBRD *blob;
blob = NULL;
FRBRD *blob = NULL;
if (gds__create_blob2(status_vector, &DB, &gds_trans, &blob,
(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.
*
**************************************/
USHORT found;
found = FALSE;
bool found = false;
FOR FIL IN RDB$FILES WITH FIL.RDB$FILE_FLAGS EQ FILE_cache
ERASE FIL;
found = TRUE;
found = true;
END_FOR;
if (!found)
@ -2192,7 +2180,7 @@ static void drop_cache( DBB dbb)
COMMIT
ON_ERROR
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;
END_ERROR;
START_TRANSACTION;
@ -2219,10 +2207,10 @@ static void drop_field( DUDLEY_FLD field)
*
**************************************/
DUDLEY_REL relation;
USHORT error, if_any;
bool error = false;
bool if_any = false;
relation = field->fld_relation;
error = if_any = FALSE;
FOR X IN RDB$RELATION_FIELDS CROSS Y IN RDB$RELATION_FIELDS CROSS
Z IN RDB$VIEW_RELATIONS WITH
@ -2238,8 +2226,8 @@ static void drop_field( DUDLEY_FLD field)
relation->rel_name->sym_string,
Y.RDB$RELATION_NAME,
NULL, NULL);
/* msg 60: field %s from relation %s is referenced in view %s */
error = TRUE;
// msg 60: field %s from relation %s is referenced in view %s
error = true;
END_FOR;
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$FIELD_NAME EQ field->fld_name->sym_string
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
if (!if_any) {
@ -2260,12 +2248,11 @@ static void drop_field( DUDLEY_FLD field)
END_FOR;
}
ERASE X;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
DDL_err(61,
field->fld_name->sym_string,
DDL_err(61, field->fld_name->sym_string,
relation->rel_name->sym_string, NULL, NULL, NULL);
/* 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.
*
**************************************/
USHORT if_any;
if_any = FALSE;
bool if_any = false;
FOR F IN RDB$FILTERS WITH F.RDB$FUNCTION_NAME EQ filter->filter_name->sym_string
ERASE F;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -2311,10 +2296,9 @@ static void drop_function( FUNC function)
*
**************************************/
TEXT *name;
USHORT if_any;
bool if_any = false;
name = function->func_name->sym_string;
if_any = FALSE;
/* 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
ERASE FUNC;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -2346,10 +2330,8 @@ static void drop_global_field( DUDLEY_FLD field)
*
**************************************/
SCHAR *p;
USHORT if_any, error;
if_any = FALSE;
error = FALSE;
bool if_any = false;
bool error = false;
FOR Y IN RDB$RELATION_FIELDS WITH
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++);
*p = 0;
DDL_err(64,
Y.RDB$FIELD_SOURCE,
DDL_err(64, Y.RDB$FIELD_SOURCE,
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 */
error = TRUE;
// msg 64: field %s is used in relation %s (local name %s) and can not be dropped
error = true;
END_FOR;
if (error)
@ -2385,8 +2366,10 @@ static void drop_global_field( DUDLEY_FLD field)
FOR X IN RDB$FIELDS WITH
X.RDB$FIELD_NAME EQ field->fld_name->sym_string
ERASE X;
if_any = TRUE;
END_FOR if (!if_any)
if_any = true;
END_FOR
if (!if_any)
DDL_err(65, field->fld_name->sym_string, NULL, NULL, NULL, NULL);
/* msg 65: field %s doesn't exist */
}
@ -2405,10 +2388,9 @@ static void drop_index( DUDLEY_IDX index)
*
**************************************/
TEXT *name;
USHORT if_any;
bool if_any = false;
name = index->idx_name->sym_string;
if_any = FALSE;
/* 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
ERASE IDX;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -2440,10 +2422,9 @@ static void drop_relation( DUDLEY_REL relation)
*
**************************************/
TEXT *name;
USHORT if_any;
bool if_any = false;
name = relation->rel_name->sym_string;
if_any = FALSE;
FOR X IN RDB$VIEW_RELATIONS WITH X.RDB$RELATION_NAME EQ name
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
if (X.RDB$SYSTEM_FLAG == 1) {
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;
}
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any) {
@ -2516,14 +2497,13 @@ static void drop_security_class( SCL scl_class)
*
**************************************/
SYM name;
USHORT if_any;
bool if_any = false;
name = scl_class->scl_name;
if_any = FALSE;
FOR X IN RDB$SECURITY_CLASSES WITH X.RDB$SECURITY_CLASS EQ name->sym_string
ERASE X;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -2592,11 +2572,11 @@ static void drop_trigger( DUDLEY_TRG trigger)
*
**************************************/
TEXT *name;
USHORT if_any, others;
bool if_any = false;
bool others = false;
BASED_ON RDB$TRIGGERS.RDB$RELATION_NAME relation_name;
name = trigger->trg_name->sym_string;
if_any = others = FALSE;
/* 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
gds__vtov(X.RDB$RELATION_NAME, relation_name, sizeof(relation_name));
ERASE X;
if_any = TRUE;
if_any = true;
END_FOR;
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
RDB$RELATION_NAME WITH
F.RDB$RELATION_NAME = V.RDB$VIEW_NAME
others = TRUE;
others = true;
END_FOR;
if (!others) {
@ -2647,20 +2627,17 @@ static void drop_trigger_msg( TRGMSG trigmsg)
* Drop a trigger message.
*
**************************************/
USHORT if_any;
if_any = FALSE;
bool if_any = false;
FOR FIRST 1 X IN RDB$TRIGGER_MESSAGES WITH
X.RDB$TRIGGER_NAME EQ trigmsg->trgmsg_trg_name->sym_string AND
X.RDB$MESSAGE_NUMBER = trigmsg->trgmsg_number;
ERASE X;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
DDL_err(74,
(TEXT *)(SLONG) trigmsg->trgmsg_number,
DDL_err(74, (TEXT *)(SLONG) trigmsg->trgmsg_number,
trigmsg->trgmsg_trg_name->sym_string, NULL, NULL, NULL);
/* 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.
*
**************************************/
USHORT if_any;
bool if_any = false;
if (fldtype->typ_name->sym_length == 3 &&
!strncmp(fldtype->typ_name->sym_string, "ALL", 3)) {
@ -2690,13 +2667,11 @@ static void drop_type( TYP fldtype)
return;
}
if_any = FALSE;
FOR X IN RDB$TYPES WITH
X.RDB$FIELD_NAME EQ fldtype->typ_field_name->sym_string AND
X.RDB$TYPE_NAME EQ fldtype->typ_name->sym_string
ERASE X;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -2788,11 +2763,10 @@ static void erase_userpriv( USERPRIV upriv, TEXT * priv, USRE usr, UPFE upf)
*
**************************************/
TEXT *fldname, *relname, *usrname;
USHORT if_any;
bool if_any = false;
usrname = usr->usre_name->sym_string;
relname = upriv->userpriv_relation->sym_string;
if_any = FALSE;
/* 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
ERASE X;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
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
ERASE X;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
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.
*
**************************************/
USHORT if_any;
if_any = FALSE;
bool if_any = false;
FOR DUDLEY_FLD IN RDB$RELATION_FIELDS CROSS SRC IN RDB$FIELDS
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_segment_length = SRC.RDB$SEGMENT_LENGTH;
field->fld_sub_type = SRC.RDB$FIELD_SUB_TYPE;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -2914,8 +2886,9 @@ static void get_log_names(SCHAR * db_name,
**************************************/
SCHAR next_log[512], expanded_name[512];
SCHAR *cl, *nl;
int log_count, ret_val;
SSHORT not_archived;
int log_count;
int ret_val;
bool not_archived;
SLONG last_log_flag, next_offset;
SLONG log_seqno, log_length;
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 */
while (TRUE) {
while (true) {
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,
&next_offset, &last_log_flag,
&not_archived) != FB_SUCCESS)
&not_archived))
{
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)
break;
@ -2965,7 +2940,8 @@ static void get_log_names(SCHAR * db_name,
if (ret_val == FB_FAILURE)
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)
break;
@ -3547,12 +3523,11 @@ static void modify_field( DUDLEY_FLD field)
*
**************************************/
SYM name;
USHORT if_any;
bool if_any = false;
DUDLEY_REL relation;
relation = field->fld_relation;
name = field->fld_name;
if_any = FALSE;
FOR FIRST 1 X IN RDB$RELATION_FIELDS WITH
X.RDB$FIELD_NAME EQ name->sym_string AND
@ -3601,7 +3576,7 @@ static void modify_field( DUDLEY_FLD field)
}
END_MODIFY
if_any = TRUE;
if_any = true;
END_FOR
if (!if_any)
DDL_err(82, name->sym_string, NULL, NULL, NULL, NULL);
@ -3622,10 +3597,9 @@ static void modify_global_field( DUDLEY_FLD field)
*
**************************************/
SYM name;
USHORT if_any;
bool if_any = false;
name = field->fld_name;
if_any = FALSE;
FOR FIRST 1 X IN RDB$FIELDS WITH X.RDB$FIELD_NAME EQ name->sym_string
MODIFY X USING
@ -3701,7 +3675,7 @@ static void modify_global_field( DUDLEY_FLD field)
X.RDB$QUERY_HEADER.NULL = FALSE;
}
END_MODIFY
if_any = TRUE;
if_any = true;
END_FOR
if (!if_any)
@ -3723,18 +3697,16 @@ static void modify_index( DUDLEY_IDX index)
* Modify an index.
*
**************************************/
USHORT if_any;
if_any = FALSE;
bool if_any = false;
FOR X IN RDB$INDICES WITH X.RDB$INDEX_NAME = index->idx_name->sym_string
MODIFY X USING
if (index->idx_flags & IDX_active_flag) {
X.RDB$INDEX_INACTIVE = (index->idx_inactive) ? TRUE : FALSE;
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) {
X.RDB$INDEX_TYPE = index->idx_type;
X.RDB$INDEX_TYPE = (index->idx_type) ? TRUE : FALSE;
X.RDB$INDEX_TYPE.NULL = FALSE;
}
if (index->idx_flags & IDX_null_description)
@ -3747,7 +3719,7 @@ static void modify_index( DUDLEY_IDX index)
X.RDB$STATISTICS = -1.0;
}
END_MODIFY;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -3771,13 +3743,12 @@ static void modify_relation( DUDLEY_REL relation)
*
**************************************/
SYM name;
USHORT if_any;
bool if_any = false;
if (!(relation->rel_flags & rel_marked_for_modify)) {
return;
}
name = relation->rel_name;
if_any = FALSE;
FOR FIRST 1 X IN RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ name->sym_string
MODIFY X USING
@ -3802,7 +3773,7 @@ static void modify_relation( DUDLEY_REL relation)
MOVE_SYMBOL(relation->rel_filename, X.RDB$EXTERNAL_FILE);
}
END_MODIFY
if_any = TRUE;
if_any = true;
END_FOR
if (!if_any)
@ -3823,12 +3794,10 @@ static void modify_trigger( DUDLEY_TRG trigger)
* modify a trigger in rdb$triggers.
*
**************************************/
USHORT if_any;
bool if_any = false;
DUDLEY_REL relation;
TEXT buffer[32], *p, *q;
if_any = FALSE;
FOR FIRST 1 X IN RDB$TRIGGERS WITH
X.RDB$TRIGGER_NAME EQ trigger->trg_name->sym_string
MODIFY X USING
@ -3863,7 +3832,7 @@ static void modify_trigger( DUDLEY_TRG trigger)
store_text(trigger->trg_description, (SLONG*) &X.RDB$DESCRIPTION);
}
END_MODIFY;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -3884,9 +3853,7 @@ static void modify_trigger_msg( TRGMSG trigmsg)
* Modify a trigger message.
*
**************************************/
USHORT if_any;
if_any = FALSE;
bool if_any = false;
FOR FIRST 1 X IN RDB$TRIGGER_MESSAGES WITH
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
MOVE_SYMBOL(trigmsg->trgmsg_text, X.RDB$MESSAGE);
END_MODIFY;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)
@ -3914,9 +3881,7 @@ static void modify_type( TYP fldtype)
* Modify type value or description of a type for a field.
*
**************************************/
USHORT if_any;
if_any = FALSE;
bool if_any = false;
FOR FIRST 1 X IN RDB$TYPES WITH
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);
}
END_MODIFY;
if_any = TRUE;
if_any = true;
END_FOR;
if (!if_any)

View File

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

View File

@ -37,17 +37,17 @@
extern jmp_buf parse_env;
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_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_gen_id(void);
static CON parse_literal(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_primitive_value(USHORT *, USHORT *);
static DUDLEY_NOD parse_primitive_value(USHORT *, bool *);
static DUDLEY_CTX parse_relation(void);
static DUDLEY_NOD parse_relational(USHORT *);
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();
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);
if (MATCH(KW_OVER)) {
for (;;) {
@ -235,7 +235,7 @@ DUDLEY_NOD EXPR_statement(void)
}
else if (MATCH(KW_FOR)) {
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;
while (!MATCH(KW_END_FOR))
LLS_PUSH(EXPR_statement(), &stack);
@ -277,14 +277,14 @@ DUDLEY_NOD EXPR_statement(void)
else if (MATCH(KW_POST)) {
node = SYNTAX_NODE(nod_post, 1);
node->nod_count = 1;
node->nod_arg[0] = EXPR_value(0, 0);
node->nod_arg[0] = EXPR_value(0, NULL);
}
else {
node = SYNTAX_NODE(nod_assignment, 2);
node->nod_arg[1] = parse_field();
if (!MATCH(KW_EQUALS))
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);
@ -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;
USHORT local_count, local_flag;
USHORT local_count;
bool local_flag;
if (!paren_count) {
local_count = 0;
paren_count = &local_count;
}
if (!bool_flag) {
local_flag = FALSE;
local_flag = false;
bool_flag = &local_flag;
}
node = parse_add(paren_count, bool_flag);
while (TRUE) {
while (true) {
if (!MATCH(KW_BAR)) {
parse_terminating_parens(paren_count, &local_count);
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);
while (TRUE) {
while (true) {
if (MATCH(KW_PLUS))
operatr = nod_add;
else if (MATCH(KW_MINUS))
@ -497,7 +500,7 @@ static DUDLEY_NOD parse_field(void)
stack = NULL;
while (TRUE) {
while (true) {
LEX_real();
LLS_PUSH(PARSE_symbol(tok_ident), &stack);
if (!MATCH(KW_DOT))
@ -514,7 +517,7 @@ static DUDLEY_NOD parse_field(void)
stack = NULL;
for (;;) {
LLS_PUSH(EXPR_value(0, 0), &stack);
LLS_PUSH(EXPR_value(0, NULL), &stack);
if (MATCH(KW_R_BRCKET))
break;
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;
if (MATCH(KW_FIRST)) {
value = parse_primitive_value(0, 0);
value = parse_primitive_value(0, NULL);
if (!MATCH(KW_FROM))
PARSE_error(239, DDL_token.tok_string, NULL);
/* 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->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))
node->nod_arg[s_stt_default] = EXPR_value(0, 0);
node->nod_arg[s_stt_default] = EXPR_value(0, NULL);
return node;
}
@ -599,7 +603,7 @@ static DUDLEY_NOD parse_function(void)
if (MATCH(KW_LEFT_PAREN) && !MATCH(KW_RIGHT_PAREN))
for (;;) {
LLS_PUSH(EXPR_value(0, 0), &stack);
LLS_PUSH(EXPR_value(0, NULL), &stack);
if (MATCH(KW_RIGHT_PAREN))
break;
if (!MATCH(KW_COMMA))
@ -638,7 +642,7 @@ static DUDLEY_NOD parse_gen_id(void)
node->nod_count = 1;
node->nod_arg[1] = (DUDLEY_NOD) PARSE_symbol(tok_ident);
MATCH(KW_COMMA);
node->nod_arg[0] = EXPR_value(0, 0);
node->nod_arg[0] = EXPR_value(0, NULL);
parse_matching_paren();
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);
while (TRUE) {
while (true) {
if (MATCH(KW_ASTERISK))
operatr = nod_multiply;
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:
LEX_token();
sub = parse_primitive_value(paren_count, 0);
sub = parse_primitive_value(paren_count, NULL);
if (sub->nod_type == nod_literal) {
constant = (CON) sub->nod_arg[0];
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:
LEX_token();
sub = parse_primitive_value(0, 0);
sub = parse_primitive_value(0, NULL);
node = SYNTAX_NODE(nod_uppercase, 1);
node->nod_arg[0] = sub;
break;
@ -907,21 +913,19 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
*
**************************************/
DUDLEY_NOD node, expr1, expr2, or_node;
USHORT negation;
bool negation;
enum nod_t operatr, *rel_ops;
USHORT local_flag;
local_flag = TRUE;
bool local_flag = true;
if (MATCH(KW_ANY)) {
node = SYNTAX_NODE(nod_any, 1);
node->nod_arg[0] = EXPR_rse(FALSE);
node->nod_arg[0] = EXPR_rse(false);
return node;
}
if (MATCH(KW_UNIQUE)) {
node = SYNTAX_NODE(nod_unique, 1);
node->nod_arg[0] = EXPR_rse(FALSE);
node->nod_arg[0] = EXPR_rse(false);
return node;
}
@ -929,12 +933,12 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
if (KEYWORD(KW_RIGHT_PAREN))
return expr1;
negation = FALSE;
negation = false;
node = NULL;
LEX_real();
if (MATCH(KW_NOT)) {
negation = TRUE;
negation = true;
LEX_real();
}
@ -942,32 +946,32 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
case KW_EQUALS:
case KW_EQ:
operatr = (negation) ? nod_neq : nod_eql;
negation = FALSE;
negation = false;
break;
case KW_NE:
operatr = (negation) ? nod_eql : nod_neq;
negation = FALSE;
negation = false;
break;
case KW_GT:
operatr = (negation) ? nod_leq : nod_gtr;
negation = FALSE;
negation = false;
break;
case KW_GE:
operatr = (negation) ? nod_lss : nod_geq;
negation = FALSE;
negation = false;
break;
case KW_LE:
operatr = (negation) ? nod_gtr : nod_leq;
negation = FALSE;
negation = false;
break;
case KW_LT:
operatr = (negation) ? nod_geq : nod_lss;
negation = FALSE;
negation = false;
break;
case KW_CONTAINING:
@ -976,11 +980,11 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
case KW_MATCHES:
LEX_token();
expr2 = EXPR_value(0, 0);
expr2 = EXPR_value(0, NULL);
if (MATCH(KW_USING)) {
operatr = nod_sleuth;
node = SYNTAX_NODE(operatr, 3);
node->nod_arg[2] = EXPR_value(0, 0);
node->nod_arg[2] = EXPR_value(0, NULL);
}
else {
operatr = nod_matches;
@ -995,7 +999,7 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
MATCH(KW_WITH);
node = SYNTAX_NODE(nod_starts, 2);
node->nod_arg[0] = expr1;
node->nod_arg[1] = EXPR_value(0, 0);
node->nod_arg[1] = EXPR_value(0, NULL);
break;
case KW_MISSING:
@ -1008,9 +1012,9 @@ static DUDLEY_NOD parse_relational( USHORT * paren_count)
LEX_token();
node = SYNTAX_NODE(nod_between, 3);
node->nod_arg[0] = expr1;
node->nod_arg[1] = EXPR_value(0, 0);
node->nod_arg[1] = EXPR_value(0, NULL);
MATCH(KW_AND);
node->nod_arg[2] = EXPR_value(0, 0);
node->nod_arg[2] = EXPR_value(0, NULL);
break;
default:
@ -1079,13 +1083,13 @@ static DUDLEY_NOD parse_sort(void)
direction = 0;
stack = NULL;
while (TRUE) {
while (true) {
LEX_real();
if (MATCH(KW_ASCENDING))
direction = 0;
else if (MATCH(KW_DESCENDING))
direction = 1;
LLS_PUSH(EXPR_value(0, 0), &stack);
LLS_PUSH(EXPR_value(0, NULL), &stack);
LLS_PUSH((SLONG) direction, &stack);
if (!MATCH(KW_COMMA))
break;
@ -1121,12 +1125,12 @@ static DUDLEY_NOD parse_statistical(void)
node = SYNTAX_NODE(types->nod_t_node, s_stt_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))
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;
}

View File

@ -25,8 +25,8 @@
#define _DUDLEY_EXPR_PROTO_H_
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_value(USHORT *, USHORT *);
extern DUDLEY_NOD EXPR_value(USHORT *, bool *);
#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_triggers(void);
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 field_attributes(SLONG *, const TEXT *, SLONG *, const TEXT *, SSHORT);
static void format_acl(const SCHAR *);
@ -1066,7 +1066,7 @@ static void extract_indexes(void)
if (EXT_capabilities & EXT_v3)
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");
END_FOR;
@ -1420,8 +1420,8 @@ static void extract_view(const TEXT * rel_name,
SLONG * description,
bool source_null,
bool desc_null,
USHORT system_flag,
bool* first)
bool system_flag,
bool * first)
{
/**************************************
*
@ -1477,7 +1477,8 @@ static void extract_views(void)
* and write it to the output file.
*
**************************************/
bool source_null, desc_null;
bool source_null;
bool desc_null;
TEXT s[32];
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$VIEW_BLR NOT MISSING
SORTED BY V.RDB$RELATION_NAME
source_null = V.RDB$VIEW_SOURCE.NULL ? true : false;
desc_null = blob_null(V.RDB$DESCRIPTION) ? true : false;
source_null = (V.RDB$VIEW_SOURCE.NULL);
desc_null = (blob_null(V.RDB$DESCRIPTION));
extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE,
(SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null,
V.RDB$SYSTEM_FLAG, &first);
(V.RDB$SYSTEM_FLAG), &first);
END_FOR;
return;
}
/* 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. */
// 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.
view* view_list = NULL;
@ -1531,9 +1532,9 @@ static void extract_views(void)
bool do_this_one = true;
const TEXT* view_name = (*view_ptr)->view_name;
/* fields of rdb$dependencies have been renamed for V4.0
This means if we are extracting a pre V3 definition, views
will not be spit out in the optimal order. */
// fields of rdb$dependencies have been renamed for V4.0
// This means if we are extracting a pre V3 definition, views
// will not be spit out in the optimal order. */
if (EXT_capabilities & EXT_v4) {
FOR D IN RDB$DEPENDENCIES WITH
@ -1551,11 +1552,11 @@ static void extract_views(void)
if (do_this_one) {
FOR V IN RDB$RELATIONS WITH
V.RDB$RELATION_NAME EQ view_name
source_null = V.RDB$VIEW_SOURCE.NULL ? true : false;
desc_null = blob_null(V.RDB$DESCRIPTION) ? true : false;
source_null = (V.RDB$VIEW_SOURCE.NULL);
desc_null = (blob_null(V.RDB$DESCRIPTION));
extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE,
(SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null,
V.RDB$SYSTEM_FLAG, &first);
(V.RDB$SYSTEM_FLAG), &first);
END_FOR;
did_any = true;
@ -1566,16 +1567,16 @@ static void extract_views(void)
}
} 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 V IN RDB$RELATIONS WITH
V.RDB$RELATION_NAME EQ viewp->view_name
source_null = V.RDB$VIEW_SOURCE.NULL ? true : false;
desc_null = blob_null(V.RDB$DESCRIPTION) ? true : false;
source_null = (V.RDB$VIEW_SOURCE.NULL);
desc_null = (blob_null(V.RDB$DESCRIPTION));
extract_view(V.RDB$RELATION_NAME, (SLONG*) &V.RDB$VIEW_SOURCE,
(SLONG*) &V.RDB$DESCRIPTION, source_null, desc_null,
V.RDB$SYSTEM_FLAG, &first);
(V.RDB$SYSTEM_FLAG), &first);
END_FOR;
}

View File

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

View File

@ -95,7 +95,7 @@ jmp_buf parse_env;
extern TEXT *DDL_prompt;
static bool check_filename(SYM, USHORT);
static bool check_filename(SYM, bool);
static SYM copy_symbol(SYM);
static DUDLEY_FLD create_global_field(DUDLEY_FLD);
#ifdef FLINT_CACHE
@ -197,7 +197,7 @@ void PARSE_actions(void)
}
}
else {
DDL_drop_database = FALSE;
DDL_drop_database = false;
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)) {
LEX_token();
return TRUE;
return true;
}
for (symbol = DDL_token.tok_symbol; symbol; symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_keyword &&
symbol->sym_keyword == (int) keyword) {
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_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 */
if (MATCH(KW_LENGTH)) {
@ -694,7 +695,7 @@ static void define_database( enum act_t action_type)
/* parse options for the database parameter block */
while (TRUE) {
while (true) {
if (MATCH(KW_LENGTH)) {
database->dbb_length = PARSE_number();
MATCH(KW_PAGES);
@ -715,13 +716,13 @@ static void define_database( enum act_t action_type)
if (MATCH(KW_CASCADE))
database->dbb_flags |= DBB_cascade;
EXE_drop_database(database);
DDL_drop_database = TRUE;
DDL_drop_database = true;
return;
}
/* parse add/drop items */
while (TRUE) {
while (true) {
MATCH(KW_ADD);
if (KEYWORD(KW_DESCRIPTION))
database->dbb_description = parse_description();
@ -782,7 +783,7 @@ static void define_database( enum act_t action_type)
if (MATCH(KW_LEFT_PAREN)) {
database->dbb_flags |= DBB_log_preallocated;
while (TRUE) {
while (true) {
file = define_log_file(DBB_log_preallocated);
file->fil_next = database->dbb_logfiles;
database->dbb_logfiles = file;
@ -873,10 +874,10 @@ static FIL define_file(void)
file = (FIL) DDL_alloc(sizeof(struct fil));
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 */
while (TRUE) {
while (true) {
if (MATCH(KW_LENGTH)) {
file->fil_length = PARSE_number();
MATCH(KW_PAGES);
@ -914,7 +915,7 @@ static void define_filter(void)
filter = (FILTER) DDL_alloc(sizeof(struct filter));
filter->filter_name = PARSE_symbol(tok_ident);
while (TRUE) {
while (true) {
if (KEYWORD(KW_DESCRIPTION))
filter->filter_description = parse_description();
else if (MATCH(KW_INPUT_TYPE))
@ -960,7 +961,7 @@ static void define_function(void)
function = PARSE_function(FALSE);
while (TRUE) {
while (true) {
if (KEYWORD(KW_DESCRIPTION))
function->func_description = parse_description();
else if (MATCH(KW_FUNCTION_MODULE_NAME))
@ -985,7 +986,7 @@ static void define_function(void)
position = 1;
while (TRUE) {
while (true) {
if (KEYWORD(KW_SEMI))
break;
function_arg = parse_function_arg(function, (USHORT*) &position);
@ -1039,31 +1040,31 @@ static void define_index(void)
**************************************/
LLS stack;
SYM index_name, rel_name, *ptr;
TXT description;
SSHORT count, unique, inactive, descending;
TXT description = NULL;
SSHORT count;
bool unique = false;
bool inactive = false;
bool descending = false;
index_name = PARSE_symbol(tok_ident);
MATCH(KW_FOR);
rel_name = PARSE_symbol(tok_ident);
unique = inactive = descending = FALSE;
description = NULL;
while (TRUE) {
while (true) {
if (MATCH(KW_DUPLICATES))
unique = FALSE;
unique = false;
else if (MATCH(KW_UNIQUE))
unique = TRUE;
unique = true;
else if (KEYWORD(KW_DESCRIPTION))
description = parse_description();
else if (MATCH(KW_ACTIVE))
inactive = FALSE;
inactive = false;
else if (MATCH(KW_INACTIVE))
inactive = TRUE;
inactive = true;
else if (MATCH(KW_ASCENDING))
descending = IDX_type_none;
descending = false;
else if (MATCH(KW_DESCENDING))
descending = IDX_type_descend;
descending = true;
else
break;
}
@ -1072,7 +1073,7 @@ static void define_index(void)
stack = NULL;
while (TRUE) {
while (true) {
LLS_PUSH(PARSE_symbol(tok_ident), &stack);
count++;
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_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 */
while (TRUE) {
while (true) {
if (MATCH(KW_SIZE)) {
MATCH(KW_EQUALS);
file->fil_length = PARSE_number();
@ -1228,20 +1229,24 @@ static void define_relation(void)
relation = PARSE_relation();
if (!(relation->rel_flags & rel_marked_for_delete) &&
((relation->rel_flags & rel_marked_for_creation)
|| EXE_relation(relation))) PARSE_error(137,
relation->rel_name->sym_string, 0); /* msg 137: relation %s already exists */
|| EXE_relation(relation)))
{
PARSE_error(137, relation->rel_name->sym_string, 0);
// msg 137: relation %s already exists
}
if (MATCH(KW_EXTERNAL_FILE)) {
relation->rel_filename = PARSE_symbol(tok_quoted);
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 */
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
}
rel_actions = action = make_action(act_a_relation, (DBB) relation);
action->act_flags |= ACT_ignore;
position = 1;
while (TRUE)
while (true)
if (KEYWORD(KW_DESCRIPTION))
relation->rel_description = parse_description();
else if (MATCH(KW_SECURITY_CLASS))
@ -1255,7 +1260,7 @@ static void define_relation(void)
/* Gobble fields */
while (TRUE) {
while (true) {
MATCH(KW_ADD);
MATCH(KW_FIELD);
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
turn them on. */
while (TRUE) {
while (true) {
action->act_flags &= ~ACT_ignore;
if (action == rel_actions)
break;
@ -1329,7 +1334,7 @@ static void define_security_class(void)
/* Pick up entries. Use the users's order */
while (TRUE) {
while (true) {
if (!(element = parse_identifier()))
return;
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_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 */
if (MATCH(KW_LENGTH)) {
@ -1394,7 +1399,7 @@ static void define_shadow(void)
MATCH(KW_PAGES);
}
while (TRUE) {
while (true) {
if (MATCH(KW_FILE)) {
file = define_file();
file->fil_next = shadow;
@ -1430,7 +1435,6 @@ static void define_trigger(void)
DUDLEY_TRG trigger;
TRGMSG trigmsg;
int flags, trg_state, trg_sequence;
USHORT action, end;
if (MATCH(KW_FOR)) {
define_old_trigger();
@ -1454,18 +1458,19 @@ static void define_trigger(void)
PARSE_error(141, DDL_token.tok_string, 0);
/* msg 141: expected STORE, MODIFY, ERASE, encountered \"%s\" */
action = end = FALSE;
bool action = false;
bool end = false;
while (!KEYWORD(KW_SEMI)) {
if (KEYWORD(KW_DESCRIPTION))
trigger->trg_description = parse_description();
else if (MATCH(KW_END_TRIGGER))
action = end = TRUE;
action = end = true;
else if (!action) {
trigger->trg_source = start_text();
trigger->trg_statement = EXPR_statement();
end_text(trigger->trg_source);
action = TRUE;
action = true;
}
else if (MATCH(KW_MESSAGE)) {
trigmsg = (TRGMSG) DDL_alloc(sizeof(struct trgmsg));
@ -1521,7 +1526,7 @@ static void define_type(void)
MATCH(KW_FOR);
fldname = PARSE_symbol(tok_ident);
while (TRUE) {
while (true) {
fldtype = (TYP) DDL_alloc(sizeof(struct typ));
fldtype->typ_field_name = fldname;
fldtype->typ_name = PARSE_symbol(tok_ident);
@ -1563,8 +1568,11 @@ static void define_view(void)
relation = PARSE_relation();
if (!(relation->rel_flags & rel_marked_for_delete) &&
((relation->rel_flags & rel_marked_for_creation)
|| EXE_relation(relation))) PARSE_error(300,
relation->rel_name->sym_string, 0); /* msg 300: relation %s already exists */
|| EXE_relation(relation)))
{
PARSE_error(300, relation->rel_name->sym_string, 0);
// msg 300: relation %s already exists
}
MATCH(KW_OF);
@ -1572,7 +1580,7 @@ static void define_view(void)
contexts = NULL;
relation->rel_view_source = start_text();
relation->rel_rse = EXPR_rse(TRUE);
relation->rel_rse = EXPR_rse(true);
end_text(relation->rel_view_source);
/* add my context to the context stack */
@ -1587,7 +1595,7 @@ static void define_view(void)
/* Pick up various fields and clauses */
while (TRUE) {
while (true) {
if (KEYWORD(KW_DESCRIPTION))
relation->rel_description = parse_description();
else if (MATCH(KW_SECURITY_CLASS))
@ -1605,7 +1613,7 @@ static void define_view(void)
position = 1;
ptr = &relation->rel_fields;
while (TRUE) {
while (true) {
MATCH(KW_ADD);
MATCH(KW_FIELD);
field = (DUDLEY_FLD) DDL_alloc(FLD_LEN);
@ -1640,7 +1648,7 @@ static void define_view(void)
if (!(MATCH(KW_LEFT_PAREN)))
PARSE_error(148, 0, 0); /* msg 148: computed by expression must be parenthesized */
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);
if (!(MATCH(KW_RIGHT_PAREN)))
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
turn them on. */
while (TRUE) {
while (true) {
action->act_flags &= ~ACT_ignore;
if (action == rel_actions)
break;
@ -1855,16 +1863,16 @@ static void drop_trigger(void)
*
**************************************/
SYM name;
SSHORT old_style;
bool old_style;
DUDLEY_REL relation;
DUDLEY_TRG trigger;
if (MATCH(KW_FOR)) {
relation = PARSE_relation();
old_style = TRUE;
old_style = true;
}
else {
old_style = FALSE;
old_style = false;
name = PARSE_symbol(tok_ident);
}
@ -1921,7 +1929,7 @@ static void drop_type(void)
}
else {
fldname = PARSE_symbol(tok_ident);
while (TRUE) {
while (true) {
fldtype = (TYP) DDL_alloc(sizeof(struct typ));
fldtype->typ_field_name = fldname;
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_flags = 0;
while (TRUE) {
while (true) {
/* ALL is translated to mean four individual privileges */
if (MATCH(KW_ALL)) {
@ -2192,7 +2200,7 @@ static void grant_user_privilege(void)
/* get the userlist */
while (TRUE) {
while (true) {
usr = (USRE) DDL_alloc(sizeof(struct usre));
usr->usre_name = PARSE_symbol(tok_ident);
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
index->idx_name = PARSE_symbol(tok_ident);
while (TRUE) {
while (true) {
if (MATCH(KW_DUPLICATES)) {
index->idx_unique = FALSE;
index->idx_unique = false;
index->idx_flags |= IDX_unique_flag;
}
else if (MATCH(KW_UNIQUE)) {
index->idx_unique = TRUE;
index->idx_unique = true;
index->idx_flags |= IDX_unique_flag;
}
else if (MATCH(KW_ACTIVE)) {
index->idx_inactive = FALSE;
index->idx_inactive = false;
index->idx_flags |= IDX_active_flag;
}
else if (MATCH(KW_INACTIVE)) {
index->idx_inactive = TRUE;
index->idx_inactive = true;
index->idx_flags |= IDX_active_flag;
}
else if (MATCH(KW_ASCENDING)) {
index->idx_type = IDX_type_none;
index->idx_type = false;
index->idx_flags |= IDX_type_flag;
}
else if (MATCH(KW_DESCENDING)) {
index->idx_type = IDX_type_descend;
index->idx_type = true;
index->idx_flags |= IDX_type_flag;
}
else if (KEYWORD(KW_DESCRIPTION)) {
@ -2574,33 +2582,32 @@ static void modify_relation(void)
**************************************/
DUDLEY_REL relation;
DUDLEY_FLD field, global;
TEXT modify_relation;
relation = PARSE_relation();
make_action(act_m_relation, (DBB) relation);
if (MATCH(KW_EXTERNAL_FILE)) {
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 */
}
modify_relation = FALSE;
bool modify_relation = false;
while (TRUE) {
while (true) {
if (KEYWORD(KW_DESCRIPTION)) {
relation->rel_description = parse_description();
modify_relation = TRUE;
modify_relation = true;
}
else if (MATCH(KW_SECURITY_CLASS))
{
modify_relation = TRUE;
modify_relation = true;
relation->rel_security_class = PARSE_symbol(tok_ident);
}
else if (MATCH(KW_SYSTEM_FLAG)) {
relation->rel_system = get_system_flag();
relation->rel_flags |= rel_explicit_system;
modify_relation = TRUE;
modify_relation = true;
}
else
break;
@ -2609,7 +2616,7 @@ static void modify_relation(void)
/* Act on field actions */
if (!KEYWORD(KW_SEMI))
while (TRUE) {
while (true) {
if (MATCH(KW_ADD)) {
MATCH(KW_FIELD);
{
@ -2651,7 +2658,7 @@ static void modify_relation(void)
else if (MATCH(KW_DROP)) {
if (MATCH(KW_SECURITY_CLASS)) {
relation->rel_flags |= rel_null_security_class;
modify_relation = TRUE;
modify_relation = true;
MATCH(KW_COMMA);
if (KEYWORD(KW_SEMI))
break;
@ -2659,7 +2666,7 @@ static void modify_relation(void)
continue;
}
else if (MATCH(KW_DESCRIP)) {
modify_relation = TRUE;
modify_relation = true;
relation->rel_flags |= rel_null_description;
MATCH(KW_COMMA);
if (KEYWORD(KW_SEMI))
@ -2715,7 +2722,7 @@ static void modify_security_class(void)
if (KEYWORD(KW_DESCRIPTION))
class_->scl_description = parse_description();
while (TRUE) {
while (true) {
if (!(element = parse_identifier()))
return;
score = score_entry(element);
@ -2752,11 +2759,10 @@ static void modify_trigger(void)
DUDLEY_TRG trigger;
TRGMSG trigmsg;
TRGMSG_T msg_type;
SLONG flags, type, sequence;
SYM name;
SCHAR action, end;
bool action = false;
bool end = false;
action = end = FALSE;
msg_type = trgmsg_none;
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;
name && (name->sym_type != SYM_trigger); name = name->sym_homonym);
{
if (!name)
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;
LEX_token();
@ -2785,7 +2793,9 @@ static void modify_trigger(void)
else
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);
while (!KEYWORD(KW_SEMI)) {
@ -2813,12 +2823,12 @@ static void modify_trigger(void)
msg_type = trgmsg_none;
}
else if (MATCH(KW_END_TRIGGER))
end = TRUE;
end = true;
else if (KEYWORD(KW_DESCRIPTION))
trigger->trg_description = parse_description();
else if (!action && !end) {
modify_trigger_action(trigger, relation);
action = TRUE;
action = true;
}
else
PARSE_error(179, DDL_token.tok_string, 0);
@ -2868,7 +2878,7 @@ static void modify_type(void)
MATCH(KW_FOR);
fldname = PARSE_symbol(tok_ident);
while (TRUE) {
while (true) {
fldtype = (TYP) DDL_alloc(sizeof(struct typ));
fldtype->typ_field_name = fldname;
fldtype->typ_name = PARSE_symbol(tok_ident);
@ -2898,25 +2908,24 @@ static void modify_view(void)
**************************************/
DUDLEY_REL relation;
DUDLEY_FLD field;
USHORT view_modify;
bool view_modify = false;
relation = PARSE_relation();
make_action(act_m_relation, (DBB) relation);
view_modify = FALSE;
while (TRUE) {
while (true) {
if (KEYWORD(KW_DESCRIPTION)) {
relation->rel_description = parse_description();
view_modify = TRUE;
view_modify = true;
}
else if (MATCH(KW_SECURITY_CLASS)) {
relation->rel_security_class = PARSE_symbol(tok_ident);
view_modify = TRUE;
view_modify = true;
}
else if (MATCH(KW_SYSTEM_FLAG)) {
relation->rel_system = get_system_flag();
relation->rel_flags |= rel_explicit_system;
view_modify = TRUE;
view_modify = true;
}
else
break;
@ -2925,7 +2934,7 @@ static void modify_view(void)
/* Act on field actions */
if (!KEYWORD(KW_SEMI))
while (TRUE) {
while (true) {
if (MATCH(KW_MODIFY)) {
MATCH(KW_FIELD);
field = (DUDLEY_FLD) DDL_alloc(FLD_LEN);
@ -2939,7 +2948,7 @@ static void modify_view(void)
}
else if (MATCH(KW_DROP)) {
if (MATCH(KW_DESCRIP)) {
view_modify = TRUE;
view_modify = true;
relation->rel_flags |= rel_null_description;
if (KEYWORD(KW_SEMI))
@ -2948,7 +2957,7 @@ static void modify_view(void)
continue;
}
else if (MATCH(KW_SECURITY_CLASS)) {
view_modify = TRUE;
view_modify = true;
relation->rel_flags |= rel_null_security_class;
if (KEYWORD(KW_SEMI))
@ -2988,7 +2997,7 @@ static bool parse_action(void)
**************************************
*
* 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;
}
else if (DDL_interactive && KEYWORD(KW_EXIT)) {
DDL_eof = TRUE;
DDL_eof = true;
return false;
}
else if (DDL_interactive && KEYWORD(KW_QUIT)) {
DDL_quit = DDL_eof = TRUE;
DDL_quit = DDL_eof = true;
return false;
}
PARSE_error(186, DDL_token.tok_string, 0); /* msg 186: expected command, encountered \"%s\" */
return FALSE;
return false;
} // try
catch (const std::exception&) {
@ -3233,7 +3242,7 @@ static TXT parse_description(void)
**************************************/
TXT description;
DDL_description = TRUE;
DDL_description = true;
description = start_text();
description->txt_position = DDL_token.tok_position;
@ -3245,7 +3254,7 @@ static TXT parse_description(void)
end_text(description);
MATCH(KW_END_DESCRIPTION);
DDL_description = FALSE;
DDL_description = false;
return description;
}
@ -3328,7 +3337,7 @@ static void parse_field_clauses( DUDLEY_FLD field)
/* Pick up purely optional clauses */
while (TRUE)
while (true)
switch (PARSE_keyword()) {
case KW_POSITION:
LEX_token();
@ -3393,7 +3402,7 @@ static void parse_field_clauses( DUDLEY_FLD field)
if (!(MATCH(KW_LEFT_PAREN)))
PARSE_error(194, 0, 0); /* msg 194: computed by expression must be parenthesized */
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);
if (!(MATCH(KW_RIGHT_PAREN)))
PARSE_error(195, 0, 0); /* msg 195: unmatched parenthesis */
@ -3403,7 +3412,7 @@ static void parse_field_clauses( DUDLEY_FLD field)
LEX_token();
MATCH(KW_VALUE);
MATCH(KW_IS);
field->fld_missing = EXPR_value(0, 0);
field->fld_missing = EXPR_value(0, NULL);
break;
case KW_VALID_IF:
@ -3435,7 +3444,7 @@ static void parse_field_clauses( DUDLEY_FLD field)
LEX_token();
MATCH(KW_VALUE);
MATCH(KW_IS);
field->fld_default = EXPR_value(0, 0);
field->fld_default = EXPR_value(0, NULL);
break;
case KW_DESCRIPTION:
@ -3959,7 +3968,7 @@ static void revoke_user_privilege(void)
upriv = (USERPRIV) DDL_alloc(sizeof(struct userpriv));
while (TRUE) {
while (true) {
if (MATCH(KW_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\" */
break;
}
} /* while (TRUE) */
} // while (true)
if (!upriv->userpriv_flags)
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\" */
/* get the userlist */
while (TRUE) {
while (true) {
usr = (USRE) DDL_alloc(sizeof(struct usre));
usr->usre_name = PARSE_symbol(tok_ident);
usr->usre_next = upriv->userpriv_userlist;
@ -4083,7 +4092,7 @@ static DUDLEY_NOD set_generator(void)
node->nod_count = 1;
node->nod_arg[1] = (DUDLEY_NOD) PARSE_symbol(tok_ident);
MATCH(KW_TO);
node->nod_arg[0] = EXPR_value(0, 0);
node->nod_arg[0] = EXPR_value(0, NULL);
parse_end();
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 DUDLEY_NOD PARSE_make_list(LLS);
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 DUDLEY_REL PARSE_relation(void);
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);
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_symbol(dyn, gds_dyn_fld_name, field->fld_name);
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_rel_name, index->idx_relation);
put_number(dyn, gds_dyn_idx_unique, index->idx_unique);
if (index->idx_inactive)
put_number(dyn, gds_dyn_idx_inactive, TRUE);
else
put_number(dyn, gds_dyn_idx_inactive, FALSE);
put_number(dyn, gds_dyn_idx_unique, (index->idx_unique) ? TRUE : FALSE);
put_number(dyn, gds_dyn_idx_inactive, (index->idx_inactive) ? TRUE : FALSE);
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);
@ -1376,14 +1374,14 @@ static void modify_index( STR dyn, DUDLEY_IDX index)
put_symbol(dyn, gds_dyn_mod_idx, index->idx_name);
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)
put_number(dyn, gds_dyn_idx_inactive,
(index->idx_inactive) ? TRUE : FALSE);
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) {
CHECK_DYN(3);

View File

@ -36,9 +36,9 @@
#include "../jrd/jrn_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 USHORT open_file(TEXT *, SLONG, USHORT, SLONG *);
static bool open_file(TEXT *, SLONG, USHORT, SLONG *);
int CLIB_ROUTINE main(int argc,
@ -61,7 +61,7 @@ int CLIB_ROUTINE main(int argc,
SLONG s_fd, d_fd;
SLONG p_offset;
USHORT j_length;
USHORT ret_val;
bool ret_val;
SLONG size;
SLONG db_id;
ISC_STATUS_ARRAY status;
@ -89,11 +89,11 @@ int CLIB_ROUTINE main(int argc,
// 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);
// 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);
error_exit(status, &journal, db_id, file_id, 237);
// 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 |= LLIO_close(0, s_fd);
ret_val |= LLIO_close(0, d_fd);
ret_val |= (LLIO_close(0, s_fd) == FB_SUCCESS);
ret_val |= (LLIO_close(0, d_fd) == FB_SUCCESS);
if (ret_val)
if (!ret_val)
error_exit(status, &journal, db_id, file_id, 238);
// 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 size)
{
@ -130,6 +130,7 @@ static USHORT copy_file(SLONG s_fd,
*
* Functional description
* copy source file to destination file
* Return true on success, false on failure
*
**************************************/
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) ||
l != read)
{
return FB_FAILURE;
return false;
}
if (LLIO_write(0, d_fd, 0, 0L, LLIO_SEEK_NONE, buff, 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,
USHORT mode,
SLONG * fd)
@ -195,17 +196,18 @@ static USHORT open_file(TEXT * full_name,
*
* Functional description
* 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))
return FB_FAILURE;
return false;
if (p_offset) {
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;
SCHAR buf[MAX_PATH_LENGTH];
SSHORT stop_flag;
bool stop_flag;
SLONG *until_ptr;
WALR_handle = 0;
@ -2109,7 +2109,7 @@ static int open_journal(SCHAR * dbname,
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;
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,
J.LOG_NAME, J.PARTITION_OFFSET,
WALFH_KEEP_FOR_LONG_TERM_RECV, 0);
WALFH_KEEP_FOR_LONG_TERM_RECV, false);
MODIFY J USING
strcpy(J.DELETE_STATUS, LOG_DELETED);
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
WALF_set_log_header_flag(status, db, J.LOG_NAME,
J.PARTITION_OFFSET,
WALFH_KEEP_FOR_LONG_TERM_RECV, 0);
WALFH_KEEP_FOR_LONG_TERM_RECV, false);
strcpy(file_name, J.LOG_NAME);
build_indexed_name(name, arch, J.FILE_SEQUENCE);
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);
WAL_flush(tdbb->tdbb_status_vector, dbb->dbb_wal,
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);
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
*/
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_flags = 0;
@ -1135,9 +1135,9 @@ void AIL_shutdown(
tdbb = GET_THREAD_DATA;
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,
p_offset, offset, force_archive);
p_offset, offset, (force_archive));
AIL_fini();
}

View File

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

View File

@ -3539,7 +3539,7 @@ static void THREAD_ROUTINE cache_writer(DBB dbb)
#ifdef SUPERSERVER_V2
SLONG commit_mask;
#endif
SSHORT start_chkpt;
bool start_chkpt;
ISC_STATUS_ARRAY status_vector;
SCHAR walname[256];
EVENT writer_event;
@ -5871,10 +5871,9 @@ static BOOLEAN write_page(
AST_CHECK;
dbb->dbb_writes++;
if (dbb->dbb_wal)
WAL_flush(status,
dbb->dbb_wal,
WAL_flush(status, dbb->dbb_wal,
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
/* 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 */
WALRS_handle = 0;
ret_val =
WALR_open(tdbb->tdbb_status_vector,
ret_val = WALR_open(tdbb->tdbb_status_vector,
reinterpret_cast < walrs ** >(&WALRS_handle), dbname, 1,
&start_logname, &cp1->cp_p_offset, cp1->cp_offset,
timestamp, FALSE);
timestamp, false);
if (ret_val == -1)
return; /* reached EOF */
else if (ret_val != FB_SUCCESS)

View File

@ -21,7 +21,7 @@
* 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
tail. If there isn't a fit, extend the pool and try, try again. */
while (TRUE) {
while (true) {
best = NULL;
best_tail = 32767;
for (ptr = &pool->plb_free; (free = *ptr); ptr = &free->frb_next)

View File

@ -72,7 +72,9 @@
jmp_buf QLI_env; // Error return environment
TEXT *QLI_error;
USHORT sw_verify, sw_trace, sw_buffers;
bool sw_verify;
bool sw_trace;
USHORT sw_buffers;
#ifdef PYXIS
USHORT sw_forms;
#endif
@ -89,21 +91,21 @@ USHORT QLI_columns = 80;
extern TEXT *QLI_prompt;
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_quit(void);
static BOOLEAN yes_no(USHORT, TEXT *);
static bool yes_no(USHORT, TEXT *);
typedef struct answer_t {
TEXT answer[30];
BOOLEAN value;
bool value;
} *ANS;
static int yes_no_loaded = 0;
static struct answer_t answer_table[] = {
{ "", FALSE }, // NO
{ "", TRUE }, // YES
{ NULL, 0 }
{ "", false }, /* NO */
{ "", true }, /* YES */
{ NULL, false }
};
@ -124,9 +126,12 @@ int CLIB_ROUTINE main( int argc, char **argv)
SCHAR home_directory[256];
#endif
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
USHORT vms_tryagain_flag;
bool vms_tryagain_flag;
#endif
SLONG debug_value;
jmp_buf env;
@ -151,8 +156,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
application_file = NULL;
ALLQ_init();
LEX_init();
version_flag = flush_flag = FALSE;
banner_flag = TRUE;
version_flag = flush_flag = false;
banner_flag = true;
sw_buffers = 0;
strcpy(QLI_prompt_string, "QLI> ");
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;) {
p = *argv++;
if (*p++ != '-') {
banner_flag = FALSE;
banner_flag = false;
LEX_pop_line();
LEX_push_string(p - 1);
continue;
@ -202,7 +207,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
break;
case 'N':
banner_flag = FALSE;
banner_flag = false;
break;
case 'P':
@ -216,7 +221,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
break;
case 'T':
sw_trace = TRUE;
sw_trace = true;
break;
case 'U':
@ -230,7 +235,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
break;
case 'V':
sw_verify = TRUE;
sw_verify = true;
break;
case 'X':
@ -246,7 +251,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
break;
case 'Z':
version_flag = TRUE;
version_flag = true;
break;
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 */
if (application_file)
LEX_push_file(application_file, TRUE);
LEX_push_file(application_file, true);
if (startup_file)
LEX_push_file(startup_file, FALSE);
LEX_push_file(startup_file, false);
#ifdef VMS
vms_tryagain_flag = FALSE;
vms_tryagain_flag = false;
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,
and LEX returned FALSE (above), try the old logical name, QLI_INIT */
if (!vms_tryagain_flag && startup_file
&& !(strcmp(startup_file, STARTUP_FILE))) LEX_push_file("QLI_INIT",
FALSE);
&& !(strcmp(startup_file, STARTUP_FILE)))
{
LEX_push_file("QLI_INIT", false);
}
#endif
for (got_started = 0; !got_started;)
for (got_started = false; !got_started;)
{
got_started = 1;
got_started = true;
try {
memcpy(QLI_env, env, sizeof(QLI_env));
PAR_token();
}
catch (const std::exception&) {
// try again
got_started = 0;
/* try again */
got_started = false;
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
* 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;
@ -417,7 +424,7 @@ static USHORT process_statement( USHORT flush_flag)
PAR_real();
if (!QLI_line)
return FALSE;
return false;
EXEC_poll_abort();
@ -432,7 +439,7 @@ static USHORT process_statement( USHORT flush_flag)
QLI_prompt = QLI_cont_string;
if (!(syntax_tree = PARQ_parse()))
return FALSE;
return false;
EXEC_poll_abort();
@ -440,7 +447,7 @@ static USHORT process_statement( USHORT flush_flag)
if (syntax_tree->syn_type == nod_exit) {
QLI_line = NULL;
return FALSE;
return false;
}
/* 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);
else
MET_transaction(nod_commit, dbb);
return FALSE;
return false;
}
/* Expand the statement. It will return NULL is the statement was
a command. An error will be unwound */
if (!(expanded_tree = (BLK) EXP_expand(syntax_tree)))
return FALSE;
return false;
// Compile the statement
if (!(execution_tree = (BLK) CMPQ_compile((qli_nod*) expanded_tree)))
return FALSE;
return false;
// Generate any BLR needed to support the request
if (!GEN_generate(( (qli_nod*) execution_tree)))
return FALSE;
return false;
if (QLI_statistics)
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
@ -513,7 +520,7 @@ static USHORT process_statement( USHORT flush_flag)
GEN_release();
return FALSE;
return false;
} // try
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");
}
while (TRUE) {
while (true) {
buffer[0] = 0;
if (!LEX_get_line(prompt, buffer, sizeof(buffer)))
return TRUE;
return true;
for (response = answer_table; (TEXT *) response->answer; response++) {
p = buffer;
while (*p == ' ')
p++;
if (*p == EOF)
return TRUE;
return true;
for (q = response->answer; *p && UPPER(*p) == *q++; p++);
if (!*p || *p == '\n')
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
true. */
while (TRUE) {
while (true) {
desc = EXEC_receive(message, (PAR) node->nod_arg[e_for_eof]);
if (*(USHORT *) desc->dsc_address)
break;

View File

@ -43,8 +43,8 @@ extern USHORT QLI_columns, QLI_lines;
#define MAKE_NODE(type,count) make_node (type, count)
static int compare_names(NAM, SYM);
static int compare_symbols(SYM, SYM);
static bool compare_names(NAM, SYM);
static bool compare_symbols(SYM, SYM);
static SYM copy_symbol(SYM);
static void declare_global(QLI_FLD, SYN);
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 int generate_fields(QLI_CTX, LLS, SYN);
static int generate_items(SYN, LLS, LLS, QLI_NOD);
static SLONG global_agg(SYN, SYN);
static int invalid_nod_field(QLI_NOD, QLI_NOD);
static int invalid_syn_field(SYN, SYN);
static bool global_agg(SYN, SYN);
static bool invalid_nod_field(QLI_NOD, QLI_NOD);
static bool invalid_syn_field(SYN, SYN);
static QLI_NOD make_and(QLI_NOD, QLI_NOD);
static QLI_NOD make_assignment(QLI_NOD, QLI_NOD, LLS);
#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_node(NOD_T, USHORT);
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_FLD resolve(SYN, LLS, QLI_CTX *);
#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
* 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;
TEXT *p, *q;
if (!symbol || (l = name->nam_length) != symbol->sym_length)
return FALSE;
return false;
p = symbol->sym_string;
q = name->nam_string;
@ -313,14 +313,14 @@ static int compare_names( NAM name, SYM symbol)
if (l)
do
if (*p++ != *q++)
return FALSE;
return false;
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;
if (!symbol1 || !symbol2)
return FALSE;
return false;
if ((l = symbol1->sym_length) != symbol2->sym_length)
return FALSE;
return false;
p = symbol1->sym_string;
q = symbol2->sym_string;
@ -347,10 +347,10 @@ static int compare_symbols( SYM symbol1, SYM symbol2)
if (l)
do
if (*p++ != *q++)
return FALSE;
return false;
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);
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);
// 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);
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);
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
for (fld = ctx->ctx_relation->rel_fields; fld;
fld =
fld->fld_next) if (compare_symbols(field->fld_name,
fld->fld_name)) break;
fld = fld->fld_next)
{
if (compare_symbols(field->fld_name, fld->fld_name))
break;
}
/* Next try, target field name matching source query name */
if (!fld)
for (fld = ctx->ctx_relation->rel_fields; fld;
fld =
fld->fld_next) if (compare_symbols(field->fld_name,
fld->
fld_query_name))
fld = fld->fld_next)
{
if (compare_symbols(field->fld_name, fld->fld_query_name))
break;
}
/* If nothing yet, look for any old match */
if (!fld)
for (fld = ctx->ctx_relation->rel_fields; fld;
fld =
fld->fld_next) if (compare_symbols(field->
fld_query_name,
fld = fld->fld_next)
{
if (compare_symbols(field-> fld_query_name,
fld->fld_name)
|| compare_symbols(field->
fld_query_name,
fld->
fld_query_name))
|| compare_symbols(field->fld_query_name,
fld->fld_query_name))
{
break;
}
}
if (fld) {
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;
int normal_field, aggregate;
normal_field = FALSE;
aggregate = FALSE;
bool normal_field = false;
bool aggregate = false;
switch (item->syn_type) {
case nod_agg_average:
@ -2725,7 +2724,7 @@ static SLONG global_agg( SYN item, SYN group_list)
case nod_agg_count:
case nod_running_total:
case nod_running_count:
return TRUE;
return true;
case nod_upcase:
case nod_add:
@ -2741,9 +2740,9 @@ static SLONG global_agg( SYN item, SYN group_list)
if ((*ptr)->syn_type == nod_constant)
continue;
if (global_agg(*ptr, group_list))
aggregate = TRUE;
aggregate = true;
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_CTX context;
SCHAR invalid;
bool invalid = false;
QLI_NOD *ptr, *end;
if (!list)
return TRUE;
invalid = FALSE;
return true;
if (node->nod_type == nod_field) {
field = (QLI_FLD) node->nod_arg[e_fld_field];
context = (QLI_CTX) node->nod_arg[e_fld_context];
for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end;
ptr++)
for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end; ptr++)
if (field == (QLI_FLD) (*ptr)->nod_arg[e_fld_field]
&& context == (QLI_CTX) (*ptr)->nod_arg[e_fld_context])
return FALSE;
return TRUE;
{
return false;
}
return true;
}
else
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;
NAM gname, fname, gctx, fctx;
SSHORT count;
SCHAR invalid;
bool invalid = false;
if (syn_node->syn_type == nod_star)
return FALSE;
return false;
if (!list)
return TRUE;
invalid = FALSE;
return true;
if (syn_node->syn_type == nod_field) {
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 (!gctx || !fctx
|| (!strcmp(fctx->nam_string, gctx->nam_string))) return
FALSE;
|| (!strcmp(fctx->nam_string, gctx->nam_string)))
{
return false;
}
return TRUE;
}
return true;
}
else
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:
if (ptr == base)
for (field = context->ctx_variable; field;
field =
field->fld_next) if (compare_names(name, field->fld_name)
|| compare_names(name,
field->
fld_query_name))
field = field->fld_next)
{
if (compare_names(name, field->fld_name)
|| compare_names(name, field->fld_query_name))
{
return field;
}
}
break;
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)
if (compare_names(name, field->fld_name) ||
compare_names(name, field->fld_query_name)) {
compare_names(name, field->fld_query_name))
{
if (ptr == base)
return field;
name = *--ptr;
@ -3429,12 +3431,13 @@ static QLI_FLD resolve_name( SYM name, LLS stack, QLI_CTX * out_context)
break;
case CTX_VARIABLE:
for (field = context->ctx_variable; field;
field =
field->fld_next) if (compare_symbols(name, field->fld_name)
|| compare_symbols(name,
field->
fld_query_name))
field = field->fld_next)
{
if (compare_symbols(name, field->fld_name)
|| compare_symbols(name, field->fld_query_name))
{
return field;
}
break;
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)
if (compare_symbols(name, field->fld_name) ||
compare_symbols(name, field->fld_query_name))
{
return field;
}
break;
}
@ -3468,17 +3473,16 @@ static void resolve_really( QLI_FLD variable, SYN field_node)
*
**************************************/
USHORT offset;
BOOLEAN resolved, local;
NAM fld_name, rel_name, db_name;
bool resolved = false;
bool local = false;
NAM fld_name = NULL;
NAM rel_name = NULL;
NAM db_name = NULL;
SYM symbol;
QLI_FLD field;
QLI_FLD field = NULL;
QLI_REL relation;
DBB dbb;
db_name = rel_name = fld_name = NULL;
field = NULL;
resolved = local = FALSE;
/* For ease, break down the syntax block.
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>). */
@ -3493,37 +3497,41 @@ static void resolve_really( QLI_FLD variable, SYN field_node)
}
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) {
for (symbol = rel_name->nam_symbol; symbol;
symbol =
symbol->sym_homonym) if (symbol->sym_type == SYM_database) {
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
}
if (!resolved) {
for (dbb = QLI_databases; dbb && !resolved; dbb = dbb->dbb_next)
for (symbol = rel_name->nam_symbol; symbol;
symbol =
symbol->sym_homonym) if (symbol->sym_type == SYM_relation
&& (relation =
(QLI_REL) symbol->sym_object)
&& relation->rel_database ==
dbb) {
symbol = symbol->sym_homonym)
{
if (symbol->sym_type == SYM_relation
&& (relation = (QLI_REL) symbol->sym_object)
&& relation->rel_database == dbb)
{
if (!relation->rel_fields)
MET_fields(relation);
for (field = relation->rel_fields; field;
field = field->fld_next) if (resolved = local =
compare_names
(fld_name,
field->
fld_name)) break;
field = field->fld_next)
{
if (resolved = local = compare_names (fld_name,
field->fld_name))
{
break;
}
}
break; // should be only one rel in homonym list for each db
}
}
}
}
else {
relation = variable->fld_relation;
if (!relation->rel_fields)

View File

@ -31,8 +31,7 @@
#define HASH_SIZE 224
static int hash(SCHAR *, int);
static BOOLEAN scompare(SCHAR *, int, SCHAR *,
int);
static bool scompare(SCHAR *, int, SCHAR *, int);
static SYM hash_table[HASH_SIZE];
static SYM key_symbols;
@ -220,10 +219,10 @@ static int hash( SCHAR * string, int length)
}
static BOOLEAN scompare(
SCHAR * string1,
static bool scompare(SCHAR * string1,
int length1,
SCHAR * string2, int length2)
SCHAR * string2,
int length2)
{
/**************************************
*
@ -238,11 +237,11 @@ static BOOLEAN scompare(
SCHAR c1, c2;
if (length1 != length2)
return FALSE;
return false;
while (length1--)
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"
#endif
extern USHORT sw_verify, sw_trace;
extern bool sw_verify;
extern bool sw_trace;
static BOOLEAN get_line(IB_FILE *, TEXT *, USHORT);
static int nextchar(BOOLEAN);
static void next_line(BOOLEAN);
static bool get_line(IB_FILE *, TEXT *, USHORT);
static int nextchar(bool);
static void next_line(bool);
static void retchar(SSHORT);
static BOOLEAN scan_number(SSHORT, TEXT **);
static bool scan_number(SSHORT, TEXT **);
static int skip_white(void);
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
* Return TRUE if we're running out of a
* procedure and FALSE otherwise. Somebody
* Return true if we're running out of a
* procedure and false otherwise. Somebody
* 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);
if (gds__edit(filename, TRUE))
LEX_push_file(filename, TRUE);
LEX_push_file(filename, true);
unlink(filename);
@ -237,7 +238,7 @@ TOK LEX_edit_string(void)
*p++ = c;
if (classes[c] & CHR_quote)
for (;;) {
if ((d = nextchar(FALSE)) == '\n') {
if ((d = nextchar(false)) == '\n') {
retchar(d);
break;
}
@ -245,7 +246,7 @@ TOK LEX_edit_string(void)
if (d == c)
break;
}
c = nextchar(TRUE);
c = nextchar(true);
}
retchar(c);
@ -310,12 +311,12 @@ TOK LEX_filename(void)
/* Look for white space or end of line, allowing embedded quoted strings. */
for (;;) {
c = nextchar(TRUE);
c = nextchar(true);
class_ = classes[c];
if (c == '"' && c != save) {
*p++ = c;
for (;;) {
c = nextchar(TRUE);
c = nextchar(true);
class_ = classes[c];
if ((class_ & CHR_eol) || c == '"')
break;
@ -409,7 +410,9 @@ void LEX_flush(void)
#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
* 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,
* return FALSE. Regardless, a null terminated string is returned.
* return false. Regardless, a null terminated string is returned.
*
**************************************/
TEXT *p;
USHORT overflow_flag;
bool overflow_flag = false;
SSHORT c;
// UNIX flavor
@ -435,9 +438,8 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
errno = 0;
p = buffer;
overflow_flag = FALSE;
while (TRUE) {
while (true) {
c = ib_getc(input_file);
if (c == EOF) {
if (SYSCALL_INTERRUPTED(errno) && !QLI_abort) {
@ -461,14 +463,14 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
if (--size > 0)
*p++ = c;
else if (c != ' ' && c != '\n')
overflow_flag = TRUE;
overflow_flag = true;
if (c == '\n')
break;
}
*p = 0;
if (c == EOF)
return FALSE;
return false;
if (overflow_flag) {
buffer[0] = 0;
@ -478,13 +480,15 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
if (sw_verify)
ib_fputs(buffer, ib_stdout);
return TRUE;
return true;
}
#endif
#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
* 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,
* 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;
@ -527,7 +531,7 @@ int LEX_get_line( TEXT * prompt, TEXT * buffer, int size)
if (!(status & 1)) {
if (status != LIB$_INPSTRTRU)
return FALSE;
return false;
buffer[0] = 0;
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);
}
return TRUE;
return true;
}
#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 (error_flag)
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;
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;
QLI_line = line;
return TRUE;
return true;
}
@ -844,7 +849,7 @@ TOK LEX_token(void)
if (c != '\n' || QLI_line->line_type != line_blob)
break;
prior = QLI_line;
next_line(TRUE);
next_line(true);
if (prior == QLI_line)
break;
}
@ -868,7 +873,7 @@ TOK LEX_token(void)
class_ = classes[c];
if (class_ & CHR_letter) {
while (classes[c = nextchar(TRUE)] & CHR_ident)
while (classes[c = nextchar(true)] & CHR_ident)
*p++ = c;
retchar(c);
token->tok_type = tok_ident;
@ -877,8 +882,8 @@ TOK LEX_token(void)
token->tok_type = tok_number;
else if (class_ & CHR_quote) {
token->tok_type = tok_quoted;
while (TRUE) {
if (!(next = nextchar(FALSE)) || next == '\n') {
while (true) {
if (!(next = nextchar(false)) || next == '\n') {
retchar(next);
IBERROR(63); // Msg 63 unterminated quoted string
break;
@ -890,11 +895,11 @@ TOK LEX_token(void)
/* If there are 2 quotes in a row, interpret 2nd as a literal */
if (next == c) {
peek = nextchar(FALSE);
peek = nextchar(false);
retchar(peek);
if (peek != c)
break;
nextchar(FALSE);
nextchar(false);
}
}
}
@ -907,7 +912,7 @@ TOK LEX_token(void)
}
else {
token->tok_type = tok_punct;
*p++ = nextchar(TRUE);
*p++ = nextchar(true);
if (!HSH_lookup(token->tok_string, 2))
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
* 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,
* return FALSE. Regardless, a null terminated string is returned.
* return false. Regardless, a null terminated string is returned.
*
**************************************/
TEXT *p;
SLONG length;
USHORT overflow_flag;
bool overflow_flag = false;
SSHORT c;
errno = 0;
p = buffer;
overflow_flag = FALSE;
length = size;
while (TRUE) {
while (true) {
c = ib_getc(file);
if (c == EOF) {
if (SYSCALL_INTERRUPTED(errno) && !QLI_abort) {
@ -978,14 +984,14 @@ static BOOLEAN get_line( IB_FILE * file, TEXT * buffer, USHORT size)
if (--length > 0)
*p++ = c;
else if (c != ' ' && c != '\n')
overflow_flag = TRUE;
overflow_flag = true;
if (c == '\n')
break;
}
*p = 0;
if (c == EOF)
return FALSE;
return false;
if (overflow_flag)
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)
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];
SSHORT flag;
bool flag;
while (QLI_line) {
flag = FALSE;
flag = false;
/* Get next line from where ever. If it comes from either the terminal
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
&& p[-1] == '\n' && *p)
flag = TRUE;
flag = true;
else {
// Initialize line block for retrieval
p = QLI_line->line_data;
QLI_line->line_ptr = QLI_line->line_data;
flag =
PRO_get_line(QLI_line->line_source, p,
flag = PRO_get_line(QLI_line->line_source, p,
QLI_line->line_size);
if (flag && QLI_echo)
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)
flag = LEX_get_line(QLI_prompt, p, (int) QLI_line->line_size);
else if (QLI_line->line_type == line_file) {
flag =
get_line((FILE*) QLI_line->line_source, p, QLI_line->line_size);
flag = get_line((FILE*) QLI_line->line_source, p, QLI_line->line_size);
if (QLI_echo)
ib_printf("%s", QLI_line->line_data);
}
@ -1087,7 +1091,7 @@ static void next_line( BOOLEAN eof_ok)
*q++ = *p++;
*q = 0;
QLI_line->line_ptr = (TEXT *) p;
LEX_push_file(filename, TRUE);
LEX_push_file(filename, true);
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;
SSHORT dot;
bool dot = false;
p = *ptr;
dot = FALSE;
/* If this is a leading decimal point, check that the next
character is really a digit, otherwise backout */
if (c == '.') {
retchar(c = nextchar(TRUE));
retchar(c = nextchar(true));
if (!(classes[c] & CHR_digit))
return FALSE;
dot = TRUE;
return false;
dot = true;
}
// Gobble up digits up to a single decimal point
for (;;) {
c = nextchar(TRUE);
c = nextchar(true);
if (classes[c] & CHR_digit)
*p++ = c;
else if (!dot && c == '.') {
*p++ = c;
dot = TRUE;
dot = true;
}
else
break;
@ -1214,21 +1218,21 @@ static BOOLEAN scan_number( SSHORT c, TEXT ** ptr)
if (UPPER(c) == 'E') {
*p++ = c;
c = nextchar(TRUE);
c = nextchar(true);
if (c == '+' || c == '-') {
*p++ = c;
c = nextchar(TRUE);
c = nextchar(true);
}
while (classes[c] & CHR_digit) {
*p++ = c;
c = nextchar(TRUE);
c = nextchar(true);
}
}
retchar(c);
*ptr = p;
return TRUE;
return true;
}
@ -1246,18 +1250,18 @@ static int skip_white(void)
**************************************/
SSHORT c, next, class_;
while (TRUE) {
c = nextchar(TRUE);
while (true) {
c = nextchar(true);
class_ = classes[c];
if (class_ & CHR_white)
continue;
if (c == '/') {
if ((next = nextchar(TRUE)) != '*') {
if ((next = nextchar(true)) != '*') {
retchar(next);
return c;
}
c = nextchar(FALSE);
while ((next = nextchar(FALSE)) && !(c == '*' && next == '/'))
c = nextchar(false);
while ((next = nextchar(false)) && !(c == '*' && next == '/'))
c = next;
continue;
}

View File

@ -24,19 +24,19 @@
#ifndef _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 struct tok *LEX_edit_string (void);
extern struct tok *LEX_filename (void);
extern void LEX_fini (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_mark_statement (void);
extern void LEX_pop_line (void);
extern void LEX_procedure (struct dbb *, FRBRD *);
extern int LEX_push_file (TEXT *, int);
extern int LEX_push_string (TEXT *);
extern bool LEX_push_file (TEXT *, bool);
extern bool LEX_push_string (TEXT *);
extern void LEX_put_procedure (FRBRD *, SLONG, SLONG);
extern void LEX_real (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 int blob_copy(RLB, QLI_REL, SLONG *);
static void change_field(QLI_REL, QLI_FLD);
static int check_global_field(DBB, QLI_FLD, TEXT *);
static int check_relation(QLI_REL);
static bool check_global_field(DBB, QLI_FLD, TEXT *);
static bool check_relation(QLI_REL);
static int clone_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 delete_fields(QLI_REL);
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 void get_database_type(DBB);
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;
SYM relation_name, field_name, symbol, global_field;
USHORT global_flag;
bool global_flag;
database = relation->rel_database;
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. */
global_flag = FALSE;
global_flag = false;
if (!check_global_field(database, field, global_field->sym_string)) {
global_flag = TRUE;
global_flag = true;
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.
*
**************************************/
BOOLEAN previously_defined;
bool previously_defined = false;
SLONG *blob;
previously_defined = FALSE;
FOR(REQUEST_HANDLE database->dbb_requests[REQ_field_def])
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
ON_ERROR
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.
*
**************************************/
BOOLEAN previously_defined;
bool previously_defined = false;
FRBRD *spare;
previously_defined = FALSE;
spare = DB;
DB = relation->rel_database->dbb_handle;
FOR(REQUEST_HANDLE relation->rel_database->dbb_requests[REQ_relation_def]
TRANSACTION_HANDLE relation->rel_database->dbb_meta_trans)
X IN DB.RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ relation->rel_symbol->sym_string
previously_defined = TRUE;
previously_defined = true;
END_FOR
ON_ERROR
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;
if (!dbb->dbb_handle)
return FB_SUCCESS;
return NULL;
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;
return FB_SUCCESS;
}
@ -2832,8 +2830,9 @@ static void get_log_names(
**************************************/
SCHAR next_log[512];
SCHAR *cl, *nl;
int log_count, ret_val;
SSHORT not_archived;
int log_count;
int ret_val;
bool not_archived;
SLONG last_log_flag, next_offset;
SLONG log_seqno, log_length;
SSHORT loop;
@ -2843,12 +2842,14 @@ static void get_log_names(
// loop up to 10 times to allow the file to be archived
while (TRUE) {
while (true) {
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,
&next_offset, &last_log_flag, &not_archived) != FB_SUCCESS)
&next_offset, &last_log_flag, &not_archived))
{
ERRQ_database_error(dbb, gds_status);
}
if ((!not_archived) || force)
break;

View File

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

View File

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

View File

@ -97,10 +97,12 @@ void PRO_commit( DBB database)
if ((database->dbb_capabilities & DBB_cap_multi_trans) &&
!(LEX_active_procedure()))
{
if (gds__commit_transaction(status_vector, &database->dbb_proc_trans)) {
PRO_rollback(database);
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);
if (status_vector[1] && status_vector[1] != gds_segment)
return FALSE;
return false;
p = buffer + length;
@ -380,7 +384,7 @@ int PRO_get_line( FRBRD *blob, TEXT * buffer, USHORT size)
*p = 0;
return TRUE;
return true;
}
@ -865,7 +869,7 @@ static int upcase_name( TEXT * name, TEXT * buffer)
l = 0;
while (TRUE) {
while (true) {
c = *name++;
*buffer++ = UPPER(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 void PRO_edit_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 FRBRD *PRO_open_blob (struct dbb *, SLONG *);
extern int PRO_rename_procedure (struct dbb *, TEXT *, TEXT *);

View File

@ -37,9 +37,9 @@
static void bottom_break(BRK, PRT);
static void increment_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_of_page(PRT, BOOLEAN);
static void top_of_page(PRT, bool);
#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)
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_page);
@ -126,6 +126,7 @@ void RPT_report( QLI_NOD loop)
for (control = report->rpt_bottom_breaks; control;
control = control->brk_next)
{
if (test_break(control, report, message)) {
SWAP(message->msg_buffer, report->rpt_buffer);
bottom_break(control, print);
@ -133,18 +134,21 @@ void RPT_report( QLI_NOD loop)
initialize_break(control);
break;
}
}
if (print->prt_lines_remaining <= 0)
top_of_page(print, FALSE);
top_of_page(print, false);
/* Now check for top breaks. */
for (control = report->rpt_top_breaks; control;
control = control->brk_next)
{
if (test_break(control, report, message)) {
top_break(control, print);
break;
}
}
/* 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)
do
if (*p1++ != *p2++)
return TRUE;
return true;
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_output_proc = output_proc;
tdsec->tsec_output_data = output_data;
tdsec->tsec_interactive = TRUE;
tdsec->tsec_service_gsec = FALSE;
tdsec->tsec_service_thd = FALSE;
tdsec->tsec_interactive = true;
tdsec->tsec_service_gsec = false;
tdsec->tsec_service_thd = false;
tdsec->tsec_service_blk = NULL;
tdsec->tsec_status = tdsec->tsec_status_vector;
user_data = tdsec->tsec_user_data;
if (argc > 1 && !strcmp(argv[1], "-svc")) {
tdsec->tsec_service_gsec = TRUE;
tdsec->tsec_service_gsec = true;
argv++;
argc--;
}
#ifdef SUPERSERVER
else if (argc > 1 && !strcmp(argv[1], "-svc_thd")) {
tdsec->tsec_service_gsec = TRUE;
tdsec->tsec_service_thd = TRUE;
tdsec->tsec_service_gsec = true;
tdsec->tsec_service_thd = true;
tdsec->tsec_service_blk = (SVC) output_data;
tdsec->tsec_status = tdsec->tsec_service_blk->svc_status;
argv++;
@ -258,7 +258,7 @@ int UTIL_gsec(int argc,
}
#endif
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_out = atol(argv[3]);
redir_err = atol(argv[4]);
@ -579,7 +579,7 @@ static bool get_switches(
user_data = tdsec->tsec_user_data;
*quitflag = false;
last_sw = IN_SW_GSEC_0;
tdsec->tsec_sw_version = FALSE;
tdsec->tsec_sw_version = false;
for (--argc; argc > 0; argc--) {
string = *++argv;
if (*string == '?')
@ -605,7 +605,7 @@ static bool get_switches(
return false;
}
user_data->user_name[l] = '\0';
user_data->user_name_entered = TRUE;
user_data->user_name_entered = true;
break;
case IN_SW_GSEC_PASSWORD:
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 */
}
user_data->password[l] = '\0';
user_data->password_entered = TRUE;
user_data->password_entered = true;
break;
case IN_SW_GSEC_UID:
user_data->uid = atoi(string);
user_data->uid_entered = TRUE;
user_data->uid_entered = true;
break;
case IN_SW_GSEC_GID:
user_data->gid = atoi(string);
user_data->gid_entered = TRUE;
user_data->gid_entered = true;
break;
case IN_SW_GSEC_SYSU:
strncpy(user_data->sys_user_name, string, 128);
user_data->sys_user_entered = TRUE;
user_data->sys_user_entered = true;
break;
case IN_SW_GSEC_GROUP:
strncpy(user_data->group_name, string, 128);
user_data->group_name_entered = TRUE;
user_data->group_name_entered = true;
break;
case IN_SW_GSEC_FNAME:
strncpy(user_data->first_name, string, 17);
user_data->first_name_entered = TRUE;
user_data->first_name_entered = true;
break;
case IN_SW_GSEC_MNAME:
strncpy(user_data->middle_name, string, 17);
user_data->middle_name_entered = TRUE;
user_data->middle_name_entered = true;
break;
case IN_SW_GSEC_LNAME:
strncpy(user_data->last_name, string, 17);
user_data->last_name_entered = TRUE;
user_data->last_name_entered = true;
break;
case IN_SW_GSEC_DATABASE:
strncpy(user_data->database_name, string, 512);
user_data->database_entered = TRUE;
user_data->database_entered = true;
break;
case IN_SW_GSEC_DBA_USER_NAME:
strncpy(user_data->dba_user_name, string, 133);
user_data->dba_user_name_entered = TRUE;
user_data->dba_user_name_entered = true;
break;
case IN_SW_GSEC_DBA_PASSWORD:
strncpy(user_data->dba_password, string, 33);
user_data->dba_password_entered = TRUE;
user_data->dba_password_entered = true;
break;
case IN_SW_GSEC_SQL_ROLE_NAME:
strncpy(user_data->sql_role_name, string, 33);
user_data->sql_role_name_entered = TRUE;
user_data->sql_role_name_entered = true;
break;
case IN_SW_GSEC_Z:
case IN_SW_GSEC_0:
@ -747,7 +747,7 @@ static bool get_switches(
break;
}
user_data->user_name[0] = '\0';
tdsec->tsec_interactive = FALSE;
tdsec->tsec_interactive = false;
break;
case IN_SW_GSEC_PASSWORD:
case IN_SW_GSEC_UID:
@ -768,7 +768,7 @@ static bool get_switches(
err_msg_no = GsecMsg31;
break;
}
user_data->password_specified = TRUE;
user_data->password_specified = true;
user_data->password[0] = '\0';
break;
case IN_SW_GSEC_UID:
@ -776,7 +776,7 @@ static bool get_switches(
err_msg_no = GsecMsg32;
break;
}
user_data->uid_specified = TRUE;
user_data->uid_specified = true;
user_data->uid = 0;
break;
case IN_SW_GSEC_GID:
@ -784,7 +784,7 @@ static bool get_switches(
err_msg_no = GsecMsg33;
break;
}
user_data->gid_specified = TRUE;
user_data->gid_specified = true;
user_data->gid = 0;
break;
case IN_SW_GSEC_SYSU:
@ -792,7 +792,7 @@ static bool get_switches(
err_msg_no = GsecMsg34;
break;
}
user_data->sys_user_specified = TRUE;
user_data->sys_user_specified = true;
user_data->sys_user_name[0] = '\0';
break;
case IN_SW_GSEC_GROUP:
@ -800,7 +800,7 @@ static bool get_switches(
err_msg_no = GsecMsg35;
break;
}
user_data->group_name_specified = TRUE;
user_data->group_name_specified = true;
user_data->group_name[0] = '\0';
break;
case IN_SW_GSEC_FNAME:
@ -808,7 +808,7 @@ static bool get_switches(
err_msg_no = GsecMsg36;
break;
}
user_data->first_name_specified = TRUE;
user_data->first_name_specified = true;
user_data->first_name[0] = '\0';
break;
case IN_SW_GSEC_MNAME:
@ -816,7 +816,7 @@ static bool get_switches(
err_msg_no = GsecMsg37;
break;
}
user_data->middle_name_specified = TRUE;
user_data->middle_name_specified = true;
user_data->middle_name[0] = '\0';
break;
case IN_SW_GSEC_LNAME:
@ -824,7 +824,7 @@ static bool get_switches(
err_msg_no = GsecMsg38;
break;
}
user_data->last_name_specified = TRUE;
user_data->last_name_specified = true;
user_data->last_name[0] = '\0';
break;
case IN_SW_GSEC_DATABASE:
@ -832,7 +832,7 @@ static bool get_switches(
err_msg_no = GsecMsg78;
break;
}
user_data->database_specified = TRUE;
user_data->database_specified = true;
user_data->database_name[0] = '\0';
break;
case IN_SW_GSEC_DBA_USER_NAME:
@ -840,7 +840,7 @@ static bool get_switches(
err_msg_no = GsecMsg79;
break;
}
user_data->dba_user_name_specified = TRUE;
user_data->dba_user_name_specified = true;
user_data->dba_user_name[0] = '\0';
break;
case IN_SW_GSEC_DBA_PASSWORD:
@ -848,7 +848,7 @@ static bool get_switches(
err_msg_no = GsecMsg80;
break;
}
user_data->dba_password_specified = TRUE;
user_data->dba_password_specified = true;
user_data->dba_password[0] = '\0';
break;
case IN_SW_GSEC_SQL_ROLE_NAME:
@ -856,7 +856,7 @@ static bool get_switches(
err_msg_no = GsecMsg81;
break;
}
user_data->sql_role_name_specified = TRUE;
user_data->sql_role_name_specified = true;
user_data->sql_role_name[0] = '\0';
break;
}
@ -870,7 +870,7 @@ static bool get_switches(
SECURITY_msg_get(GsecMsg39, msg);
util_output("%s %s\n", msg, GDS_VERSION);
}
tdsec->tsec_sw_version = TRUE;
tdsec->tsec_sw_version = true;
break;
case IN_SW_GSEC_0:
#ifdef SUPERSERVER

View File

@ -86,43 +86,43 @@
typedef struct user_data {
int operation; /* what's to be done */
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 */
BOOLEAN uid_entered; /* UID entered flag */
BOOLEAN uid_specified; /* UID specified flag */
bool uid_entered; /* UID entered flag */
bool uid_specified; /* UID specified flag */
int gid; /* the user's group id */
BOOLEAN gid_entered; /* GID entered flag */
BOOLEAN gid_specified; /* GID specified flag */
bool gid_entered; /* GID entered flag */
bool gid_specified; /* GID specified flag */
TEXT sys_user_name [ALT_NAME_LEN]; /* the sys_user's name */
BOOLEAN sys_user_entered; /* sys_user entered flag */
BOOLEAN sys_user_specified; /* sys_user specified flag */
bool sys_user_entered; /* sys_user entered flag */
bool sys_user_specified; /* sys_user specified flag */
TEXT group_name [ALT_NAME_LEN]; /* the group name */
BOOLEAN group_name_entered; /* group_name entered flag */
BOOLEAN group_name_specified; /* group_name specified flag */
bool group_name_entered; /* group_name entered flag */
bool group_name_specified; /* group_name specified flag */
TEXT password [NAME_LEN]; /* the user's password */
BOOLEAN password_entered; /* password entered flag */
BOOLEAN password_specified; /* password specified flag */
bool password_entered; /* password entered flag */
bool password_specified; /* password specified flag */
TEXT first_name [NAME_LEN]; /* the user's first name */
BOOLEAN first_name_entered; /* first name entered flag */
BOOLEAN first_name_specified; /* first name specified flag */
bool first_name_entered; /* first name entered flag */
bool first_name_specified; /* first name specified flag */
TEXT middle_name [NAME_LEN]; /* the user's middle name */
BOOLEAN middle_name_entered; /* middle name entered flag */
BOOLEAN middle_name_specified; /* middle name specified flag */
bool middle_name_entered; /* middle name entered flag */
bool middle_name_specified; /* middle name specified flag */
TEXT last_name [NAME_LEN]; /* the user's last name */
BOOLEAN last_name_entered; /* last name entered flag */
BOOLEAN last_name_specified; /* last name specified flag */
bool last_name_entered; /* last name entered flag */
bool last_name_specified; /* last name specified flag */
TEXT dba_user_name [USER_NAME_LEN]; /* the user's name */
BOOLEAN dba_user_name_entered; /* user name entered flag */
BOOLEAN dba_user_name_specified;/* database specified flag */
bool dba_user_name_entered; /* user name entered flag */
bool dba_user_name_specified;/* database specified flag */
TEXT dba_password [NAME_LEN]; /* the user's name */
BOOLEAN dba_password_entered; /* user name entered flag */
BOOLEAN dba_password_specified; /* database specified flag */
bool dba_password_entered; /* user name entered flag */
bool dba_password_specified; /* database specified flag */
TEXT sql_role_name [NAME_LEN]; /* the user's name */
BOOLEAN sql_role_name_entered; /* user name entered flag */
BOOLEAN sql_role_name_specified;/* database specified flag */
bool sql_role_name_entered; /* user name entered flag */
bool sql_role_name_specified;/* database specified flag */
TEXT database_name [512]; /* database pathname */
BOOLEAN database_entered; /* database entered flag */
BOOLEAN database_specified; /* database specified flag */
bool database_entered; /* database entered flag */
bool database_specified; /* database specified flag */
} *USER_DATA;
@ -133,10 +133,10 @@ typedef struct tsec {
jmp_buf* tsec_env;
ISC_STATUS *tsec_status;
ISC_STATUS_ARRAY tsec_status_vector;
BOOLEAN tsec_interactive;
BOOLEAN tsec_sw_version;
BOOLEAN tsec_service_gsec;
BOOLEAN tsec_service_thd;
bool tsec_interactive;
bool tsec_sw_version;
bool tsec_service_gsec;
bool tsec_service_thd;
int(*tsec_output_proc)(SLONG, UCHAR*);
SLONG tsec_output_data;
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_buflen;
SLONG wal_ckpt_intrvl;
SSHORT first_time_log;
bool first_time_log;
SSHORT logcount;
@ -148,7 +148,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
SCHAR last_logname[MAXPATHLEN];
SLONG last_log_partition_offset;
SLONG last_log_flags;
SSHORT any_log_to_be_archived;
bool any_log_to_be_archived;
if (argc < 2) {
ib_printf
@ -164,11 +164,11 @@ int CLIB_ROUTINE main( int argc, char **argv)
wal_buflen = MIN_WALBUFLEN;
wal_ckpt_intrvl = 100; /* 100K bytes */
if (argc == 6) {
first_time_log = TRUE;
first_time_log = true;
sscanf(argv[5], "%ld", &new_log_seqno);
}
else {
first_time_log = FALSE;
first_time_log = false;
/* Set some default value for the log_seqno. If using an existing
log file, log_seqno will be set accordingly by the WAL writer */
new_log_seqno = 1L;
@ -313,8 +313,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
if (strcmp(buff, "Q") == 0)
break;
if (strcmp(buff, "F") == 0) {
WAL_flush(status_vector, WAL_handle, &log_seqno, &log_offset,
FALSE);
WAL_flush(status_vector, WAL_handle, &log_seqno, &log_offset, false);
ib_printf("flushed_seqno=%ld, flushed_offset=%ld\n", log_seqno,
log_offset);
}
@ -392,7 +391,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
ib_printf("Enter the partition offset: ");
ib_scanf("%ld", &log_partition_offset);
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,
log_name, log_partition_offset,
&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 */
WALF_set_log_header_flag(status_vector, dbname, log_name,
log_partition_offset, log_flag,
(set == 'S') ? TRUE : FALSE);
(set == 'S'));
}
else if (strcmp(buff, "J") == 0) {
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_scanf("%c", &shutdown);
if (shutdown == 'y' || shutdown == 'Y') {
WAL_shutdown(status_vector, WAL_handle,
&log_seqno, log_name, &log_partition_offset, &log_offset,
FALSE);
WAL_shutdown(status_vector, WAL_handle, &log_seqno, log_name,
&log_partition_offset, &log_offset, false);
ib_printf("At shutdown:\n");
ib_printf
("log_seqno=%ld, logname=%s, log_partition_offset=%ld, shutdown offset=%ld\n",
@ -751,7 +749,7 @@ log_count = 3;
WALRS_handle = NULL;
if ((ret = WALR_open(status_vector, &WALRS_handle, dbname,
log_count, lognames, log_p_offsets,
0L, NULL, FALSE)) != FB_SUCCESS) {
0L, NULL, false)) != FB_SUCCESS) {
if (ret == -1) {
ib_printf("End of log...\n");
return FB_SUCCESS;

View File

@ -93,12 +93,12 @@ static SSHORT grpc_wait_for_group_commit_finish(ISC_STATUS *, WAL, SSHORT,
GRP_COMMIT *);
static void inform_wal_writer(WAL);
static SSHORT next_buffer_available(WALS);
static void setup_buffer_for_writing(WAL, WALS, SSHORT);
static SSHORT shutdown_writer(ISC_STATUS *, WAL, SSHORT);
static void setup_buffer_for_writing(WAL, WALS, bool);
static SSHORT shutdown_writer(ISC_STATUS *, WAL, bool);
static SSHORT sync_with_wal_writer(ISC_STATUS *, WAL);
static SSHORT wait_for_writer(ISC_STATUS *, WAL);
static SSHORT wal_put2(ISC_STATUS *, WAL, UCHAR *, USHORT, UCHAR *, USHORT,
SLONG *, SLONG *, SSHORT);
SLONG *, SLONG *, bool);
#ifdef WIN_NT
#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;
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 = WALC_check_writer(*WAL_handle)) != FB_SUCCESS)
ret = fork_writer(status_vector, *WAL_handle);
@ -199,7 +199,7 @@ SSHORT WAL_checkpoint_finish(ISC_STATUS * status_vector,
UCHAR chkpt_rec[100];
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
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_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);
*log_seqno = WAL_segment->wals_ckpted_log_seqno;
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,
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
* 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.
*
@ -276,10 +277,10 @@ SSHORT WAL_checkpoint_start(ISC_STATUS * status_vector,
WALC_acquire(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) &&
!(WAL_segment->wals_flags & WALS_CKPT_RECORDED))
*ckpt_start = TRUE;
*ckpt_start = true;
WALC_release(WAL_handle);
return FB_SUCCESS;
@ -345,8 +346,10 @@ SSHORT WAL_commit(ISC_STATUS * status_vector,
WALS WAL_segment;
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;
}
SSHORT ret = FB_SUCCESS;
@ -381,7 +384,7 @@ SSHORT WAL_commit(ISC_STATUS * status_vector,
SLONG dummy_seqno;
SLONG dummy_offset;
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;
@ -421,10 +424,11 @@ void WAL_fini( ISC_STATUS * status_vector, WAL * WAL_handle)
}
SSHORT WAL_flush(
ISC_STATUS * status_vector,
SSHORT WAL_flush(ISC_STATUS * status_vector,
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. */
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++;
inform_wal_writer(WAL_handle);
@ -516,8 +520,10 @@ SSHORT WAL_init(ISC_STATUS * status_vector,
USHORT db_page_len,
SCHAR * logname,
SLONG log_partition_offset,
SSHORT first_time_log,
SLONG new_log_seqno, SSHORT wpb_length, SCHAR * wpb)
bool first_time_log,
SLONG new_log_seqno,
SSHORT wpb_length,
SCHAR * wpb)
{
/**************************************
*
@ -531,7 +537,7 @@ SSHORT WAL_init(ISC_STATUS * status_vector,
*
* 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
* files.
*
@ -541,15 +547,10 @@ SSHORT WAL_init(ISC_STATUS * status_vector,
**************************************/
ISC_STATUS_ARRAY local_status;
SSHORT ret = WALC_init(status_vector,
WAL_handle,
dbname,
db_page_len,
logname,
log_partition_offset,
first_time_log,
new_log_seqno,
wpb_length, reinterpret_cast < UCHAR * >(wpb), TRUE);
SSHORT ret = WALC_init(status_vector, WAL_handle, dbname, db_page_len,
logname, log_partition_offset, first_time_log,
new_log_seqno, wpb_length,
reinterpret_cast < UCHAR * >(wpb), TRUE);
if (ret == FB_SUCCESS) {
if ((ret = fork_writer(status_vector, *WAL_handle)) != FB_SUCCESS)
WALC_fini(local_status, WAL_handle);
@ -691,7 +692,7 @@ SSHORT WAL_put(ISC_STATUS * status_vector,
**************************************/
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
* 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
* with the new information. The caller should invoke
* WAL_rollover_recorded() after recording the rollover
@ -883,7 +884,8 @@ SSHORT WAL_shutdown(ISC_STATUS * status_vector,
SLONG * log_seqno,
SCHAR * logname,
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 */
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);
@ -1191,9 +1193,8 @@ static SSHORT grpc_do_group_commit(
if (ret != FB_SUCCESS)
return ret;
ret =
WAL_flush(status_vector, WAL_handle, &dummy_seqno, &dummy_offset,
FALSE);
ret = WAL_flush(status_vector, WAL_handle, &dummy_seqno, &dummy_offset,
false);
if (ret != FB_SUCCESS)
return ret;
@ -1263,10 +1264,7 @@ static SSHORT grpc_wait_for_grouping(
SLONG value = ISC_event_clear(ptr);
WALC_release(WAL_handle);
ISC_event_wait(1,
&ptr,
&value,
WAL_handle->wal_grpc_wait_usecs,
ISC_event_wait(1, &ptr, &value, WAL_handle->wal_grpc_wait_usecs,
WALC_alarm_handler, ptr);
/* 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];
value = ISC_event_clear(ptr);
WALC_release(WAL_handle);
while (ISC_event_wait(1, &ptr, &value,
WAL_handle->wal_grpc_wait_coord_usecs,
while (ISC_event_wait(1, &ptr, &value, WAL_handle->wal_grpc_wait_coord_usecs,
WALC_alarm_handler, ptr) != FB_SUCCESS)
{
/* 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(
WAL WAL_handle,
WALS WAL_segment, SSHORT ckpt)
static void setup_buffer_for_writing(WAL WAL_handle,
WALS WAL_segment,
bool ckpt)
{
/**************************************
*
@ -1437,7 +1434,7 @@ static void setup_buffer_for_writing(
* Inform the WAL writer that the current buffer is ready
* to be flushed to disk. Assumes that acquire() has
* 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;
@ -1454,9 +1451,9 @@ static void setup_buffer_for_writing(
}
static SSHORT shutdown_writer(
ISC_STATUS * status_vector,
WAL WAL_handle, SSHORT inform_close_to_jserver)
static SSHORT shutdown_writer(ISC_STATUS * status_vector,
WAL WAL_handle,
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);
WALC_release(WAL_handle);
ret =
ISC_event_wait(1, &ptr, &value, WAIT_TIME,
ret = ISC_event_wait(1, &ptr, &value, WAIT_TIME,
WALC_alarm_handler, ptr);
if (ret == FB_FAILURE) {
/* 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(
ISC_STATUS * status_vector,
static SSHORT wal_put2(ISC_STATUS * status_vector,
WAL WAL_handle,
UCHAR * logrec1,
USHORT len1,
UCHAR * logrec2,
USHORT len2, SLONG * log_seqno, SLONG * log_offset, SSHORT ckpt)
UCHAR * logrec2,
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
* 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.
* The WAL writer will handle this checkpointed buffer in a special
* way.
@ -1621,7 +1619,8 @@ USHORT len2, SLONG * log_seqno, SLONG * log_offset, SSHORT ckpt)
*
**************************************/
int available_bytes;
USHORT total_len, done = FALSE;
USHORT total_len;
bool done = false;
WALBLK *wblk;
SLONG lsn;
SLONG offset;
@ -1664,7 +1663,7 @@ USHORT len2, SLONG * log_seqno, SLONG * log_offset, SSHORT ckpt)
{
WAL_segment->wals_flags |= WALS_ROLLOVER_REQUIRED;
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++;
wait_for_writer(status_vector, WAL_handle);
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. */
lsn = WAL_segment->wals_log_seqno;
offset =
copy_buffer(WAL_segment, wblk, logrec1, len1, logrec2, len2);
done = TRUE;
offset = copy_buffer(WAL_segment, wblk, logrec1, len1, logrec2, len2);
done = true;
}
else
/* Assumption: One empty WAL buffer is long enough to fully accommodate
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)

View File

@ -32,12 +32,13 @@
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_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_commit (ISC_STATUS *, struct wal *, UCHAR *, USHORT, SLONG *, SLONG *);
extern void WAL_fini (ISC_STATUS *, struct wal **);
extern SSHORT WAL_flush (ISC_STATUS *, struct wal *, SLONG *, SLONG *, BOOLEAN);
extern SSHORT WAL_init (ISC_STATUS *, struct wal **, SCHAR *, USHORT, SCHAR *, SLONG, SSHORT, SLONG, SSHORT, SCHAR *);
extern SSHORT WAL_flush (ISC_STATUS *, struct wal *, SLONG *, SLONG *, bool);
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_enable (ISC_STATUS *, struct wal *, SCHAR *, USHORT, SCHAR *);
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 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_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_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;
TEXT *walc_logname;
SLONG walc_log_partition_offset;
SSHORT walc_first_time_log;
SLONG walc_new_log_seqno; /* used when first_time_log is TRUE */
bool walc_first_time_log;
SLONG walc_new_log_seqno; // used when first_time_log is true
SSHORT walc_maxbufs;
USHORT walc_bufsize;
@ -362,9 +362,11 @@ SSHORT WALC_init(ISC_STATUS * status_vector,
USHORT db_page_len,
TEXT * logname,
SLONG log_partition_offset,
SSHORT first_time_log,
bool first_time_log,
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 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
* 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
* 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.
*
***************************************/

View File

@ -31,9 +31,10 @@ extern void WALC_build_dbg_filename (TEXT *, TEXT *);
extern void WALC_build_logname (TEXT *, TEXT *, SLONG);
extern SSHORT WALC_check_writer (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_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_ */

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() */
if (!log_header)
return FB_FAILURE;
ret =
WALF_open_log_file(status_vector, dbname, logname,
ret = WALF_open_log_file(status_vector, dbname, logname,
log_partition_offset, log_header, &log_fd);
if (ret != FB_SUCCESS) {
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() */
if (!log_header)
return FB_FAILURE;
ret =
WALF_open_log_file(status_vector, dbname, logname,
ret = WALF_open_log_file(status_vector, dbname, logname,
log_partition_offset, log_header, &log_fd);
if (ret != FB_SUCCESS) {
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 * starting_logname,
SLONG starting_log_partition_offset,
@ -194,7 +192,7 @@ SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector,
SCHAR * last_logname,
SLONG * last_log_partition_offset,
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)
* 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
* 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.
* 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,
starting_log_partition_offset,
&log_seqno, &log_length,
&log_flags)) != FB_SUCCESS) return FB_FAILURE;
*any_log_to_be_archived =
((log_flags & WALFH_KEEP_FOR_LONG_TERM_RECV) ? TRUE : FALSE);
&log_flags)) != FB_SUCCESS)
{
return false;
}
*any_log_to_be_archived = (log_flags & WALFH_KEEP_FOR_LONG_TERM_RECV);
strcpy(log_name1, starting_logname);
curr_name = log_name1;
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,
prev_name, &prev_log_partition_offset, &log_seqno, &log_length,
&log_flags, -1) != FB_SUCCESS)
{
break;
}
log_count++;
temp_name = prev_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;
if (!(*any_log_to_be_archived) &&
(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. */
@ -265,7 +269,7 @@ SSHORT WALF_get_linked_logs_info(ISC_STATUS * status_vector,
*last_log_partition_offset = curr_log_partition_offset;
*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,
SLONG log_partition_offset,
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
* 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.
*
**************************************/
@ -296,13 +301,12 @@ SSHORT WALF_get_log_info(ISC_STATUS * status_vector,
log_header = (WALFH) gds__alloc(WALFH_LENGTH);
/* NOMEM: error return, FREE: by error returns & WALF_dispose_log_header() */
if (!log_header)
return FB_FAILURE;
ret =
WALF_open_log_file(status_vector, dbname, logname,
return false;
ret = WALF_open_log_file(status_vector, dbname, logname,
log_partition_offset, log_header, &log_fd);
if (ret != FB_SUCCESS) {
gds__free((SLONG *) log_header);
return FB_FAILURE;
return false;
}
*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_seqno,
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)
return FB_FAILURE;
ret =
WALF_open_log_file(status_vector, dbname, logname,
ret = WALF_open_log_file(status_vector, dbname, logname,
log_partition_offset, log_header, &log_fd);
if (ret != FB_SUCCESS) {
gds__free((SLONG *) log_header);
@ -736,7 +740,8 @@ SSHORT WALF_set_log_header_flag(ISC_STATUS * status_vector,
SCHAR * dbname,
SCHAR * logname,
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
* Update the walfh_flags field of the log header in the log
* 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.
* 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_prev_log (ISC_STATUS *, SCHAR *, SCHAR *, SLONG);
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_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_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_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 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);

View File

@ -206,7 +206,8 @@ SSHORT WALR_open(ISC_STATUS * status_vector,
SCHAR ** lognames,
SLONG * log_partitions_offsets,
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_get (ISC_STATUS *, struct walrs *, UCHAR *, USHORT *, SLONG *, 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_ */

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)); }
static void close_log(ISC_STATUS *, WAL, SCHAR *, WALFH, SLONG);
static SSHORT discard_prev_logs(ISC_STATUS *, SCHAR *, SCHAR *, SLONG, SSHORT);
static void close_log(ISC_STATUS *, WAL, SCHAR *, WALFH, bool);
static SSHORT discard_prev_logs(ISC_STATUS *, SCHAR *, SCHAR *, SLONG, bool);
static void finishup_checkpoint(WALS);
static SSHORT flush_all_buffers(ISC_STATUS *, WAL);
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 void setup_for_checkpoint(WALS);
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,
SLONG *, WALFH, SSHORT, SCHAR *, SLONG,
SLONG *, WALFH, bool, SCHAR *, SLONG,
bool*);
static SSHORT write_log_header_and_reposition(ISC_STATUS *, SCHAR *, SLONG,
WALFH);
@ -233,7 +233,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
WAL WAL_handle = NULL;
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__print_status(status_vector);
exit(FINI_ERROR);
@ -351,7 +352,7 @@ static SSHORT walw_writer(ISC_STATUS * status_vector, WAL WAL_handle)
WALS WAL_segment;
WALBLK *wblk;
SSHORT bufnum;
SSHORT first_logfile;
bool first_logfile;
int buffer_full;
int journal_enable_or_disable;
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_CHECK_BUG_ERROR(WAL_handle, WAL_segment);
first_logfile =
(WAL_segment->wals_flags & WALS_FIRST_TIME_LOG) ? TRUE : FALSE;
first_logfile = (WAL_segment->wals_flags & WALS_FIRST_TIME_LOG);
log_type = 0L;
if (first_logfile) {
/* 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);
acquired = false;
ISC_event_wait(1, &ptr, &value, WALW_WRITER_TIMEOUT_USECS,
WALC_alarm_handler, ptr);
(WALC_alarm_handler), ptr);
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,
WAL_segment->wals_prev_ckpt_logname,
WAL_segment->wals_prev_ckpt_log_p_offset,
FALSE);
false);
#ifdef SUPERSERVER
/* 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
@ -603,7 +603,7 @@ static SSHORT walw_writer(ISC_STATUS * status_vector, WAL WAL_handle)
log_header->walfh_hibsn = WAL_segment->wals_blkseqno - 1;
close_log(status_vector, WAL_handle, WAL_segment->wals_logname,
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);
WAL_segment->wals_flags |= WALS_WRITER_DONE;
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(
ISC_STATUS * status_vector,
static void close_log(ISC_STATUS * status_vector,
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(
ISC_STATUS * status_vector,
static SSHORT discard_prev_logs(ISC_STATUS * status_vector,
SCHAR * dbname,
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
* one, mark all the log files as NOT needed for short-term
* 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.
* 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. */
WALF_set_log_header_flag(status_vector, dbname, log_name,
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. */
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);
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(
ISC_STATUS * status_vector,
static bool get_log_usability(ISC_STATUS * status_vector,
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
* 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.
*
**************************************/
@ -1077,11 +1078,11 @@ SLONG * new_offset, SLONG * log_type)
}
static SSHORT get_next_serial_logname(
ISC_STATUS * status_vector,
static SSHORT get_next_serial_logname(ISC_STATUS * status_vector,
WALS WAL_segment,
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];
SLONG last_log_partition_offset;
SLONG last_log_flags;
SSHORT any_log_to_be_archived;
bool any_log_to_be_archived;
SLONG fd;
int retry_count;
#define MAX_RETRIES 1000
@ -1120,7 +1121,8 @@ SLONG * new_offset, SLONG * log_type)
logf->logf_fname_seqno);
logf->logf_fname_seqno++;
if (LLIO_open(status_vector, new_logname, LLIO_OPEN_NEW_RW, TRUE, &fd)
== FB_SUCCESS) {
== FB_SUCCESS)
{
/* Found one */
LLIO_close(status_vector, fd);
@ -1186,24 +1188,26 @@ static bool get_next_usable_partition(
*
* Functional description
* 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.
*
**************************************/
SLONG p_log_fd;
int i, j, count;
int i;
int j;
int count;
bool found;
SLONG p_offset;
P_LOGFH p_log_header = (P_LOGFH) gds__alloc(P_LOGFH_LENGTH);
/* NOMEM: return failure, FREE: by returns in this procedure */
if (!p_log_header)
return FALSE;
return false;
if (WALF_open_partitioned_log_file(status_vector, dbname, master_logname,
p_log_header, &p_log_fd) != FB_SUCCESS) {
gds__free((SLONG *) p_log_header);
return FALSE;
return false;
}
/* Now check for a free partition */
@ -1270,7 +1274,8 @@ SLONG * new_offset, SLONG * log_type)
logf->logf_fname_seqno++;
if (LLIO_open
(status_vector, new_logname, LLIO_OPEN_NEW_RW, TRUE,
&fd) == FB_SUCCESS) {
&fd) == FB_SUCCESS)
{
LLIO_close(status_vector, fd);
*new_offset = 0;
break;
@ -1772,7 +1777,7 @@ static SSHORT rollover_log(
ret = setup_log(status_vector, WAL_handle, new_logname,
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_log_partition_offset);
if (ret == FB_SUCCESS) {
@ -1804,7 +1809,7 @@ static SSHORT rollover_log(
log_header->walfh_length = saved_flushed_offset;
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
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(
ISC_STATUS * status_vector,
static SSHORT setup_log(ISC_STATUS * status_vector,
WAL WAL_handle,
SCHAR * logname,
SLONG log_partition_offset,
SLONG log_type,
SLONG * logfile_fd,
WALFH log_header,
SSHORT rollover, SCHAR * prev_logname, SLONG prev_log_partition_offset)
SLONG log_type,
SLONG * logfile_fd,
WALFH log_header,
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(
ISC_STATUS * status_vector,
static SSHORT setup_log_header_info(ISC_STATUS * status_vector,
WAL WAL_handle,
SCHAR * logname,
SLONG log_partition_offset,
SLONG log_type,
SLONG * logfile_fd,
WALFH log_header,
SSHORT rollover,
bool rollover,
SCHAR * prev_logname,
SLONG prev_log_partition_offset,
bool* takeover)
bool * takeover)
{
/**************************************
*
@ -1984,7 +1989,7 @@ static SSHORT setup_log_header_info(
* Functional description
* Open a given log file.
* 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
* name for the new log file.
* 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.
*
* If we determine that this is a takeover situation, set the takeover
* parameter to TRUE.
* parameter to true.
*
* Returns FB_SUCCESS or FB_FAILURE.
*