mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 00:03:03 +01:00
const correctness, almost minimal scope for variables, bool, etc.
Hope I did integrate others' changes correctly and totally.
This commit is contained in:
parent
fb952bae18
commit
65df94f50a
@ -21,8 +21,8 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_CMP_PROTO_H_
|
||||
#define _GPRE_CMP_PROTO_H_
|
||||
#ifndef GPRE_CMP_PROTO_H
|
||||
#define GPRE_CMP_PROTO_H
|
||||
|
||||
#include "../gpre/form.h"
|
||||
|
||||
@ -37,4 +37,4 @@ extern USHORT CMP_next_ident(void);
|
||||
extern void CMP_stuff_symbol(GPRE_REQ, SYM);
|
||||
extern void CMP_t_start(GPRE_TRA);
|
||||
|
||||
#endif /* _GPRE_CMP_PROTO_H_ */
|
||||
#endif /* GPRE_CMP_PROTO_H */
|
||||
|
@ -25,7 +25,7 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: exp.cpp,v 1.15 2003-09-05 14:55:59 brodsom Exp $
|
||||
// $Id: exp.cpp,v 1.16 2003-09-08 11:27:51 robocop Exp $
|
||||
//
|
||||
|
||||
#include "firebird.h"
|
||||
@ -168,7 +168,7 @@ GPRE_FLD EXP_cast(GPRE_FLD field)
|
||||
}
|
||||
if (!MATCH(KW_L_BRCKET) && !MATCH(KW_LT))
|
||||
SYNTAX_ERROR("left bracket or <");
|
||||
cast->fld_length += EXP_pos_USHORT_ordinal(TRUE);
|
||||
cast->fld_length += EXP_pos_USHORT_ordinal(true);
|
||||
if (!MATCH(KW_R_BRCKET) && !MATCH(KW_GT))
|
||||
SYNTAX_ERROR("right bracket or >");
|
||||
break;
|
||||
@ -616,14 +616,12 @@ ULONG EXP_ULONG_ordinal(USHORT advance_flag)
|
||||
// Parse and convert to binary a numeric token.
|
||||
//
|
||||
|
||||
USHORT EXP_USHORT_ordinal(USHORT advance_flag)
|
||||
USHORT EXP_USHORT_ordinal(bool advance_flag)
|
||||
{
|
||||
ULONG n;
|
||||
|
||||
if (token.tok_type != tok_number)
|
||||
SYNTAX_ERROR("<unsigned number>");
|
||||
|
||||
n = atoi(token.tok_string);
|
||||
ULONG n = atoi(token.tok_string);
|
||||
if (n > MAX_USHORT)
|
||||
PAR_error("Numeric value out of range");
|
||||
|
||||
@ -640,11 +638,9 @@ USHORT EXP_USHORT_ordinal(USHORT advance_flag)
|
||||
// Which must be non-zero.
|
||||
//
|
||||
|
||||
USHORT EXP_pos_USHORT_ordinal(USHORT advance_flag)
|
||||
USHORT EXP_pos_USHORT_ordinal(bool advance_flag)
|
||||
{
|
||||
USHORT n;
|
||||
|
||||
n = EXP_USHORT_ordinal(advance_flag);
|
||||
USHORT n = EXP_USHORT_ordinal(advance_flag);
|
||||
if (n == 0)
|
||||
PAR_error("Expected positive value");
|
||||
|
||||
@ -927,13 +923,13 @@ RSE EXP_rse(GPRE_REQ request, SYM initial_symbol)
|
||||
|
||||
direction = FALSE;
|
||||
insensitive = FALSE;
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (MATCH(KW_SORTED)) {
|
||||
MATCH(KW_BY);
|
||||
items = NULL;
|
||||
direction = 0;
|
||||
count = 0;
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (MATCH(KW_ASCENDING)) {
|
||||
direction = FALSE;
|
||||
continue;
|
||||
@ -980,7 +976,7 @@ RSE EXP_rse(GPRE_REQ request, SYM initial_symbol)
|
||||
MATCH(KW_TO);
|
||||
items = NULL;
|
||||
count = 0;
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
item = par_value(request, 0);
|
||||
count++;
|
||||
PUSH(item, &items);
|
||||
@ -1059,7 +1055,7 @@ GPRE_NOD EXP_subscript(GPRE_REQ request)
|
||||
return node;
|
||||
}
|
||||
|
||||
reference->ref_value = PAR_native_value(TRUE, FALSE);
|
||||
reference->ref_value = PAR_native_value(true, false);
|
||||
|
||||
if (request) {
|
||||
reference->ref_next = request->req_values;
|
||||
@ -1449,7 +1445,7 @@ static GPRE_NOD par_multiply( GPRE_REQ request, GPRE_FLD field)
|
||||
|
||||
node = par_primitive_value(request, field);
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (MATCH(KW_ASTERISK))
|
||||
operator_ = nod_times;
|
||||
else if (MATCH(KW_SLASH))
|
||||
@ -1489,7 +1485,7 @@ static GPRE_NOD par_native_value( GPRE_REQ request, GPRE_FLD field)
|
||||
// to be exported to the database system, make sure there is a reference
|
||||
// field.
|
||||
|
||||
reference->ref_value = PAR_native_value(FALSE, FALSE);
|
||||
reference->ref_value = PAR_native_value(false, false);
|
||||
|
||||
if (!field) {
|
||||
sprintf(s, "no reference field for %s", reference->ref_value);
|
||||
@ -1774,7 +1770,7 @@ static GPRE_NOD par_value( GPRE_REQ request, GPRE_FLD field)
|
||||
|
||||
node = par_multiply(request, field);
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (MATCH(KW_PLUS))
|
||||
operator_ = nod_plus;
|
||||
else if (MATCH(KW_MINUS))
|
||||
@ -1785,3 +1781,4 @@ static GPRE_NOD par_value( GPRE_REQ request, GPRE_FLD field)
|
||||
node = MSC_binary(operator_, arg, par_value(request, field));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_EXP_PROTO_H_
|
||||
#define _GPRE_EXP_PROTO_H_
|
||||
#ifndef GPRE_EXP_PROTO_H
|
||||
#define GPRE_EXP_PROTO_H
|
||||
|
||||
extern GPRE_NOD EXP_array(GPRE_REQ, GPRE_FLD, SSHORT, SSHORT);
|
||||
extern GPRE_FLD EXP_cast(GPRE_FLD);
|
||||
@ -44,7 +44,8 @@ extern SLONG EXP_SLONG_ordinal(USHORT);
|
||||
extern SINT64 EXP_SINT64_ordinal(USHORT);
|
||||
extern SSHORT EXP_SSHORT_ordinal(USHORT);
|
||||
extern ULONG EXP_ULONG_ordinal(USHORT);
|
||||
extern USHORT EXP_USHORT_ordinal(USHORT);
|
||||
extern USHORT EXP_pos_USHORT_ordinal(USHORT);
|
||||
extern USHORT EXP_USHORT_ordinal(bool);
|
||||
extern USHORT EXP_pos_USHORT_ordinal(bool);
|
||||
|
||||
#endif /* GPRE_EXP_PROTO_H */
|
||||
|
||||
#endif /* _GPRE_EXP_PROTO_H_ */
|
||||
|
@ -22,8 +22,8 @@
|
||||
*/
|
||||
#ifdef PYXIS
|
||||
|
||||
#ifndef _GPRE_FORM_H_
|
||||
#define _GPRE_FORM_H_
|
||||
#ifndef GPRE_FORM_H
|
||||
#define GPRE_FORM_H
|
||||
|
||||
/* Form instance */
|
||||
|
||||
@ -77,6 +77,6 @@ typedef struct menu {
|
||||
#define menu_entree_value menu_entree.entree_value
|
||||
#define menu_entree_entree menu_entree.entree_entree
|
||||
|
||||
#endif /* _GPRE_FORM_H_ */
|
||||
#endif /* GPRE_FORM_H */
|
||||
|
||||
#endif
|
||||
#endif /* PYXIS */
|
||||
|
@ -20,7 +20,7 @@
|
||||
//
|
||||
// All Rights Reserved.
|
||||
// Contributor(s): ______________________________________.
|
||||
// $Id: gpre.cpp,v 1.30 2003-09-06 00:52:10 brodsom Exp $
|
||||
// $Id: gpre.cpp,v 1.31 2003-09-08 11:27:51 robocop Exp $
|
||||
// Revision 1.2 2000/11/16 15:54:29 fsg
|
||||
// Added new switch -verbose to gpre that will dump
|
||||
// parsed lines to stderr
|
||||
@ -42,7 +42,6 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: gpre.cpp,v 1.30 2003-09-06 00:52:10 brodsom Exp $
|
||||
//
|
||||
|
||||
#define GPRE_MAIN
|
||||
@ -101,7 +100,7 @@ static BOOLEAN file_rename(TEXT *, TEXT *, TEXT *);
|
||||
static void finish_based(ACT);
|
||||
#endif
|
||||
static int get_char(IB_FILE *);
|
||||
static BOOLEAN get_switches(int, TEXT **, IN_SW_TAB, SW_TAB, TEXT **);
|
||||
static BOOLEAN get_switches(int, TEXT **, const in_sw_tab_t*, SW_TAB, TEXT **);
|
||||
static TOK get_token();
|
||||
static int nextchar();
|
||||
static SLONG pass1(TEXT*);
|
||||
@ -153,7 +152,7 @@ bool isLangCpp(LANG_T lang) {
|
||||
* the default extensions for DML and host languages.
|
||||
*/
|
||||
|
||||
typedef struct ext_table_t
|
||||
struct ext_table_t
|
||||
{
|
||||
lang_t ext_language;
|
||||
gpre_cmd_switch ext_in_sw;
|
||||
@ -162,7 +161,7 @@ typedef struct ext_table_t
|
||||
};
|
||||
|
||||
|
||||
static ext_table_t dml_ext_table[] =
|
||||
static const ext_table_t dml_ext_table[] =
|
||||
{
|
||||
{ lang_c, IN_SW_GPRE_C, ".e", ".c" },
|
||||
|
||||
@ -256,7 +255,7 @@ int main(int argc, char* argv[])
|
||||
TEXT spare_file_name[256];
|
||||
TEXT spare_out_file_name[256];
|
||||
BOOLEAN renamed, explicit_;
|
||||
ext_table_t* ext_tab;
|
||||
const ext_table_t* ext_tab;
|
||||
sw_tab_t sw_table[IN_SW_GPRE_COUNT];
|
||||
#ifdef VMS
|
||||
IB_FILE *temp;
|
||||
@ -452,7 +451,7 @@ int main(int argc, char* argv[])
|
||||
// adding in the language switch in case we inferred it rather than parsing it.
|
||||
//
|
||||
|
||||
ext_table_t* src_ext_tab = dml_ext_table;
|
||||
const ext_table_t* src_ext_tab = dml_ext_table;
|
||||
|
||||
while (src_ext_tab->ext_language != sw_language) {
|
||||
++src_ext_tab;
|
||||
@ -812,7 +811,7 @@ int main(int argc, char* argv[])
|
||||
//
|
||||
|
||||
if (!sw_standard_out) {
|
||||
ext_table_t* out_src_ext_tab = src_ext_tab;
|
||||
const ext_table_t* out_src_ext_tab = src_ext_tab;
|
||||
if (use_lang_internal_gxx_output) {
|
||||
out_src_ext_tab = dml_ext_table;
|
||||
while (out_src_ext_tab->ext_language != lang_internal_cxx) {
|
||||
@ -969,7 +968,7 @@ void CPR_end_text( TXT text)
|
||||
// Issue an error message.
|
||||
//
|
||||
|
||||
int CPR_error( TEXT * string)
|
||||
int CPR_error(const TEXT* string)
|
||||
{
|
||||
|
||||
ib_fprintf(ib_stderr, "(E) %s:%d: %s\n", file_name, line + 1, string);
|
||||
@ -1011,7 +1010,7 @@ void CPR_exit( int stat)
|
||||
// Issue an warning message.
|
||||
//
|
||||
|
||||
void CPR_warn( TEXT * string)
|
||||
void CPR_warn(const TEXT* string)
|
||||
{
|
||||
|
||||
ib_fprintf(ib_stderr, "(W) %s:%d: %s\n", file_name, line + 1, string);
|
||||
@ -1669,12 +1668,12 @@ static int get_char( IB_FILE * file)
|
||||
|
||||
static BOOLEAN get_switches(int argc,
|
||||
TEXT** argv,
|
||||
IN_SW_TAB in_sw_table,
|
||||
const in_sw_tab_t* in_sw_table,
|
||||
SW_TAB sw_table,
|
||||
TEXT** file_array)
|
||||
{
|
||||
TEXT *p, *q, *string;
|
||||
IN_SW_TAB in_sw_table_iterator;
|
||||
const in_sw_tab_t* in_sw_table_iterator;
|
||||
SW_TAB sw_table_iterator;
|
||||
USHORT in_sw;
|
||||
|
||||
@ -2662,7 +2661,7 @@ static void pass2( SLONG start_position)
|
||||
|
||||
static void print_switches()
|
||||
{
|
||||
IN_SW_TAB in_sw_table_iterator;
|
||||
const in_sw_tab_t* in_sw_table_iterator;
|
||||
|
||||
ib_fprintf(ib_stderr, "\tlegal switches are:\n");
|
||||
for (in_sw_table_iterator = gpre_in_sw_table;
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* $Id: gpre.h,v 1.37 2003-09-06 00:52:10 brodsom Exp $
|
||||
* $Id: gpre.h,v 1.38 2003-09-08 11:27:51 robocop Exp $
|
||||
* Revision 1.3 2000/11/27 09:26:13 fsg
|
||||
* Fixed bugs in gpre to handle PYXIS forms
|
||||
* and allow edit.e and fred.e to go through
|
||||
@ -56,8 +56,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_GPRE_H_
|
||||
#define _GPRE_GPRE_H_
|
||||
#ifndef GPRE_GPRE_H
|
||||
#define GPRE_GPRE_H
|
||||
|
||||
#include <stddef.h> // offsetof
|
||||
|
||||
@ -1544,5 +1544,5 @@ EXTERN USHORT ada_flags;
|
||||
#define assert_IS_NOD(x) assert(!(x) || ((x)->nod_type >= 1 && (x)->nod_type < nod_LASTNOD))
|
||||
#define assert_IS_ACT(x) assert(!(x) || ((x)->act_type >= 0 && (x)->act_type < ACT_LASTACT))
|
||||
|
||||
#endif /* _GPRE_GPRE_H_ */
|
||||
#endif /* GPRE_GPRE_H */
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_GPRE_PROTO_H_
|
||||
#define _GPRE_GPRE_PROTO_H_
|
||||
#ifndef GPRE_GPRE_PROTO_H
|
||||
#define GPRE_GPRE_PROTO_H
|
||||
|
||||
#include "../gpre/parse.h"
|
||||
|
||||
@ -32,9 +32,9 @@ extern void CPR_assert(TEXT *, int);
|
||||
#endif
|
||||
extern void CPR_bugcheck(TEXT *);
|
||||
extern void CPR_end_text(TXT);
|
||||
extern int CPR_error(TEXT *);
|
||||
extern int CPR_error(const TEXT*);
|
||||
extern void CPR_exit(int);
|
||||
extern void CPR_warn(TEXT *);
|
||||
extern void CPR_warn(const TEXT*);
|
||||
extern TOK CPR_eol_token(void);
|
||||
extern void CPR_get_text(TEXT *, TXT);
|
||||
extern void CPR_raw_read(void);
|
||||
@ -42,4 +42,4 @@ extern void CPR_s_error(TEXT *);
|
||||
extern TXT CPR_start_text(void);
|
||||
extern TOK CPR_token(void);
|
||||
|
||||
#endif /* _GPRE_GPRE_PROTO_H_ */
|
||||
#endif /* GPRE_GPRE_PROTO_H */
|
||||
|
@ -19,7 +19,7 @@
|
||||
*
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
* $Id: gpreswi.h,v 1.9 2003-09-05 10:14:08 aafemt Exp $
|
||||
* $Id: gpreswi.h,v 1.10 2003-09-08 11:27:51 robocop Exp $
|
||||
* Revision 1.2 2000/11/16 15:54:29 fsg
|
||||
* Added new switch -verbose to gpre that will dump
|
||||
* parsed lines to stderr
|
||||
@ -114,7 +114,7 @@ typedef struct sw_tab_t
|
||||
} *SW_TAB;
|
||||
|
||||
|
||||
static in_sw_tab_t gpre_in_sw_table[] =
|
||||
static const in_sw_tab_t gpre_in_sw_table[] =
|
||||
{
|
||||
#ifdef GPRE_ADA
|
||||
{IN_SW_GPRE_ADA , 0, "ADA" , 0, 0, 0, FALSE, 0, 0, "\t\textended ADA program"},
|
||||
|
@ -21,8 +21,8 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_HSH_PROTO_H_
|
||||
#define _GPRE_HSH_PROTO_H_
|
||||
#ifndef GPRE_HSH_PROTO_H
|
||||
#define GPRE_HSH_PROTO_H
|
||||
|
||||
extern void HSH_fini(void);
|
||||
extern void HSH_init(void);
|
||||
@ -31,4 +31,4 @@ extern SYM HSH_lookup(SCHAR *);
|
||||
extern SYM HSH_lookup2(SCHAR *);
|
||||
extern void HSH_remove(SYM);
|
||||
|
||||
#endif /* _GPRE_HSH_PROTO_H_ */
|
||||
#endif /* GPRE_HSH_PROTO_H */
|
||||
|
@ -21,9 +21,9 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_JRDME_PROTO_H_
|
||||
#define _GPRE_JRDME_PROTO_H_
|
||||
#ifndef GPRE_JRDME_PROTO_H
|
||||
#define GPRE_JRDME_PROTO_H
|
||||
|
||||
extern void JRDMET_init(DBB);
|
||||
|
||||
#endif /* _GPRE_JRDME_PROTO_H_ */
|
||||
#endif /* GPRE_JRDME_PROTO_H */
|
||||
|
@ -21,8 +21,8 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_LANG_PROTO_H_
|
||||
#define _GPRE_LANG_PROTO_H_
|
||||
#ifndef GPRE_LANG_PROTO_H
|
||||
#define GPRE_LANG_PROTO_H
|
||||
|
||||
extern void ADA_action(ACT, int);
|
||||
extern void ADA_print_buffer(TEXT *, int);
|
||||
@ -39,4 +39,4 @@ extern void INT_CXX_action(ACT, int);
|
||||
extern void PAS_action(ACT, int);
|
||||
extern int PLI_action(ACT, int);
|
||||
|
||||
#endif /* _GPRE_LANG_PROTO_H_ */
|
||||
#endif /* GPRE_LANG_PROTO_H */
|
||||
|
@ -25,10 +25,9 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: msc.cpp,v 1.9 2003-09-06 00:52:10 brodsom Exp $
|
||||
// $Id: msc.cpp,v 1.10 2003-09-08 11:27:51 robocop Exp $
|
||||
//
|
||||
//
|
||||
//$Id: msc.cpp,v 1.9 2003-09-06 00:52:10 brodsom Exp $
|
||||
//
|
||||
|
||||
// ***************************************************
|
||||
@ -213,7 +212,7 @@ GPRE_CTX MSC_context(GPRE_REQ request)
|
||||
// Copy one string into another.
|
||||
//
|
||||
|
||||
void MSC_copy( char *from, int length, char *to)
|
||||
void MSC_copy(const char* from, int length, char* to)
|
||||
{
|
||||
|
||||
if (length)
|
||||
@ -229,7 +228,8 @@ void MSC_copy( char *from, int length, char *to)
|
||||
// Copy two strings into another.
|
||||
//
|
||||
|
||||
void MSC_copy_cat( char *from1, int length1, char *from2, int length2, char *to)
|
||||
void MSC_copy_cat(const char* from1, int length1, const char* from2, int length2,
|
||||
char* to)
|
||||
{
|
||||
|
||||
if (length1)
|
||||
|
@ -21,8 +21,8 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_MSC_PROTO_H_
|
||||
#define _GPRE_MSC_PROTO_H_
|
||||
#ifndef GPRE_MSC_PROTO_H
|
||||
#define GPRE_MSC_PROTO_H
|
||||
|
||||
#include "../gpre/parse.h"
|
||||
|
||||
@ -31,8 +31,8 @@ extern UCHAR *MSC_alloc(int);
|
||||
extern UCHAR *MSC_alloc_permanent(int);
|
||||
extern GPRE_NOD MSC_binary(NOD_T, GPRE_NOD, GPRE_NOD);
|
||||
extern GPRE_CTX MSC_context(GPRE_REQ);
|
||||
extern void MSC_copy(char *, int, char *);
|
||||
extern void MSC_copy_cat(char *, int, char *, int, char *);
|
||||
extern void MSC_copy(const char*, int, char*);
|
||||
extern void MSC_copy_cat(const char*, int, const char*, int, char*);
|
||||
extern SYM MSC_find_symbol(SYM, enum sym_t);
|
||||
extern void MSC_free(UCHAR *);
|
||||
extern void MSC_free_request(GPRE_REQ);
|
||||
@ -52,4 +52,4 @@ extern SYM MSC_symbol(enum sym_t, TEXT *, USHORT, GPRE_CTX);
|
||||
extern GPRE_NOD MSC_unary(NOD_T, GPRE_NOD);
|
||||
extern USN MSC_username(SCHAR *, USHORT);
|
||||
|
||||
#endif /* _GPRE_MSC_PROTO_H_ */
|
||||
#endif /* GPRE_MSC_PROTO_H */
|
||||
|
127
src/gpre/par.cpp
127
src/gpre/par.cpp
@ -20,7 +20,7 @@
|
||||
//
|
||||
// All Rights Reserved.
|
||||
// Contributor(s): ______________________________________.
|
||||
// $Id: par.cpp,v 1.26 2003-09-06 00:52:10 brodsom Exp $
|
||||
// $Id: par.cpp,v 1.27 2003-09-08 11:27:51 robocop Exp $
|
||||
// Revision 1.2 2000/11/27 09:26:13 fsg
|
||||
// Fixed bugs in gpre to handle PYXIS forms
|
||||
// and allow edit.e and fred.e to go through
|
||||
@ -37,7 +37,6 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: par.cpp,v 1.26 2003-09-06 00:52:10 brodsom Exp $
|
||||
//
|
||||
|
||||
#include "firebird.h"
|
||||
@ -250,7 +249,7 @@ ACT PAR_action(TEXT* base_dir)
|
||||
return par_window_create();
|
||||
#endif
|
||||
case KW_DATABASE:
|
||||
return PAR_database(FALSE, base_dir);
|
||||
return PAR_database(false, base_dir);
|
||||
#ifdef PYXIS
|
||||
case KW_DELETE_WINDOW:
|
||||
return par_window_delete();
|
||||
@ -290,9 +289,9 @@ ACT PAR_action(TEXT* base_dir)
|
||||
case KW_ERASE:
|
||||
return cur_statement = par_erase();
|
||||
case KW_EVENT_INIT:
|
||||
return cur_statement = PAR_event_init(FALSE);
|
||||
return cur_statement = PAR_event_init(false);
|
||||
case KW_EVENT_WAIT:
|
||||
return cur_statement = PAR_event_wait(FALSE);
|
||||
return cur_statement = PAR_event_wait(false);
|
||||
case KW_FETCH:
|
||||
return cur_statement = par_fetch();
|
||||
case KW_FINISH:
|
||||
@ -525,14 +524,13 @@ SSHORT PAR_blob_subtype(DBB db)
|
||||
// an action block.
|
||||
//
|
||||
|
||||
ACT PAR_database(USHORT sql, TEXT* base_directory)
|
||||
ACT PAR_database(bool sql, const TEXT* base_directory)
|
||||
{
|
||||
ACT action;
|
||||
SYM symbol;
|
||||
DBB db, *db_ptr;
|
||||
TEXT s[256], *string;
|
||||
|
||||
action = MAKE_ACTION(0, ACT_database);
|
||||
ACT action = MAKE_ACTION(0, ACT_database);
|
||||
db = (DBB) ALLOC(DBB_LEN);
|
||||
|
||||
// Get handle name token, make symbol for handle, and
|
||||
@ -631,23 +629,23 @@ ACT PAR_database(USHORT sql, TEXT* base_directory)
|
||||
|
||||
if (MATCH(KW_RUNTIME)) {
|
||||
if (MATCH(KW_FILENAME))
|
||||
db->dbb_runtime = sql ? SQL_var_or_string((USHORT) FALSE)
|
||||
: PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_runtime = sql ? SQL_var_or_string(false)
|
||||
: PAR_native_value(false, false);
|
||||
else if (MATCH(KW_PASSWORD))
|
||||
db->dbb_r_password = sql ? SQL_var_or_string((USHORT) FALSE)
|
||||
: PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_r_password = sql ? SQL_var_or_string(false)
|
||||
: PAR_native_value(false, false);
|
||||
else if (MATCH(KW_USER))
|
||||
db->dbb_r_user = sql ? SQL_var_or_string((USHORT) FALSE)
|
||||
: PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_r_user = sql ? SQL_var_or_string(false)
|
||||
: PAR_native_value(false, false);
|
||||
else if (MATCH(KW_LC_MESSAGES))
|
||||
db->dbb_r_lc_messages = sql ? SQL_var_or_string((USHORT) FALSE)
|
||||
: PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_r_lc_messages = sql ? SQL_var_or_string(false)
|
||||
: PAR_native_value(false, false);
|
||||
else if (!sql && MATCH(KW_LC_CTYPE))
|
||||
db->dbb_r_lc_ctype = sql ? SQL_var_or_string((USHORT) FALSE)
|
||||
: PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_r_lc_ctype = sql ? SQL_var_or_string(false)
|
||||
: PAR_native_value(false, false);
|
||||
else
|
||||
db->dbb_runtime = sql ? SQL_var_or_string((USHORT) FALSE)
|
||||
: PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_runtime = sql ? SQL_var_or_string(false)
|
||||
: PAR_native_value(false, false);
|
||||
}
|
||||
|
||||
if ((sw_language == lang_ada) && (KEYWORD(KW_HANDLES))) {
|
||||
@ -729,7 +727,7 @@ BOOLEAN PAR_end()
|
||||
// Report an error during parse and unwind.
|
||||
//
|
||||
|
||||
void PAR_error( TEXT * string)
|
||||
void PAR_error(const TEXT* string)
|
||||
{
|
||||
|
||||
IBERROR(string);
|
||||
@ -743,7 +741,7 @@ void PAR_error( TEXT * string)
|
||||
// to wait on a number of named events.
|
||||
//
|
||||
|
||||
ACT PAR_event_init( USHORT sql)
|
||||
ACT PAR_event_init(bool sql)
|
||||
{
|
||||
GPRE_NOD init, event_list, node, *ptr;
|
||||
ACT action;
|
||||
@ -782,7 +780,7 @@ ACT PAR_event_init( USHORT sql)
|
||||
// eat any number of event strings until a right paren is found,
|
||||
// pushing the events onto a stack
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (MATCH(KW_RIGHT_PAREN))
|
||||
break;
|
||||
|
||||
@ -796,9 +794,9 @@ ACT PAR_event_init( USHORT sql)
|
||||
else {
|
||||
node = MAKE_NODE(nod_null, 1);
|
||||
if (sql)
|
||||
node->nod_arg[0] = (GPRE_NOD) SQL_var_or_string((USHORT) FALSE);
|
||||
node->nod_arg[0] = (GPRE_NOD) SQL_var_or_string(false);
|
||||
else
|
||||
node->nod_arg[0] = (GPRE_NOD) PAR_native_value(FALSE, FALSE);
|
||||
node->nod_arg[0] = (GPRE_NOD) PAR_native_value(false, false);
|
||||
}
|
||||
PUSH(node, &stack);
|
||||
count++;
|
||||
@ -827,7 +825,7 @@ ACT PAR_event_init( USHORT sql)
|
||||
// to wait on a number of named events.
|
||||
//
|
||||
|
||||
ACT PAR_event_wait(USHORT sql)
|
||||
ACT PAR_event_wait(bool sql)
|
||||
{
|
||||
ACT action;
|
||||
char req_name[132];
|
||||
@ -933,7 +931,7 @@ void PAR_init()
|
||||
// Parse a native expression as a string.
|
||||
//
|
||||
|
||||
TEXT *PAR_native_value(USHORT array_ref, USHORT handle_ref)
|
||||
TEXT *PAR_native_value(bool array_ref, bool handle_ref)
|
||||
{
|
||||
SCHAR *s2, buffer[512];
|
||||
SCHAR *string, *s1;
|
||||
@ -945,7 +943,7 @@ TEXT *PAR_native_value(USHORT array_ref, USHORT handle_ref)
|
||||
|
||||
string = buffer;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
/** PAR_native_values copies the string constants. These are
|
||||
passed to api calls. Make sure to enclose these with
|
||||
double quotes.
|
||||
@ -1082,14 +1080,14 @@ GPRE_FLD PAR_null_field()
|
||||
// TPB just hangs off the end of the transaction block.
|
||||
//
|
||||
|
||||
void PAR_reserving( USHORT flags, SSHORT parse_sql)
|
||||
void PAR_reserving( USHORT flags, bool parse_sql)
|
||||
{
|
||||
RRL lock_block;
|
||||
GPRE_REL relation;
|
||||
DBB database;
|
||||
USHORT lock_level, lock_mode;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
/* find a relation name, or maybe a list of them */
|
||||
|
||||
if ((!parse_sql) && terminator())
|
||||
@ -1129,20 +1127,20 @@ void PAR_reserving( USHORT flags, SSHORT parse_sql)
|
||||
else
|
||||
MATCH(KW_READ);
|
||||
|
||||
for (database = isc_databases; database;
|
||||
database = database->dbb_next) for (lock_block =
|
||||
database->dbb_rrls;
|
||||
lock_block;
|
||||
lock_block =
|
||||
lock_block->
|
||||
rrl_next) if (!lock_block->
|
||||
rrl_lock_level)
|
||||
for (database = isc_databases; database; database = database->dbb_next)
|
||||
{
|
||||
for (lock_block = database->dbb_rrls; lock_block;
|
||||
lock_block = lock_block->rrl_next)
|
||||
{
|
||||
if (!lock_block->rrl_lock_level)
|
||||
{
|
||||
assert(lock_level <= MAX_UCHAR);
|
||||
assert(lock_mode <= MAX_UCHAR);
|
||||
lock_block->rrl_lock_level = (UCHAR) lock_level;
|
||||
lock_block->rrl_lock_mode = (UCHAR) lock_mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(MATCH(KW_COMMA)))
|
||||
break;
|
||||
}
|
||||
@ -1216,7 +1214,7 @@ void PAR_using_db()
|
||||
DBB db;
|
||||
SYM symbol;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if ((symbol = MSC_find_symbol(token.tok_symbol, SYM_database))) {
|
||||
db = (DBB) symbol->sym_object;
|
||||
db->dbb_flags |= DBB_in_trans;
|
||||
@ -1511,7 +1509,7 @@ static ACT par_based()
|
||||
case lang_c:
|
||||
case lang_cxx:
|
||||
do {
|
||||
PUSH((GPRE_NOD) PAR_native_value(FALSE, FALSE),
|
||||
PUSH((GPRE_NOD) PAR_native_value(false, false),
|
||||
&based_on->bas_variables);
|
||||
} while (MATCH(KW_COMMA));
|
||||
/*
|
||||
@ -1738,7 +1736,7 @@ static ACT par_derived_from()
|
||||
based_on->bas_variables = (LLS) ALLOC(LLS_LEN);;
|
||||
based_on->bas_variables->lls_next = NULL;
|
||||
based_on->bas_variables->lls_object =
|
||||
(GPRE_NOD) PAR_native_value(FALSE, FALSE);
|
||||
(GPRE_NOD) PAR_native_value(false, false);
|
||||
|
||||
strcpy(based_on->bas_terminator, token.tok_string);
|
||||
ADVANCE_TOKEN;
|
||||
@ -2243,7 +2241,7 @@ static ACT par_finish()
|
||||
action = MAKE_ACTION(0, ACT_finish);
|
||||
|
||||
if (!terminator())
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if ((symbol = token.tok_symbol)
|
||||
&& (symbol->sym_type == SYM_database)) {
|
||||
ready = (RDY) ALLOC(RDY_LEN);
|
||||
@ -2631,7 +2629,7 @@ static ACT par_menu_case()
|
||||
else if (MATCH(KW_TRANSPARENT))
|
||||
request->req_flags |= REQ_transparent;
|
||||
else if (MATCH(KW_MENU_HANDLE)) {
|
||||
request->req_handle = PAR_native_value(FALSE, TRUE);
|
||||
request->req_handle = PAR_native_value(false, true);
|
||||
request->req_flags |= REQ_exp_hand;
|
||||
}
|
||||
else
|
||||
@ -2745,10 +2743,8 @@ static ACT par_menu_entree_att()
|
||||
static ACT par_menu_for()
|
||||
{
|
||||
SYM symbol;
|
||||
ACT action;
|
||||
GPRE_REQ request;
|
||||
GPRE_CTX context;
|
||||
MENU menu;
|
||||
|
||||
sw_pyxis = TRUE;
|
||||
request = MAKE_REQUEST(REQ_menu);
|
||||
@ -2757,7 +2753,7 @@ static ACT par_menu_for()
|
||||
if (MATCH(KW_LEFT_PAREN)) {
|
||||
for (;;)
|
||||
if (MATCH(KW_MENU_HANDLE)) {
|
||||
request->req_handle = PAR_native_value(FALSE, TRUE);
|
||||
request->req_handle = PAR_native_value(false, true);
|
||||
request->req_flags |= REQ_exp_hand;
|
||||
}
|
||||
else
|
||||
@ -2776,10 +2772,10 @@ static ACT par_menu_for()
|
||||
HSH_insert(symbol);
|
||||
PUSH((GPRE_NOD) request, &cur_menu);
|
||||
|
||||
action = MAKE_ACTION(request, ACT_menu_for);
|
||||
menu = (MENU) ALLOC(sizeof(menu));
|
||||
action->act_object = (REF) menu;
|
||||
menu->menu_request = request;
|
||||
ACT action = MAKE_ACTION(request, ACT_menu_for);
|
||||
MENU a_menu = (MENU) ALLOC(sizeof(menu));
|
||||
action->act_object = (REF) a_menu;
|
||||
a_menu->menu_request = request;
|
||||
|
||||
return action;
|
||||
}
|
||||
@ -2794,7 +2790,6 @@ static ACT par_menu_item_for( SYM symbol, GPRE_CTX context, ACT_T type)
|
||||
{
|
||||
ACT action;
|
||||
GPRE_REQ request, parent;
|
||||
ENTREE entree;
|
||||
|
||||
sw_pyxis = TRUE;
|
||||
symbol->sym_type = SYM_menu_map;
|
||||
@ -2812,9 +2807,9 @@ static ACT par_menu_item_for( SYM symbol, GPRE_CTX context, ACT_T type)
|
||||
action = MAKE_ACTION(request, type);
|
||||
PUSH((GPRE_NOD) action, (LLS *) & cur_item);
|
||||
|
||||
entree = (ENTREE) ALLOC(sizeof(entree));
|
||||
action->act_object = (REF) entree;
|
||||
entree->entree_request = parent;
|
||||
ENTREE a_entree = (ENTREE) ALLOC(sizeof(entree));
|
||||
action->act_object = (REF) a_entree;
|
||||
a_entree->entree_request = parent;
|
||||
|
||||
return action;
|
||||
}
|
||||
@ -3032,17 +3027,17 @@ static BOOLEAN par_options( GPRE_REQ request, BOOLEAN flag)
|
||||
if (!MATCH(KW_LEFT_PAREN))
|
||||
return TRUE;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (MATCH(KW_RIGHT_PAREN))
|
||||
return TRUE;
|
||||
if (MATCH(KW_REQUEST_HANDLE)) {
|
||||
request->req_handle = PAR_native_value(FALSE, TRUE);
|
||||
request->req_handle = PAR_native_value(false, true);
|
||||
request->req_flags |= REQ_exp_hand;
|
||||
}
|
||||
else if (MATCH(KW_TRANSACTION_HANDLE))
|
||||
request->req_trans = PAR_native_value(FALSE, TRUE);
|
||||
request->req_trans = PAR_native_value(false, true);
|
||||
else if (MATCH(KW_LEVEL))
|
||||
request->req_request_level = PAR_native_value(FALSE, FALSE);
|
||||
request->req_request_level = PAR_native_value(false, false);
|
||||
else {
|
||||
if (!flag)
|
||||
SYNTAX_ERROR("request option");
|
||||
@ -3151,7 +3146,7 @@ static ACT par_ready()
|
||||
action->act_object = (REF) ready;
|
||||
|
||||
if (!(symbol = token.tok_symbol) || symbol->sym_type != SYM_database) {
|
||||
ready->rdy_filename = PAR_native_value(FALSE, FALSE);
|
||||
ready->rdy_filename = PAR_native_value(false, false);
|
||||
if (MATCH(KW_AS))
|
||||
need_handle = TRUE;
|
||||
}
|
||||
@ -3182,13 +3177,13 @@ static ACT par_ready()
|
||||
MATCH(KW_BUFFERS);
|
||||
}
|
||||
else if (MATCH(KW_USER))
|
||||
db->dbb_r_user = PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_r_user = PAR_native_value(false, false);
|
||||
else if (MATCH(KW_PASSWORD))
|
||||
db->dbb_r_password = PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_r_password = PAR_native_value(false, false);
|
||||
else if (MATCH(KW_LC_MESSAGES))
|
||||
db->dbb_r_lc_messages = PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_r_lc_messages = PAR_native_value(false, false);
|
||||
else if (MATCH(KW_LC_CTYPE)) {
|
||||
db->dbb_r_lc_ctype = PAR_native_value(FALSE, FALSE);
|
||||
db->dbb_r_lc_ctype = PAR_native_value(false, false);
|
||||
db->dbb_know_subtype = 2;
|
||||
}
|
||||
else
|
||||
@ -3566,7 +3561,7 @@ static ACT par_start_transaction()
|
||||
// get the transaction handle
|
||||
|
||||
if (!token.tok_symbol)
|
||||
trans->tra_handle = PAR_native_value(FALSE, TRUE);
|
||||
trans->tra_handle = PAR_native_value(false, true);
|
||||
|
||||
// loop reading the various transaction options
|
||||
|
||||
@ -3612,7 +3607,7 @@ static ACT par_start_transaction()
|
||||
|
||||
if (MATCH(KW_RESERVING)) {
|
||||
trans->tra_flags |= TRA_rrl;
|
||||
PAR_reserving(trans->tra_flags, 0);
|
||||
PAR_reserving(trans->tra_flags, false);
|
||||
}
|
||||
else if (MATCH(KW_USING)) {
|
||||
trans->tra_flags |= TRA_inc;
|
||||
@ -3669,7 +3664,7 @@ static ACT par_trans( ACT_T act_op)
|
||||
}
|
||||
else
|
||||
MATCH(KW_TRANSACTION_HANDLE);
|
||||
action->act_object = (REF) PAR_native_value(FALSE, TRUE);
|
||||
action->act_object = (REF) PAR_native_value(false, true);
|
||||
if (parens)
|
||||
EXP_match_paren();
|
||||
}
|
||||
|
@ -21,25 +21,25 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_PAR_PROTO_H_
|
||||
#define _GPRE_PAR_PROTO_H_
|
||||
#ifndef GPRE_PAR_PROTO_H
|
||||
#define GPRE_PAR_PROTO_H
|
||||
|
||||
extern ACT PAR_action(TEXT*);
|
||||
extern SSHORT PAR_blob_subtype(DBB);
|
||||
extern ACT PAR_database(USHORT, TEXT*);
|
||||
extern ACT PAR_database(bool, const TEXT*);
|
||||
extern BOOLEAN PAR_end(void);
|
||||
extern void PAR_error(TEXT *);
|
||||
extern ACT PAR_event_init(USHORT);
|
||||
extern ACT PAR_event_wait(USHORT);
|
||||
extern void PAR_error(const TEXT *);
|
||||
extern ACT PAR_event_init(bool);
|
||||
extern ACT PAR_event_wait(bool);
|
||||
extern void PAR_fini(void);
|
||||
extern TOK PAR_get_token(void);
|
||||
extern void PAR_init(void);
|
||||
extern TEXT *PAR_native_value(USHORT, USHORT);
|
||||
extern TEXT *PAR_native_value(bool, bool);
|
||||
extern GPRE_FLD PAR_null_field(void);
|
||||
extern void PAR_reserving(USHORT, SSHORT);
|
||||
extern void PAR_reserving(USHORT, bool);
|
||||
extern GPRE_REQ PAR_set_up_dpb_info(RDY, ACT, USHORT);
|
||||
extern SYM PAR_symbol(enum sym_t);
|
||||
extern void PAR_unwind(void);
|
||||
extern void PAR_using_db(void);
|
||||
|
||||
#endif /* _GPRE_PAR_PROTO_H_ */
|
||||
#endif /* GPRE_PAR_PROTO_H */
|
||||
|
@ -21,8 +21,8 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_PARSE_H_
|
||||
#define _GPRE_PARSE_H_
|
||||
#ifndef GPRE_PARSE_H
|
||||
#define GPRE_PARSE_H
|
||||
|
||||
typedef enum kwwords {
|
||||
KW_none = 0,
|
||||
@ -72,4 +72,4 @@ EXTERN tok token;
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
#endif /* _GPRE_PARSE_H_ */
|
||||
#endif /* GPRE_PARSE_H */
|
||||
|
@ -24,7 +24,7 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: pat.cpp,v 1.10 2003-09-06 00:52:10 brodsom Exp $
|
||||
// $Id: pat.cpp,v 1.11 2003-09-08 11:27:51 robocop Exp $
|
||||
//
|
||||
|
||||
#include "firebird.h"
|
||||
@ -64,8 +64,9 @@ typedef enum {
|
||||
static struct ops {
|
||||
PAT_T ops_type;
|
||||
TEXT ops_string[3];
|
||||
} operators[] = {
|
||||
{ RH, "RH" },
|
||||
} operators[] =
|
||||
{
|
||||
{ RH, "RH" },
|
||||
{ RL, "RL" },
|
||||
{ RT, "RT" },
|
||||
{ RI, "RI" },
|
||||
@ -107,7 +108,8 @@ static struct ops {
|
||||
{ VF, "VF" },
|
||||
{ VE, "VE" },
|
||||
{ FR, "FR" },
|
||||
{ NL, "" } };
|
||||
{ NL, "" }
|
||||
};
|
||||
|
||||
|
||||
//____________________________________________________________
|
||||
@ -117,7 +119,6 @@ static struct ops {
|
||||
|
||||
void PATTERN_expand( USHORT column, TEXT * pattern, PAT * args)
|
||||
{
|
||||
ops* operator_;
|
||||
TEXT buffer[512], c, *p, temp1[16], temp2[16];
|
||||
USHORT sw_ident, sw_gen, n;
|
||||
SSHORT value; /* value needs to be signed since some of the
|
||||
@ -181,12 +182,13 @@ void PATTERN_expand( USHORT column, TEXT * pattern, PAT * args)
|
||||
string = NULL;
|
||||
reference = NULL;
|
||||
handle_flag = long_flag = FALSE;
|
||||
for (operator_ = operators; operator_->ops_type != NL; operator_++)
|
||||
if (operator_->ops_string[0] == pattern[0] &&
|
||||
operator_->ops_string[1] == pattern[1])
|
||||
ops* oper_iter;
|
||||
for (oper_iter = operators; oper_iter->ops_type != NL; oper_iter++)
|
||||
if (oper_iter->ops_string[0] == pattern[0] &&
|
||||
oper_iter->ops_string[1] == pattern[1])
|
||||
break;
|
||||
pattern += 2;
|
||||
switch (operator_->ops_type) {
|
||||
switch (oper_iter->ops_type) {
|
||||
case IF:
|
||||
sw_gen = args->pat_condition;
|
||||
continue;
|
||||
|
@ -21,9 +21,9 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_PAT_PROTO_H_
|
||||
#define _GPRE_PAT_PROTO_H_
|
||||
#ifndef GPRE_PAT_PROTO_H
|
||||
#define GPRE_PAT_PROTO_H
|
||||
|
||||
extern void PATTERN_expand(USHORT, TEXT *, PAT *);
|
||||
|
||||
#endif /* _GPRE_PAT_PROTO_H_ */
|
||||
#endif /* GPRE_PAT_PROTO_H */
|
||||
|
@ -37,7 +37,7 @@
|
||||
//
|
||||
//____________________________________________________________
|
||||
//
|
||||
// $Id: sqe.cpp,v 1.14 2003-09-06 00:52:10 brodsom Exp $
|
||||
// $Id: sqe.cpp,v 1.15 2003-09-08 11:27:51 robocop Exp $
|
||||
//
|
||||
#include "firebird.h"
|
||||
#include <stdio.h>
|
||||
@ -93,7 +93,7 @@ static GPRE_CTX par_join_clause(GPRE_REQ, GPRE_CTX);
|
||||
static NOD_T par_join_type(void);
|
||||
static GPRE_NOD par_multiply(GPRE_REQ, BOOLEAN, USHORT *, USHORT *);
|
||||
static GPRE_NOD par_not(GPRE_REQ, USHORT *);
|
||||
static void par_order(GPRE_REQ, RSE, SSHORT, USHORT);
|
||||
static void par_order(GPRE_REQ, RSE, bool, bool);
|
||||
static GPRE_NOD par_plan(GPRE_REQ);
|
||||
static GPRE_NOD par_plan_item(GPRE_REQ, BOOLEAN);
|
||||
static GPRE_NOD par_primitive_value(GPRE_REQ, BOOLEAN, USHORT *, USHORT *);
|
||||
@ -127,7 +127,8 @@ struct ops {
|
||||
enum nod_t rel_negation;
|
||||
};
|
||||
|
||||
static ops rel_ops[] = {
|
||||
static const ops rel_ops[] =
|
||||
{
|
||||
{ nod_eq, KW_EQ, nod_ne },
|
||||
{ nod_eq, KW_EQUALS, nod_ne },
|
||||
{ nod_ne, KW_NE, nod_eq },
|
||||
@ -140,18 +141,22 @@ static ops rel_ops[] = {
|
||||
{ nod_matches, KW_MATCHES, nod_any },
|
||||
{ nod_any, KW_none, nod_any },
|
||||
{ nod_ansi_any, KW_none, nod_ansi_any },
|
||||
{ nod_ansi_all, KW_none, nod_ansi_all }};
|
||||
{ nod_ansi_all, KW_none, nod_ansi_all }
|
||||
};
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static ops scalar_stat_ops[] = {
|
||||
static const ops scalar_stat_ops[] = {
|
||||
{ nod_count, KW_COUNT, nod_any },
|
||||
{ nod_max, KW_MAX, nod_any },
|
||||
{ nod_min, KW_MIN, nod_any },
|
||||
{ nod_total, KW_TOTAL, nod_any },
|
||||
{ nod_total, KW_SUM, nod_any },
|
||||
{ nod_average, KW_AVERAGE, nod_any },
|
||||
{ nod_via, KW_none, nod_any}};
|
||||
{ nod_via, KW_none, nod_any}
|
||||
};
|
||||
#endif
|
||||
static ops stat_ops[] = {
|
||||
|
||||
static const ops stat_ops[] = {
|
||||
{ nod_agg_count, KW_COUNT, nod_any },
|
||||
{ nod_agg_max, KW_MAX, nod_any },
|
||||
{ nod_agg_min, KW_MIN, nod_any },
|
||||
@ -160,9 +165,10 @@ static ops stat_ops[] = {
|
||||
{ nod_agg_average, KW_AVERAGE, nod_any },
|
||||
{ nod_any, KW_none, nod_any },
|
||||
{ nod_ansi_any, KW_none, nod_ansi_any },
|
||||
{ nod_ansi_all, KW_none, nod_ansi_all }};
|
||||
{ nod_ansi_all, KW_none, nod_ansi_all }
|
||||
};
|
||||
|
||||
static NOD_T relationals[] = {
|
||||
static const NOD_T relationals[] = {
|
||||
nod_eq, nod_ne, nod_gt, nod_ge, nod_le, nod_lt, nod_containing,
|
||||
nod_starting, nod_matches, nod_any, nod_missing, nod_between, nod_like,
|
||||
nod_and, nod_or, nod_not, nod_ansi_any, nod_ansi_all, (NOD_T) 0
|
||||
@ -224,10 +230,10 @@ GPRE_CTX SQE_context(GPRE_REQ request)
|
||||
SQL_relation_name(r_name, db_name, owner_name);
|
||||
|
||||
if (!(context->ctx_relation =
|
||||
SQL_relation(request, r_name, db_name, owner_name, FALSE))) {
|
||||
SQL_relation(request, r_name, db_name, owner_name, false))) {
|
||||
/* check for a procedure */
|
||||
if (procedure = context->ctx_procedure =
|
||||
SQL_procedure(request, r_name, db_name, owner_name, FALSE)) {
|
||||
SQL_procedure(request, r_name, db_name, owner_name, false)) {
|
||||
if (procedure->prc_inputs) {
|
||||
if (!MATCH(KW_LEFT_PAREN))
|
||||
SYNTAX_ERROR("( <procedure input parameters> )");
|
||||
@ -758,12 +764,12 @@ REF SQE_parameter(GPRE_REQ request, BOOLEAN aster_ok)
|
||||
break;
|
||||
}
|
||||
|
||||
reference->ref_value = PAR_native_value(FALSE, FALSE);
|
||||
reference->ref_value = PAR_native_value(false, false);
|
||||
|
||||
MATCH(KW_INDICATOR);
|
||||
|
||||
if (MATCH(KW_COLON))
|
||||
reference->ref_null_value = PAR_native_value(FALSE, FALSE);
|
||||
reference->ref_null_value = PAR_native_value(false, false);
|
||||
|
||||
return reference;
|
||||
}
|
||||
@ -1024,7 +1030,7 @@ BOOLEAN SQE_resolve(GPRE_NOD node, GPRE_REQ request, rse* selection)
|
||||
// Parse a SELECT (sans keyword) expression.
|
||||
//
|
||||
|
||||
RSE SQE_select(GPRE_REQ request, USHORT view_flag)
|
||||
RSE SQE_select(GPRE_REQ request, bool view_flag)
|
||||
{
|
||||
RSE select, rse1, rse2;
|
||||
GPRE_NOD node;
|
||||
@ -1139,7 +1145,7 @@ GPRE_NOD SQE_value(GPRE_REQ request,
|
||||
return node;
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (MATCH(KW_PLUS))
|
||||
operator_ = nod_plus;
|
||||
else if (MATCH(KW_MINUS))
|
||||
@ -1204,12 +1210,12 @@ REF SQE_variable(GPRE_REQ request, BOOLEAN aster_ok)
|
||||
break;
|
||||
}
|
||||
|
||||
reference->ref_value = PAR_native_value(FALSE, FALSE);
|
||||
reference->ref_value = PAR_native_value(false, false);
|
||||
|
||||
MATCH(KW_INDICATOR);
|
||||
|
||||
if (MATCH(KW_COLON))
|
||||
reference->ref_null_value = PAR_native_value(FALSE, FALSE);
|
||||
reference->ref_null_value = PAR_native_value(false, false);
|
||||
|
||||
return reference;
|
||||
}
|
||||
@ -1884,7 +1890,7 @@ static GPRE_NOD par_in( GPRE_REQ request, GPRE_NOD value)
|
||||
node = implicit_any(request, value, nod_eq, nod_ansi_any);
|
||||
else {
|
||||
node = NULL;
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
value2 = par_primitive_value(request, FALSE, 0, 0);
|
||||
if (value2->nod_type == nod_value) {
|
||||
ref2 = (REF) value2->nod_arg[0];
|
||||
@ -2032,7 +2038,7 @@ static GPRE_NOD par_multiply(
|
||||
if (KEYWORD(KW_COLLATE))
|
||||
return par_collate(request, node);
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
if (MATCH(KW_ASTERISK))
|
||||
operator_ = nod_times;
|
||||
else if (MATCH(KW_SLASH))
|
||||
@ -2113,7 +2119,7 @@ static GPRE_NOD par_not( GPRE_REQ request, USHORT * paren_count)
|
||||
|
||||
static void par_order(
|
||||
GPRE_REQ request,
|
||||
RSE select, SSHORT union_f, USHORT view_flag)
|
||||
RSE select, bool union_f, bool view_flag)
|
||||
{
|
||||
GPRE_NOD sort, *ptr, values;
|
||||
LLS items, directions;
|
||||
@ -2144,10 +2150,10 @@ static void par_order(
|
||||
count = direction = 0;
|
||||
values = select->rse_fields;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
direction = FALSE;
|
||||
if (token.tok_type == tok_number) {
|
||||
i = EXP_USHORT_ordinal(FALSE);
|
||||
i = EXP_USHORT_ordinal(false);
|
||||
if (i < 1 || i > values->nod_count)
|
||||
SYNTAX_ERROR("<ordinal column position>");
|
||||
sort = values->nod_arg[i - 1];
|
||||
@ -2361,7 +2367,6 @@ static GPRE_NOD par_primitive_value(
|
||||
{
|
||||
GPRE_NOD node, node_arg;
|
||||
REF reference;
|
||||
ops *op;
|
||||
map* tmp_map;
|
||||
USHORT distinct, local_count;
|
||||
ACT action;
|
||||
@ -2421,7 +2426,7 @@ static GPRE_NOD par_primitive_value(
|
||||
// ORDER clause. In this case, post only the complete expression, and not
|
||||
// the sub-expressions.
|
||||
|
||||
for (op = stat_ops; (int) op->rel_kw != (int) KW_none; op++) {
|
||||
for (const ops *op = stat_ops; (int) op->rel_kw != (int) KW_none; op++) {
|
||||
MATCH(KW_ALL);
|
||||
if (MATCH(op->rel_kw)) {
|
||||
if (request && (request->req_in_aggregate ||
|
||||
@ -2539,10 +2544,8 @@ static GPRE_NOD par_relational( GPRE_REQ request, USHORT * paren_count)
|
||||
{
|
||||
GPRE_NOD node, expr1, expr2;
|
||||
REF ref_value;
|
||||
ops *op;
|
||||
int negation;
|
||||
USHORT local_flag;
|
||||
NOD_T *relational_ops;
|
||||
|
||||
assert_IS_REQ(request);
|
||||
|
||||
@ -2553,10 +2556,14 @@ static GPRE_NOD par_relational( GPRE_REQ request, USHORT * paren_count)
|
||||
if (KEYWORD(KW_RIGHT_PAREN))
|
||||
return expr1;
|
||||
if (KEYWORD(KW_SEMI_COLON))
|
||||
for (relational_ops = relationals; *relational_ops != (NOD_T) 0;
|
||||
{
|
||||
for (const NOD_T* relational_ops = relationals; *relational_ops != (NOD_T) 0;
|
||||
relational_ops++)
|
||||
{
|
||||
if (expr1->nod_type == *relational_ops)
|
||||
return expr1;
|
||||
}
|
||||
}
|
||||
|
||||
if (MATCH(KW_NOT))
|
||||
negation = TRUE;
|
||||
@ -2602,15 +2609,16 @@ static GPRE_NOD par_relational( GPRE_REQ request, USHORT * paren_count)
|
||||
}
|
||||
else {
|
||||
node = NULL;
|
||||
for (op = rel_ops; (int) op->rel_kw != (int) KW_none; op++)
|
||||
for (const ops* op = rel_ops; (int) op->rel_kw != (int) KW_none; op++)
|
||||
if (MATCH(op->rel_kw))
|
||||
break;
|
||||
if ((int) op->rel_kw == (int) KW_none) {
|
||||
for (relational_ops = relationals; *relational_ops != (NOD_T) 0;
|
||||
relational_ops++)
|
||||
|
||||
for (const NOD_T* relational_ops = relationals;
|
||||
*relational_ops != (NOD_T) 0; relational_ops++)
|
||||
{
|
||||
if (expr1->nod_type == *relational_ops)
|
||||
return expr1;
|
||||
}
|
||||
SYNTAX_ERROR("<relational operator>");
|
||||
}
|
||||
if ((int) op->rel_kw == (int) KW_STARTING)
|
||||
@ -2907,7 +2915,7 @@ static GPRE_NOD par_subscript( GPRE_REQ request)
|
||||
if (!MATCH(KW_COLON))
|
||||
SYNTAX_ERROR("<colon>");
|
||||
|
||||
reference->ref_value = PAR_native_value(FALSE, FALSE);
|
||||
reference->ref_value = PAR_native_value(false, false);
|
||||
|
||||
if (request) {
|
||||
reference->ref_next = request->req_values;
|
||||
|
@ -21,8 +21,8 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_SQE_PROTO_H_
|
||||
#define _GPRE_SQE_PROTO_H_
|
||||
#ifndef GPRE_SQE_PROTO_H
|
||||
#define GPRE_SQE_PROTO_H
|
||||
|
||||
typedef GPRE_NOD(*pfn_SQE_list_cb) (GPRE_REQ, BOOLEAN, USHORT *, USHORT *);
|
||||
|
||||
@ -34,8 +34,9 @@ extern REF SQE_parameter(GPRE_REQ, BOOLEAN);
|
||||
extern void SQE_post_field(GPRE_NOD, GPRE_FLD);
|
||||
extern REF SQE_post_reference(GPRE_REQ, GPRE_FLD, GPRE_CTX, GPRE_NOD);
|
||||
extern BOOLEAN SQE_resolve(GPRE_NOD, GPRE_REQ, RSE);
|
||||
extern RSE SQE_select(GPRE_REQ, USHORT);
|
||||
extern RSE SQE_select(GPRE_REQ, bool);
|
||||
extern GPRE_NOD SQE_value(GPRE_REQ, BOOLEAN, USHORT *, USHORT *);
|
||||
extern REF SQE_variable(GPRE_REQ, BOOLEAN);
|
||||
|
||||
#endif /* _GPRE_SQE_PROTO_H_ */
|
||||
#endif /* GPRE_SQE_PROTO_H */
|
||||
|
||||
|
1782
src/gpre/sql.cpp
1782
src/gpre/sql.cpp
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PROGRAM: Preprocessor
|
||||
* MODULE: sql_proto.h
|
||||
* DESCRIPTION: Prototype header file for sql.c
|
||||
* DESCRIPTION: Prototype header file for sql.cpp
|
||||
*
|
||||
* The contents of this file are subject to the Interbase Public
|
||||
* License Version 1.0 (the "License"); you may not use this file
|
||||
@ -21,19 +21,19 @@
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#ifndef _GPRE_SQL_PROTO_H_
|
||||
#define _GPRE_SQL_PROTO_H_
|
||||
#ifndef GPRE_SQL_PROTO_H
|
||||
#define GPRE_SQL_PROTO_H
|
||||
|
||||
extern ACT SQL_action(TEXT*);
|
||||
extern ACT SQL_action(const TEXT*);
|
||||
extern void SQL_adjust_field_dtype(GPRE_FLD);
|
||||
extern void SQL_init(void);
|
||||
extern void SQL_par_field_collate(GPRE_REQ, GPRE_FLD);
|
||||
extern void SQL_par_field_dtype(GPRE_REQ, GPRE_FLD, BOOLEAN);
|
||||
extern GPRE_PRC SQL_procedure(GPRE_REQ, TEXT *, TEXT *, TEXT *, BOOLEAN);
|
||||
extern GPRE_REL SQL_relation(GPRE_REQ, TEXT *, TEXT *, TEXT *, BOOLEAN);
|
||||
extern GPRE_PRC SQL_procedure(GPRE_REQ, TEXT *, TEXT *, TEXT *, bool);
|
||||
extern GPRE_REL SQL_relation(GPRE_REQ, TEXT *, TEXT *, TEXT *, bool);
|
||||
extern void SQL_relation_name(TEXT *, TEXT *, TEXT *);
|
||||
extern void SQL_resolve_identifier(TEXT *, TEXT *);
|
||||
extern GPRE_REL SQL_view(GPRE_REQ, TEXT *, TEXT *, TEXT *, BOOLEAN);
|
||||
extern void SQL_relation_name(TEXT *, TEXT *, TEXT *);
|
||||
extern TEXT *SQL_var_or_string(BOOLEAN);
|
||||
extern TEXT *SQL_var_or_string(bool);
|
||||
|
||||
#endif /* _GPRE_SQL_PROTO_H_ */
|
||||
#endif /* GPRE_SQL_PROTO_H */
|
||||
|
Loading…
Reference in New Issue
Block a user