8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 08:40:39 +01:00

Changes to bring FB2 to c++ on *nix.

This commit is contained in:
bellardo 2001-07-12 05:46:06 +00:00
parent baa3485651
commit 747d13c0d5
156 changed files with 3368 additions and 2839 deletions

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: alice.cpp,v 1.2 2001-07-10 17:35:12 awharrison Exp $ // $Id: alice.cpp,v 1.3 2001-07-12 05:46:03 bellardo Exp $
// //
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports // conditionals, as the engine now fully supports
@ -54,6 +54,10 @@
#include "../jrd/svc_proto.h" #include "../jrd/svc_proto.h"
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef SUPERSERVER #ifdef SUPERSERVER
#include "../utilities/cmd_util_proto.h" #include "../utilities/cmd_util_proto.h"
#endif #endif
@ -707,7 +711,7 @@ static void alice_output(CONST SCHAR * format, ...)
if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') { if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') {
exit_code = exit_code =
tdgbl->output_proc(tdgbl->output_data, tdgbl->output_proc(tdgbl->output_data,
reinterpret_cast < UCHAR * >("")); (UCHAR *)(""));
} }
else if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) { else if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) {
VA_START(arglist, format); VA_START(arglist, format);
@ -715,7 +719,7 @@ static void alice_output(CONST SCHAR * format, ...)
va_end(arglist); va_end(arglist);
exit_code = exit_code =
tdgbl->output_proc(tdgbl->output_data, tdgbl->output_proc(tdgbl->output_data,
reinterpret_cast < UCHAR * >("")); (UCHAR *)(""));
} }
else { else {
VA_START(arglist, format); VA_START(arglist, format);
@ -742,4 +746,4 @@ static void expand_filename(TEXT * filename, TEXT * expanded_name)
} }
} // extern "C" } // extern "C"

View File

@ -212,7 +212,7 @@ extern struct tgbl *gdgbl;
#if defined(__cplusplus) #if defined(__cplusplus)
#define EXIT(code) { tdgbl->exit_code = (code); \ #define EXIT(code) { tdgbl->exit_code = (code); \
if (tdgbl->alice_env != NULL) \ if (tdgbl->alice_env != NULL) \
LONGJMP(reinterpret_cast<jmp_buf&>(const_cast<UCHAR*>(tdgbl->alice_env)), 1); } LONGJMP((jmp_buf)(tdgbl->alice_env), 1); }
#else #else
#define EXIT(code) { tdgbl->exit_code = (code); \ #define EXIT(code) { tdgbl->exit_code = (code); \
if (tdgbl->alice_env != NULL) \ if (tdgbl->alice_env != NULL) \

View File

@ -66,6 +66,10 @@
#include "../jrd/why_proto.h" #include "../jrd/why_proto.h"
#include "../jrd/gdsassert.h" #include "../jrd/gdsassert.h"
#ifdef HAVE_CTYPE_H
#include <ctype.h>
#endif
#ifdef SUPERSERVER #ifdef SUPERSERVER
#include "../utilities/cmd_util_proto.h" #include "../utilities/cmd_util_proto.h"
#endif #endif
@ -686,7 +690,7 @@ int DLL_EXPORT BURP_gbak(int argc,
for (in_sw_tab = burp_in_sw_table; in_sw_tab->in_sw; for (in_sw_tab = burp_in_sw_table; in_sw_tab->in_sw;
in_sw_tab++) in_sw_tab++)
if (in_sw_tab->in_sw_msg) { if (in_sw_tab->in_sw_msg) {
BURP_msg_put(in_sw_tab->in_sw_msg, SWITCH_CHAR, 0, 0, BURP_msg_put(in_sw_tab->in_sw_msg, (void*)SWITCH_CHAR, 0, 0,
0, 0); 0, 0);
} }
@ -979,7 +983,7 @@ int DLL_EXPORT BURP_gbak(int argc,
break; break;
case (IN_SW_BURP_Z): case (IN_SW_BURP_Z):
BURP_print(91, GDS_VERSION, 0, 0, 0, 0); /* msg 91 gbak version %s */ BURP_print(91, (void*) GDS_VERSION, 0, 0, 0, 0); /* msg 91 gbak version %s */
tdgbl->gbl_sw_version = TRUE; tdgbl->gbl_sw_version = TRUE;
break; break;
@ -1559,7 +1563,7 @@ static SSHORT open_files(TEXT * file1,
BURP_print(139, file1, 0, 0, 0, 0); BURP_print(139, file1, 0, 0, 0, 0);
isc_version(&tdgbl->db_handle, isc_version(&tdgbl->db_handle,
reinterpret_cast<void (*)()>(BURP_output_version), reinterpret_cast<void (*)()>(BURP_output_version),
"\t%s\n"); (void*) "\t%s\n");
} }
if (sw_verbose) if (sw_verbose)
BURP_print(166, file1, 0, 0, 0, 0); /* msg 166: readied database %s for backup */ BURP_print(166, file1, 0, 0, 0, 0); /* msg 166: readied database %s for backup */
@ -1627,7 +1631,7 @@ static SSHORT open_files(TEXT * file1,
#ifndef WIN_NT #ifndef WIN_NT
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
#endif #endif
fil->fil_fd = reinterpret_cast<void*>(GBAK_STDOUT_DESC); fil->fil_fd = reinterpret_cast<DESC>(GBAK_STDOUT_DESC);
break; break;
} }
else else
@ -1745,7 +1749,7 @@ static SSHORT open_files(TEXT * file1,
tdgbl->action->act_action = ACT_restore; tdgbl->action->act_action = ACT_restore;
if (!strcmp(fil->fil_name, "stdin")) { if (!strcmp(fil->fil_name, "stdin")) {
fil->fil_fd = reinterpret_cast<void*>(GBAK_STDIN_DESC); fil->fil_fd = reinterpret_cast<DESC>(GBAK_STDIN_DESC);
tdgbl->file_desc = fil->fil_fd; tdgbl->file_desc = fil->fil_fd;
tdgbl->gbl_sw_files = fil->fil_next; tdgbl->gbl_sw_files = fil->fil_next;
} }
@ -1936,7 +1940,7 @@ static void burp_output( CONST SCHAR * format, ...)
if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') { if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') {
exit_code = exit_code =
tdgbl->output_proc(tdgbl->output_data, tdgbl->output_proc(tdgbl->output_data,
reinterpret_cast<UCHAR*>("")); (UCHAR*)(""));
} }
else if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) { else if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) {
VA_START(arglist, format); VA_START(arglist, format);
@ -1944,7 +1948,7 @@ static void burp_output( CONST SCHAR * format, ...)
va_end(arglist); va_end(arglist);
exit_code = exit_code =
tdgbl->output_proc(tdgbl->output_data, tdgbl->output_proc(tdgbl->output_data,
reinterpret_cast<UCHAR*>("")); (UCHAR*)(""));
} }
else { else {
VA_START(arglist, format); VA_START(arglist, format);
@ -2252,4 +2256,4 @@ static int api_gbak(int argc,
#endif // !SUPERSERVER #endif // !SUPERSERVER
} // extern "C" } // extern "C"

View File

@ -33,6 +33,10 @@
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
#include "../jrd/thd.h" #include "../jrd/thd.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -858,9 +862,10 @@ extern struct tgbl *gdgbl;
#endif #endif
#if defined(__cplusplus) #if defined(__cplusplus)
// I had funnies with this cast
#define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \ #define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \
if (tdgbl->burp_env != NULL) \ if (tdgbl->burp_env != NULL) \
LONGJMP(reinterpret_cast<jmp_buf&>(const_cast<UCHAR*>(tdgbl->burp_env)), 1); } LONGJMP((jmp_buf)(const_cast<UCHAR*>(tdgbl->burp_env)), 1); }
#else #else
#define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \ #define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \
if (tdgbl->burp_env != NULL) \ if (tdgbl->burp_env != NULL) \

View File

@ -262,7 +262,7 @@ void MVOL_init_write(UCHAR* database_name,
BURP_error(269, tdgbl->action->act_file->fil_name, 0, 0, 0, 0); BURP_error(269, tdgbl->action->act_file->fil_name, 0, 0, 0, 0);
/* msg 269 can't write a header record to file %s */ /* msg 269 can't write a header record to file %s */
} }
tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_WRITE, FALSE); tdgbl->file_desc = (DESC) next_volume(tdgbl->file_desc, MODE_WRITE, FALSE);
} }
tdgbl->mvol_actual_buffer_size = temp_buffer_size; tdgbl->mvol_actual_buffer_size = temp_buffer_size;
@ -298,7 +298,7 @@ int MVOL_read(int* cnt, UCHAR** ptr)
{ {
if (!tdgbl->mvol_io_cnt || errno == EIO) if (!tdgbl->mvol_io_cnt || errno == EIO)
{ {
tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_READ, FALSE); tdgbl->file_desc = (DESC) next_volume(tdgbl->file_desc, MODE_READ, FALSE);
if (tdgbl->mvol_io_cnt > 0) if (tdgbl->mvol_io_cnt > 0)
{ {
break; break;
@ -678,7 +678,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr)
else else
full_buffer = FALSE; full_buffer = FALSE;
tdgbl->file_desc = tdgbl->file_desc =
next_volume(tdgbl->file_desc, MODE_WRITE, full_buffer); (DESC) next_volume(tdgbl->file_desc, MODE_WRITE, full_buffer);
if (full_buffer) if (full_buffer)
{ {
left -= tdgbl->mvol_io_buffer_size; left -= tdgbl->mvol_io_buffer_size;
@ -886,7 +886,7 @@ static void* next_volume( DESC handle, int mode, USHORT full_buffer)
(tdgbl->action->act_file = tdgbl->action->act_file->fil_next) && (tdgbl->action->act_file = tdgbl->action->act_file->fil_next) &&
(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE)) (tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE))
{ {
return tdgbl->action->act_file->fil_fd; return (void*) tdgbl->action->act_file->fil_fd;
} }
BURP_error_redirect(0, 50, NULL, NULL); /* msg 50 unexpected end of file on backup file */ BURP_error_redirect(0, 50, NULL, NULL); /* msg 50 unexpected end of file on backup file */

View File

@ -40,6 +40,10 @@
#include "../burp/spit.h" #include "../burp/spit.h"
#include "../burp/burpswi.h" #include "../burp/burpswi.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef WIN_NT #ifdef WIN_NT
#include <io.h> /* usage of non-ANSI open/read/write/close functions */ #include <io.h> /* usage of non-ANSI open/read/write/close functions */
#endif #endif

View File

@ -20,7 +20,7 @@
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* *
* $Id: ddl.cpp,v 1.2 2001-07-10 17:35:13 awharrison Exp $ * $Id: ddl.cpp,v 1.3 2001-07-12 05:46:04 bellardo Exp $
* 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash, * 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash,
* caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET; * caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET;
* *
@ -379,7 +379,7 @@ void DDL_resolve_intl_type( REQ request, FLD field, STR collation_name)
{ {
if (!METD_get_type(request, if (!METD_get_type(request,
reinterpret_cast<STR>(field->fld_sub_type_name), reinterpret_cast<STR>(field->fld_sub_type_name),
reinterpret_cast < UCHAR * >("RDB$FIELD_SUB_TYPE"), (UCHAR *)("RDB$FIELD_SUB_TYPE"),
&blob_sub_type)) &blob_sub_type))
{ {
ERRD_post( gds__sqlerr, ERRD_post( gds__sqlerr,
@ -1213,7 +1213,7 @@ TEXT * prim_rel_name, TEXT * for_rel_name)
return; return;
/* stuff a trigger_name of size 0. So the dyn-parser will make one up. */ /* stuff a trigger_name of size 0. So the dyn-parser will make one up. */
put_string(request, gds_dyn_def_trigger, reinterpret_cast < UCHAR * >(""), put_string(request, gds_dyn_def_trigger, (UCHAR *)(""),
(USHORT) 0); (USHORT) 0);
put_number(request, gds_dyn_trg_type, (SSHORT) POST_ERASE_TRIGGER); put_number(request, gds_dyn_trg_type, (SSHORT) POST_ERASE_TRIGGER);
@ -1283,7 +1283,7 @@ TEXT * prim_rel_name, TEXT * for_rel_name, BOOLEAN on_upd_trg)
return; return;
/* stuff a trigger_name of size 0. So the dyn-parser will make one up. */ /* stuff a trigger_name of size 0. So the dyn-parser will make one up. */
put_string(request, gds_dyn_def_trigger, reinterpret_cast < UCHAR * >(""), put_string(request, gds_dyn_def_trigger, (UCHAR *)(""),
(USHORT) 0); (USHORT) 0);
put_number(request, gds_dyn_trg_type, put_number(request, gds_dyn_trg_type,
@ -2414,7 +2414,7 @@ TEXT * prim_rel_name, TEXT * for_rel_name, BOOLEAN on_upd_trg)
assert(prim_columns->nod_count != 0); assert(prim_columns->nod_count != 0);
/* no trigger name. It is generated by the engine */ /* no trigger name. It is generated by the engine */
put_string(request, gds_dyn_def_trigger, reinterpret_cast < UCHAR * >(""), put_string(request, gds_dyn_def_trigger, (UCHAR *)(""),
(USHORT) 0); (USHORT) 0);
put_number(request, gds_dyn_trg_type, put_number(request, gds_dyn_trg_type,
@ -3050,7 +3050,7 @@ TEXT * prim_rel_name, TEXT * for_rel_name)
assert(prim_columns->nod_count != 0); assert(prim_columns->nod_count != 0);
/* no trigger name is generated here. Let the engine make one up */ /* no trigger name is generated here. Let the engine make one up */
put_string(request, gds_dyn_def_trigger, reinterpret_cast < UCHAR * >(""), put_string(request, gds_dyn_def_trigger, (UCHAR *)(""),
(USHORT) 0); (USHORT) 0);
put_number(request, gds_dyn_trg_type, (SSHORT) POST_MODIFY_TRIGGER); put_number(request, gds_dyn_trg_type, (SSHORT) POST_MODIFY_TRIGGER);
@ -4514,7 +4514,7 @@ static SCHAR modify_privileges(REQ request,
case nod_references: case nod_references:
case nod_update: case nod_update:
p = (privs->nod_type == nod_references) ? "R" : "U"; p = (privs->nod_type == nod_references) ? (SCHAR*) "R" : (SCHAR*) "U";
if (!(fields = privs->nod_arg[0])) if (!(fields = privs->nod_arg[0]))
return *p; return *p;
@ -5525,4 +5525,4 @@ static void set_nod_value_attributes( NOD node, FLD field)
} }
} // extern "C" } // extern "C"

View File

@ -24,7 +24,7 @@
* readonly databases. * readonly databases.
*/ */
/* /*
$Id: dsql.cpp,v 1.3 2001-07-10 17:35:13 awharrison Exp $ $Id: dsql.cpp,v 1.4 2001-07-12 05:46:04 bellardo Exp $
*/ */
/************************************************************** /**************************************************************
V4 Multi-threading changes. V4 Multi-threading changes.
@ -3150,7 +3150,7 @@ static void map_in_out( REQ request,
flag = NULL; flag = NULL;
if ((null = parameter->par_null) != NULL) { if ((null = parameter->par_null) != NULL) {
null_offset = reinterpret_cast<USHORT>(null->par_user_desc.dsc_address); null_offset = (USHORT)(null->par_user_desc.dsc_address);
length = null_offset + sizeof(SSHORT); length = null_offset + sizeof(SSHORT);
if (length > msg_length) if (length > msg_length)
break; break;
@ -3959,4 +3959,4 @@ static SCHAR *var_info(
} }
} // extern "C" } // extern "C"

View File

@ -24,7 +24,9 @@
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
#include <string.h> #include <string.h>
#include "../jrd/common.h" #include "../jrd/common.h"
#ifdef HAVE_STDARG_H
#include <stdarg.h> #include <stdarg.h>
#endif
#include "../dsql/dsql.h" #include "../dsql/dsql.h"
#include "../dsql/sqlda.h" #include "../dsql/sqlda.h"

View File

@ -24,6 +24,8 @@
#ifndef _DSQL_NODE_H_ #ifndef _DSQL_NODE_H_
#define _DSQL_NODE_H_ #define _DSQL_NODE_H_
#include "../dsql/dsql.h"
/* an enumeration of the possible node types in a syntax tree */ /* an enumeration of the possible node types in a syntax tree */
typedef ENUM nod_t typedef ENUM nod_t

View File

@ -17,6 +17,9 @@ s/yychar/DSQL_yychar/g
s/yyerrflag/DSQL_yyerrflag/g s/yyerrflag/DSQL_yyerrflag/g
s/yyparse/dsql_yyparse/g s/yyparse/dsql_yyparse/g
s/static int dsql_yyparse/int dsql_yyparse/g s/static int dsql_yyparse/int dsql_yyparse/g
s/yyssp/DSQL_yyssp/g
s/yysslim/DSQL_yysslim/g
s/yyss/DSQL_yyss/g
/^#ident/d /^#ident/d
s/^static TOK tokens/static CONST TOK FAR_VARIABLE tokens/ s/^static TOK tokens/static CONST TOK FAR_VARIABLE tokens/
s/^__YYSCLASS yytabelem/__YYSCLASS CONST yytabelem FAR_VARIABLE/ s/^__YYSCLASS yytabelem/__YYSCLASS CONST yytabelem FAR_VARIABLE/
@ -26,6 +29,7 @@ s/^#include *<values.h> *$//g
s/yylex(void)/yylex(USHORT, USHORT, USHORT, BOOLEAN *)/g s/yylex(void)/yylex(USHORT, USHORT, USHORT, BOOLEAN *)/g
s/yylex()/yylex(client_dialect, db_dialect, parser_version, stmt_ambiguous)/g s/yylex()/yylex(client_dialect, db_dialect, parser_version, stmt_ambiguous)/g
s/dsql_yyparse(void);/dsql_yyparse(USHORT, USHORT, USHORT, BOOLEAN *);/g s/dsql_yyparse(void);/dsql_yyparse(USHORT, USHORT, USHORT, BOOLEAN *);/g
s/dsql_yyparse __P((void));/dsql_yyparse __P((USHORT, USHORT, USHORT, BOOLEAN *));/g
s/dsql_yyparse(void)/dsql_yyparse(USHORT client_dialect, USHORT db_dialect, USHORT parser_version, BOOLEAN *stmt_ambiguous)/g s/dsql_yyparse(void)/dsql_yyparse(USHORT client_dialect, USHORT db_dialect, USHORT parser_version, BOOLEAN *stmt_ambiguous)/g
s/dsql_yyparse()/dsql_yyparse(USHORT client_dialect, USHORT db_dialect, USHORT parser_version, BOOLEAN *stmt_ambiguous)/g s/dsql_yyparse()/dsql_yyparse(USHORT client_dialect, USHORT db_dialect, USHORT parser_version, BOOLEAN *stmt_ambiguous)/g
s/YYLEX()/YYLEX(client_dialect, db_dialect, parser_version, stmt_ambiguous)/g s/YYLEX()/YYLEX(client_dialect, db_dialect, parser_version, stmt_ambiguous)/g

View File

@ -28,7 +28,7 @@
#include "../jrd/common.h" #include "../jrd/common.h"
#include <stdarg.h> #include <stdarg.h>
#include "../jrd/iberror.h" #include "../include/iberror.h"
#include "../dsql/dsql.h" #include "../dsql/dsql.h"
#include "../dsql/node.h" #include "../dsql/node.h"
#include "../dsql/sym.h" #include "../dsql/sym.h"
@ -46,6 +46,8 @@
#include "../wal/wal.h" #include "../wal/wal.h"
#endif #endif
extern "C" TEXT *DLL_EXPORT ERR_string(CONST TEXT*, int);
ASSERT_FILENAME ASSERT_FILENAME
static void yyerror (TEXT *); static void yyerror (TEXT *);
@ -1854,13 +1856,13 @@ non_charset_simple_type : national_character_type
| TIME | TIME
{ {
if (client_dialect < SQL_DIALECT_V6_TRANSITION) if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_dialect_datatype_unsupport, gds_arg_gds, isc_sql_dialect_datatype_unsupport,
gds_arg_number, client_dialect, gds_arg_number, client_dialect,
gds_arg_string, "TIME", gds_arg_string, "TIME",
0); 0);
if (db_dialect < SQL_DIALECT_V6_TRANSITION) if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_db_dialect_dtype_unsupport, gds_arg_gds, isc_sql_db_dialect_dtype_unsupport,
gds_arg_number, db_dialect, gds_arg_number, db_dialect,
gds_arg_string, "TIME", gds_arg_string, "TIME",
@ -2037,7 +2039,7 @@ prec_scale :
(db_dialect > SQL_DIALECT_V5) ) || (db_dialect > SQL_DIALECT_V5) ) ||
( (client_dialect > SQL_DIALECT_V5) && ( (client_dialect > SQL_DIALECT_V5) &&
(db_dialect <= SQL_DIALECT_V5) ) ) (db_dialect <= SQL_DIALECT_V5) ) )
ERRD_post (gds__sqlerr, ERRD_post (gds_sqlerr,
gds_arg_number, (SLONG) -817, gds_arg_number, (SLONG) -817,
gds_arg_gds, gds_arg_gds,
isc_ddl_not_allowed_by_db_sql_dial, isc_ddl_not_allowed_by_db_sql_dial,
@ -2094,7 +2096,7 @@ prec_scale :
(db_dialect > SQL_DIALECT_V5) ) || (db_dialect > SQL_DIALECT_V5) ) ||
( (client_dialect > SQL_DIALECT_V5) && ( (client_dialect > SQL_DIALECT_V5) &&
(db_dialect <= SQL_DIALECT_V5) ) ) (db_dialect <= SQL_DIALECT_V5) ) )
ERRD_post (gds__sqlerr, ERRD_post (gds_sqlerr,
gds_arg_number, (SLONG) -817, gds_arg_number, (SLONG) -817,
gds_arg_gds, gds_arg_gds,
isc_ddl_not_allowed_by_db_sql_dial, isc_ddl_not_allowed_by_db_sql_dial,
@ -2989,13 +2991,13 @@ value : column_name
datetime_value_expression : CURRENT_DATE datetime_value_expression : CURRENT_DATE
{ {
if (client_dialect < SQL_DIALECT_V6_TRANSITION) if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_dialect_datatype_unsupport, gds_arg_gds, isc_sql_dialect_datatype_unsupport,
gds_arg_number, client_dialect, gds_arg_number, client_dialect,
gds_arg_string, "DATE", gds_arg_string, "DATE",
0); 0);
if (db_dialect < SQL_DIALECT_V6_TRANSITION) if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_db_dialect_dtype_unsupport, gds_arg_gds, isc_sql_db_dialect_dtype_unsupport,
gds_arg_number, db_dialect, gds_arg_number, db_dialect,
gds_arg_string, "DATE", gds_arg_string, "DATE",
@ -3005,13 +3007,13 @@ datetime_value_expression : CURRENT_DATE
| CURRENT_TIME | CURRENT_TIME
{ {
if (client_dialect < SQL_DIALECT_V6_TRANSITION) if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_dialect_datatype_unsupport, gds_arg_gds, isc_sql_dialect_datatype_unsupport,
gds_arg_number, client_dialect, gds_arg_number, client_dialect,
gds_arg_string, "TIME", gds_arg_string, "TIME",
0); 0);
if (db_dialect < SQL_DIALECT_V6_TRANSITION) if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_db_dialect_dtype_unsupport, gds_arg_gds, isc_sql_db_dialect_dtype_unsupport,
gds_arg_number, db_dialect, gds_arg_number, db_dialect,
gds_arg_string, "TIME", gds_arg_string, "TIME",
@ -3054,13 +3056,13 @@ u_constant : u_numeric_constant
| DATE STRING | DATE STRING
{ {
if (client_dialect < SQL_DIALECT_V6_TRANSITION) if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_dialect_datatype_unsupport, gds_arg_gds, isc_sql_dialect_datatype_unsupport,
gds_arg_number, client_dialect, gds_arg_number, client_dialect,
gds_arg_string, "DATE", gds_arg_string, "DATE",
0); 0);
if (db_dialect < SQL_DIALECT_V6_TRANSITION) if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_db_dialect_dtype_unsupport, gds_arg_gds, isc_sql_db_dialect_dtype_unsupport,
gds_arg_number, db_dialect, gds_arg_number, db_dialect,
gds_arg_string, "DATE", gds_arg_string, "DATE",
@ -3070,13 +3072,13 @@ u_constant : u_numeric_constant
| TIME STRING | TIME STRING
{ {
if (client_dialect < SQL_DIALECT_V6_TRANSITION) if (client_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_dialect_datatype_unsupport, gds_arg_gds, isc_sql_dialect_datatype_unsupport,
gds_arg_number, client_dialect, gds_arg_number, client_dialect,
gds_arg_string, "TIME", gds_arg_string, "TIME",
0); 0);
if (db_dialect < SQL_DIALECT_V6_TRANSITION) if (db_dialect < SQL_DIALECT_V6_TRANSITION)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, isc_sql_db_dialect_dtype_unsupport, gds_arg_gds, isc_sql_db_dialect_dtype_unsupport,
gds_arg_number, db_dialect, gds_arg_number, db_dialect,
gds_arg_string, "TIME", gds_arg_string, "TIME",
@ -3400,7 +3402,7 @@ for (token = tokens; token->tok_string; ++token)
symbol->sym_version = token->tok_version; symbol->sym_version = token->tok_version;
str = (STR) ALLOCPV (type_str, symbol->sym_length); str = (STR) ALLOCPV (type_str, symbol->sym_length);
str->str_length = symbol->sym_length; str->str_length = symbol->sym_length;
strncpy (str->str_data, symbol->sym_string, symbol->sym_length); strncpy ((char*)str->str_data, (char*)symbol->sym_string, symbol->sym_length);
symbol->sym_object = (void *) str; symbol->sym_object = (void *) str;
HSHD_insert (symbol); HSHD_insert (symbol);
} }
@ -3838,7 +3840,7 @@ static int yylex (
* Functional description * Functional description
* *
**************************************/ **************************************/
UCHAR *p, class, string [MAX_TOKEN_LEN], *buffer, *buffer_end, *new_buffer; UCHAR *p, tok_class, string [MAX_TOKEN_LEN], *buffer, *buffer_end, *new_buffer;
SYM sym; SYM sym;
SSHORT c; SSHORT c;
USHORT buffer_len; USHORT buffer_len;
@ -3883,21 +3885,21 @@ for (;;)
} }
#if (! ( defined JPN_SJIS || defined JPN_EUC) ) #if (! ( defined JPN_SJIS || defined JPN_EUC) )
class = classes [c]; tok_class = classes [c];
#else #else
c = c & 0xff; c = c & 0xff;
class = (JPN1_CHAR(c) ? CHR_LETTER : classes[c]); tok_class = (JPN1_CHAR(c) ? CHR_LETTER : classes[c]);
#endif /*JPN_SJIS || JPN_EUC */ #endif /*JPN_SJIS || JPN_EUC */
if (!(class & CHR_WHITE)) if (!(tok_class & CHR_WHITE))
break; break;
} }
/* Depending on class of token, parse token */ /* Depending on tok_class of token, parse token */
last_token = ptr - 1; last_token = ptr - 1;
if (class & CHR_INTRODUCER) if (tok_class & CHR_INTRODUCER)
{ {
/* The Introducer (_) is skipped, all other idents are copied /* The Introducer (_) is skipped, all other idents are copied
* to become the name of the character set * to become the name of the character set
@ -3923,7 +3925,7 @@ if (class & CHR_INTRODUCER)
/* parse a quoted string, being sure to look for double quotes */ /* parse a quoted string, being sure to look for double quotes */
if (class & CHR_QUOTE) if (tok_class & CHR_QUOTE)
{ {
buffer = string; buffer = string;
buffer_len = sizeof (string); buffer_len = sizeof (string);
@ -4021,7 +4023,7 @@ if (class & CHR_QUOTE)
assert(ptr <= end); assert(ptr <= end);
if ((class & CHR_DIGIT) || if ((tok_class & CHR_DIGIT) ||
((c == '.') && (ptr < end) && (classes [*ptr] & CHR_DIGIT))) ((c == '.') && (ptr < end) && (classes [*ptr] & CHR_DIGIT)))
{ {
/* The following variables are used to recognize kinds of numbers. */ /* The following variables are used to recognize kinds of numbers. */
@ -4168,12 +4170,12 @@ if ((class & CHR_DIGIT) ||
attempt to recognize a number. */ attempt to recognize a number. */
ptr = last_token; ptr = last_token;
c = *ptr++; c = *ptr++;
/* We never touched class, so it doesn't need to be restored. */ /* We never touched tok_class, so it doesn't need to be restored. */
/* end of number-recognition code */ /* end of number-recognition code */
if (class & CHR_LETTER) if (tok_class & CHR_LETTER)
{ {
#if (! ( defined JPN_SJIS || defined JPN_EUC) ) #if (! ( defined JPN_SJIS || defined JPN_EUC) )
p = string; p = string;
@ -4269,17 +4271,17 @@ static void yyerror (
**************************************/ **************************************/
if (yychar < 1) if (yychar < 1)
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, gds__command_end_err, /* Unexpected end of command */ gds_arg_gds, gds_command_end_err, /* Unexpected end of command */
0); 0);
else else
{ {
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
gds_arg_gds, gds__dsql_token_unk_err, gds_arg_gds, gds_dsql_token_unk_err,
gds_arg_number, (SLONG) lines, gds_arg_number, (SLONG) lines,
gds_arg_number, (SLONG) (last_token - line_start), gds_arg_number, (SLONG) (last_token - line_start),
/* Token unknown - line %d, char %d */ /* Token unknown - line %d, char %d */
gds_arg_gds, gds__random, gds_arg_gds, gds_random,
gds_arg_cstring, (int) (ptr - last_token), last_token, gds_arg_cstring, (int) (ptr - last_token), last_token,
0); 0);
} }
@ -4301,6 +4303,6 @@ static void yyabandon (
* *
**************************************/ **************************************/
ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) sql_code, ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) sql_code,
gds_arg_gds, error_symbol, 0); gds_arg_gds, error_symbol, 0);
} }

View File

@ -39,6 +39,10 @@
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
#include "../jrd/why_proto.h" #include "../jrd/why_proto.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if defined(WIN_NT) #if defined(WIN_NT)
#include <io.h> #include <io.h>
#endif #endif
@ -483,7 +487,7 @@ UCHAR *DDL_alloc(register int size)
**************************************/ **************************************/
register UCHAR *block, *p; register UCHAR *block, *p;
p = block = gds__alloc((SLONG) size); p = block = (UCHAR*) gds__alloc((SLONG) size);
#ifdef DEBUG_GDS_ALLOC #ifdef DEBUG_GDS_ALLOC
/* For V4.0 we don't care about gdef specific memory leaks */ /* For V4.0 we don't care about gdef specific memory leaks */

View File

@ -55,7 +55,7 @@ static GDS__QUAD null_blob;
static LLS request_context; static LLS request_context;
static jmp_buf exp_env; static jmp_buf exp_env;
static TEXT alloc_info[] = { gds__info_allocation, gds__info_end }; static TEXT alloc_info[] = { gds_info_allocation, gds_info_end };
#define CMP_SYMBOL(sym1, sym2) strcmp (sym1->sym_string, sym2->sym_string) #define CMP_SYMBOL(sym1, sym2) strcmp (sym1->sym_string, sym2->sym_string)
#define MOVE_SYMBOL(symbol, field) move_symbol (symbol, field, sizeof (field)) #define MOVE_SYMBOL(symbol, field) move_symbol (symbol, field, sizeof (field))
@ -109,12 +109,12 @@ static void expand_action( ACT action)
switch (action->act_type) { switch (action->act_type) {
case act_a_field: case act_a_field:
expand_field(action->act_object); expand_field((FLD) action->act_object);
break; break;
case act_m_field: case act_m_field:
case act_d_field: case act_d_field:
lookup_field(action->act_object); lookup_field((FLD) action->act_object);
break; break;
case act_d_filter: case act_d_filter:
@ -130,41 +130,41 @@ static void expand_action( ACT action)
*/ break; */ break;
case act_a_gfield: case act_a_gfield:
expand_global_field(action->act_object); expand_global_field((FLD) action->act_object);
break; break;
case act_m_gfield: case act_m_gfield:
lookup_global_field(action->act_object); lookup_global_field((FLD) action->act_object);
expand_global_field(action->act_object); expand_global_field((FLD) action->act_object);
break; break;
case act_d_gfield: case act_d_gfield:
lookup_global_field(action->act_object); lookup_global_field((FLD) action->act_object);
break; break;
case act_a_index: case act_a_index:
expand_index(action->act_object); expand_index((ACT) action->act_object);
break; break;
case act_m_relation: case act_m_relation:
lookup_relation(action->act_object); lookup_relation((REL) action->act_object);
case act_a_relation: case act_a_relation:
expand_relation(action->act_object); expand_relation((REL) action->act_object);
break; break;
case act_d_relation: case act_d_relation:
lookup_relation(action->act_object); lookup_relation((REL) action->act_object);
break; break;
case act_d_trigger: case act_d_trigger:
lookup_trigger(action->act_object); lookup_trigger((TRG) action->act_object);
break; break;
case act_m_trigger: case act_m_trigger:
lookup_trigger(action->act_object); lookup_trigger((TRG) action->act_object);
case act_a_trigger: case act_a_trigger:
expand_trigger(action->act_object); expand_trigger((TRG) action->act_object);
break; break;
case act_c_database: case act_c_database:
@ -359,12 +359,12 @@ static void expand_trigger( TRG trigger)
* *
**************************************/ **************************************/
LLS contexts, update; LLS contexts, update;
CTX old, new; CTX old, new_ctx;
REL relation; REL relation;
USHORT old_id; USHORT old_id;
context_id = 2; context_id = 2;
old = new = NULL; old = new_ctx = NULL;
request_context = contexts = update = NULL; request_context = contexts = update = NULL;
relation = trigger->trg_relation; relation = trigger->trg_relation;
@ -378,10 +378,10 @@ static void expand_trigger( TRG trigger)
if ((trigger->trg_type != trg_erase) if ((trigger->trg_type != trg_erase)
&& (trigger->trg_type != trg_pre_erase)) { && (trigger->trg_type != trg_pre_erase)) {
if (!new) if (!new_ctx)
new = make_context("NEW", relation, 1); new_ctx = make_context("NEW", relation, 1);
LLS_PUSH(new, &contexts); LLS_PUSH(new_ctx, &contexts);
LLS_PUSH(new, &update); LLS_PUSH(new_ctx, &update);
} }
resolve(trigger->trg_statement, contexts, update); resolve(trigger->trg_statement, contexts, update);
@ -418,7 +418,7 @@ static FLD field_context( NOD node, LLS contexts, CTX * output_context)
name = (SYM) node->nod_arg[0]; name = (SYM) node->nod_arg[0];
} }
else if (node->nod_count == 2) { else if (node->nod_count == 2) {
context = lookup_context(node->nod_arg[0], contexts); context = lookup_context((SYM) node->nod_arg[0], contexts);
name = (SYM) node->nod_arg[1]; name = (SYM) node->nod_arg[1];
} }
else else

View File

@ -303,7 +303,7 @@ NOD EXPR_value(USHORT * paren_count, USHORT * bool_flag)
* *
**************************************/ **************************************/
NOD node, arg; NOD node, arg;
enum nod_t operator; enum nod_t operatr;
USHORT local_count, local_flag; USHORT local_count, local_flag;
if (!paren_count) { if (!paren_count) {
@ -431,19 +431,19 @@ static NOD parse_add( USHORT * paren_count, USHORT * bool_flag)
* *
**************************************/ **************************************/
NOD node, arg; NOD node, arg;
enum nod_t operator; enum nod_t operatr;
node = parse_multiply(paren_count, bool_flag); node = parse_multiply(paren_count, bool_flag);
while (TRUE) { while (TRUE) {
if (MATCH(KW_PLUS)) if (MATCH(KW_PLUS))
operator = nod_add; operatr = nod_add;
else if (MATCH(KW_MINUS)) else if (MATCH(KW_MINUS))
operator = nod_subtract; operatr = nod_subtract;
else else
return node; return node;
arg = node; arg = node;
node = SYNTAX_NODE(operator, 2); node = SYNTAX_NODE(operatr, 2);
node->nod_arg[0] = arg; node->nod_arg[0] = arg;
node->nod_arg[1] = parse_multiply(paren_count, bool_flag); node->nod_arg[1] = parse_multiply(paren_count, bool_flag);
} }
@ -688,7 +688,7 @@ static CON parse_literal(void)
} }
static parse_matching_paren(void) static int parse_matching_paren(void)
{ {
/************************************** /**************************************
* *
@ -719,19 +719,19 @@ static NOD parse_multiply( USHORT * paren_count, USHORT * bool_flag)
* *
**************************************/ **************************************/
NOD node, arg; NOD node, arg;
enum nod_t operator; enum nod_t operatr;
node = parse_from(paren_count, bool_flag); node = parse_from(paren_count, bool_flag);
while (TRUE) { while (TRUE) {
if (MATCH(KW_ASTERISK)) if (MATCH(KW_ASTERISK))
operator = nod_multiply; operatr = nod_multiply;
else if (MATCH(KW_SLASH)) else if (MATCH(KW_SLASH))
operator = nod_divide; operatr = nod_divide;
else else
return node; return node;
arg = node; arg = node;
node = SYNTAX_NODE(operator, 2); node = SYNTAX_NODE(operatr, 2);
node->nod_arg[0] = arg; node->nod_arg[0] = arg;
node->nod_arg[1] = parse_from(paren_count, bool_flag); node->nod_arg[1] = parse_from(paren_count, bool_flag);
} }
@ -909,7 +909,7 @@ static NOD parse_relational( USHORT * paren_count)
NOD node, expr1, expr2, or_node; NOD node, expr1, expr2, or_node;
LLS stack; LLS stack;
USHORT count, negation; USHORT count, negation;
enum nod_t operator, *rel_ops; enum nod_t operatr, *rel_ops;
USHORT local_flag; USHORT local_flag;
local_flag = TRUE; local_flag = TRUE;
@ -942,50 +942,50 @@ static NOD parse_relational( USHORT * paren_count)
switch (PARSE_keyword()) { switch (PARSE_keyword()) {
case KW_EQUALS: case KW_EQUALS:
case KW_EQ: case KW_EQ:
operator = (negation) ? nod_neq : nod_eql; operatr = (negation) ? nod_neq : nod_eql;
negation = FALSE; negation = FALSE;
break; break;
case KW_NE: case KW_NE:
operator = (negation) ? nod_eql : nod_neq; operatr = (negation) ? nod_eql : nod_neq;
negation = FALSE; negation = FALSE;
break; break;
case KW_GT: case KW_GT:
operator = (negation) ? nod_leq : nod_gtr; operatr = (negation) ? nod_leq : nod_gtr;
negation = FALSE; negation = FALSE;
break; break;
case KW_GE: case KW_GE:
operator = (negation) ? nod_lss : nod_geq; operatr = (negation) ? nod_lss : nod_geq;
negation = FALSE; negation = FALSE;
break; break;
case KW_LE: case KW_LE:
operator = (negation) ? nod_gtr : nod_leq; operatr = (negation) ? nod_gtr : nod_leq;
negation = FALSE; negation = FALSE;
break; break;
case KW_LT: case KW_LT:
operator = (negation) ? nod_geq : nod_lss; operatr = (negation) ? nod_geq : nod_lss;
negation = FALSE; negation = FALSE;
break; break;
case KW_CONTAINING: case KW_CONTAINING:
operator = nod_containing; operatr = nod_containing;
break; break;
case KW_MATCHES: case KW_MATCHES:
LEX_token(); LEX_token();
expr2 = EXPR_value(0, 0); expr2 = EXPR_value(0, 0);
if (MATCH(KW_USING)) { if (MATCH(KW_USING)) {
operator = nod_sleuth; operatr = nod_sleuth;
node = SYNTAX_NODE(operator, 3); node = SYNTAX_NODE(operatr, 3);
node->nod_arg[2] = EXPR_value(0, 0); node->nod_arg[2] = EXPR_value(0, 0);
} }
else { else {
operator = nod_matches; operatr = nod_matches;
node = SYNTAX_NODE(operator, 2); node = SYNTAX_NODE(operatr, 2);
} }
node->nod_arg[0] = expr1; node->nod_arg[0] = expr1;
node->nod_arg[1] = expr2; node->nod_arg[1] = expr2;
@ -1026,7 +1026,7 @@ static NOD parse_relational( USHORT * paren_count)
if (!node) { if (!node) {
LEX_token(); LEX_token();
node = SYNTAX_NODE(operator, 2); node = SYNTAX_NODE(operatr, 2);
node->nod_arg[0] = expr1; node->nod_arg[0] = expr1;
node->nod_arg[1] = EXPR_value(paren_count, &local_flag); node->nod_arg[1] = EXPR_value(paren_count, &local_flag);
} }
@ -1042,7 +1042,7 @@ static NOD parse_relational( USHORT * paren_count)
/* If the node isn't an equality, we've done. Since equalities can be structured /* If the node isn't an equality, we've done. Since equalities can be structured
as implicit ORs, build them here. */ as implicit ORs, build them here. */
if (operator != nod_eql) if (operatr != nod_eql)
return node; return node;
/* We have an equality operation, which can take a number of values. Generate /* We have an equality operation, which can take a number of values. Generate

View File

@ -69,7 +69,7 @@ int GENERATE_acl( SCL class_, UCHAR * buffer)
for (i = 0, id = item->sce_idents; i < id_max; id++, i++) for (i = 0, id = item->sce_idents; i < id_max; id++, i++)
if (q = *id) { if (q = *id) {
*p++ = i; *p++ = i;
*p++ = strlen(q); *p++ = strlen((char*) q);
while (c = *q++) while (c = *q++)
*p++ = UPPER(c); *p++ = UPPER(c);
} }
@ -126,7 +126,7 @@ static void generate( STR blr, NOD node)
CON constant; CON constant;
NOD sub, *arg, *end; NOD sub, *arg, *end;
CTX context; CTX context;
SCHAR operator, *p; SCHAR operatr, *p;
SLONG value; SLONG value;
USHORT l; USHORT l;
@ -375,26 +375,26 @@ static void generate( STR blr, NOD node)
case nod_from: case nod_from:
switch (node->nod_type) { switch (node->nod_type) {
case nod_count: case nod_count:
operator = blr_count; operatr = blr_count;
break; break;
case nod_max: case nod_max:
operator = blr_maximum; operatr = blr_maximum;
break; break;
case nod_min: case nod_min:
operator = blr_minimum; operatr = blr_minimum;
break; break;
case nod_total: case nod_total:
operator = blr_total; operatr = blr_total;
break; break;
case nod_average: case nod_average:
operator = blr_average; operatr = blr_average;
break; break;
case nod_from: case nod_from:
operator = (node->nod_arg[s_stt_default]) ? blr_via : blr_from; operatr = (node->nod_arg[s_stt_default]) ? blr_via : blr_from;
break; break;
} }
CHECK_BLR(1); CHECK_BLR(1);
STUFF(operator); STUFF(operatr);
generate(blr, node->nod_arg[s_stt_rse]); generate(blr, node->nod_arg[s_stt_rse]);
if (sub = node->nod_arg[s_stt_value]) if (sub = node->nod_arg[s_stt_value])
generate(blr, sub); generate(blr, sub);
@ -460,84 +460,84 @@ static void generate( STR blr, NOD node)
return; return;
case nod_eql: case nod_eql:
operator = blr_eql; operatr = blr_eql;
break; break;
case nod_neq: case nod_neq:
operator = blr_neq; operatr = blr_neq;
break; break;
case nod_gtr: case nod_gtr:
operator = blr_gtr; operatr = blr_gtr;
break; break;
case nod_geq: case nod_geq:
operator = blr_geq; operatr = blr_geq;
break; break;
case nod_leq: case nod_leq:
operator = blr_leq; operatr = blr_leq;
break; break;
case nod_lss: case nod_lss:
operator = blr_lss; operatr = blr_lss;
break; break;
case nod_between: case nod_between:
operator = blr_between; operatr = blr_between;
break; break;
case nod_matches: case nod_matches:
operator = blr_matching; operatr = blr_matching;
break; break;
case nod_containing: case nod_containing:
operator = blr_containing; operatr = blr_containing;
break; break;
case nod_starts: case nod_starts:
operator = blr_starting; operatr = blr_starting;
break; break;
case nod_missing: case nod_missing:
operator = blr_missing; operatr = blr_missing;
break; break;
case nod_and: case nod_and:
operator = blr_and; operatr = blr_and;
break; break;
case nod_or: case nod_or:
operator = blr_or; operatr = blr_or;
break; break;
case nod_not: case nod_not:
operator = blr_not; operatr = blr_not;
break; break;
case nod_add: case nod_add:
operator = blr_add; operatr = blr_add;
break; break;
case nod_subtract: case nod_subtract:
operator = blr_subtract; operatr = blr_subtract;
break; break;
case nod_multiply: case nod_multiply:
operator = blr_multiply; operatr = blr_multiply;
break; break;
case nod_divide: case nod_divide:
operator = blr_divide; operatr = blr_divide;
break; break;
case nod_negate: case nod_negate:
operator = blr_negate; operatr = blr_negate;
break; break;
case nod_concatenate: case nod_concatenate:
operator = blr_concatenate; operatr = blr_concatenate;
break; break;
case nod_for: case nod_for:
operator = blr_for; operatr = blr_for;
break; break;
case nod_assignment: case nod_assignment:
operator = blr_assignment; operatr = blr_assignment;
break; break;
case nod_store: case nod_store:
operator = blr_store; operatr = blr_store;
break; break;
case nod_post: case nod_post:
operator = blr_post; operatr = blr_post;
break; break;
case nod_uppercase: case nod_uppercase:
operator = blr_upcase; operatr = blr_upcase;
break; break;
case nod_sleuth: case nod_sleuth:
operator = blr_matching2; operatr = blr_matching2;
break; break;
/*case nod_substr: operator = blr_substring; break; */ /*case nod_substr: operatr = blr_substring; break; */
default: default:
DDL_err(96, NULL, NULL, NULL, NULL, NULL); /* msg 96: GENERATE_blr: node not supported */ DDL_err(96, NULL, NULL, NULL, NULL, NULL); /* msg 96: GENERATE_blr: node not supported */
@ -553,13 +553,13 @@ static void generate( STR blr, NOD node)
field [NOT] MISSING */ field [NOT] MISSING */
if ((operator == blr_eql || operator == blr_neq) && if ((operatr == blr_eql || operatr == blr_neq) &&
(arg[0]->nod_type == nod_null || arg[1]->nod_type == nod_null)) { (arg[0]->nod_type == nod_null || arg[1]->nod_type == nod_null)) {
if (operator == blr_neq) { if (operatr == blr_neq) {
CHECK_BLR(1); CHECK_BLR(1);
STUFF(blr_not); STUFF(blr_not);
} }
operator = blr_missing; operatr = blr_missing;
if (arg[0]->nod_type == nod_null) if (arg[0]->nod_type == nod_null)
arg++; arg++;
end = arg + 1; end = arg + 1;
@ -568,7 +568,7 @@ static void generate( STR blr, NOD node)
/* Fall thru on reasonable stuff */ /* Fall thru on reasonable stuff */
CHECK_BLR(1); CHECK_BLR(1);
STUFF(operator); STUFF(operatr);
for (; arg < end; arg++) for (; arg < end; arg++)
generate(blr, *arg); generate(blr, *arg);
} }

View File

@ -34,6 +34,10 @@
#include "../dudley/lex_proto.h" #include "../dudley/lex_proto.h"
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef PC_PLATFORM #ifdef PC_PLATFORM
#ifndef NETWARE_386 #ifndef NETWARE_386
#define SCRATCH "I" #define SCRATCH "I"

View File

@ -924,7 +924,7 @@ static void define_filter(void)
#endif #endif
parse_end(); parse_end();
make_action(act_a_filter, filter); make_action(act_a_filter, (DBB) filter);
} }
@ -974,9 +974,9 @@ static void define_function(void)
while (TRUE) { while (TRUE) {
if (KEYWORD(KW_SEMI)) if (KEYWORD(KW_SEMI))
break; break;
function_arg = parse_function_arg(function, &position); function_arg = parse_function_arg(function, (USHORT*) &position);
function_arg->funcarg_funcname = function->func_name; function_arg->funcarg_funcname = function->func_name;
make_action(act_a_function_arg, function_arg); make_action(act_a_function_arg, (DBB) function_arg);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
} }
@ -984,7 +984,7 @@ static void define_function(void)
if (!KEYWORD(KW_SEMI)) if (!KEYWORD(KW_SEMI))
PARSE_error(132, DDL_token.tok_string, 0); /* msg 132: expected comma or semi-colon, encountered \"%s\" */ PARSE_error(132, DDL_token.tok_string, 0); /* msg 132: expected comma or semi-colon, encountered \"%s\" */
make_action(act_a_function, function); make_action(act_a_function, (DBB) function);
} }
@ -1007,7 +1007,7 @@ static void define_generator(void)
symbol = PARSE_symbol(tok_ident); symbol = PARSE_symbol(tok_ident);
parse_end(); parse_end();
make_action(act_a_generator, symbol); make_action(act_a_generator, (DBB) symbol);
} }
@ -1082,7 +1082,7 @@ static void define_index(void)
while (stack) while (stack)
*--ptr = (SYM) LLS_POP(&stack); *--ptr = (SYM) LLS_POP(&stack);
make_action(act_a_index, index); make_action(act_a_index, (DBB) index);
} }
@ -1182,7 +1182,7 @@ static void define_old_trigger(void)
trigger->trg_statement = EXPR_statement(); trigger->trg_statement = EXPR_statement();
end_text(trigger->trg_source); end_text(trigger->trg_source);
make_action(act_a_trigger, trigger); make_action(act_a_trigger, (DBB) trigger);
} }
parse_end(); parse_end();
@ -1226,7 +1226,7 @@ static void define_relation(void)
PARSE_error(298, 0, 0); /* msg 298: A non-Decnet node name is not permitted in an external file name */ PARSE_error(298, 0, 0); /* msg 298: A non-Decnet node name is not permitted in an external file name */
} }
rel_actions = action = make_action(act_a_relation, relation); rel_actions = action = make_action(act_a_relation, (DBB) relation);
action->act_flags |= ACT_ignore; action->act_flags |= ACT_ignore;
position = 1; position = 1;
@ -1270,7 +1270,7 @@ static void define_relation(void)
field->fld_flags |= fld_explicit_position; field->fld_flags |= fld_explicit_position;
field->fld_name->sym_type = SYM_field; field->fld_name->sym_type = SYM_field;
HSH_insert(field->fld_name); HSH_insert(field->fld_name);
action = make_action(act_a_field, field); action = make_action(act_a_field, (DBB) field);
action->act_flags |= ACT_ignore; action->act_flags |= ACT_ignore;
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
@ -1332,7 +1332,7 @@ static void define_security_class(void)
parse_end(); parse_end();
make_action(act_a_security, class_); make_action(act_a_security, (DBB) class_);
} }
@ -1400,7 +1400,7 @@ static void define_shadow(void)
for (file = shadow; file; file = file->fil_next) for (file = shadow; file; file = file->fil_next)
file->fil_shadow_number = number; file->fil_shadow_number = number;
make_action(act_a_shadow, shadow); make_action(act_a_shadow, (DBB) shadow);
} }
@ -1465,7 +1465,7 @@ static void define_trigger(void)
PARSE_error(142, (TEXT *) (trigmsg->trgmsg_number), 0); /* msg 142: message number %d exceeds 255 */ PARSE_error(142, (TEXT *) (trigmsg->trgmsg_number), 0); /* msg 142: message number %d exceeds 255 */
MATCH(KW_COLON); MATCH(KW_COLON);
trigmsg->trgmsg_text = PARSE_symbol(tok_quoted); trigmsg->trgmsg_text = PARSE_symbol(tok_quoted);
make_action(act_a_trigger_msg, trigmsg); make_action(act_a_trigger_msg, (DBB) trigmsg);
MATCH(KW_COMMA); MATCH(KW_COMMA);
} }
else { else {
@ -1482,7 +1482,7 @@ static void define_trigger(void)
parse_end(); parse_end();
make_action(act_a_trigger, trigger); make_action(act_a_trigger, (DBB) trigger);
trigger->trg_name->sym_type = SYM_trigger; trigger->trg_name->sym_type = SYM_trigger;
trigger->trg_name->sym_object = (CTX) trigger; trigger->trg_name->sym_object = (CTX) trigger;
HSH_insert(trigger->trg_name); HSH_insert(trigger->trg_name);
@ -1515,7 +1515,7 @@ static ACT define_type(void)
fldtype->typ_type = PARSE_number(); fldtype->typ_type = PARSE_number();
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
fldtype->typ_description = parse_description(); fldtype->typ_description = parse_description();
make_action(act_a_type, fldtype); make_action(act_a_type, (DBB) fldtype);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
} }
@ -1568,7 +1568,7 @@ static ACT define_view(void)
LLS_PUSH(my_context, &contexts); LLS_PUSH(my_context, &contexts);
relation->rel_rse->nod_arg[s_rse_contexts] = (NOD) contexts; relation->rel_rse->nod_arg[s_rse_contexts] = (NOD) contexts;
rel_actions = action = make_action(act_a_relation, relation); rel_actions = action = make_action(act_a_relation, (DBB) relation);
action->act_flags |= ACT_ignore; action->act_flags |= ACT_ignore;
/* Pick up various fields and clauses */ /* Pick up various fields and clauses */
@ -1690,7 +1690,7 @@ static void drop_filter(void)
filter->filter_name = PARSE_symbol(tok_ident); filter->filter_name = PARSE_symbol(tok_ident);
parse_end(); parse_end();
make_action(act_d_filter, filter); make_action(act_d_filter, (DBB) filter);
} }
@ -1712,7 +1712,7 @@ static void drop_function(void)
function->func_name = PARSE_symbol(tok_ident); function->func_name = PARSE_symbol(tok_ident);
parse_end(); parse_end();
make_action(act_d_function, function); make_action(act_d_function, (DBB) function);
} }
@ -1734,7 +1734,7 @@ static void drop_gfield(void)
field->fld_name = PARSE_symbol(tok_ident); field->fld_name = PARSE_symbol(tok_ident);
parse_end(); parse_end();
make_action(act_d_gfield, field); make_action(act_d_gfield, (DBB) field);
} }
@ -1757,7 +1757,7 @@ static void drop_index(void)
index->idx_name = PARSE_symbol(tok_ident); index->idx_name = PARSE_symbol(tok_ident);
parse_end(); parse_end();
make_action(act_d_index, index); make_action(act_d_index, (DBB) index);
} }
@ -1784,7 +1784,7 @@ static void drop_relation(void)
relation->rel_flags |= rel_marked_for_delete; relation->rel_flags |= rel_marked_for_delete;
make_action(act_d_relation, relation); make_action(act_d_relation, (DBB) relation);
} }
@ -1806,7 +1806,7 @@ static void drop_security_class(void)
class_->scl_name = PARSE_symbol(tok_ident); class_->scl_name = PARSE_symbol(tok_ident);
parse_end(); parse_end();
make_action(act_d_security, class_); make_action(act_d_security, (DBB) class_);
} }
@ -1873,13 +1873,13 @@ static void drop_trigger(void)
trigger->trg_name = name = trigger->trg_name = name =
gen_trigger_name(trigger->trg_type, relation); gen_trigger_name(trigger->trg_type, relation);
trigger->trg_relation = relation; trigger->trg_relation = relation;
make_action(act_d_trigger, trigger); make_action(act_d_trigger, (DBB) trigger);
} }
} }
else { else {
trigger = (TRG) DDL_alloc(TRG_LEN); trigger = (TRG) DDL_alloc(TRG_LEN);
trigger->trg_name = name; trigger->trg_name = name;
make_action(act_d_trigger, trigger); make_action(act_d_trigger, (DBB) trigger);
} }
parse_end(); parse_end();
@ -1907,7 +1907,7 @@ static void drop_type(void)
fldtype->typ_field_name = PARSE_symbol(tok_ident); fldtype->typ_field_name = PARSE_symbol(tok_ident);
fldtype->typ_name->sym_length = 3; fldtype->typ_name->sym_length = 3;
strncpy(fldtype->typ_name->sym_string, "ALL", 3); strncpy(fldtype->typ_name->sym_string, "ALL", 3);
make_action(act_d_type, fldtype); make_action(act_d_type, (DBB) fldtype);
} }
else { else {
fldname = PARSE_symbol(tok_ident); fldname = PARSE_symbol(tok_ident);
@ -1915,7 +1915,7 @@ static void drop_type(void)
fldtype = (TYP) DDL_alloc(sizeof(struct typ)); fldtype = (TYP) DDL_alloc(sizeof(struct typ));
fldtype->typ_field_name = fldname; fldtype->typ_field_name = fldname;
fldtype->typ_name = PARSE_symbol(tok_ident); fldtype->typ_name = PARSE_symbol(tok_ident);
make_action(act_d_type, fldtype); make_action(act_d_type,(DBB) fldtype);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
} }
@ -2203,7 +2203,7 @@ static void grant_user_privilege(void)
parse_end(); parse_end();
make_action(act_grant, upriv); make_action(act_grant, (DBB) upriv);
} }
@ -2394,7 +2394,7 @@ static ACT make_global_field( FLD field)
HSH_insert(field->fld_name); HSH_insert(field->fld_name);
return make_action(act_a_gfield, field); return make_action(act_a_gfield, (DBB) field);
} }
@ -2436,7 +2436,7 @@ static void mod_old_trigger(void)
SYM_trigger))) PARSE_error(166, SYM_trigger))) PARSE_error(166,
name->sym_string, 0); /* msg 166: Trigger %s does not exist */ name->sym_string, 0); /* msg 166: Trigger %s does not exist */
modify_trigger_action(trigger, relation); modify_trigger_action(trigger, relation);
make_action(act_m_trigger, trigger); make_action(act_m_trigger, (DBB) trigger);
} }
parse_end(); parse_end();
} }
@ -2485,7 +2485,7 @@ static void modify_field(void)
parse_end(); parse_end();
make_action(act_m_gfield, field); make_action(act_m_gfield, (DBB) field);
} }
@ -2550,7 +2550,7 @@ static void modify_index(void)
break; break;
} }
make_action(act_m_index, index); make_action(act_m_index, (DBB) index);
} }
@ -2571,7 +2571,7 @@ static void modify_relation(void)
TEXT modify_relation; TEXT modify_relation;
relation = PARSE_relation(); relation = PARSE_relation();
make_action(act_m_relation, relation); make_action(act_m_relation, (DBB) relation);
if (MATCH(KW_EXTERNAL_FILE)) { if (MATCH(KW_EXTERNAL_FILE)) {
relation->rel_filename = PARSE_symbol(tok_quoted); relation->rel_filename = PARSE_symbol(tok_quoted);
@ -2628,7 +2628,7 @@ static void modify_relation(void)
field->fld_position = ++relation->rel_field_position; field->fld_position = ++relation->rel_field_position;
field->fld_name->sym_type = SYM_field; field->fld_name->sym_type = SYM_field;
HSH_insert(field->fld_name); HSH_insert(field->fld_name);
make_action(act_a_field, field); make_action(act_a_field, (DBB) field);
} }
} }
else if (MATCH(KW_MODIFY)) { else if (MATCH(KW_MODIFY)) {
@ -2640,7 +2640,7 @@ static void modify_relation(void)
field->fld_database = database; field->fld_database = database;
if (field->fld_computed) if (field->fld_computed)
PARSE_error(173, 0, 0); /* msg 173: A computed expression can not be changed or added */ PARSE_error(173, 0, 0); /* msg 173: A computed expression can not be changed or added */
make_action(act_m_field, field); make_action(act_m_field, (DBB) field);
} }
else if (MATCH(KW_DROP)) { else if (MATCH(KW_DROP)) {
if (MATCH(KW_SECURITY_CLASS)) { if (MATCH(KW_SECURITY_CLASS)) {
@ -2668,7 +2668,7 @@ static void modify_relation(void)
field->fld_relation = relation; field->fld_relation = relation;
field->fld_database = database; field->fld_database = database;
field->fld_name = PARSE_symbol(tok_ident); field->fld_name = PARSE_symbol(tok_ident);
make_action(act_d_field, field); make_action(act_d_field, (DBB) field);
} }
} }
else else
@ -2726,7 +2726,7 @@ static void modify_security_class(void)
} }
parse_end(); parse_end();
make_action(act_m_security, class_); make_action(act_m_security, (DBB) class_);
} }
@ -2779,7 +2779,7 @@ static void modify_trigger(void)
relation = trigger->trg_relation; relation = trigger->trg_relation;
flags = type = sequence = NULL; flags = type = sequence = NULL;
get_trigger_attributes(&flags, &type, &sequence); get_trigger_attributes((int*) &flags, (int*) &type, (int*) &sequence);
while (!KEYWORD(KW_SEMI)) { while (!KEYWORD(KW_SEMI)) {
if ((MATCH(KW_MESSAGE)) || (MATCH(KW_MSGADD)) || if ((MATCH(KW_MESSAGE)) || (MATCH(KW_MSGADD)) ||
@ -2795,11 +2795,11 @@ static void modify_trigger(void)
if (trigmsg->trgmsg_number > 255) if (trigmsg->trgmsg_number > 255)
PARSE_error(178, (TEXT *) trigmsg->trgmsg_number, 0); /* msg 178: message number %d exceeds 255 */ PARSE_error(178, (TEXT *) trigmsg->trgmsg_number, 0); /* msg 178: message number %d exceeds 255 */
if (msg_type == trgmsg_drop) if (msg_type == trgmsg_drop)
make_action(act_d_trigger_msg, trigmsg); make_action(act_d_trigger_msg, (DBB) trigmsg);
else if (msg_type == trgmsg_modify) { else if (msg_type == trgmsg_modify) {
MATCH(KW_COLON); MATCH(KW_COLON);
trigmsg->trgmsg_text = PARSE_symbol(tok_quoted); trigmsg->trgmsg_text = PARSE_symbol(tok_quoted);
make_action(act_m_trigger_msg, trigmsg); make_action(act_m_trigger_msg, (DBB) trigmsg);
} }
MATCH(KW_COMMA); MATCH(KW_COMMA);
msg_type = trgmsg_none; msg_type = trgmsg_none;
@ -2819,7 +2819,7 @@ static void modify_trigger(void)
if (flags || type || sequence) if (flags || type || sequence)
sort_out_attributes(trigger, flags, type, sequence); sort_out_attributes(trigger, flags, type, sequence);
make_action(act_m_trigger, trigger); make_action(act_m_trigger, (DBB) trigger);
} }
@ -2868,7 +2868,7 @@ static void modify_type(void)
fldtype->typ_type = PARSE_number(); fldtype->typ_type = PARSE_number();
if (KEYWORD(KW_DESCRIPTION)) if (KEYWORD(KW_DESCRIPTION))
fldtype->typ_description = parse_description(); fldtype->typ_description = parse_description();
make_action(act_m_type, fldtype); make_action(act_m_type, (DBB) fldtype);
if (!MATCH(KW_COMMA)) if (!MATCH(KW_COMMA))
break; break;
} }
@ -2893,7 +2893,7 @@ static void modify_view(void)
USHORT view_modify; USHORT view_modify;
relation = PARSE_relation(); relation = PARSE_relation();
make_action(act_m_relation, relation); make_action(act_m_relation, (DBB) relation);
view_modify = FALSE; view_modify = FALSE;
while (TRUE) { while (TRUE) {
@ -2927,7 +2927,7 @@ static void modify_view(void)
field->fld_database = database; field->fld_database = database;
if (field->fld_computed) if (field->fld_computed)
PARSE_error(181, 0, 0); /* msg 181: A computed expression can not be changed or added */ PARSE_error(181, 0, 0); /* msg 181: A computed expression can not be changed or added */
make_action(act_m_field, field); make_action(act_m_field, (DBB) field);
} }
else if (MATCH(KW_DROP)) { else if (MATCH(KW_DROP)) {
if (MATCH(KW_DESCRIP)) { if (MATCH(KW_DESCRIP)) {
@ -2955,7 +2955,7 @@ static void modify_view(void)
field->fld_relation = relation; field->fld_relation = relation;
field->fld_database = database; field->fld_database = database;
field->fld_name = PARSE_symbol(tok_ident); field->fld_name = PARSE_symbol(tok_ident);
make_action(act_d_field, field); make_action(act_d_field, (DBB) field);
} }
} }
else else
@ -4020,7 +4020,7 @@ static void revoke_user_privilege(void)
} }
parse_end(); parse_end();
make_action(act_revoke, upriv); make_action(act_revoke, (DBB) upriv);
} }
@ -4080,7 +4080,7 @@ static NOD set_generator(void)
node->nod_arg[0] = EXPR_value(0, 0); node->nod_arg[0] = EXPR_value(0, 0);
parse_end(); parse_end();
make_action(act_s_generator, node); make_action(act_s_generator, (DBB) node);
} }

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: ada.cpp,v 1.1.1.1 2001-05-23 13:25:33 tamlin Exp $ // $Id: ada.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
@ -41,6 +41,10 @@
#include "../gpre/prett_proto.h" #include "../gpre/prett_proto.h"
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
static int align(int); static int align(int);
static int asgn_from(ACT, REF, int); static int asgn_from(ACT, REF, int);
static int asgn_sqlda_from(REF, int, TEXT *, int); static int asgn_sqlda_from(REF, int, TEXT *, int);
@ -528,12 +532,12 @@ void ADA_print_buffer( TEXT * output_buffer, int column)
// Align output to a specific column for output. // Align output to a specific column for output.
// //
static align( int column) static int align( int column)
{ {
int i; int i;
if (column < 0) if (column < 0)
return; return 0;
ib_putc('\n', out_file); ib_putc('\n', out_file);
@ -551,7 +555,7 @@ static align( int column)
// a port variable. // a port variable.
// //
static asgn_from( ACT action, REF reference, int column) static int asgn_from( ACT action, REF reference, int column)
{ {
FLD field; FLD field;
TEXT *value, name[64], variable[20], temp[20]; TEXT *value, name[64], variable[20], temp[20];
@ -620,7 +624,7 @@ static void asgn_sqlda_from(
// a port variable. // a port variable.
// //
static asgn_to( ACT action, REF reference, int column) static int asgn_to( ACT action, REF reference, int column)
{ {
FLD field; FLD field;
REF source; REF source;
@ -632,7 +636,7 @@ static asgn_to( ACT action, REF reference, int column)
if (field->fld_array_info) { if (field->fld_array_info) {
source->ref_value = reference->ref_value; source->ref_value = reference->ref_value;
gen_get_or_put_slice(action, source, TRUE, column); gen_get_or_put_slice(action, source, TRUE, column);
return; return 0;
} }
// //
//if (field && (field->fld_flags & FLD_text)) //if (field && (field->fld_flags & FLD_text))
@ -659,7 +663,7 @@ static asgn_to( ACT action, REF reference, int column)
// a port variable. // a port variable.
// //
static asgn_to_proc( REF reference, int column) static int asgn_to_proc( REF reference, int column)
{ {
SCHAR s[64]; SCHAR s[64];
@ -719,7 +723,7 @@ static int gen_at_end( ACT action, int column)
// Substitute for a BASED ON <field name> clause. // Substitute for a BASED ON <field name> clause.
// //
static gen_based( ACT action, int column) static int gen_based( ACT action, int column)
{ {
BAS based_on; BAS based_on;
FLD field; FLD field;
@ -795,7 +799,7 @@ static gen_based( ACT action, int column)
default: default:
sprintf(s2, "datatype %d unknown\n", field->fld_dtype); sprintf(s2, "datatype %d unknown\n", field->fld_dtype);
return; return 0;
} }
for (p = s2; *p; p++, q++) for (p = s2; *p; p++, q++)
*q = *p; *q = *p;
@ -811,7 +815,7 @@ static gen_based( ACT action, int column)
// Make a blob FOR loop. // Make a blob FOR loop.
// //
static gen_blob_close( ACT action, USHORT column) static int gen_blob_close( ACT action, USHORT column)
{ {
TEXT *command; TEXT *command;
BLB blob; BLB blob;
@ -823,7 +827,8 @@ static gen_blob_close( ACT action, USHORT column)
else else
blob = (BLB) action->act_object; blob = (BLB) action->act_object;
command = (action->act_type == ACT_blob_cancel) ? "CANCEL" : "CLOSE"; command = (action->act_type == ACT_blob_cancel) ? (TEXT*)"CANCEL" :
(TEXT*)"CLOSE";
printa(column, "interbase.%s_BLOB (%s isc_%d);", printa(column, "interbase.%s_BLOB (%s isc_%d);",
command, status_vector(action), blob->blb_ident); command, status_vector(action), blob->blb_ident);
@ -841,7 +846,7 @@ static gen_blob_close( ACT action, USHORT column)
// End a blob FOR loop. // End a blob FOR loop.
// //
static gen_blob_end( ACT action, USHORT column) static int gen_blob_end( ACT action, USHORT column)
{ {
BLB blob; BLB blob;
@ -862,7 +867,7 @@ static gen_blob_end( ACT action, USHORT column)
// Make a blob FOR loop. // Make a blob FOR loop.
// //
static gen_blob_for( ACT action, USHORT column) static int gen_blob_for( ACT action, USHORT column)
{ {
gen_blob_open(action, column); gen_blob_open(action, column);
@ -947,7 +952,7 @@ static gen_blob_open( ACT action, USHORT column)
// Generate the call to open (or create) a blob. // Generate the call to open (or create) a blob.
// //
static gen_blob_open( ACT action, USHORT column) static int gen_blob_open( ACT action, USHORT column)
{ {
TEXT *command; TEXT *command;
BLB blob; BLB blob;
@ -981,7 +986,7 @@ static gen_blob_open( ACT action, USHORT column)
// Callback routine for BLR pretty printer. // Callback routine for BLR pretty printer.
// //
static gen_blr( int *user_arg, int offset, TEXT * string) static int gen_blr( int *user_arg, int offset, TEXT * string)
{ {
int from, to, len, c_len; int from, to, len, c_len;
SCHAR c; SCHAR c;
@ -1051,7 +1056,7 @@ static void gen_compatibility_symbol(
// Generate text to compile a request. // Generate text to compile a request.
// //
static gen_compile( ACT action, int column) static int gen_compile( ACT action, int column)
{ {
REQ request; REQ request;
DBB db; DBB db;
@ -1108,7 +1113,7 @@ static gen_compile( ACT action, int column)
// Generate a call to create a database. // Generate a call to create a database.
// //
static gen_create_database( ACT action, int column) static int gen_create_database( ACT action, int column)
{ {
REQ request; REQ request;
DBB db; DBB db;
@ -1207,7 +1212,7 @@ static gen_create_database( ACT action, int column)
// Generate substitution text for END_STREAM. // Generate substitution text for END_STREAM.
// //
static gen_cursor_close( ACT action, REQ request, int column) static int gen_cursor_close( ACT action, REQ request, int column)
{ {
return column; return column;
@ -1219,7 +1224,7 @@ static gen_cursor_close( ACT action, REQ request, int column)
// Generate text to initialize a cursor. // Generate text to initialize a cursor.
// //
static gen_cursor_init( ACT action, int column) static int gen_cursor_init( ACT action, int column)
{ {
// If blobs are present, zero out all of the blob handles. After this // If blobs are present, zero out all of the blob handles. After this
@ -1239,7 +1244,7 @@ static gen_cursor_init( ACT action, int column)
// Generate text to open an embedded SQL cursor. // Generate text to open an embedded SQL cursor.
// //
static gen_cursor_open( ACT action, REQ request, int column) static int gen_cursor_open( ACT action, REQ request, int column)
{ {
return column; return column;
@ -1253,7 +1258,7 @@ static gen_cursor_open( ACT action, REQ request, int column)
// and port declarations for requests in the main routine. // and port declarations for requests in the main routine.
// //
static gen_database( ACT action, int column) static int gen_database( ACT action, int column)
{ {
DBB db; DBB db;
REQ request; REQ request;
@ -1270,7 +1275,7 @@ static gen_database( ACT action, int column)
BOOLEAN array_flag; BOOLEAN array_flag;
if (first_flag++ != 0) if (first_flag++ != 0)
return; return 0;
ib_fprintf(out_file, "\n----- GPRE Preprocessor Definitions -----\n"); ib_fprintf(out_file, "\n----- GPRE Preprocessor Definitions -----\n");
@ -1320,7 +1325,7 @@ static gen_database( ACT action, int column)
max_count = 0; max_count = 0;
for (stack_ptr = events; stack_ptr; stack_ptr = stack_ptr->lls_next) { for (stack_ptr = events; stack_ptr; stack_ptr = stack_ptr->lls_next) {
event_count = gen_event_block(stack_ptr->lls_object); event_count = gen_event_block((ACT) stack_ptr->lls_object);
max_count = MAX(event_count, max_count); max_count = MAX(event_count, max_count);
} }
@ -1399,7 +1404,7 @@ static gen_database( ACT action, int column)
// Generate a call to update metadata. // Generate a call to update metadata.
// //
static gen_ddl( ACT action, int column) static int gen_ddl( ACT action, int column)
{ {
REQ request; REQ request;
@ -1443,7 +1448,7 @@ static gen_ddl( ACT action, int column)
// Generate a call to create a database. // Generate a call to create a database.
// //
static gen_drop_database( ACT action, int column) static int gen_drop_database( ACT action, int column)
{ {
REQ request; REQ request;
DBB db; DBB db;
@ -1464,7 +1469,7 @@ static gen_drop_database( ACT action, int column)
// Generate a dynamic SQL statement. // Generate a dynamic SQL statement.
// //
static gen_dyn_close( ACT action, int column) static int gen_dyn_close( ACT action, int column)
{ {
DYN statement; DYN statement;
TEXT s[64]; TEXT s[64];
@ -1482,7 +1487,7 @@ static gen_dyn_close( ACT action, int column)
// Generate a dynamic SQL statement. // Generate a dynamic SQL statement.
// //
static gen_dyn_declare( ACT action, int column) static int gen_dyn_declare( ACT action, int column)
{ {
DYN statement; DYN statement;
TEXT s1[64], s2[64]; TEXT s1[64], s2[64];
@ -1502,7 +1507,7 @@ static gen_dyn_declare( ACT action, int column)
// Generate a dynamic SQL statement. // Generate a dynamic SQL statement.
// //
static gen_dyn_describe( ACT action, int column, BOOLEAN input_flag) static int gen_dyn_describe( ACT action, int column, BOOLEAN input_flag)
{ {
DYN statement; DYN statement;
TEXT s[64]; TEXT s[64];
@ -1523,7 +1528,7 @@ static gen_dyn_describe( ACT action, int column, BOOLEAN input_flag)
// Generate a dynamic SQL statement. // Generate a dynamic SQL statement.
// //
static gen_dyn_execute( ACT action, int column) static int gen_dyn_execute( ACT action, int column)
{ {
DYN statement; DYN statement;
TEXT *transaction, s[64]; TEXT *transaction, s[64];
@ -1584,7 +1589,7 @@ static gen_dyn_execute( ACT action, int column)
// Generate a dynamic SQL statement. // Generate a dynamic SQL statement.
// //
static gen_dyn_fetch( ACT action, int column) static int gen_dyn_fetch( ACT action, int column)
{ {
DYN statement; DYN statement;
TEXT s[64]; TEXT s[64];
@ -1611,7 +1616,7 @@ static gen_dyn_fetch( ACT action, int column)
// Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement.
// //
static gen_dyn_immediate( ACT action, int column) static int gen_dyn_immediate( ACT action, int column)
{ {
DYN statement; DYN statement;
DBB database; DBB database;
@ -1657,7 +1662,7 @@ static gen_dyn_immediate( ACT action, int column)
// Generate a dynamic SQL statement. // Generate a dynamic SQL statement.
// //
static gen_dyn_insert( ACT action, int column) static int gen_dyn_insert( ACT action, int column)
{ {
DYN statement; DYN statement;
TEXT s[64]; TEXT s[64];
@ -1682,7 +1687,7 @@ static gen_dyn_insert( ACT action, int column)
// Generate a dynamic SQL statement. // Generate a dynamic SQL statement.
// //
static gen_dyn_open( ACT action, int column) static int gen_dyn_open( ACT action, int column)
{ {
DYN statement; DYN statement;
TEXT *transaction, s[64]; TEXT *transaction, s[64];
@ -1732,7 +1737,7 @@ static gen_dyn_open( ACT action, int column)
// Generate a dynamic SQL statement. // Generate a dynamic SQL statement.
// //
static gen_dyn_prepare( ACT action, int column) static int gen_dyn_prepare( ACT action, int column)
{ {
DYN statement; DYN statement;
DBB database; DBB database;
@ -1786,7 +1791,7 @@ static gen_dyn_prepare( ACT action, int column)
// Generate substitution text for END_MODIFY. // Generate substitution text for END_MODIFY.
// //
static gen_emodify( ACT action, int column) static int gen_emodify( ACT action, int column)
{ {
UPD modify; UPD modify;
REF reference, source; REF reference, source;
@ -1815,7 +1820,7 @@ static gen_emodify( ACT action, int column)
// Generate substitution text for END_STORE. // Generate substitution text for END_STORE.
// //
static gen_estore( ACT action, int column) static int gen_estore( ACT action, int column)
{ {
REQ request; REQ request;
@ -1826,7 +1831,7 @@ static gen_estore( ACT action, int column)
if (request->req_type == REQ_store2) { if (request->req_type == REQ_store2) {
if (action->act_error) if (action->act_error)
ENDIF; ENDIF;
return; return 0;
} }
gen_start(action, request->req_primary, column); gen_start(action, request->req_primary, column);
@ -1840,7 +1845,7 @@ static gen_estore( ACT action, int column)
// Generate definitions associated with a single request. // Generate definitions associated with a single request.
// //
static gen_endfor( ACT action, int column) static int gen_endfor( ACT action, int column)
{ {
REQ request; REQ request;
@ -1861,7 +1866,7 @@ static gen_endfor( ACT action, int column)
// Generate substitution text for ERASE. // Generate substitution text for ERASE.
// //
static gen_erase( ACT action, int column) static int gen_erase( ACT action, int column)
{ {
UPD erase; UPD erase;
@ -1914,7 +1919,7 @@ static SSHORT gen_event_block( ACT action)
// Generate substitution text for EVENT_INIT. // Generate substitution text for EVENT_INIT.
// //
static gen_event_init( ACT action, int column) static int gen_event_init( ACT action, int column)
{ {
NOD init, event_list, *ptr, *end, node; NOD init, event_list, *ptr, *end, node;
REF reference; REF reference;
@ -1979,7 +1984,7 @@ static gen_event_init( ACT action, int column)
// Generate substitution text for EVENT_WAIT. // Generate substitution text for EVENT_WAIT.
// //
static gen_event_wait( ACT action, int column) static int gen_event_wait( ACT action, int column)
{ {
PAT args; PAT args;
NOD event_init; NOD event_init;
@ -2042,7 +2047,7 @@ static gen_event_wait( ACT action, int column)
// stream fetch). // stream fetch).
// //
static gen_fetch( ACT action, int column) static int gen_fetch( ACT action, int column)
{ {
REQ request; REQ request;
NOD var_list; NOD var_list;
@ -2112,7 +2117,7 @@ static gen_fetch( ACT action, int column)
if (var_list = (NOD) action->act_object) { if (var_list = (NOD) action->act_object) {
for (i = 0; i < var_list->nod_count; i++) for (i = 0; i < var_list->nod_count; i++)
asgn_to(action, var_list->nod_arg[i], column); asgn_to(action, (REF) var_list->nod_arg[i], column);
} }
else { /* No WITH clause on the FETCH, so no assignments generated; fix else { /* No WITH clause on the FETCH, so no assignments generated; fix
for bug#940. mao 6/20/89 */ for bug#940. mao 6/20/89 */
@ -2144,7 +2149,7 @@ static gen_fetch( ACT action, int column)
// Generate substitution text for FINISH. // Generate substitution text for FINISH.
// //
static gen_finish( ACT action, int column) static int gen_finish( ACT action, int column)
{ {
DBB db; DBB db;
REQ request; REQ request;
@ -2214,7 +2219,7 @@ static gen_finish( ACT action, int column)
// Generate substitution text for FOR statement. // Generate substitution text for FOR statement.
// //
static gen_for( ACT action, int column) static int gen_for( ACT action, int column)
{ {
POR port; POR port;
REQ request; REQ request;
@ -2252,7 +2257,7 @@ static gen_for( ACT action, int column)
// Generate code for a form interaction. // Generate code for a form interaction.
// //
static gen_form_display( ACT action, int column) static int gen_form_display( ACT action, int column)
{ {
FINT display; FINT display;
REQ request; REQ request;
@ -2294,7 +2299,7 @@ static gen_form_display( ACT action, int column)
// Generate code for a form block. // Generate code for a form block.
// //
static gen_form_end( ACT action, int column) static int gen_form_end( ACT action, int column)
{ {
REQ request; REQ request;
FORM form; FORM form;
@ -2311,7 +2316,7 @@ static gen_form_end( ACT action, int column)
// Generate code for a form block. // Generate code for a form block.
// //
static gen_form_for( ACT action, int column) static int gen_form_for( ACT action, int column)
{ {
REQ request; REQ request;
FORM form; FORM form;
@ -2375,7 +2380,7 @@ static int gen_function( ACT function, int column)
if (action->act_type != ACT_any) { if (action->act_type != ACT_any) {
IBERROR("can't generate function"); IBERROR("can't generate function");
return; return 0;
} }
request = action->act_request; request = action->act_request;
@ -2429,7 +2434,7 @@ static int gen_function( ACT function, int column)
default: default:
IBERROR("gen_function: unsupported datatype"); IBERROR("gen_function: unsupported datatype");
return; return 0;
} }
ib_fprintf(out_file, " %s\t%s;\n", dtype, ib_fprintf(out_file, " %s\t%s;\n", dtype,
gen_name(s, reference->ref_source, TRUE)); gen_name(s, reference->ref_source, TRUE));
@ -2462,7 +2467,7 @@ static int gen_function( ACT function, int column)
// or isc_put_slice for an array. // or isc_put_slice for an array.
// //
static gen_get_or_put_slice( static int gen_get_or_put_slice(
ACT action, ACT action,
REF reference, BOOLEAN get, int column) REF reference, BOOLEAN get, int column)
{ {
@ -2474,7 +2479,7 @@ static gen_get_or_put_slice(
"interbase.PUT_SLICE (%V1 %RF%DH%RE, %RF%S1%RE, %S2, %N1, %S3, %N2, %S4, %L1, %S5);"; "interbase.PUT_SLICE (%V1 %RF%DH%RE, %RF%S1%RE, %S2, %N1, %S3, %N2, %S4, %L1, %S5);";
if (!(reference->ref_flags & REF_fetch_array)) if (!(reference->ref_flags & REF_fetch_array))
return; return 0;
args.pat_vector1 = status_vector(action); /* status vector */ args.pat_vector1 = status_vector(action); /* status vector */
args.pat_database = action->act_request->req_database; /* database handle */ args.pat_database = action->act_request->req_database; /* database handle */
@ -2519,7 +2524,7 @@ static gen_get_or_put_slice(
// Generate the code to do a get segment. // Generate the code to do a get segment.
// //
static gen_get_segment( ACT action, int column) static int gen_get_segment( ACT action, int column)
{ {
BLB blob; BLB blob;
REF into; REF into;
@ -2561,7 +2566,7 @@ static gen_get_segment( ACT action, int column)
// Generate end of block for PUT_ITEM and FOR_ITEM. // Generate end of block for PUT_ITEM and FOR_ITEM.
// //
static gen_item_end( ACT action, int column) static int gen_item_end( ACT action, int column)
{ {
ACT org_action; ACT org_action;
FINT display; FINT display;
@ -2576,7 +2581,7 @@ static gen_item_end( ACT action, int column)
request = action->act_request; request = action->act_request;
if (request->req_type == REQ_menu) { if (request->req_type == REQ_menu) {
gen_menu_item_end(action, column); gen_menu_item_end(action, column);
return; return 0;
} }
if (action->act_pair->act_type == ACT_item_for) { if (action->act_pair->act_type == ACT_item_for) {
@ -2584,7 +2589,7 @@ static gen_item_end( ACT action, int column)
gen_name(index, request->req_index, TRUE); gen_name(index, request->req_index, TRUE);
printa(column, "%s := %s + 1;", index, index); printa(column, "%s := %s + 1;", index, index);
printa(column, "end loop"); printa(column, "end loop");
return; return 0;
} }
dbb = request->req_database; dbb = request->req_database;
@ -2595,7 +2600,7 @@ static gen_item_end( ACT action, int column)
for (reference = port->por_references; reference; for (reference = port->por_references; reference;
reference = reference->ref_next) if (master = reference->ref_master) reference = reference->ref_next) if (master = reference->ref_master)
printa(column, "%s := %d;", gen_name(s, reference, TRUE), printa(column, "%s := %d;", gen_name(s, reference, TRUE),
PYXIS__OPT_DISPLAY); PYXIS_OPT_DISPLAY);
printa(column, printa(column,
"interbase.insert_sub_form (%s %s%s, %s%s, %s, isc_%d'address)", "interbase.insert_sub_form (%s %s%s, %s%s, %s, isc_%d'address)",
@ -2611,7 +2616,7 @@ static gen_item_end( ACT action, int column)
// Generate insert text for FOR_ITEM and PUT_ITEM. // Generate insert text for FOR_ITEM and PUT_ITEM.
// //
static gen_item_for( ACT action, int column) static int gen_item_for( ACT action, int column)
{ {
REQ request, parent; REQ request, parent;
FORM form; FORM form;
@ -2620,7 +2625,7 @@ static gen_item_for( ACT action, int column)
request = action->act_request; request = action->act_request;
if (request->req_type == REQ_menu) { if (request->req_type == REQ_menu) {
gen_menu_item_for(action, column); gen_menu_item_for(action, column);
return; return 0;
} }
column += INDENT; column += INDENT;
@ -2639,7 +2644,7 @@ static gen_item_for( ACT action, int column)
printa(column, "end if;"); printa(column, "end if;");
if (action->act_type != ACT_item_for) if (action->act_type != ACT_item_for)
return; return 0;
// Build stuff for item loop // Build stuff for item loop
@ -2663,7 +2668,7 @@ static gen_item_for( ACT action, int column)
// and get the result. // and get the result.
// //
static gen_loop( ACT action, int column) static int gen_loop( ACT action, int column)
{ {
REQ request; REQ request;
POR port; POR port;
@ -2688,7 +2693,7 @@ static gen_loop( ACT action, int column)
// //
// //
static gen_menu( ACT action, int column) static int gen_menu( ACT action, int column)
{ {
REQ request; REQ request;
@ -2704,7 +2709,7 @@ static gen_menu( ACT action, int column)
// Generate code for a menu interaction. // Generate code for a menu interaction.
// //
static gen_menu_display( ACT action, int column) static int gen_menu_display( ACT action, int column)
{ {
MENU menu; MENU menu;
REQ request, display_request; REQ request, display_request;
@ -2739,14 +2744,14 @@ static gen_menu_display( ACT action, int column)
// //
// //
static gen_menu_end( ACT action, int column) static int gen_menu_end( ACT action, int column)
{ {
REQ request; REQ request;
request = action->act_request; request = action->act_request;
if (request->req_flags & REQ_menu_for) if (request->req_flags & REQ_menu_for)
return; return 0;
printa(column, "when others =>"); printa(column, "when others =>");
printa(column + INDENT, "null ;"); printa(column + INDENT, "null ;");
@ -2758,7 +2763,7 @@ static gen_menu_end( ACT action, int column)
// //
// //
static gen_menu_entree( ACT action, int column) static int gen_menu_entree( ACT action, int column)
{ {
REQ request; REQ request;
@ -2773,7 +2778,7 @@ static gen_menu_entree( ACT action, int column)
// Generate code for a reference to a menu or entree attribute. // Generate code for a reference to a menu or entree attribute.
// //
static gen_menu_entree_att( ACT action, int column) static int gen_menu_entree_att( ACT action, int column)
{ {
MENU menu; MENU menu;
SSHORT ident, length; SSHORT ident, length;
@ -2819,7 +2824,7 @@ static gen_menu_entree_att( ACT action, int column)
// Generate code for a menu block. // Generate code for a menu block.
// //
static gen_menu_for( ACT action, int column) static int gen_menu_for( ACT action, int column)
{ {
REQ request; REQ request;
@ -2839,7 +2844,7 @@ static gen_menu_for( ACT action, int column)
// for a dynamic menu. // for a dynamic menu.
// //
static gen_menu_item_end( ACT action, int column) static int gen_menu_item_end( ACT action, int column)
{ {
REQ request; REQ request;
ENTREE entree; ENTREE entree;
@ -2847,7 +2852,7 @@ static gen_menu_item_end( ACT action, int column)
if (action->act_pair->act_type == ACT_item_for) { if (action->act_pair->act_type == ACT_item_for) {
column += INDENT; column += INDENT;
printa(column, "end loop"); printa(column, "end loop");
return; return 0;
} }
entree = (ENTREE) action->act_pair->act_object; entree = (ENTREE) action->act_pair->act_object;
@ -2869,13 +2874,13 @@ static gen_menu_item_end( ACT action, int column)
// for a dynamic menu. // for a dynamic menu.
// //
static gen_menu_item_for( ACT action, int column) static int gen_menu_item_for( ACT action, int column)
{ {
ENTREE entree; ENTREE entree;
REQ request; REQ request;
if (action->act_type != ACT_item_for) if (action->act_type != ACT_item_for)
return; return 0;
// Build stuff for item loop // Build stuff for item loop
@ -2901,7 +2906,7 @@ static gen_menu_item_for( ACT action, int column)
// Generate definitions associated with a dynamic menu request. // Generate definitions associated with a dynamic menu request.
// //
static gen_menu_request( REQ request, int column) static int gen_menu_request( REQ request, int column)
{ {
ACT action; ACT action;
MENU menu; MENU menu;
@ -2983,7 +2988,7 @@ static TEXT *gen_name( TEXT * string, REF reference, BOOLEAN as_blob)
// Generate a block to handle errors. // Generate a block to handle errors.
// //
static gen_on_error( ACT action, USHORT column) static int gen_on_error( ACT action, USHORT column)
{ {
ACT err_action; ACT err_action;
@ -3003,7 +3008,7 @@ static gen_on_error( ACT action, USHORT column)
// Generate code for an EXECUTE PROCEDURE. // Generate code for an EXECUTE PROCEDURE.
// //
static gen_procedure( ACT action, int column) static int gen_procedure( ACT action, int column)
{ {
PAT args; PAT args;
TEXT *pattern; TEXT *pattern;
@ -3062,7 +3067,7 @@ static gen_procedure( ACT action, int column)
// Generate the code to do a put segment. // Generate the code to do a put segment.
// //
static gen_put_segment( ACT action, int column) static int gen_put_segment( ACT action, int column)
{ {
BLB blob; BLB blob;
REF from; REF from;
@ -3092,7 +3097,7 @@ static gen_put_segment( ACT action, int column)
// Generate BLR in raw, numeric form. Ughly but dense. // Generate BLR in raw, numeric form. Ughly but dense.
// //
static gen_raw( static int gen_raw(
UCHAR * blr, UCHAR * blr,
enum req_t request_type, int request_length, int column) enum req_t request_type, int request_length, int column)
{ {
@ -3127,7 +3132,7 @@ static gen_raw(
// Generate substitution text for READY // Generate substitution text for READY
// //
static gen_ready( ACT action, int column) static int gen_ready( ACT action, int column)
{ {
RDY ready; RDY ready;
DBB db; DBB db;
@ -3156,7 +3161,7 @@ static gen_ready( ACT action, int column)
// Generate receive call for a port. // Generate receive call for a port.
// //
static gen_receive( ACT action, int column, POR port) static int gen_receive( ACT action, int column, POR port)
{ {
REQ request; REQ request;
@ -3182,7 +3187,7 @@ static gen_receive( ACT action, int column, POR port)
// a serious error, it will be caught on the next statement. // a serious error, it will be caught on the next statement.
// //
static gen_release( ACT action, int column) static int gen_release( ACT action, int column)
{ {
DBB db, exp_db; DBB db, exp_db;
REQ request; REQ request;
@ -3211,7 +3216,7 @@ static gen_release( ACT action, int column)
// Generate definitions associated with a single request. // Generate definitions associated with a single request.
// //
static gen_request( REQ request, int column) static int gen_request( REQ request, int column)
{ {
ACT action; ACT action;
UPD modify; UPD modify;
@ -3302,37 +3307,43 @@ static gen_request( REQ request, int column)
case REQ_create_database: case REQ_create_database:
case REQ_ready: case REQ_ready:
string_type = "DPB"; string_type = "DPB";
if (PRETTY_print_cdb(request->req_blr, gen_blr, 0, 0)) if (PRETTY_print_cdb((SCHAR*) request->req_blr,
(int (*)()) gen_blr, 0, 0))
IBERROR("internal error during parameter generation"); IBERROR("internal error during parameter generation");
break; break;
case REQ_ddl: case REQ_ddl:
string_type = "DYN"; string_type = "DYN";
if (PRETTY_print_dyn(request->req_blr, gen_blr, 0, 0)) if (PRETTY_print_dyn((SCHAR*) request->req_blr,
( int (*)()) gen_blr, 0, 0))
IBERROR("internal error during dynamic DDL generation"); IBERROR("internal error during dynamic DDL generation");
break; break;
case REQ_form: case REQ_form:
string_type = "form map"; string_type = "form map";
if (PRETTY_print_form_map(request->req_blr, gen_blr, 0, 0)) if (PRETTY_print_form_map((SCHAR*) request->req_blr,
( int (*)()) gen_blr, 0, 0))
IBERROR("internal error during form map generation"); IBERROR("internal error during form map generation");
break; break;
case REQ_menu: case REQ_menu:
string_type = "menu"; string_type = "menu";
if (PRETTY_print_menu(request->req_blr, gen_blr, 0, 1)) if (PRETTY_print_menu((SCHAR*) request->req_blr,
(int (*)()) gen_blr, 0, 1))
IBERROR("internal error during menu generation"); IBERROR("internal error during menu generation");
break; break;
case REQ_slice: case REQ_slice:
string_type = "SDL"; string_type = "SDL";
if (PRETTY_print_sdl(request->req_blr, gen_blr, 0, 0)) if (PRETTY_print_sdl((SCHAR*) request->req_blr,
( int (*)() ) gen_blr, 0, 0))
IBERROR("internal error during SDL generation"); IBERROR("internal error during SDL generation");
break; break;
default: default:
string_type = "BLR"; string_type = "BLR";
if (isc_print_blr(request->req_blr, gen_blr, 0, 0)) if (isc_print_blr((SCHAR*) request->req_blr,
( void (*)() ) gen_blr, 0, 0))
IBERROR("internal error during BLR generation"); IBERROR("internal error during BLR generation");
} }
} }
@ -3374,7 +3385,7 @@ static gen_request( REQ request, int column)
printa(column, printa(column,
"isc_%d\t: CONSTANT interbase.blr (1..%d) := (", "isc_%d\t: CONSTANT interbase.blr (1..%d) := (",
reference->ref_sdl_ident, reference->ref_sdl_length); reference->ref_sdl_ident, reference->ref_sdl_length);
gen_raw(reference->ref_sdl, REQ_slice, gen_raw((UCHAR*) reference->ref_sdl, REQ_slice,
reference->ref_sdl_length, column); reference->ref_sdl_length, column);
printa(column, "); \t--- end of SDL string for isc_%d\n", printa(column, "); \t--- end of SDL string for isc_%d\n",
reference->ref_sdl_ident); reference->ref_sdl_ident);
@ -3383,7 +3394,8 @@ static gen_request( REQ request, int column)
printa(column, printa(column,
"--- FORMATTED REQUEST SDL FOR GDS_%d = \n", "--- FORMATTED REQUEST SDL FOR GDS_%d = \n",
reference->ref_sdl_ident); reference->ref_sdl_ident);
if (PRETTY_print_sdl(reference->ref_sdl, gen_blr, 0, 1)) if (PRETTY_print_sdl(reference->ref_sdl,
( int(*)() ) gen_blr, 0, 1))
IBERROR("internal error during SDL generation"); IBERROR("internal error during SDL generation");
} }
} }
@ -3418,7 +3430,7 @@ static gen_request( REQ request, int column)
// in a store2 statement. // in a store2 statement.
// //
static gen_return_value( ACT action, int column) static int gen_return_value( ACT action, int column)
{ {
UPD update; UPD update;
REF reference; REF reference;
@ -3442,7 +3454,7 @@ static gen_return_value( ACT action, int column)
// routine, insert local definitions. // routine, insert local definitions.
// //
static gen_routine( ACT action, int column) static int gen_routine( ACT action, int column)
{ {
BLB blob; BLB blob;
REQ request; REQ request;
@ -3490,7 +3502,7 @@ static gen_routine( ACT action, int column)
// Generate substitution text for END_STREAM. // Generate substitution text for END_STREAM.
// //
static gen_s_end( ACT action, int column) static int gen_s_end( ACT action, int column)
{ {
REQ request; REQ request;
@ -3522,7 +3534,7 @@ static gen_s_end( ACT action, int column)
// Generate substitution text for FETCH. // Generate substitution text for FETCH.
// //
static gen_s_fetch( ACT action, int column) static int gen_s_fetch( ACT action, int column)
{ {
REQ request; REQ request;
@ -3540,7 +3552,7 @@ static gen_s_fetch( ACT action, int column)
// used both by START_STREAM and FOR // used both by START_STREAM and FOR
// //
static gen_s_start( ACT action, int column) static int gen_s_start( ACT action, int column)
{ {
REQ request; REQ request;
POR port; POR port;
@ -3580,7 +3592,7 @@ static gen_s_start( ACT action, int column)
// Substitute for a segment, segment length, or blob handle. // Substitute for a segment, segment length, or blob handle.
// //
static gen_segment( ACT action, int column) static int gen_segment( ACT action, int column)
{ {
BLB blob; BLB blob;
@ -3598,7 +3610,7 @@ static gen_segment( ACT action, int column)
// Generate code for standalone SELECT statement. // Generate code for standalone SELECT statement.
// //
static gen_select( ACT action, int column) static int gen_select( ACT action, int column)
{ {
REQ request; REQ request;
POR port; POR port;
@ -3619,7 +3631,7 @@ static gen_select( ACT action, int column)
if (var_list = (NOD) action->act_object) if (var_list = (NOD) action->act_object)
for (i = 0; i < var_list->nod_count; i++) for (i = 0; i < var_list->nod_count; i++)
asgn_to(action, var_list->nod_arg[i], column); asgn_to(action, (REF) var_list->nod_arg[i], column);
if (request->req_database->dbb_flags & DBB_v3) { if (request->req_database->dbb_flags & DBB_v3) {
gen_receive(action, column, port); gen_receive(action, column, port);
printa(column, "if (SQLCODE = 0) AND (%s /= 0) then", name); printa(column, "if (SQLCODE = 0) AND (%s /= 0) then", name);
@ -3641,7 +3653,7 @@ static gen_select( ACT action, int column)
// Generate a send or receive call for a port. // Generate a send or receive call for a port.
// //
static gen_send( ACT action, POR port, int column) static int gen_send( ACT action, POR port, int column)
{ {
REQ request; REQ request;
@ -3661,13 +3673,13 @@ static gen_send( ACT action, POR port, int column)
// Generate support for get/put slice statement. // Generate support for get/put slice statement.
// //
static gen_slice( ACT action, int column) static int gen_slice( ACT action, int column)
{ {
REQ request, parent_request; REQ request, parent_request;
REF reference, upper, lower; REF reference, upper, lower;
SLC slice; SLC slice;
PAT args; PAT args;
struct slc_repeat *tail, *end; slc::slc_repeat *tail, *end;
TEXT *pattern1 = TEXT *pattern1 =
"interbase.GET_SLICE (%V1 %RF%DH%RE, %RF%RT%RE, %RF%FR%RE, %N1, \ "interbase.GET_SLICE (%V1 %RF%DH%RE, %RF%RT%RE, %RF%FR%RE, %N1, \
%I1, %N2, %I1v, %I1s, %RF%S5'address%RE, %RF%S6%RE);"; %I1, %N2, %I1v, %I1s, %RF%S5'address%RE, %RF%S6%RE);";
@ -3731,7 +3743,7 @@ static gen_slice( ACT action, int column)
// on whether or a not a port is present. // on whether or a not a port is present.
// //
static gen_start( ACT action, POR port, int column) static int gen_start( ACT action, POR port, int column)
{ {
REQ request; REQ request;
TEXT *vector; TEXT *vector;
@ -3772,7 +3784,7 @@ static gen_start( ACT action, POR port, int column)
// call and any variable initialization required. // call and any variable initialization required.
// //
static gen_store( ACT action, int column) static int gen_store( ACT action, int column)
{ {
REQ request; REQ request;
REF reference; REF reference;
@ -3803,7 +3815,7 @@ static gen_store( ACT action, int column)
// Generate substitution text for START_TRANSACTION. // Generate substitution text for START_TRANSACTION.
// //
static gen_t_start( ACT action, int column) static int gen_t_start( ACT action, int column)
{ {
DBB db; DBB db;
TRA trans; TRA trans;
@ -3818,7 +3830,7 @@ static gen_t_start( ACT action, int column)
if (!action || !(trans = (TRA) action->act_object)) { if (!action || !(trans = (TRA) action->act_object)) {
t_start_auto(action, 0, status_vector(action), column, FALSE); t_start_auto(action, 0, status_vector(action), column, FALSE);
return; return 0;
} }
// build a complete statement, including tpb's. // build a complete statement, including tpb's.
@ -3861,7 +3873,7 @@ static gen_t_start( ACT action, int column)
// Generate a TPB in the output file // Generate a TPB in the output file
// //
static gen_tpb( TPB tpb, int column) static int gen_tpb( TPB tpb, int column)
{ {
TEXT *text, buffer[80], c, *p; TEXT *text, buffer[80], c, *p;
int length; int length;
@ -3899,7 +3911,7 @@ static gen_tpb( TPB tpb, int column)
// Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE
// //
static gen_trans( ACT action, int column) static int gen_trans( ACT action, int column)
{ {
if (action->act_type == ACT_commit_retain_context) if (action->act_type == ACT_commit_retain_context)
@ -3946,7 +3958,7 @@ static int gen_type( ACT action, int column)
// Generate substitution text for UPDATE ... WHERE CURRENT OF ... // Generate substitution text for UPDATE ... WHERE CURRENT OF ...
// //
static gen_update( ACT action, int column) static int gen_update( ACT action, int column)
{ {
POR port; POR port;
UPD modify; UPD modify;
@ -3963,7 +3975,7 @@ static gen_update( ACT action, int column)
// Substitute for a variable reference. // Substitute for a variable reference.
// //
static gen_variable( ACT action, int column) static int gen_variable( ACT action, int column)
{ {
TEXT s[20]; TEXT s[20];
@ -3976,7 +3988,7 @@ static gen_variable( ACT action, int column)
// Generate tests for any WHENEVER clauses that may have been declared. // Generate tests for any WHENEVER clauses that may have been declared.
// //
static gen_whenever( SWE label, int column) static int gen_whenever( SWE label, int column)
{ {
TEXT *condition; TEXT *condition;
@ -4006,7 +4018,7 @@ static gen_whenever( SWE label, int column)
// Create a new window. // Create a new window.
// //
static gen_window_create( ACT action, int column) static int gen_window_create( ACT action, int column)
{ {
printa(column, printa(column,
@ -4020,7 +4032,7 @@ static gen_window_create( ACT action, int column)
// Delete a window. // Delete a window.
// //
static gen_window_delete( ACT action, int column) static int gen_window_delete( ACT action, int column)
{ {
printa(column, "interbase.delete_window (%sisc_window)", printa(column, "interbase.delete_window (%sisc_window)",
@ -4033,7 +4045,7 @@ static gen_window_delete( ACT action, int column)
// Suspend a window. // Suspend a window.
// //
static gen_window_suspend( ACT action, int column) static int gen_window_suspend( ACT action, int column)
{ {
printa(column, "interbase.suspend_window (%sisc_window)", printa(column, "interbase.suspend_window (%sisc_window)",
@ -4047,7 +4059,7 @@ static gen_window_suspend( ACT action, int column)
// output file. // output file.
// //
static make_array_declaration( REF reference, int column) static int make_array_declaration( REF reference, int column)
{ {
FLD field; FLD field;
SCHAR *name; SCHAR *name;
@ -4061,7 +4073,7 @@ static make_array_declaration( REF reference, int column)
// Don't generate multiple declarations for the array. V3 Bug 569. // Don't generate multiple declarations for the array. V3 Bug 569.
if (field->fld_array_info->ary_declared) if (field->fld_array_info->ary_declared)
return; return 0;
field->fld_array_info->ary_declared = TRUE; field->fld_array_info->ary_declared = TRUE;
@ -4134,7 +4146,7 @@ static make_array_declaration( REF reference, int column)
default: default:
printa(column, "datatype %d unknown for field %s", printa(column, "datatype %d unknown for field %s",
field->fld_array_info->ary_dtype, name); field->fld_array_info->ary_dtype, name);
return; return 0;
} }
ib_fprintf(out_file, ";\n"); ib_fprintf(out_file, ";\n");
@ -4155,7 +4167,7 @@ static make_array_declaration( REF reference, int column)
// if type == ACT_close && !isc_nl, error // if type == ACT_close && !isc_nl, error
// //
static make_cursor_open_test( enum act_t type, REQ request, int column) static int make_cursor_open_test( enum act_t type, REQ request, int column)
{ {
if (type == ACT_open) { if (type == ACT_open) {
@ -4191,7 +4203,7 @@ static TEXT *make_name( TEXT * string, SYM symbol)
// compiled request with active transaction. // compiled request with active transaction.
// //
static make_ok_test( ACT action, REQ request, int column) static int make_ok_test( ACT action, REQ request, int column)
{ {
if (sw_auto) if (sw_auto)
@ -4208,7 +4220,7 @@ static make_ok_test( ACT action, REQ request, int column)
// Insert a port record description in output. // Insert a port record description in output.
// //
static make_port( POR port, int column) static int make_port( POR port, int column)
{ {
FLD field; FLD field;
REF reference; REF reference;
@ -4284,7 +4296,7 @@ static make_port( POR port, int column)
sprintf(s, "datatype %d unknown for field %s, msg %d", sprintf(s, "datatype %d unknown for field %s, msg %d",
field->fld_dtype, name, port->por_msg_number); field->fld_dtype, name, port->por_msg_number);
IBERROR(s); IBERROR(s);
return; return 0;
} }
} }
@ -4313,7 +4325,7 @@ static make_port( POR port, int column)
// ready; // ready;
// //
static make_ready( static int make_ready(
DBB db, DBB db,
TEXT * filename, TEXT * vector, USHORT column, REQ request) TEXT * filename, TEXT * vector, USHORT column, REQ request)
{ {
@ -4404,7 +4416,7 @@ static make_ready(
// Print a fixed string at a particular column. // Print a fixed string at a particular column.
// //
static printa( int column, TEXT * string, ...) static int printa( int column, TEXT * string, ...)
{ {
va_list ptr; va_list ptr;
@ -4430,7 +4442,7 @@ static TEXT *request_trans( ACT action, REQ request)
return trname; return trname;
} }
else else
return (request) ? request->req_trans : "gds_trans"; return (request) ? request->req_trans : (TEXT*) "gds_trans";
} }
@ -4455,7 +4467,7 @@ static TEXT *status_vector( ACT action)
// Generate substitution text for START_TRANSACTION. // Generate substitution text for START_TRANSACTION.
// //
static t_start_auto( static int t_start_auto(
ACT action, ACT action,
REQ request, TEXT * vector, int column, SSHORT test) REQ request, TEXT * vector, int column, SSHORT test)
{ {

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: c_cxx.cpp,v 1.1.1.1 2001-05-23 13:25:32 tamlin Exp $ // $Id: c_cxx.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
@ -149,7 +149,7 @@ static TEXT *make_name(TEXT *, SYM);
static void make_ok_test(ACT, REQ, int); static void make_ok_test(ACT, REQ, int);
static void make_port(POR, int); static void make_port(POR, int);
static void make_ready(DBB, TEXT *, TEXT *, USHORT, REQ); static void make_ready(DBB, TEXT *, TEXT *, USHORT, REQ);
static void printa(int, TEXT *, ...); static void printa(int, const char *, ...);
static void printb(TEXT *, ...); static void printb(TEXT *, ...);
static TEXT *request_trans(ACT, REQ); static TEXT *request_trans(ACT, REQ);
static TEXT *status_vector(ACT); static TEXT *status_vector(ACT);
@ -171,6 +171,10 @@ static TEXT *status_name;
#define GDS_INCLUDE "\"interbase:[syslib]gds.h\"" #define GDS_INCLUDE "\"interbase:[syslib]gds.h\""
#endif #endif
#ifdef DARWIN
#define GDS_INCLUDE "<Firebird/ibase.h>"
#endif
#ifndef GDS_INCLUDE #ifndef GDS_INCLUDE
#define GDS_INCLUDE "<ibase.h>" #define GDS_INCLUDE "<ibase.h>"
#endif #endif
@ -680,7 +684,7 @@ static void asgn_from( ACT action, REF reference, int column)
ib_fprintf(out_file, "isc_ftof (%s, %d, %s, %d);", value, ib_fprintf(out_file, "isc_ftof (%s, %d, %s, %d);", value,
field->fld_length, variable, field->fld_length); field->fld_length, variable, field->fld_length);
else if (sw_cstring) else if (sw_cstring)
ib_fprintf(out_file, "isc_vtov (%s, %s, %d);", value, ib_fprintf(out_file, "isc_vtov ((char*)%s, (char*)%s, %d);", value,
variable, field->fld_length); variable, field->fld_length);
else if (reference->ref_source) else if (reference->ref_source)
ib_fprintf(out_file, "isc_ftof (%s, sizeof (%s), %s, %d);", ib_fprintf(out_file, "isc_ftof (%s, sizeof (%s), %s, %d);",
@ -812,7 +816,7 @@ static void asgn_to( ACT action, REF reference, int column)
field->fld_length, reference->ref_value, field->fld_length, reference->ref_value,
reference->ref_value); reference->ref_value);
else else
ib_fprintf(out_file, "isc_vtov (%s, %s, sizeof (%s));", s, ib_fprintf(out_file, "isc_vtov ((char*)%s, (char*)%s, sizeof (%s));", s,
reference->ref_value, reference->ref_value); reference->ref_value, reference->ref_value);
#else #else
/* To avoid chopping off a double byte kanji character in between /* To avoid chopping off a double byte kanji character in between
@ -875,7 +879,7 @@ static void asgn_to_proc( REF reference, int column)
field->fld_length, reference->ref_value, field->fld_length, reference->ref_value,
reference->ref_value); reference->ref_value);
else else
ib_fprintf(out_file, "isc_vtov (%s, %s, sizeof (%s));", s, ib_fprintf(out_file, "isc_vtov ((char*)%s, (char*)%s, sizeof (%s));", s,
reference->ref_value, reference->ref_value); reference->ref_value, reference->ref_value);
#else #else
/* To avoid chopping off a double byte kanji character in between /* To avoid chopping off a double byte kanji character in between
@ -1167,7 +1171,7 @@ static void gen_blob_open( ACT action, USHORT column)
TEXT *pattern1 = TEXT *pattern1 =
"isc_%IFcreate%ELopen%EN_blob2 (%V1, &%DH, &%RT, &%BH, &%FR, (short) %N1, %I1);", "isc_%IFcreate%ELopen%EN_blob2 (%V1, &%DH, &%RT, &%BH, &%FR, (short) %N1, %I1);",
*pattern2 = *pattern2 =
"isc_%IFcreate%ELopen%EN_blob2 (%V1, &%DH, &%RT, &%BH, &%FR, (short) 0, (char*) 0);"; "isc_%IFcreate%ELopen%EN_blob2 (%V1, &%DH, &%RT, &%BH, &%FR, (short) 0, (%IFchar%ELunsigned char%EN*) 0);";
if (sw_auto && (action->act_flags & ACT_sql)) { if (sw_auto && (action->act_flags & ACT_sql)) {
t_start_auto(action, action->act_request, status_vector(action), t_start_auto(action, action->act_request, status_vector(action),
@ -1234,7 +1238,7 @@ static void gen_blob_open( ACT action, USHORT column)
// Callback routine for BLR pretty printer. // Callback routine for BLR pretty printer.
// //
static gen_blr( int *user_arg, int offset, TEXT * string) static int gen_blr( int *user_arg, int offset, TEXT * string)
{ {
int indent, length; int indent, length;
TEXT *p, *q, *p1, *q1, c, d, line[256]; TEXT *p, *q, *p1, *q1, c, d, line[256];
@ -1326,7 +1330,7 @@ static void gen_compatibility_symbol(
TEXT * symbol, TEXT * symbol,
TEXT * v4_prefix, TEXT * trailer) TEXT * v4_prefix, TEXT * trailer)
{ {
TEXT *v3_prefix; const char *v3_prefix;
v3_prefix = (sw_language == lang_cxx) ? "gds_" : "gds__"; v3_prefix = (sw_language == lang_cxx) ? "gds_" : "gds__";
@ -1347,7 +1351,7 @@ static void gen_compile( ACT action, int column)
BLB blob; BLB blob;
PAT args; PAT args;
TEXT *pattern1 = TEXT *pattern1 =
"isc_compile_request%IF2%EN (%V1, &%DH, &%RH, (short) sizeof (%RI), (char ISC_FAR *) %RI);", "isc_compile_request%IF2%EN (%V1, (void**) &%DH, (void**) &%RH, (short) sizeof (%RI), (char ISC_FAR *) %RI);",
*pattern2 = "if (!%RH%IF && %S1%EN)"; *pattern2 = "if (!%RH%IF && %S1%EN)";
args.pat_request = request = action->act_request; args.pat_request = request = action->act_request;
@ -1435,7 +1439,7 @@ static void gen_create_database( ACT action, int column)
if (request->req_flags & REQ_extend_dpb) { if (request->req_flags & REQ_extend_dpb) {
if (request->req_length) if (request->req_length)
printa(column, "if (%s != isc_%d)", s2, request->req_ident); printa(column, "if (%s != isc_%d)", s2, request->req_ident);
printa(column + (request->req_length ? INDENT : 0), "isc_free (%s);", printa(column + (request->req_length ? INDENT : 0), "isc_free ((char*) %s);",
s2); s2);
/* reset the length of the dpb */ /* reset the length of the dpb */
@ -1448,7 +1452,7 @@ static void gen_create_database( ACT action, int column)
column += INDENT; column += INDENT;
BEGIN; BEGIN;
printa(column, printa(column,
"isc_start_transaction (%s, &%s, (short) 1, &%s, (short) 0, (char*) 0);", "isc_start_transaction (%s, (void**) &%s, (short) 1, &%s, (short) 0, (char*) 0);",
status_vector(action), trname, db->dbb_name->sym_string); status_vector(action), trname, db->dbb_name->sym_string);
printa(column, "if (%s)", trname); printa(column, "if (%s)", trname);
column += INDENT; column += INDENT;
@ -1459,10 +1463,10 @@ static void gen_create_database( ACT action, int column)
trname, request->req_length, request->req_ident); trname, request->req_length, request->req_ident);
column -= INDENT; column -= INDENT;
printa(column, "if (!%s [1])", status_name); printa(column, "if (!%s [1])", status_name);
printa(column + INDENT, "isc_commit_transaction (%s, &%s);", printa(column + INDENT, "isc_commit_transaction (%s, (void**) &%s);",
status_vector(action), trname); status_vector(action), trname);
printa(column, "if (%s [1])", status_name); printa(column, "if (%s [1])", status_name);
printa(column + INDENT, "isc_rollback_transaction (%s, &%s);", printa(column + INDENT, "isc_rollback_transaction (%s, (void**) &%s);",
status_vector(NULL), trname); status_vector(NULL), trname);
SET_SQLCODE; SET_SQLCODE;
END; END;
@ -1477,7 +1481,7 @@ static void gen_create_database( ACT action, int column)
// Generate substitution text for END_STREAM. // Generate substitution text for END_STREAM.
// //
static gen_cursor_close( ACT action, REQ request, int column) static int gen_cursor_close( ACT action, REQ request, int column)
{ {
PAT args; PAT args;
TEXT *pattern1 = TEXT *pattern1 =
@ -1521,7 +1525,7 @@ static void gen_cursor_init( ACT action, int column)
// Generate text to open an embedded SQL cursor. // Generate text to open an embedded SQL cursor.
// //
static gen_cursor_open( ACT action, REQ request, int column) static int gen_cursor_open( ACT action, REQ request, int column)
{ {
PAT args; PAT args;
TEXT s[64]; TEXT s[64];
@ -1770,10 +1774,10 @@ static void gen_ddl( ACT action, int column)
if (sw_auto) { if (sw_auto) {
column -= INDENT; column -= INDENT;
printa(column, "if (!%s [1])", status_name); printa(column, "if (!%s [1])", status_name);
printa(column + INDENT, "isc_commit_transaction (%s, &%s);", printa(column + INDENT, "isc_commit_transaction (%s, (void**) &%s);",
status_vector(action), transaction_name); status_vector(action), transaction_name);
printa(column, "if (%s [1])", status_name); printa(column, "if (%s [1])", status_name);
printa(column + INDENT, "isc_rollback_transaction (%s, &%s);", printa(column + INDENT, "isc_rollback_transaction (%s, (void**) &%s);",
status_vector(NULL), transaction_name); status_vector(NULL), transaction_name);
} }
@ -2129,7 +2133,7 @@ static void gen_emodify( ACT action, int column)
ib_fprintf(out_file, "%s = %s;", s2, s1); ib_fprintf(out_file, "%s = %s;", s2, s1);
#if (! (defined JPN_SJIS || defined JPN_EUC) ) #if (! (defined JPN_SJIS || defined JPN_EUC) )
else if (sw_cstring && !field->fld_sub_type) else if (sw_cstring && !field->fld_sub_type)
ib_fprintf(out_file, "isc_vtov (%s, %s, %d);", ib_fprintf(out_file, "isc_vtov ((char*)%s, (char*)%s, %d);",
s1, s2, field->fld_length); s1, s2, field->fld_length);
else else
ib_fprintf(out_file, "isc_ftof (%s, %d, %s, %d);", ib_fprintf(out_file, "isc_ftof (%s, %d, %s, %d);",
@ -2499,15 +2503,15 @@ static void gen_finish( ACT action, int column)
RDY ready; RDY ready;
PAT args; PAT args;
TEXT *pattern1 = "if (%S2)\n\ TEXT *pattern1 = "if (%S2)\n\
isc_%S1_transaction (%V1, &%S2);"; isc_%S1_transaction (%V1, (void**) &%S2);";
args.pat_vector1 = status_vector(action); args.pat_vector1 = status_vector(action);
args.pat_string2 = transaction_name; args.pat_string2 = transaction_name;
if (sw_auto || ((action->act_flags & ACT_sql) && if (sw_auto || ((action->act_flags & ACT_sql) &&
(action->act_type != ACT_disconnect))) { (action->act_type != ACT_disconnect))) {
args.pat_string1 = args.pat_string1 = (TEXT*)
(action->act_type != ACT_rfinish) ? "commit" : "rollback"; ((action->act_type != ACT_rfinish) ? "commit" : "rollback");
PATTERN_expand((USHORT) column, pattern1, &args); PATTERN_expand((USHORT) column, pattern1, &args);
} }
@ -2590,7 +2594,8 @@ static void gen_form_display( ACT action, int column)
REF reference, master; REF reference, master;
POR port; POR port;
DBB dbb; DBB dbb;
TEXT s[32], *status, out[16]; TEXT s[32], out[16];
const char *status;
int code; int code;
display = (FINT) action->act_object; display = (FINT) action->act_object;
@ -2643,7 +2648,7 @@ static void gen_form_for( ACT action, int column)
{ {
REQ request; REQ request;
FORM form; FORM form;
TEXT *status; const char *status;
DBB dbb; DBB dbb;
column += INDENT; column += INDENT;
@ -2909,7 +2914,8 @@ static void gen_item_end( ACT action, int column)
REF reference, master; REF reference, master;
POR port; POR port;
DBB dbb; DBB dbb;
TEXT s[32], *status; TEXT s[32];
const char *status;
request = action->act_request; request = action->act_request;
if (request->req_type == REQ_menu) { if (request->req_type == REQ_menu) {
@ -3519,7 +3525,7 @@ static void gen_receive( ACT action, int column, POR port)
{ {
PAT args; PAT args;
TEXT *pattern = TEXT *pattern =
"isc_receive (%V1, &%RH, (short) %PN, (short) %PL, &%PI, (short) %RL);"; "isc_receive (%V1, (void**) &%RH, (short) %PN, (short) %PL, &%PI, (short) %RL);";
args.pat_request = action->act_request; args.pat_request = action->act_request;
args.pat_vector1 = status_vector(action); args.pat_vector1 = status_vector(action);
@ -3977,7 +3983,7 @@ static void gen_send( ACT action, POR port, int column)
{ {
PAT args; PAT args;
TEXT *pattern = TEXT *pattern =
"isc_send (%V1, &%RH, (short) %PN, (short) %PL, &%PI, (short) %RL);"; "isc_send (%V1, (void**) &%RH, (short) %PN, (short) %PL, &%PI, (short) %RL);";
args.pat_request = action->act_request; args.pat_request = action->act_request;
args.pat_vector1 = status_vector(action); args.pat_vector1 = status_vector(action);
@ -4072,8 +4078,8 @@ static void gen_start( ACT action, POR port, int column, BOOLEAN sending)
{ {
PAT args; PAT args;
TEXT *pattern1 = TEXT *pattern1 =
"isc_start_and_send (%V1, &%RH, &%S1, (short) %PN, (short) %PL, &%PI, (short) %RL);"; "isc_start_and_send (%V1, (void**) &%RH, (void**) &%S1, (short) %PN, (short) %PL, &%PI, (short) %RL);";
TEXT *pattern2 = "isc_start_request (%V1, &%RH, &%S1, (short) %RL);"; TEXT *pattern2 = "isc_start_request (%V1, (void**) &%RH, (void**) &%S1, (short) %RL);";
REF reference; REF reference;
if (port && sending) { if (port && sending) {
@ -4165,7 +4171,7 @@ static void gen_t_start( ACT action, int column)
} }
} }
printa(column, "isc_start_transaction (%s, &%s, (short) %d", printa(column, "isc_start_transaction (%s, (void**) &%s, (short) %d",
vector, vector,
(trans->tra_handle) ? trans->tra_handle : transaction_name, (trans->tra_handle) ? trans->tra_handle : transaction_name,
trans->tra_db_count); trans->tra_db_count);
@ -4251,13 +4257,13 @@ static void gen_trans( ACT action, int column)
{ {
if (action->act_type == ACT_commit_retain_context) if (action->act_type == ACT_commit_retain_context)
printa(column, "isc_commit_retaining (%s, &%s);", printa(column, "isc_commit_retaining (%s, (void**) &%s);",
status_vector(action), status_vector(action),
(action->act_object) ? (TEXT *) (action-> (action->act_object) ? (TEXT *) (action->
act_object) : act_object) :
transaction_name); transaction_name);
else else
printa(column, "isc_%s_transaction (%s, &%s);", printa(column, "isc_%s_transaction (%s, (void**) &%s);",
(action->act_type == (action->act_type ==
ACT_commit) ? "commit" : (action->act_type == ACT_commit) ? "commit" : (action->act_type ==
ACT_rollback) ? "rollback" : ACT_rollback) ? "rollback" :
@ -4688,7 +4694,7 @@ static void make_ready(
if (request && request->req_flags & REQ_extend_dpb) { if (request && request->req_flags & REQ_extend_dpb) {
if (request->req_length) if (request->req_length)
printa(column, "if (%s != isc_%d)", s2, request->req_ident); printa(column, "if (%s != isc_%d)", s2, request->req_ident);
printa(column + (request->req_length ? INDENT : 0), "isc_free (%s);", printa(column + (request->req_length ? INDENT : 0), "isc_free ((char*) %s);",
s2); s2);
/* reset the length of the dpb */ /* reset the length of the dpb */
@ -4703,7 +4709,7 @@ static void make_ready(
// Print a fixed string at a particular column. // Print a fixed string at a particular column.
// //
static void printa( int column, TEXT * string, ...) static void printa( int column, const char * string, ...)
{ {
va_list ptr; va_list ptr;
@ -4815,7 +4821,7 @@ static void t_start_auto(
else else
for (count = 0, db = isc_databases; db; db = db->dbb_next, count++); for (count = 0, db = isc_databases; db; db = db->dbb_next, count++);
printa(column, "isc_start_transaction (%s, &%s, (short) %d", printa(column, "isc_start_transaction (%s, (void**) &%s, (short) %d",
vector, trname, count); vector, trname, count);
// Some systems don't like infinitely long lines. Limit them to 256. // Some systems don't like infinitely long lines. Limit them to 256.

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: cmd.cpp,v 1.1.1.1 2001-05-23 13:25:29 tamlin Exp $ // $Id: cmd.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include <string.h> #include <string.h>
@ -110,6 +110,7 @@ static void set_statistics(REQ, ACT);
// numbers, and internal idents. Compute length of request. // numbers, and internal idents. Compute length of request.
// //
int
CMD_compile_ddl(register REQ request) CMD_compile_ddl(register REQ request)
{ {
ACT action; ACT action;

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: cmp.cpp,v 1.1.1.1 2001-05-23 13:25:30 tamlin Exp $ // $Id: cmp.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include <stdlib.h> #include <stdlib.h>
@ -329,6 +329,7 @@ void CMP_compile_request( register REQ request)
// override of the field, -1 is returned. // override of the field, -1 is returned.
// //
int
CMP_display_code(FINT display, REF reference) CMP_display_code(FINT display, REF reference)
{ {
int code; int code;

File diff suppressed because it is too large Load Diff

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: exp.cpp,v 1.1.1.1 2001-05-23 13:25:30 tamlin Exp $ // $Id: exp.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include <stdlib.h> #include <stdlib.h>
@ -406,7 +406,7 @@ void EXP_left_paren( TEXT * string)
{ {
if (!MATCH(KW_LEFT_PAREN)) if (!MATCH(KW_LEFT_PAREN))
SYNTAX_ERROR((string) ? string : "left parenthesis"); SYNTAX_ERROR((string) ? string : (char*)"left parenthesis");
} }

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: form.cpp,v 1.1.1.1 2001-05-23 13:25:31 tamlin Exp $ // $Id: form.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// Revision 1.2 2000/11/27 09:26:13 fsg // Revision 1.2 2000/11/27 09:26:13 fsg
// Fixed bugs in gpre to handle PYXIS forms // Fixed bugs in gpre to handle PYXIS forms
// and allow edit.e and fred.e to go through // and allow edit.e and fred.e to go through
@ -35,7 +35,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: form.cpp,v 1.1.1.1 2001-05-23 13:25:31 tamlin Exp $ // $Id: form.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include "../gpre/gpre.h" #include "../gpre/gpre.h"
@ -48,7 +48,10 @@
typedef int *HANDLE; typedef int *HANDLE;
extern HANDLE PYXIS_find_field(), PYXIS_get_attribute_value(); extern "C" HANDLE PYXIS_find_field(HANDLE , TEXT *);
extern "C" HANDLE PYXIS_get_attribute_value(HANDLE , ATT_N );
extern int pyxis__load_form(STATUS *, SLONG *, SLONG *, SLONG *, SSHORT *,
SCHAR *);
extern USHORT sw_cstring; extern USHORT sw_cstring;
@ -74,13 +77,13 @@ FLD FORM_lookup_field( FORM form, HANDLE object, char *string)
for (field = form->form_fields; field; field = field->fld_next) { for (field = form->form_fields; field; field = field->fld_next) {
symbol = field->fld_symbol; symbol = field->fld_symbol;
if (!strcmp(name, symbol->sym_string)) if (!strcmp((char*)name, symbol->sym_string))
return field; return field;
} }
// Haven't seen it before -- look it up on form // Haven't seen it before -- look it up on form
if (!(handle = PYXIS_find_field(object, name))) if (!(handle = PYXIS_find_field(object, (TEXT*) name)))
return NULL; return NULL;
// Make field block and decrypt data type // Make field block and decrypt data type
@ -88,7 +91,7 @@ FLD FORM_lookup_field( FORM form, HANDLE object, char *string)
field->fld_next = form->form_fields; field->fld_next = form->form_fields;
form->form_fields = field; form->form_fields = field;
field->fld_handle = handle; field->fld_handle = handle;
field->fld_prototype = GET_VALUE(handle, att_prototype); field->fld_prototype = (int*) GET_VALUE(handle, att_prototype);
field->fld_dtype = FORM_TRN_dtype((USHORT) GET_VALUE(handle, att_dtype)); field->fld_dtype = FORM_TRN_dtype((USHORT) GET_VALUE(handle, att_dtype));
field->fld_length = (int) GET_VALUE(handle, att_length); field->fld_length = (int) GET_VALUE(handle, att_length);
field->fld_scale = (int) GET_VALUE(handle, att_scale); field->fld_scale = (int) GET_VALUE(handle, att_scale);
@ -109,7 +112,7 @@ FLD FORM_lookup_field( FORM form, HANDLE object, char *string)
// Make up symbol block // Make up symbol block
l = p - name; l = p - name;
field->fld_symbol = symbol = MSC_symbol(SYM_form_field, name, l, 0); field->fld_symbol = symbol = MSC_symbol(SYM_form_field, (TEXT*) name, l, 0);
return field; return field;
} }
@ -138,7 +141,7 @@ FORM FORM_lookup_form(DBB dbb, UCHAR * string)
l = p - name; l = p - name;
for (symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym) for (symbol = HSH_lookup((SCHAR*) name); symbol; symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_form && if (symbol->sym_type == SYM_form &&
(form = (FORM) symbol->sym_object) && form->form_dbb == dbb) (form = (FORM) symbol->sym_object) && form->form_dbb == dbb)
return form; return form;
@ -147,8 +150,8 @@ FORM FORM_lookup_form(DBB dbb, UCHAR * string)
form = (FORM) ALLOC(sizeof(struct form)); form = (FORM) ALLOC(sizeof(struct form));
pyxis__load_form(status, pyxis__load_form(status,
&dbb->dbb_handle, &dbb->dbb_transaction, (SLONG*)&dbb->dbb_handle, (SLONG*)&dbb->dbb_transaction,
&form->form_object, 0, name); (SLONG*)&form->form_object, 0, (SCHAR*)name);
if (!form->form_object) if (!form->form_object)
return NULL; return NULL;
@ -159,7 +162,7 @@ FORM FORM_lookup_form(DBB dbb, UCHAR * string)
// Make up form block, etc // Make up form block, etc
form->form_name = symbol = MSC_symbol(SYM_form, name, l, (CTX) form); form->form_name = symbol = MSC_symbol(SYM_form, (TEXT*) name, l, (CTX) form);
HSH_insert(symbol); HSH_insert(symbol);
return form; return form;

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: gpre.cpp,v 1.2 2001-05-24 14:54:26 tamlin Exp $ // $Id: gpre.cpp,v 1.3 2001-07-12 05:46:04 bellardo Exp $
// Revision 1.2 2000/11/16 15:54:29 fsg // Revision 1.2 2000/11/16 15:54:29 fsg
// Added new switch -verbose to gpre that will dump // Added new switch -verbose to gpre that will dump
// parsed lines to stderr // parsed lines to stderr
@ -38,7 +38,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: gpre.cpp,v 1.2 2001-05-24 14:54:26 tamlin Exp $ // $Id: gpre.cpp,v 1.3 2001-07-12 05:46:04 bellardo Exp $
// //
#define GPRE_MAIN #define GPRE_MAIN
@ -60,6 +60,10 @@
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
#include "../gpre/gpreswi.h" #include "../gpre/gpreswi.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef VMS #ifdef VMS
#include <descrip.h> #include <descrip.h>
extern "C" { extern "C" {
@ -647,6 +651,32 @@ int main(int argc, char* argv[])
sw_interp = ttype_metadata; sw_interp = ttype_metadata;
break; break;
case IN_SW_GPRE_GXX:
/* When we get executed here the IN_SW_GPRE_G case
* has already been executed. So we just set the
* gen_routine to point to the C++ action, and be
* done with it.
*/
gen_routine = INT_CXX_action;
break;
case IN_SW_GPRE_LANG_INTERNAL:
/* We need to reset all the variables (except sw_language) to the
* default values because the IN_SW_GPRE_G case was already
* executed in the for the very first switch.
**/
sw_language = lang_internal;
gen_routine = C_CXX_action;
sw_cstring = TRUE;
transaction_name = "gds__trans";
sw_know_interp = FALSE;
sw_interp = 0;
ident_pattern = "isc_%d";
utility_name = "isc_utility";
count_name = "isc_count";
slack_name = "isc_slack";
break;
case IN_SW_GPRE_I: case IN_SW_GPRE_I:
sw_ids = TRUE; sw_ids = TRUE;
break; break;
@ -1285,7 +1315,7 @@ static BOOLEAN all_digits(char *str1)
// If there is a problem, explain and return. // If there is a problem, explain and return.
// //
static arg_is_string( SLONG argc, TEXT ** argvstring, TEXT * errstring) static int arg_is_string( SLONG argc, TEXT ** argvstring, TEXT * errstring)
{ {
TEXT *str; TEXT *str;
@ -1609,7 +1639,7 @@ static void finish_based( ACT action)
// Return a character to the input stream. // Return a character to the input stream.
// //
static get_char( IB_FILE * file) static int get_char( IB_FILE * file)
{ {
if (input_char != input_buffer) { if (input_char != input_buffer) {
return (int) *--input_char; return (int) *--input_char;
@ -1745,6 +1775,17 @@ static BOOLEAN get_switches(int argc,
sw_tab--; sw_tab--;
break; break;
case IN_SW_GPRE_GXX:
/* If we decrement sw_tab the switch is removed
* from the table and not processed in the main
* switch statement. Since IN_SW_GPRE_G will always
* be processed for lang_internal, we leave our
* switch in so we can clean up the mess left behind
* by IN_SW_GPRE_G
*/
sw_language = lang_internal;
break;
case IN_SW_GPRE_G: case IN_SW_GPRE_G:
sw_language = lang_internal; sw_language = lang_internal;
sw_tab--; sw_tab--;
@ -1780,6 +1821,11 @@ static BOOLEAN get_switches(int argc,
sw_tab--; sw_tab--;
break; break;
case IN_SW_GPRE_LANG_INTERNAL :
sw_language = lang_internal;
/*sw_tab--;*/
break;
case IN_SW_GPRE_D: case IN_SW_GPRE_D:
if (!arg_is_string if (!arg_is_string
(--argc, argv, (--argc, argv,
@ -2299,7 +2345,7 @@ static TOK get_token()
// Also, for Fortran, mark the beginning of a statement // Also, for Fortran, mark the beginning of a statement
// //
static nextchar() static int nextchar()
{ {
SSHORT c; SSHORT c;

View File

@ -25,7 +25,7 @@
#define GPRE_GPRE_META_H #define GPRE_GPRE_META_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { //extern "C" {
#endif #endif
extern FLD MET_context_field(CTX, char *); extern FLD MET_context_field(CTX, char *);
@ -53,7 +53,7 @@ extern BOOLEAN MET_type(FLD, TEXT *, SSHORT *);
extern BOOLEAN MET_trigger_exists(DBB, TEXT *); extern BOOLEAN MET_trigger_exists(DBB, TEXT *);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ //} /* extern "C" */
#endif #endif
#endif /* GPRE_GPRE_META_H */ #endif /* GPRE_GPRE_META_H */

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: gpreswi.h,v 1.1.1.1 2001-05-23 13:25:31 tamlin Exp $ * $Id: gpreswi.h,v 1.2 2001-07-12 05:46:04 bellardo Exp $
* Revision 1.2 2000/11/16 15:54:29 fsg * Revision 1.2 2000/11/16 15:54:29 fsg
* Added new switch -verbose to gpre that will dump * Added new switch -verbose to gpre that will dump
* parsed lines to stderr * parsed lines to stderr
@ -51,6 +51,7 @@ enum gpre_cmd_switch
IN_SW_GPRE_E, /* accept either case */ IN_SW_GPRE_E, /* accept either case */
IN_SW_GPRE_F, /* source is FORTRAN */ IN_SW_GPRE_F, /* source is FORTRAN */
IN_SW_GPRE_G, /* internal GDS module */ IN_SW_GPRE_G, /* internal GDS module */
IN_SW_GPRE_GXX, /* internal GDS C++ module */
IN_SW_GPRE_I, /* use ID's rather than names */ IN_SW_GPRE_I, /* use ID's rather than names */
IN_SW_GPRE_M, /* don't generate READY/START_TRANS */ IN_SW_GPRE_M, /* don't generate READY/START_TRANS */
IN_SW_GPRE_N, /* don't generate debug lines */ IN_SW_GPRE_N, /* don't generate debug lines */
@ -84,6 +85,12 @@ enum gpre_cmd_switch
*/ */
IN_SW_GPRE_VERBOSE, IN_SW_GPRE_VERBOSE,
/* Added this to allow boot version of gpre to only resolve queries
* against internal metadata
*/
IN_SW_GPRE_LANG_INTERNAL,
/* As mentioned above: This should always be one larger than the largest /* As mentioned above: This should always be one larger than the largest
switch value. switch value.
FSG 14.Nov.2000 FSG 14.Nov.2000
@ -125,10 +132,12 @@ static struct in_sw_tab_t gpre_in_sw_table[] =
IN_SW_GPRE_F , 0, "FORTRAN" , 0, 0, 0, FALSE, 0, 0, "\t\textended FORTRAN program", IN_SW_GPRE_F , 0, "FORTRAN" , 0, 0, 0, FALSE, 0, 0, "\t\textended FORTRAN program",
#endif #endif
IN_SW_GPRE_G , 0, "GDS" , 0, 0, 0, FALSE, 0, 0, NULL, IN_SW_GPRE_G , 0, "GDS" , 0, 0, 0, FALSE, 0, 0, NULL,
IN_SW_GPRE_GXX , 0, "GDS_CXX" , 0, 0, 0, FALSE, 0, 0, NULL,
IN_SW_GPRE_I , 0, "IDENTIFIERS" , 0, 0, 0, FALSE, 0, 0, NULL, IN_SW_GPRE_I , 0, "IDENTIFIERS" , 0, 0, 0, FALSE, 0, 0, NULL,
IN_SW_GPRE_I , 0, "IDS" , 0, 0, 0, FALSE, 0, 0, NULL, IN_SW_GPRE_I , 0, "IDS" , 0, 0, 0, FALSE, 0, 0, NULL,
IN_SW_GPRE_INTERP , 0, "CHARSET" , 0, 0, 0, FALSE, 0, 0, "\t\tDefault character set & format", IN_SW_GPRE_INTERP , 0, "CHARSET" , 0, 0, 0, FALSE, 0, 0, "\t\tDefault character set & format",
IN_SW_GPRE_INTERP , 0, "INTERPRETATION",0, 0, 0, FALSE, 0, 0, NULL, IN_SW_GPRE_INTERP , 0, "INTERPRETATION",0, 0, 0, FALSE, 0, 0, NULL,
IN_SW_GPRE_LANG_INTERNAL , 0, "LANG_INTERNAL" , 0, 0, 0, FALSE, 0, 0, "\tinternal language only",
IN_SW_GPRE_M , 0, "MANUAL" , 0, 0, 0, FALSE, 0, 0, "\t\tdo not automatically ATTACH to a database", IN_SW_GPRE_M , 0, "MANUAL" , 0, 0, 0, FALSE, 0, 0, "\t\tdo not automatically ATTACH to a database",
IN_SW_GPRE_N , 0, "NO_LINES" , 0, 0, 0, FALSE, 0, 0, "\tdo not generate C debug lines", IN_SW_GPRE_N , 0, "NO_LINES" , 0, 0, 0, FALSE, 0, 0, "\tdo not generate C debug lines",
IN_SW_GPRE_O , 0, "OUTPUT" , 0, 0, 0, FALSE, 0, 0, "\t\tsend output to standard out", IN_SW_GPRE_O , 0, "OUTPUT" , 0, 0, 0, FALSE, 0, 0, "\t\tsend output to standard out",

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: hsh.cpp,v 1.1.1.1 2001-05-23 13:25:31 tamlin Exp $ // $Id: hsh.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include "../gpre/gpre.h" #include "../gpre/gpre.h"
@ -227,7 +227,7 @@ void HSH_remove( register SYM symbol)
// Returns the hash function of a string. // Returns the hash function of a string.
// //
static hash( register SCHAR * string) static int hash( register SCHAR * string)
{ {
register SLONG value; register SLONG value;
SCHAR c; SCHAR c;

View File

@ -39,6 +39,7 @@ extern void FTN_action(ACT, int);
extern void FTN_fini(void); extern void FTN_fini(void);
extern void FTN_print_buffer(TEXT *); extern void FTN_print_buffer(TEXT *);
extern void INT_action(ACT, int); extern void INT_action(ACT, int);
extern void INT_CXX_action(ACT, int);
extern void PAS_action(ACT, int); extern void PAS_action(ACT, int);
extern int PLI_action(ACT, int); extern int PLI_action(ACT, int);

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: par.cpp,v 1.1.1.1 2001-05-23 13:25:29 tamlin Exp $ // $Id: par.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// Revision 1.2 2000/11/27 09:26:13 fsg // Revision 1.2 2000/11/27 09:26:13 fsg
// Fixed bugs in gpre to handle PYXIS forms // Fixed bugs in gpre to handle PYXIS forms
// and allow edit.e and fred.e to go through // and allow edit.e and fred.e to go through
@ -37,7 +37,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: par.cpp,v 1.1.1.1 2001-05-23 13:25:29 tamlin Exp $ // $Id: par.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include <setjmp.h> #include <setjmp.h>
@ -2522,11 +2522,11 @@ static ACT par_form_for()
if (!MATCH(KW_DOT)) if (!MATCH(KW_DOT))
SYNTAX_ERROR("."); SYNTAX_ERROR(".");
dbb = (DBB) dbb_symbol->sym_object; dbb = (DBB) dbb_symbol->sym_object;
form = FORM_lookup_form(dbb, token.tok_string); form = FORM_lookup_form(dbb, (UCHAR*)token.tok_string);
} }
else else
for (dbb = isc_databases; dbb; dbb = dbb->dbb_next) for (dbb = isc_databases; dbb; dbb = dbb->dbb_next)
if ((form = FORM_lookup_form(dbb, token.tok_string))) if ((form = FORM_lookup_form(dbb, (UCHAR*)token.tok_string)))
break; break;
// Pick up form // Pick up form

View File

@ -30,6 +30,8 @@ typedef enum kwwords {
KW_max KW_max
} KWWORDS; } KWWORDS;
#include "../gpre/gpre.h"
#define MATCH(keyword) MSC_match(keyword) #define MATCH(keyword) MSC_match(keyword)
#define KEYWORD(kw) ((int) token.tok_keyword == (int) kw) #define KEYWORD(kw) ((int) token.tok_keyword == (int) kw)
#define ADVANCE_TOKEN PAR_get_token () #define ADVANCE_TOKEN PAR_get_token ()

View File

@ -67,7 +67,7 @@ Substitution codes:
*/ */
typedef struct pat { struct pat {
DBB pat_database; DBB pat_database;
REQ pat_request; REQ pat_request;
TRA pat_transaction; TRA pat_transaction;
@ -93,6 +93,8 @@ typedef struct pat {
SLONG pat_long2; SLONG pat_long2;
BOOLEAN pat_condition; BOOLEAN pat_condition;
REF pat_reference; REF pat_reference;
} PAT; };
typedef pat PAT;
#endif /* _GPRE_PAT_H_ */ #endif /* _GPRE_PAT_H_ */

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: pretty.cpp,v 1.1.1.1 2001-05-23 13:25:32 tamlin Exp $ // $Id: pretty.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
// //
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
@ -237,6 +237,7 @@ int PRETTY_print_dyn(
} }
int
PRETTY_print_form_map(SCHAR * blr, PRETTY_print_form_map(SCHAR * blr,
//____________________________________________________________ //____________________________________________________________
// //
@ -346,6 +347,7 @@ int PRETTY_print_mblr(
} }
int
PRETTY_print_menu(SCHAR * blr, PRETTY_print_menu(SCHAR * blr,
//____________________________________________________________ //____________________________________________________________
// //
@ -416,6 +418,7 @@ PRETTY_print_menu(SCHAR * blr,
} }
int
PRETTY_print_sdl(SCHAR * blr, PRETTY_print_sdl(SCHAR * blr,
//____________________________________________________________ //____________________________________________________________
// //
@ -520,7 +523,7 @@ static int indent( CTL control, SSHORT level)
// data described. // data described.
// //
static print_blr_dtype( CTL control, BOOLEAN print_object) static int print_blr_dtype( CTL control, BOOLEAN print_object)
{ {
unsigned short dtype; unsigned short dtype;
SCHAR *string; SCHAR *string;
@ -993,7 +996,7 @@ static SLONG print_long( CTL control, SSHORT offset)
// Primary recursive routine to print slice description language. // Primary recursive routine to print slice description language.
// //
static print_sdl_verb( CTL control, SSHORT level) static int print_sdl_verb( CTL control, SSHORT level)
{ {
int offset, n; int offset, n;
const char *p; const char *p;
@ -1119,7 +1122,7 @@ static int print_string( CTL control, SSHORT offset)
// Print a VAX word as a numeric value an return same. // Print a VAX word as a numeric value an return same.
// //
static print_word( CTL control, SSHORT offset) static int print_word( CTL control, SSHORT offset)
{ {
UCHAR v1, v2; UCHAR v1, v2;

View File

@ -1,7 +1,7 @@
#ifndef INCLUDE_JRD_GDS_H #ifndef INCLUDE_JRD_GDS_H
#define INCLUDE_JRD_GDS_H #define INCLUDE_JRD_GDS_H
#include "../../jrd/ibase.h" #include "../jrd/ibase.h"
#include "../../jrd/gdsold.h" #include "../jrd/gdsold.h"
#endif #endif

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: isql.h,v 1.1.1.1 2001-05-23 13:26:02 tamlin Exp $ * $Id: isql.h,v 1.2 2001-07-12 05:46:04 bellardo Exp $
* Revision 1.2 2000/11/18 16:49:24 fsg * Revision 1.2 2000/11/18 16:49:24 fsg
* Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans * Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans
* Fixed Bug #122563 in extract.e get_procedure_args * Fixed Bug #122563 in extract.e get_procedure_args
@ -352,7 +352,7 @@ typedef struct sqltypes {
#endif #endif
#else #else
#ifndef ISQL_FREE #ifndef ISQL_FREE
#define ISQL_FREE(x) {isc_free (x); x = NULL;} #define ISQL_FREE(x) {isc_free ((char*) x); x = NULL;}
#endif #endif
#endif /* GUI_TOOLS */ #endif /* GUI_TOOLS */

View File

@ -58,6 +58,10 @@
#include "../wal/walc_proto.h" #include "../wal/walc_proto.h"
#include "../wal/walf_proto.h" #include "../wal/walf_proto.h"
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
extern "C" { extern "C" {

View File

@ -893,6 +893,9 @@ int API_ROUTINE isc_add_user(STATUS * status, USER_SEC_DATA * user_data)
* Return > 0 if any error occurs. * Return > 0 if any error occurs.
* *
**************************************/ **************************************/
#ifdef PHASE_1
return 1;
#else
USHORT retval = 0, l; USHORT retval = 0, l;
struct user_data userInfo; struct user_data userInfo;
void *db_handle; void *db_handle;
@ -1030,6 +1033,7 @@ int API_ROUTINE isc_add_user(STATUS * status, USER_SEC_DATA * user_data)
isc_detach_database(user_status, &db_handle); isc_detach_database(user_status, &db_handle);
} }
return status[1]; /* security database not opened */ return status[1]; /* security database not opened */
#endif
} }
int API_ROUTINE isc_blob_load( int API_ROUTINE isc_blob_load(
@ -1074,6 +1078,9 @@ int API_ROUTINE isc_delete_user(STATUS * status, USER_SEC_DATA * user_data)
* Return > 0 if any error occurs. * Return > 0 if any error occurs.
* *
**************************************/ **************************************/
#ifdef PHASE_1
return 1;
#else
USHORT retval = 0, l; USHORT retval = 0, l;
void *db_handle; void *db_handle;
struct user_data userInfo; struct user_data userInfo;
@ -1117,6 +1124,7 @@ int API_ROUTINE isc_delete_user(STATUS * status, USER_SEC_DATA * user_data)
isc_detach_database(user_status, &db_handle); isc_detach_database(user_status, &db_handle);
} }
return status[1]; /* security database not opened */ return status[1]; /* security database not opened */
#endif
} }
int API_ROUTINE isc_modify_user(STATUS * status, USER_SEC_DATA * user_data) int API_ROUTINE isc_modify_user(STATUS * status, USER_SEC_DATA * user_data)
@ -1135,6 +1143,9 @@ int API_ROUTINE isc_modify_user(STATUS * status, USER_SEC_DATA * user_data)
* Return > 0 if any error occurs. * Return > 0 if any error occurs.
* *
**************************************/ **************************************/
#ifdef PHASE_1
return 1;
#else
USHORT retval = 0, l; USHORT retval = 0, l;
struct user_data userInfo; struct user_data userInfo;
void *db_handle; void *db_handle;
@ -1268,6 +1279,7 @@ int API_ROUTINE isc_modify_user(STATUS * status, USER_SEC_DATA * user_data)
isc_detach_database(user_status, &db_handle); isc_detach_database(user_status, &db_handle);
} }
return status[1]; /* security database not opened */ return status[1]; /* security database not opened */
#endif
} }
void *open_security_db( void *open_security_db(
@ -1288,6 +1300,9 @@ void *open_security_db(
* Returns NULL otherwise * Returns NULL otherwise
* *
**************************************/ **************************************/
#ifdef PHASE_1
return 0;
#else
short dpb_length, l = 0; short dpb_length, l = 0;
char dpb_buffer[256], *dpb, *p; char dpb_buffer[256], *dpb, *p;
TEXT default_security_db[512], connect_string[1024], *database; TEXT default_security_db[512], connect_string[1024], *database;
@ -1355,6 +1370,7 @@ void *open_security_db(
NULL; NULL;
return db_handle; return db_handle;
#endif
} }
void get_security_error(STATUS * status, int gsec_err) void get_security_error(STATUS * status, int gsec_err)

View File

@ -24,7 +24,7 @@
* readonly databases. * readonly databases.
*/ */
/* /*
$Id: blb.cpp,v 1.2 2001-07-10 17:35:13 awharrison Exp $ $Id: blb.cpp,v 1.3 2001-07-12 05:46:04 bellardo Exp $
*/ */
#include <string.h> #include <string.h>
@ -198,8 +198,8 @@ BLB BLB_create2(TDBB tdbb,
type = gds__parse_bpb2(bpb_length, type = gds__parse_bpb2(bpb_length,
bpb, bpb,
reinterpret_cast < USHORT * >(&from), reinterpret_cast < SSHORT * >(&from),
reinterpret_cast < USHORT * >(&to), reinterpret_cast < SSHORT * >(&to),
reinterpret_cast < USHORT * >(&from_charset), reinterpret_cast < USHORT * >(&from_charset),
reinterpret_cast < USHORT * >(&to_charset)); reinterpret_cast < USHORT * >(&to_charset));
blob = allocate_blob(tdbb, transaction); blob = allocate_blob(tdbb, transaction);
@ -224,7 +224,7 @@ BLB BLB_create2(TDBB tdbb,
if ((to_charset != CS_NONE) && (from_charset != to_charset)) { if ((to_charset != CS_NONE) && (from_charset != to_charset)) {
filter = (BLF) ALLOCP(type_blf); filter = (BLF) ALLOCP(type_blf);
filter->blf_filter = filter->blf_filter =
reinterpret_cast < long (*) () > (filter_transliterate_text); reinterpret_cast < STATUS (*) (USHORT, CTL) > (filter_transliterate_text);
filter_required = TRUE; filter_required = TRUE;
} }
} }
@ -995,8 +995,8 @@ BLB BLB_open2(TDBB tdbb,
gds__parse_bpb2(bpb_length, gds__parse_bpb2(bpb_length,
bpb, bpb,
reinterpret_cast < USHORT * >(&from), reinterpret_cast < SSHORT * >(&from),
reinterpret_cast < USHORT * >(&to), reinterpret_cast < SSHORT * >(&to),
reinterpret_cast < USHORT * >(&from_charset), reinterpret_cast < USHORT * >(&from_charset),
reinterpret_cast < USHORT * >(&to_charset)); reinterpret_cast < USHORT * >(&to_charset));
@ -1024,7 +1024,7 @@ BLB BLB_open2(TDBB tdbb,
if ((to_charset != CS_NONE) && (from_charset != to_charset)) { if ((to_charset != CS_NONE) && (from_charset != to_charset)) {
filter = (BLF) ALLOCP(type_blf); filter = (BLF) ALLOCP(type_blf);
filter->blf_filter = filter->blf_filter =
reinterpret_cast < long (*) () > (filter_transliterate_text); reinterpret_cast < STATUS (*) (USHORT, CTL) > (filter_transliterate_text);
filter_required = TRUE; filter_required = TRUE;
} }
} }
@ -2421,4 +2421,4 @@ static BLB store_array(TDBB tdbb, TRA transaction, BID blob_id)
} }
} // extern "C" } // extern "C"

View File

@ -25,7 +25,7 @@
#define _JRD_BLF_PROTO_H_ #define _JRD_BLF_PROTO_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { //extern "C" {
#endif #endif
extern STATUS DLL_EXPORT BLF_close_blob(TDBB, struct ctl **); extern STATUS DLL_EXPORT BLF_close_blob(TDBB, struct ctl **);
@ -40,7 +40,7 @@ extern STATUS DLL_EXPORT BLF_put_segment(TDBB, struct ctl **, USHORT,
UCHAR *); UCHAR *);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ //} /* extern "C" */
#endif #endif
#endif /* _JRD_BLF_PROTO_H_ */ #endif /* _JRD_BLF_PROTO_H_ */

View File

@ -32,14 +32,14 @@
typedef struct ctl typedef struct ctl
{ {
STATUS (*ctl_source)(); /* Source filter */ STATUS (*ctl_source)(USHORT, struct ctl*); /* Source filter */
struct ctl* ctl_source_handle; /* Argument to pass to source filter */ struct ctl* ctl_source_handle; /* Argument to pass to source filter */
SSHORT ctl_to_sub_type; /* Target type */ SSHORT ctl_to_sub_type; /* Target type */
SSHORT ctl_from_sub_type; /* Source type */ SSHORT ctl_from_sub_type; /* Source type */
USHORT ctl_buffer_length; /* Length of buffer */ USHORT ctl_buffer_length; /* Length of buffer */
USHORT ctl_segment_length; /* Length of current segment */ USHORT ctl_segment_length; /* Length of current segment */
USHORT ctl_bpb_length; /* Length of blob parameter block */ USHORT ctl_bpb_length; /* Length of blob parameter block */
SCHAR* ctl_bpb; /* Address of blob parameter block */ UCHAR* ctl_bpb; /* Address of blob parameter block */
UCHAR* ctl_buffer; /* Address of segment buffer */ UCHAR* ctl_buffer; /* Address of segment buffer */
SLONG ctl_max_segment; /* Length of longest segment */ SLONG ctl_max_segment; /* Length of longest segment */
SLONG ctl_number_segments; /* Total number of segments */ SLONG ctl_number_segments; /* Total number of segments */
@ -50,7 +50,7 @@ typedef struct ctl
UCHAR* ctl_exception_message; /* Message to use in case of filter exception */ UCHAR* ctl_exception_message; /* Message to use in case of filter exception */
} *CTL; } *CTL;
typedef STATUS(*PTR) (); typedef STATUS(*PTR) (USHORT, CTL);
/* Blob filter management */ /* Blob filter management */
@ -60,7 +60,7 @@ typedef struct blf
struct blf* blf_next; /* Next known filter */ struct blf* blf_next; /* Next known filter */
SSHORT blf_from; /* Source sub-type */ SSHORT blf_from; /* Source sub-type */
SSHORT blf_to; /* Target sub-type */ SSHORT blf_to; /* Target sub-type */
STATUS (*blf_filter) (); /* Entrypoint of filter */ PTR blf_filter; /* Entrypoint of filter */
STR blf_exception_message; /* message to be used in case of filter exception */ STR blf_exception_message; /* message to be used in case of filter exception */
} *BLF; } *BLF;

View File

@ -71,7 +71,7 @@ extern "C" {
static BDB alloc_bdb(TDBB, BCB, UCHAR **); static BDB alloc_bdb(TDBB, BCB, UCHAR **);
static void blocking_ast_bdb(BDB); static int blocking_ast_bdb(BDB);
static void btc_flush(TDBB, SLONG, BOOLEAN, STATUS *); static void btc_flush(TDBB, SLONG, BOOLEAN, STATUS *);
static void btc_insert(DBB, BDB); static void btc_insert(DBB, BDB);
static void btc_remove(BDB); static void btc_remove(BDB);
@ -2575,7 +2575,7 @@ static BDB alloc_bdb(TDBB tdbb, BCB bcb, UCHAR ** memory)
#ifndef PAGE_LATCHING #ifndef PAGE_LATCHING
if (!(bdb->bdb_lock = lock = CCH_page_lock(tdbb, ERR_val))) { if (!(bdb->bdb_lock = lock = CCH_page_lock(tdbb, ERR_val))) {
ALL_release(bdb); ALL_release((FRB)bdb);
return 0; return 0;
} }
lock->lck_ast = blocking_ast_bdb; lock->lck_ast = blocking_ast_bdb;
@ -2595,7 +2595,7 @@ static BDB alloc_bdb(TDBB tdbb, BCB bcb, UCHAR ** memory)
#ifndef PAGE_LATCHING #ifndef PAGE_LATCHING
static void blocking_ast_bdb(BDB bdb) static int blocking_ast_bdb(BDB bdb)
{ {
/************************************** /**************************************
* *
@ -3482,7 +3482,7 @@ static BDB dealloc_bdb(BDB bdb)
if (bdb) { if (bdb) {
#ifndef PAGE_LATCHING #ifndef PAGE_LATCHING
if (bdb->bdb_lock) if (bdb->bdb_lock)
ALL_release(bdb->bdb_lock); ALL_release((FRB)bdb->bdb_lock);
#endif #endif
QUE_DELETE(bdb->bdb_que); QUE_DELETE(bdb->bdb_que);
ALL_release(reinterpret_cast < frb * >(bdb)); ALL_release(reinterpret_cast < frb * >(bdb));
@ -5548,4 +5548,4 @@ static void unmark(TDBB tdbb, WIN * window)
} }
} }
} // extern "C" } // extern "C"

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: cmp.cpp,v 1.1.1.1 2001-05-23 13:26:14 tamlin Exp $ $Id: cmp.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $
*/ */
#include "../jrd/ibsetjmp.h" #include "../jrd/ibsetjmp.h"
@ -3683,14 +3683,14 @@ static RSE pass1_rse(
if (boolean) { if (boolean) {
if (rse->rse_boolean) { if (rse->rse_boolean) {
NOD and; NOD additional;
and = PAR_make_node(tdbb, 2); additional = PAR_make_node(tdbb, 2);
and->nod_type = nod_and; additional->nod_type = nod_and;
and->nod_arg[0] = boolean; additional->nod_arg[0] = boolean;
and->nod_arg[1] = additional->nod_arg[1] =
pass1(tdbb, csb, rse->rse_boolean, view, view_stream, FALSE); pass1(tdbb, csb, rse->rse_boolean, view, view_stream, FALSE);
rse->rse_boolean = and; rse->rse_boolean = additional;
} }
else else
rse->rse_boolean = boolean; rse->rse_boolean = boolean;
@ -3791,13 +3791,13 @@ static void pass1_source(
pass1(tdbb, csb, sub_rse->rse_boolean, parent_view, pass1(tdbb, csb, sub_rse->rse_boolean, parent_view,
view_stream, FALSE); view_stream, FALSE);
if (*boolean) { if (*boolean) {
NOD and; NOD additional;
and = PAR_make_node(tdbb, 2); additional = PAR_make_node(tdbb, 2);
and->nod_type = nod_and; additional->nod_type = nod_and;
and->nod_arg[0] = node; additional->nod_arg[0] = node;
and->nod_arg[1] = *boolean; additional->nod_arg[1] = *boolean;
*boolean = and; *boolean = additional;
} }
else else
*boolean = node; *boolean = node;
@ -3948,17 +3948,17 @@ static void pass1_source(
copy(tdbb, csb, view_rse->rse_boolean, map, 0, FALSE), view, copy(tdbb, csb, view_rse->rse_boolean, map, 0, FALSE), view,
stream, FALSE); stream, FALSE);
if (*boolean) { if (*boolean) {
NOD and; NOD additional;
/* The order of the nodes here is important! The /* The order of the nodes here is important! The
boolean from the view must appear first so that boolean from the view must appear first so that
it gets expanded first in pass1. */ it gets expanded first in pass1. */
and = PAR_make_node(tdbb, 2); additional = PAR_make_node(tdbb, 2);
and->nod_type = nod_and; additional->nod_type = nod_and;
and->nod_arg[0] = node; additional->nod_arg[0] = node;
and->nod_arg[1] = *boolean; additional->nod_arg[1] = *boolean;
*boolean = and; *boolean = additional;
} }
else else
*boolean = node; *boolean = node;

View File

@ -27,12 +27,14 @@
* readonly databases. * readonly databases.
*/ */
/* /*
$Id: common.h,v 1.2 2001-07-10 17:35:13 awharrison Exp $ $Id: common.h,v 1.3 2001-07-12 05:46:05 bellardo Exp $
*/ */
#ifndef JRD_COMMON_H #ifndef JRD_COMMON_H
#define JRD_COMMON_H #define JRD_COMMON_H
#include "objs/jrd/autoconfig.h"
#ifndef INCLUDE_FB_MACROS_H #ifndef INCLUDE_FB_MACROS_H
#include "../include/fb_macros.h" #include "../include/fb_macros.h"
#endif #endif
@ -55,6 +57,10 @@ $Id: common.h,v 1.2 2001-07-10 17:35:13 awharrison Exp $
#define CANCEL_OPERATION #define CANCEL_OPERATION
#endif #endif
#ifndef GDS_FAR
#define GDS_FAR
#endif
/* Linux for Intel platforms*/ /* Linux for Intel platforms*/
#ifdef LINUX #ifdef LINUX
@ -90,6 +96,39 @@ $Id: common.h,v 1.2 2001-07-10 17:35:13 awharrison Exp $
#define VOLATILE volatile #define VOLATILE volatile
#endif /* LINUX */ #endif /* LINUX */
/* Darwin Platforms */
#ifdef DARWIN
#define ALIGNMENT 4
#define DOUBLE_ALIGN 4
#define FB_ALIGN(n,b) ((n + b - 1) & ~(b - 1))
#define SETPGRP setpgrp (0, 0)
#define BSD_UNIX 1
#define UNIX 1
#define ATEXIT(c) atexit (c)
#define IMPLEMENTATION 63
#define IEEE
#define QUADCONST(n) (n##LL)
#define QUADFORMAT "q"
#define NON_MNTENT
#define MMAP_SUPPORTED
#define MAP_ANONYMOUS
#define MAP_ANNON
#define LSEEK_OFFSET_CAST (off_t)
#define INTL
#define SIGACTION_SUPPORTED
#define MEMMOVE(from,to,length) memmove ((void *)to, (void *)from, (size_t)length)
#define MOVE_FAST(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_FASTER(from,to,length) memcpy (to, from, (int) (length))
#define MOVE_CLEAR(to,length) memset (to, 0, (int) (length))
#define _PPC_PARAM_H_
#ifndef MAXPATHLEN
#include <sys/param.h>
#endif
#endif /* Darwin Platforms */
/* FreeBSD for Intel platforms */ /* FreeBSD for Intel platforms */
#ifdef FREEBSD #ifdef FREEBSD
@ -1098,8 +1137,12 @@ typedef unsigned long DWORD;
#endif #endif
#define NULL_PTR ((void*) 0) #define NULL_PTR ((void*) 0)
#ifndef TRUE
#define TRUE 1 #define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0 #define FALSE 0
#endif
#define SUCCESS 0 #define SUCCESS 0
#define FAILURE 1 #define FAILURE 1
@ -1179,10 +1222,10 @@ typedef char SBYTE; /* Signed byte - rare usage */
typedef long STATUS; typedef long STATUS;
typedef long IPTR; typedef long IPTR;
typedef unsigned long U_IPTR; typedef unsigned long U_IPTR;
typedef void (*FPTR_VOID) (); typedef void (GDS_FAR *FPTR_VOID) ();
typedef void (*FPTR_VOID_PTR) (void *); typedef void (GDS_FAR *FPTR_VOID_PTR) (void *);
typedef int (*FPTR_INT) (); typedef int (GDS_FAR *FPTR_INT) ();
typedef int (*FPTR_INT_VOID_PTR) (void *); typedef int (GDS_FAR *FPTR_INT_VOID_PTR) (void *);
typedef ULONG RCRD_OFFSET; typedef ULONG RCRD_OFFSET;
typedef USHORT FLD_LENGTH; typedef USHORT FLD_LENGTH;
@ -1402,6 +1445,10 @@ void GDS_breakpoint(int);
#define BUFFER_SMALL 256 #define BUFFER_SMALL 256
#define BUFFER_TINY 128 #define BUFFER_TINY 128
#ifndef LSEEK_OFFSET_CAST
#define LSEEK_OFFSET_CAST
#endif
#ifndef DOUBLE_MULTIPLY #ifndef DOUBLE_MULTIPLY
#define DOUBLE_MULTIPLY(a,b) (((double) (a)) * ((double) (b))) #define DOUBLE_MULTIPLY(a,b) (((double) (a)) * ((double) (b)))
#endif #endif
@ -1436,4 +1483,4 @@ typedef struct in_sw_tab_t {
} *IN_SW_TAB; } *IN_SW_TAB;
#endif /* JRD_COMMON_H */ #endif /* JRD_COMMON_H */

View File

@ -44,6 +44,15 @@
#include "../jrd/intl_proto.h" #include "../jrd/intl_proto.h"
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#if !(defined REQUESTER && defined SUPERCLIENT) #if !(defined REQUESTER && defined SUPERCLIENT)
#include "../jrd/intlobj.h" #include "../jrd/intlobj.h"
#endif #endif
@ -204,7 +213,6 @@ static CONST TEXT *CONST months[] = {
#include "../jrd/quad.cpp" #include "../jrd/quad.cpp"
#endif #endif
#pragma FB_COMPILER_MESSAGE("Fix this! Ugly function pointer cast!") #pragma FB_COMPILER_MESSAGE("Fix this! Ugly function pointer cast!")
typedef void (*pfn_cvt_private_cludge) (int, int); typedef void (*pfn_cvt_private_cludge) (int, int);
typedef void (*pfn_cvt_private_cludge2) (int, int, ...); typedef void (*pfn_cvt_private_cludge2) (int, int, ...);

View File

@ -40,6 +40,7 @@
#include "../jrd/que.h" #include "../jrd/que.h"
#include "../jrd/cch_proto.h" #include "../jrd/cch_proto.h"
#include "../jrd/dbg_proto.h" #include "../jrd/dbg_proto.h"
#include "../jrd/err_proto.h"
#ifdef SUPERSERVER #ifdef SUPERSERVER
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
@ -882,7 +883,7 @@ int DBG_pretty(register NOD node, register int column)
return TRUE; return TRUE;
} }
extern "C"
int DBG_supervisor(int arg) int DBG_supervisor(int arg)
{ {
/************************************** /**************************************

View File

@ -68,6 +68,14 @@
#include <sys/param.h> #include <sys/param.h>
#endif #endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifndef NOFILE #ifndef NOFILE
#define NOFILE 20 #define NOFILE 20
#endif #endif

View File

@ -39,9 +39,9 @@
#define CHECK_CNSTRT "CHECK" #define CHECK_CNSTRT "CHECK"
#define NOT_NULL_CNSTRT "NOT NULL" #define NOT_NULL_CNSTRT "NOT NULL"
#define GET_STRING(from,to) DYN_get_string (from, to, sizeof (to), TRUE) #define GET_STRING(from,to) DYN_get_string ((TEXT**)from, (TEXT*)to, sizeof (to), TRUE)
#define GET_STRING_2(from,to) DYN_get_string (from, to, sizeof (to), FALSE) #define GET_STRING_2(from,to) DYN_get_string ((TEXT**)from, (TEXT*)to, sizeof (to), FALSE)
#define PROC_NAME_SIZE 32 #define PROC_NAME_SIZE 32
#define FLD_SRC_LEN 32 #define FLD_SRC_LEN 32

View File

@ -33,5 +33,7 @@ extern void DYN_modify_procedure(GBL, UCHAR **);
extern void DYN_modify_relation(GBL, UCHAR **); extern void DYN_modify_relation(GBL, UCHAR **);
extern void DYN_modify_trigger(GBL, UCHAR **); extern void DYN_modify_trigger(GBL, UCHAR **);
extern void DYN_modify_trigger_msg(GBL, UCHAR **, TEXT *); extern void DYN_modify_trigger_msg(GBL, UCHAR **, TEXT *);
extern void DYN_modify_sql_field(GBL, UCHAR**, TEXT*, TEXT*);
#endif /* _JRD_DYN_MD_PROTO_H_ */ #endif /* _JRD_DYN_MD_PROTO_H_ */

View File

@ -8,10 +8,15 @@
static TEXT *local_crypt(TEXT *, TEXT *); static TEXT *local_crypt(TEXT *, TEXT *);
#endif #endif
#if defined(HAVE_UNISTD_H) && !defined(NO_CRYPT)
#include <unistd.h>
#define CRYPT_FUNC crypt
#else
#ifndef NO_CRYPT #ifndef NO_CRYPT
extern TEXT *crypt(); extern TEXT *crypt();
#define CRYPT_FUNC crypt #define CRYPT_FUNC crypt
#endif #endif
#endif
extern "C" { extern "C" {

View File

@ -519,7 +519,7 @@ void DLL_EXPORT ERR_punt(void)
gds__log_status(dbname, tdbb->tdbb_status_vector); gds__log_status(dbname, tdbb->tdbb_status_vector);
} }
LONGJMP(reinterpret_cast < jmp_buf & >(tdbb->tdbb_setjmp), LONGJMP( (JMP_BUF) tdbb->tdbb_setjmp,
(int) tdbb->tdbb_status_vector[1]); (int) tdbb->tdbb_status_vector[1]);
} }
#endif #endif

View File

@ -45,13 +45,20 @@ extern void DLL_EXPORT ERR_post(STATUS, ...);
extern void DLL_EXPORT ERR_punt(void); extern void DLL_EXPORT ERR_punt(void);
extern void DLL_EXPORT ERR_warning(STATUS, ...); extern void DLL_EXPORT ERR_warning(STATUS, ...);
extern void DLL_EXPORT ERR_log(int, int, CONST TEXT *); extern void DLL_EXPORT ERR_log(int, int, CONST TEXT *);
#endif /* REQUESTER */
extern TEXT *DLL_EXPORT ERR_cstring(CONST TEXT*);
extern TEXT *DLL_EXPORT ERR_string(CONST TEXT*, int);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
#endif /* REQUESTER */
#ifdef __cplusplus
extern "C" {
#endif
extern TEXT *DLL_EXPORT ERR_cstring(CONST TEXT*);
extern TEXT *DLL_EXPORT ERR_string(CONST TEXT*, int);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* JRD_ERR_PROTO_H */ #endif /* JRD_ERR_PROTO_H */

View File

@ -36,6 +36,15 @@
#include "../jrd/isc_s_proto.h" #include "../jrd/isc_s_proto.h"
#include "../jrd/sch_proto.h" #include "../jrd/sch_proto.h"
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#include "../jrd/isc_i_proto.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#pragma FB_COMPILER_MESSAGE("FIXFIXFIX!!! - DANGER!") #pragma FB_COMPILER_MESSAGE("FIXFIXFIX!!! - DANGER!")
// We currently can't include jrd/err_proto.h to get the function // We currently can't include jrd/err_proto.h to get the function
@ -62,7 +71,7 @@ extern void DLL_EXPORT ERR_bugcheck_msg(CONST TEXT *);
#endif #endif
#ifndef AST_TYPE #ifndef AST_TYPE
#define AST_TYPE #define AST_TYPE void
#endif #endif
#ifndef MUTEX #ifndef MUTEX
@ -373,7 +382,7 @@ SLONG EVENT_que(STATUS * status_vector,
USHORT string_length, USHORT string_length,
TEXT * string, TEXT * string,
USHORT events_length, USHORT events_length,
UCHAR * events, void (*ast_routine) (), void *ast_arg) UCHAR * events, FPTR_VOID ast_routine, void *ast_arg)
{ {
/************************************** /**************************************
* *
@ -550,7 +559,7 @@ static EVH acquire(void)
#if (!(defined SUPERSERVER) && (defined MMAP_SUPPORTED)) #if (!(defined SUPERSERVER) && (defined MMAP_SUPPORTED))
STATUS status_vector[20]; STATUS status_vector[20];
header = ISC_remap_file(status_vector, &EVENT_data, length, FALSE); header = (evh*) ISC_remap_file(status_vector, &EVENT_data, length, FALSE);
#endif #endif
if (!header) { if (!header) {
RELEASE; RELEASE;

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: evl.cpp,v 1.2 2001-05-24 14:54:26 tamlin Exp $ * $Id: evl.cpp,v 1.3 2001-07-12 05:46:05 bellardo Exp $
*/ */
/* /*
@ -3805,7 +3805,7 @@ static SSHORT init_agg_distinct(TDBB tdbb, NOD node)
handle = handle =
SORT_init(tdbb->tdbb_status_vector, SORT_init(tdbb->tdbb_status_vector,
ROUNDUP_LONG(sort_key->skd_length), 1, sort_key, ROUNDUP_LONG(sort_key->skd_length), 1, sort_key,
reinterpret_cast < UCHAR(*)() > (reject_duplicate), 0, reinterpret_cast < BOOLEAN(*)() > (reject_duplicate), 0,
tdbb->tdbb_attachment); tdbb->tdbb_attachment);
if (!(asb_impure->iasb_sort_handle = (SLONG *) handle)) if (!(asb_impure->iasb_sort_handle = (SLONG *) handle))

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: exe.cpp,v 1.1.1.1 2001-05-23 13:26:17 tamlin Exp $ $Id: exe.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#include <time.h> #include <time.h>
@ -3208,8 +3208,9 @@ static void set_error(TDBB tdbb, XCP condition)
if (condition->xcp_rpt[0].xcp_code == gds__check_constraint) { if (condition->xcp_rpt[0].xcp_code == gds__check_constraint) {
MET_lookup_cnstrt_for_trigger(tdbb, name, relation_name, MET_lookup_cnstrt_for_trigger(tdbb, name, relation_name,
request->req_trg_name); request->req_trg_name);
s = (name[0]) ? name : ""; // CONST CAST
r = (relation_name[0]) ? relation_name : ""; s = (name[0]) ? name : (TEXT*)"";
r = (relation_name[0]) ? relation_name : (TEXT*)"";
ERR_post(condition->xcp_rpt[0].xcp_code, ERR_post(condition->xcp_rpt[0].xcp_code,
gds_arg_string, ERR_cstring(s), gds_arg_string, ERR_cstring(s),
gds_arg_string, ERR_cstring(r), 0); gds_arg_string, ERR_cstring(r), 0);

View File

@ -126,9 +126,15 @@
#ifdef LINUX #ifdef LINUX
#define ISC_PREFIX "/opt/interbase/" #define ISC_PREFIX "/opt/interbase/"
#else #else
#ifdef DARWIN
#define ISC_PREFIX "/all/files/are/in/framework/resources"
#define DARWIN_GEN_DIR "var"
#define DARWIN_FRAMEWORK_ID "com.firebird.Firebird2"
#else
#define ISC_PREFIX "/usr/interbase/" #define ISC_PREFIX "/usr/interbase/"
#endif #endif
#endif #endif
#endif
/* keep MSG_FILE_LANG in sync with build_file.e */ /* keep MSG_FILE_LANG in sync with build_file.e */

View File

@ -753,7 +753,7 @@ STATUS filter_transliterate_text(USHORT action, CTL control)
control->ctl_source_handle = aux->ctlaux_subfilter; control->ctl_source_handle = aux->ctlaux_subfilter;
control->ctl_source = control->ctl_source =
reinterpret_cast < long (*) () > (filter_transliterate_text); reinterpret_cast < STATUS (*) (USHORT, CTL) > (filter_transliterate_text);
source = control->ctl_source_handle; source = control->ctl_source_handle;
if (action == ACTION_open) { if (action == ACTION_open) {

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: flu.cpp,v 1.2 2001-05-24 14:54:26 tamlin Exp $ $Id: flu.cpp,v 1.3 2001-07-12 05:46:05 bellardo Exp $
*/ */
#include "../jrd/common.h" #include "../jrd/common.h"
@ -80,11 +80,20 @@ static int condition_handler(int *, int *, int *);
#define IB_UDF_DIR "UDF/" #define IB_UDF_DIR "UDF/"
#endif #endif
#ifdef DARWIN
#include <unistd.h>
#include <mach-o/dyld.h>
#define IB_UDF_DIR "UDF/"
#endif
#if defined FREEBSD || defined NETBSD #if defined FREEBSD || defined NETBSD
#include <dlfcn.h> #include <dlfcn.h>
#define DYNAMIC_SHARED_LIBRARIES #define DYNAMIC_SHARED_LIBRARIES
#include <unistd.h> #include <unistd.h>
#define IB_UDF_DIR "UDF/" #define IB_UDF_DIR "UDF/"
#endif
#if defined FREEBSD || defined NETBSD || defined DARWIN
/* /*
* Define our own dirname(), because we don't have a syscall for it. * Define our own dirname(), because we don't have a syscall for it.
* !! WARNING !! WARNING !! WARNING !! * !! WARNING !! WARNING !! WARNING !!
@ -225,6 +234,11 @@ void FLU_unregister_module(MOD module)
* *
**************************************/ **************************************/
MOD *mod; MOD *mod;
#ifdef DARWIN
NSSymbol symbol;
void (*fini)(void);
#endif
/* Module is in-use by other databases.*/ /* Module is in-use by other databases.*/
@ -253,6 +267,17 @@ void FLU_unregister_module(MOD module)
FreeLibrary(module->mod_handle); FreeLibrary(module->mod_handle);
#endif #endif
#ifdef DARWIN
/* Make sure the fini function gets called, if there is one */
symbol = NSLookupSymbolInModule(module->mod_handle, "__fini");
if (symbol != NULL)
{
fini = (void (*)(void)) NSAddressOfSymbol(symbol);
fini();
}
NSUnLinkModule (module->mod_handle, 0);
#endif
gds__free(module); gds__free(module);
} }
@ -1240,6 +1265,311 @@ static void adjust_loadlib_name(TEXT * access_path, TEXT * load_path)
} }
#endif #endif
#ifdef DARWIN
#define LOOKUP
NSModule ISC_link_with_module (TEXT*);
FPTR_INT ISC_lookup_entrypoint (
TEXT *module,
TEXT *name,
TEXT *ib_path_env_var)
{
/**************************************
*
* I S C _ l o o k u p _ e n t r y p o i n t ( D A R W I N )
*
**************************************
*
* Functional description
* Lookup entrypoint of function.
*
**************************************/
FPTR_INT function;
int lastSpace, i, len;
MOD mod;
TEXT absolute_module[MAXPATHLEN];
NSSymbol symbol;
if (function = FUNCTIONS_entrypoint (module, name))
return function;
/* Remove TRAILING spaces from path names; spaces within the path are valid */
for (i = strlen(module) - 1, lastSpace = 0; i >= 0; i--)
if (module[i] == ' ')
lastSpace = i;
else
break;
if (module[lastSpace] == ' ')
module[lastSpace] = 0;
for (i = strlen(name) - 1, lastSpace = 0; i >= 0; i--)
if (name[i] == ' ')
lastSpace = i;
else
break;
if (name[lastSpace] == ' ')
name[lastSpace] = 0;
if (!*module || !*name)
return NULL;
/*printf("names truncated: %s, function %s.\n", module, name);*/
/* Check if external function module has already been loaded */
if (!(mod = FLU_lookup_module (module)))
{
USHORT length ;
#ifdef EXT_LIB_PATH
if (ib_path_env_var == NULL)
strcpy (absolute_module, module);
else if (!gds__validate_lib_path (module, ib_path_env_var, absolute_module, sizeof(absolute_module)))
return NULL;
#else
strcpy (absolute_module, module);
#endif /* EXT_LIB_PATH */
length = strlen (absolute_module);
/* call search_for_module with the supplied name,
and if unsuccessful, then with <name>.so . */
mod = search_for_module (absolute_module, name);
if (!mod)
{
strcat (absolute_module, ".so");
mod = search_for_module (absolute_module, name);
}
if (!mod)
{
/*printf("Couldn't find module: %s\n", absolute_module);*/
return NULL;
}
assert (mod->mod_handle); /* assert that we found the module */
mod->mod_use_count = 0;
mod->mod_length = length;
strcpy (mod->mod_name, module);
mod->mod_next = FLU_modules;
FLU_modules = mod;
}
/* Look for the symbol and return a pointer to the function if found */
mod->mod_use_count++;
symbol = NSLookupSymbolInModule(mod->mod_handle, name);
if (symbol == NULL)
{
/*printf("Failed to find function: %s in module %s, trying _%s\n", name, module, name);*/
strcpy(absolute_module, "_");
strncat(absolute_module, name, sizeof(absolute_module) - 2);
symbol = NSLookupSymbolInModule(mod->mod_handle, absolute_module);
if (symbol == NULL)
{
/*printf("Failed to find symbol %s. Giving up.\n", absolute_module);*/
return NULL;
}
}
return (FPTR_INT) NSAddressOfSymbol(symbol);
}
static MOD search_for_module ( TEXT *module,
TEXT *name )
{
/**************************************
*
* s e a r c h _ f o r _ m o d u l e ( D A R W I N )
*
**************************************
*
* Functional description
* Look for a module (as named in a 'DECLARE EXTERNAL FUNCTION'
* statement.
*
**************************************/
MOD mod;
char *dirp;
TEXT ib_lib_path[MAXPATHLEN];
TEXT absolute_module[MAXPATHLEN]; /* for _access() ??? */
FDLS *dir_list;
BOOLEAN found_module;
strcpy (absolute_module, module);
if (!(mod = (MOD) gds__alloc (sizeof (struct mod) +
strlen (absolute_module))))
return NULL;
dirp = (char*) dirname (absolute_module);
if (('.' == dirp[0]) && ('\0' == dirp[1]))
{
/* We have a simple module name without a directory. */
gds__prefix (ib_lib_path, IB_UDF_DIR);
strncat (ib_lib_path, module,
MAXPATHLEN - strlen (ib_lib_path) - 1);
if (!access (ib_lib_path, R_OK))
{
/* Module is in the standard UDF directory: load it. */
if (!(mod->mod_handle = ISC_link_with_module (ib_lib_path)))
{
gds__free (mod);
return NULL;
}
}
else
{
gds__prefix (ib_lib_path, IB_INTL_DIR);
strncat (ib_lib_path, module,
MAXPATHLEN - strlen (ib_lib_path) - 1);
/*printf("intl file: %s\n", ib_lib_path);*/
if (!access (ib_lib_path, R_OK))
{
/* Module is in the default directory: load it. */
if (!(mod->mod_handle = ISC_link_with_module (ib_lib_path)))
{
gds__free (mod);
return NULL;
}
}
else
{
/* The module is not in the default directory, so ...
* use the EXTERNAL_FUNCTION_DIRECTORY lines from isc_config.
*/
dir_list = DLS_get_func_dirs();
found_module = FALSE;
while (dir_list && !found_module)
{
strcpy (ib_lib_path, dir_list->fdls_directory);
strcat (ib_lib_path, "/");
strncat (ib_lib_path, module,
MAXPATHLEN - strlen (ib_lib_path) - 1);
if (!access (ib_lib_path, R_OK))
{
if (!(mod->mod_handle = ISC_link_with_module (ib_lib_path)))
{
gds__free (mod);
return NULL;
}
found_module = TRUE;
}
dir_list = dir_list->fdls_next;
}
if (!found_module)
{
gds__free (mod);
return NULL;
}
} /* else module is not in the INTL directory */
} /* else module is not in the default directory, so ... */
} /* if *dirp is "." */
else
{
/* The module name includes a directory path.
* The directory must be the standard UDF directory, or the
* standard international directory, or listed in
* an EXTERNAL_FUNCTION_DIRECTORY line in isc_config,
* and the module must be accessible in that directory.
*/
gds__prefix (ib_lib_path, IB_UDF_DIR);
ib_lib_path [strlen(ib_lib_path) - 1] = '\0'; /* drop trailing "/" */
found_module = ! strcmp (ib_lib_path, dirp);
if (!found_module)
{
gds__prefix (ib_lib_path, IB_INTL_DIR);
ib_lib_path [strlen(ib_lib_path) - 1] = '\0'; /* drop trailing / */
found_module = ! strcmp (ib_lib_path, dirp);
}
if (!found_module)
{
/* It's not the default directory, so try the ones listed
* in EXTERNAL_FUNCTION_DIRECTORY lines in isc_config.
*/
dir_list = DLS_get_func_dirs();
while (dir_list && !found_module)
{
if (! strcmp (dir_list->fdls_directory, dirp))
found_module = TRUE;
dir_list = dir_list->fdls_next;
}
}
if (found_module)
found_module = (!access (module, R_OK)) &&
(0 != (mod->mod_handle = ISC_link_with_module (module)));
if (!found_module)
{
gds__free (mod);
return NULL;
}
} /* else module name includes a directory path, so ... */
return mod;
}
NSModule ISC_link_with_module (
TEXT *fileName)
{
/**************************************
*
* I S C _ l i n k _ w i t h _ m o d u l e ( D A R W I N )
*
**************************************
*
* Functional description
* Given the file system path to a module, load it and link it into
* our address space. Assumes all security checks have been
* performed.
*
**************************************/
NSObjectFileImage image;
NSObjectFileImageReturnCode retVal;
NSModule mod_handle;
NSSymbol initSym;
void (*init)(void);
/* Create an object file image from the given path */
retVal = NSCreateObjectFileImageFromFile(fileName, &image);
if(retVal != NSObjectFileImageSuccess)
{
switch(retVal)
{
case NSObjectFileImageFailure:
/*printf("object file setup failure");*/
return NULL;
case NSObjectFileImageInappropriateFile:
/*printf("not a Mach-O MH_BUNDLE file type");*/
return NULL;
case NSObjectFileImageArch:
/*printf("no object for this architecture");*/
return NULL;
case NSObjectFileImageFormat:
/*printf("bad object file format");*/
return NULL;
case NSObjectFileImageAccess:
/*printf("can't read object file");*/
return NULL;
default:
/*printf("unknown error from NSCreateObjectFileImageFromFile()");*/
return NULL;
}
}
/* link the image */
mod_handle = NSLinkModule(image, fileName, NSLINKMODULE_OPTION_PRIVATE);
NSDestroyObjectFileImage(image) ;
if(mod_handle == NULL)
{
/*printf("NSLinkModule() failed for dlopen()");*/
return NULL;
}
initSym = NSLookupSymbolInModule(mod_handle, "__init");
if (initSym != NULL)
{
init = ( void (*)(void)) NSAddressOfSymbol(initSym);
init();
}
return mod_handle;
}
#endif
#ifndef LOOKUP #ifndef LOOKUP
FPTR_INT ISC_lookup_entrypoint(TEXT* module, FPTR_INT ISC_lookup_entrypoint(TEXT* module,

View File

@ -23,6 +23,7 @@
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
#include <string.h> #include <string.h>
#include "../jrd/jrd.h" /* For MAX_PATH_LENGTH Bug #126614 */
/* defined in common.h, which is included by ib_stdio.h: typedef int (*FPTR_INT)(); */ /* defined in common.h, which is included by ib_stdio.h: typedef int (*FPTR_INT)(); */
@ -72,7 +73,7 @@ FPTR_INT FUNCTIONS_entrypoint(char *module, char *entrypoint)
* *
**************************************/ **************************************/
FN *function; FN *function;
char *p, temp[128], *ep; char *p, temp[MAX_PATH_LENGTH + 128], *ep; /* Bug #126614 Fix */
p = temp; p = temp;

View File

@ -49,6 +49,11 @@
#include "../jrd/time.h" #include "../jrd/time.h"
#include "../jrd/misc.h" #include "../jrd/misc.h"
#ifdef DARWIN
#include <CoreFoundation/CFBundle.h>
#include <CoreFoundation/CFURL.h>
#endif
#if (defined PC_PLATFORM && !defined NETWARE_386) #if (defined PC_PLATFORM && !defined NETWARE_386)
#include <io.h> #include <io.h>
#endif #endif
@ -159,7 +164,7 @@ extern int ib_printf();
#endif #endif
#endif #endif
#if !(defined VMS || defined PC_PLATFORM || defined WIN_NT || defined linux || defined FREEBSD || defined NETBSD) #if !(defined VMS || defined PC_PLATFORM || defined WIN_NT || defined linux || defined FREEBSD || defined NETBSD || defined DARWIN )
extern int errno; extern int errno;
extern SCHAR *sys_errlist[]; extern SCHAR *sys_errlist[];
extern int sys_nerr; extern int sys_nerr;
@ -196,7 +201,7 @@ typedef int pid_t;
#endif #endif
#ifndef GETTIMEOFDAY #ifndef GETTIMEOFDAY
#define GETTIMEOFDAY(time,tz) gettimeofday (time, tz) #define GETTIMEOFDAY(time,tz) gettimeofday ((struct timeval*)time, (struct timezone*)tz)
#define TIMEOFDAY_TZ #define TIMEOFDAY_TZ
#endif #endif
@ -389,7 +394,7 @@ void GDS_breakpoint(int);
static void blr_error(CTL, TEXT *, TEXT *); static void blr_error(CTL, TEXT *, TEXT *);
static void blr_format(CTL, TEXT *, ...); static void blr_format(CTL, const char *, ...);
static void blr_indent(CTL, SSHORT); static void blr_indent(CTL, SSHORT);
static void blr_print_blr(CTL, UCHAR); static void blr_print_blr(CTL, UCHAR);
static SCHAR blr_print_byte(CTL); static SCHAR blr_print_byte(CTL);
@ -1773,7 +1778,7 @@ SLONG API_ROUTINE gds__interprete(char *s, STATUS ** vector)
break; break;
case gds_arg_netware: case gds_arg_netware:
if (code > 0 && code < sys_nerr && (p = sys_errlist[code])) if (code > 0 && code < sys_nerr && (p = (TEXT*)sys_errlist[code]))
strcpy(s, p); strcpy(s, p);
else if (code == 60) else if (code == 60)
strcpy(s, "connection timed out"); strcpy(s, "connection timed out");
@ -1797,7 +1802,7 @@ SLONG API_ROUTINE gds__interprete(char *s, STATUS ** vector)
#ifndef NETWARE_386 #ifndef NETWARE_386
#ifndef PC_PLATFORM #ifndef PC_PLATFORM
if (code > 0 && code < sys_nerr && (p = sys_errlist[code])) if (code > 0 && code < sys_nerr && (p = (TEXT*)sys_errlist[code]))
strcpy(s, p); strcpy(s, p);
else if (code == 60) else if (code == 60)
strcpy(s, "connection timed out"); strcpy(s, "connection timed out");
@ -2178,7 +2183,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void *handle,
position = message->msg_top_tree; position = message->msg_top_tree;
for (n = 1, status = 0; !status; n++) { for (n = 1, status = 0; !status; n++) {
if (lseek(message->msg_file, position, 0) < 0) if (lseek(message->msg_file, LSEEK_OFFSET_CAST position, 0) < 0)
status = -6; status = -6;
else if (read(message->msg_file, message->msg_bucket, else if (read(message->msg_file, message->msg_bucket,
message->msg_bucket_size) < 0) message->msg_bucket_size) < 0)
@ -2392,11 +2397,16 @@ void API_ROUTINE gds__prefix(TEXT * string, TEXT * root)
* the enviroment variable INTERBASE if it is set. * the enviroment variable INTERBASE if it is set.
* *
**************************************/ **************************************/
#ifdef DARWIN /* Variables needed for Darwin specific code */
CFBundleRef ibaseBundle;
CFURLRef msgFileUrl;
CFStringRef msgFilePath;
#endif
string[0] = 0; string[0] = 0;
if (ib_prefix == NULL) { if (ib_prefix == NULL) {
if (!(ib_prefix = getenv(ISC_ENV))) if ( !(ib_prefix = getenv(ISC_ENV)) || ib_prefix[0] == 0)
{ {
#if defined(WIN_NT) #if defined(WIN_NT)
ib_prefix = ib_prefix_val; ib_prefix = ib_prefix_val;
@ -2428,8 +2438,22 @@ void API_ROUTINE gds__prefix(TEXT * string, TEXT * root)
} }
} }
#else // WIN_NT #else // WIN_NT
ib_prefix = ISC_PREFIX; #ifdef DARWIN
strcat(ib_prefix_val, ib_prefix); if ( (ibaseBundle = CFBundleGetBundleWithIdentifier(
CFSTR(DARWIN_FRAMEWORK_ID)) ) &&
(msgFileUrl = CFBundleCopyResourceURL(ibaseBundle,
CFSTR(DARWIN_GEN_DIR), NULL, NULL)) &&
(msgFilePath = CFURLCopyFileSystemPath(msgFileUrl,
kCFURLPOSIXPathStyle)) &&
(CFStringGetCString(msgFilePath, ib_prefix_val,
MAXPATHLEN, kCFStringEncodingMacRoman ))
) { }
else
#endif
{
ib_prefix = ISC_PREFIX;
strcat(ib_prefix_val, ib_prefix);
}
#endif #endif
ib_prefix = ib_prefix_val; ib_prefix = ib_prefix_val;
} }
@ -2731,14 +2755,16 @@ USHORT API_ROUTINE gds__parse_bpb(USHORT bpb_length,
* *
**************************************/ **************************************/
return gds__parse_bpb2(bpb_length, bpb, source, target, NULL, NULL); /* SIGN ERROR */
return gds__parse_bpb2(bpb_length, bpb, (SSHORT*)source, (SSHORT*)target, NULL, NULL);
} }
USHORT API_ROUTINE gds__parse_bpb2(USHORT bpb_length, USHORT API_ROUTINE gds__parse_bpb2(USHORT bpb_length,
UCHAR * bpb, UCHAR * bpb,
USHORT * source, SSHORT * source,
USHORT * target, SSHORT * target,
USHORT * source_interp, USHORT * source_interp,
USHORT * target_interp) USHORT * target_interp)
{ {
@ -2847,7 +2873,7 @@ SLONG API_ROUTINE gds__ftof(register SCHAR * string,
int API_ROUTINE gds__print_blr( int API_ROUTINE gds__print_blr(
UCHAR * blr, UCHAR * blr,
void (*routine) (), FPTR_VOID routine,
SCHAR * user_arg, SSHORT language) SCHAR * user_arg, SSHORT language)
{ {
/************************************** /**************************************
@ -3131,9 +3157,13 @@ void* API_ROUTINE gds__sys_alloc(SLONG size)
#ifdef UNIX #ifdef UNIX
#ifdef MAP_ANONYMOUS #ifdef MAP_ANONYMOUS
memory = mmap(NULL, size, (PROT_READ | PROT_WRITE), memory = mmap(NULL, size, (PROT_READ | PROT_WRITE),
#ifdef MAP_ANONYMOUS
(MAP_ANONYMOUS | (MAP_ANONYMOUS |
#ifndef LINUX #else
/* In LINUX, there is no such thing as MAP_VARIABLE. Hence, it gives (MAP_ANON |
#endif
#if (!defined(LINUX) && !defined(DARWIN))
/* In LINUX and Darwin there is no such thing as MAP_VARIABLE. Hence, it gives
compilation error. The equivalent functionality is default, compilation error. The equivalent functionality is default,
if you do not specify MAP_FIXED */ if you do not specify MAP_FIXED */
MAP_VARIABLE | MAP_VARIABLE |
@ -3811,7 +3841,7 @@ static void blr_error(CTL control, TEXT * string, TEXT * arg1)
} }
static void blr_format(CTL control, TEXT * string, ...) static void blr_format(CTL control, const char * string, ...)
{ {
/************************************** /**************************************
* *
@ -3897,7 +3927,7 @@ static SCHAR blr_print_byte(CTL control)
} }
static blr_print_char(CTL control) static int blr_print_char(CTL control)
{ {
/************************************** /**************************************
* *
@ -3978,7 +4008,7 @@ static void blr_print_cond(CTL control)
} }
static blr_print_dtype(CTL control) static int blr_print_dtype(CTL control)
{ {
/************************************** /**************************************
* *

View File

@ -106,7 +106,7 @@ void API_ROUTINE gds__prefix_msg(TEXT*, TEXT*);
SLONG API_ROUTINE gds__get_prefix(SSHORT, TEXT*); SLONG API_ROUTINE gds__get_prefix(SSHORT, TEXT*);
STATUS API_ROUTINE gds__print_status(STATUS*); STATUS API_ROUTINE gds__print_status(STATUS*);
USHORT API_ROUTINE gds__parse_bpb(USHORT, UCHAR*, USHORT*, USHORT*); USHORT API_ROUTINE gds__parse_bpb(USHORT, UCHAR*, USHORT*, USHORT*);
USHORT API_ROUTINE gds__parse_bpb2(USHORT, UCHAR*, USHORT*, USHORT*, USHORT API_ROUTINE gds__parse_bpb2(USHORT, UCHAR*, SSHORT*, SSHORT*,
USHORT*, USHORT*); USHORT*, USHORT*);
SLONG API_ROUTINE gds__ftof(SCHAR*, USHORT GDS_VAL(length1), SCHAR*, SLONG API_ROUTINE gds__ftof(SCHAR*, USHORT GDS_VAL(length1), SCHAR*,
USHORT GDS_VAL(length2)); USHORT GDS_VAL(length2));

View File

@ -21,6 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
#ifndef _JRD_GDSOLD_H_ #ifndef _JRD_GDSOLD_H_
#define _JRD_GDSOLD_H_ #define _JRD_GDSOLD_H_
@ -55,7 +56,9 @@
/* define type, export and other stuff based on c/c++ and Windows */ /* define type, export and other stuff based on c/c++ and Windows */
/******************************************************************/ /******************************************************************/
#ifndef GDS_FAR
#define GDS_FAR ISC_FAR #define GDS_FAR ISC_FAR
#endif
#define GDS_EXPORT ISC_EXPORT #define GDS_EXPORT ISC_EXPORT
typedef void GDS_FAR *gds_db_handle; typedef void GDS_FAR *gds_db_handle;
@ -279,7 +282,7 @@ void GDS_EXPORT gds__vtov(CONST SCHAR GDS_FAR*,
SSHORT); SSHORT);
int GDS_EXPORT gds__version(void GDS_FAR * GDS_FAR *, int GDS_EXPORT gds__version(void GDS_FAR * GDS_FAR *,
void (GDS_FAR *) (), FPTR_VOID,
void GDS_FAR *); void GDS_FAR *);
int GDS_EXPORT gds__disable_subsystem(char GDS_FAR *); int GDS_EXPORT gds__disable_subsystem(char GDS_FAR *);
@ -1301,6 +1304,7 @@ const char gds_info_sql_stmt_select_for_upd = 12;
#define gds_arg_next_mach 15 #define gds_arg_next_mach 15
#define gds_arg_netware 16 #define gds_arg_netware 16
#define gds_arg_win32 17 #define gds_arg_win32 17
#define gds_arg_warning 18
#else /* c++ definitions */ #else /* c++ definitions */
@ -1322,6 +1326,7 @@ const GDS_LONG gds_arg_mpexl_ipc = 11;
const GDS_LONG gds_arg_next_mach = 15; const GDS_LONG gds_arg_next_mach = 15;
const GDS_LONG gds_arg_netware = 16; const GDS_LONG gds_arg_netware = 16;
const GDS_LONG gds_arg_win32 = 17; const GDS_LONG gds_arg_win32 = 17;
const GDS_LONG gds_arg_warning = 18;
#endif #endif
@ -2413,7 +2418,10 @@ const unsigned char gds_dyn_last_dyn_value = 210;
#else /* c++ definitions */ #else /* c++ definitions */
const unsigned char gds_sdl_version1 = 1; const unsigned char gds_sdl_version1 = 1;
const unsigned char gds_sdl_eoc = -1; /* Opps, can't set an unsigned value to -1. Used to be:
* const unsigned char gds_sdl_eoc = -1;
*/
const unsigned char gds_sdl_eoc = 0xFF;
const unsigned char gds_sdl_relation = 2; const unsigned char gds_sdl_relation = 2;
const unsigned char gds_sdl_rid = 3; const unsigned char gds_sdl_rid = 3;
const unsigned char gds_sdl_field = 4; const unsigned char gds_sdl_field = 4;
@ -2628,7 +2636,10 @@ const unsigned char PYXIS_MENU_OPAQUE = 4;
const unsigned char PYXIS_MENU_TRANSPARENT = 5; const unsigned char PYXIS_MENU_TRANSPARENT = 5;
const unsigned char PYXIS_MENU_HORIZONTAL = 6; const unsigned char PYXIS_MENU_HORIZONTAL = 6;
const unsigned char PYXIS_MENU_VERTICAL = 7; const unsigned char PYXIS_MENU_VERTICAL = 7;
const unsigned char PYXIS_MENU_END = -1; /* Opps, can't set an unsigned value to -1. Used to be:
* const unsigned char PYXIS_MENU_END = -1;
*/
const unsigned char PYXIS_MENU_END = 0xFF;
#endif #endif

View File

@ -22,7 +22,7 @@
* FSG 16.03.2001 * FSG 16.03.2001
*/ */
/* /*
$Id: ibase.h,v 1.1.1.1 2001-05-23 13:26:15 tamlin Exp $ $Id: ibase.h,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#ifndef JRD_IBASE_H #ifndef JRD_IBASE_H
@ -132,7 +132,8 @@ typedef GDS_QUAD GDS__QUAD;
/* TMN: What *is* really the right definition of these structs?! */ /* TMN: What *is* really the right definition of these structs?! */
/* Is e.g a GDS_QUAD to be signed or unsigned?! */ /* Is e.g a GDS_QUAD to be signed or unsigned?! */
#ifndef ISC_QUAD #if !defined(ISC_QUAD) && !defined(DEFINED_GDS_QUAD)
#define DEFINED_GDS_QUAD
typedef struct { typedef struct {
unsigned long uquad_high; unsigned long uquad_high;

View File

@ -25,7 +25,7 @@
#define JRD_IBERR_H #define JRD_IBERR_H
#include "../jrd/gdsassert.h" #include "../jrd/gdsassert.h"
#include "../misc/status.h" #include "../jrd/status.h"
/* /*
* TMN: Leave INIT_STATUS as macro for now. At least "why.c" (what * TMN: Leave INIT_STATUS as macro for now. At least "why.c" (what

View File

@ -234,7 +234,7 @@ void IDX_create_index(
key_length + sizeof(struct isr), key_length + sizeof(struct isr),
1, 1,
&key_desc, &key_desc,
reinterpret_cast < UCHAR(*)() > (duplicate_key), reinterpret_cast < BOOLEAN(*)() > (duplicate_key),
&ifl_data, tdbb->tdbb_attachment); &ifl_data, tdbb->tdbb_attachment);
if (!sort_handle) if (!sort_handle)

View File

@ -24,7 +24,7 @@
* Solaris x86 changes - Konstantin Kuznetsov, Neil McCalden * Solaris x86 changes - Konstantin Kuznetsov, Neil McCalden
*/ */
/* /*
$Id: isc.cpp,v 1.1.1.1 2001-05-23 13:26:11 tamlin Exp $ $Id: isc.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
@ -1444,6 +1444,14 @@ void isc_internal_set_config_value(UCHAR key, ULONG * value1, ULONG * value2)
#ifdef UNIX #ifdef UNIX
#ifdef AIX_PPC
#define _UNIX95
#endif
#include <grp.h>
#ifdef AIX_PPC
#undef _UNIX95
#endif
SLONG ISC_get_user_group_id(TEXT * user_group_name) SLONG ISC_get_user_group_id(TEXT * user_group_name)
{ {
/************************************** /**************************************
@ -1460,14 +1468,9 @@ SLONG ISC_get_user_group_id(TEXT * user_group_name)
* --- for UNIX platform --- * --- for UNIX platform ---
* *
**************************************/ **************************************/
#ifdef AIX_PPC #ifndef DARWIN
#define _UNIX95
#endif
#include <grp.h>
#ifdef AIX_PPC
#undef _UNIX95
#endif
extern struct group *getgrnam(); extern struct group *getgrnam();
#endif
struct group *user_group; struct group *user_group;
SLONG n; SLONG n;

View File

@ -101,6 +101,12 @@ typedef struct itm {
#define MTAB_CLOSE(stream) ib_fclose (stream) #define MTAB_CLOSE(stream) ib_fclose (stream)
#endif #endif
#ifdef DARWIN
#define MTAB "/etc/fstab.hd"
#define MTAB_OPEN(path,type) ib_fopen (path, type)
#define MTAB_CLOSE(stream) ib_fclose (stream)
#endif
#ifdef SCO_UNIX #ifdef SCO_UNIX
#define NON_MNTENT #define NON_MNTENT
#define MTAB "/etc/mount" #define MTAB "/etc/mount"
@ -135,7 +141,7 @@ typedef struct itm {
#include <sys/vmount.h> #include <sys/vmount.h>
#endif #endif
#if (defined SOLARIS || defined UNIXWARE || defined NCR3000 || defined linux || defined M88K || defined FREEBSD || defined NETBSD) #if (defined SOLARIS || defined UNIXWARE || defined NCR3000 || defined linux || defined M88K || defined FREEBSD || defined NETBSD || defined DARWIN)
#define GETWD(buf) getcwd (buf, MAXPATHLEN) #define GETWD(buf) getcwd (buf, MAXPATHLEN)
#endif #endif
@ -1474,7 +1480,7 @@ int ISC_strip_extension(TEXT * file_name)
#if (defined NFS || defined FREEBSD || defined NETBSD) #if (defined NFS || defined FREEBSD || defined NETBSD)
static expand_filename2(TEXT * from_buff, USHORT length, TEXT * to_buff) static int expand_filename2(TEXT * from_buff, USHORT length, TEXT * to_buff)
{ {
/************************************** /**************************************
* *

View File

@ -24,9 +24,18 @@
#ifndef _JRD_ISC_I_PROTO_H_ #ifndef _JRD_ISC_I_PROTO_H_
#define _JRD_ISC_I_PROTO_H_ #define _JRD_ISC_I_PROTO_H_
#ifdef __cplusplus
extern "C" {
#endif
void DLL_EXPORT ISC_enter(void); void DLL_EXPORT ISC_enter(void);
void DLL_EXPORT ISC_enable(void);
void DLL_EXPORT ISC_exit(void); void DLL_EXPORT ISC_exit(void);
#ifdef __cplusplus
}
#endif
void DLL_EXPORT ISC_enable(void);
void DLL_EXPORT ISC_inhibit(void); void DLL_EXPORT ISC_inhibit(void);
#ifdef WIN_NT #ifdef WIN_NT

View File

@ -22,7 +22,7 @@
* Solaris x86 changes - Konstantin Kuznetsov, Neil McCalden * Solaris x86 changes - Konstantin Kuznetsov, Neil McCalden
*/ */
/* $Id: isc_ipc.cpp,v 1.1.1.1 2001-05-23 13:26:10 tamlin Exp $ */ /* $Id: isc_ipc.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $ */
#ifdef SHLIB_DEFS #ifdef SHLIB_DEFS
#define LOCAL_SHLIB_DEFS #define LOCAL_SHLIB_DEFS
@ -47,6 +47,10 @@
#endif #endif
#endif #endif
#ifdef DARWIN
#include <string.h>
#endif
#ifdef SOLX86 #ifdef SOLX86
#define HANDLER_ADDR_ARG #define HANDLER_ADDR_ARG
#endif #endif
@ -77,9 +81,13 @@ typedef int (*CLIB_ROUTINE SIG_FPTR) ();
#if ((defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER)) #if ((defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER))
typedef void (CLIB_ROUTINE * SIG_FPTR) (); typedef void (CLIB_ROUTINE * SIG_FPTR) ();
#else #else
#if (defined(DARWIN))
typedef void (*CLIB_ROUTINE SIG_FPTR) (int);
#else
typedef void (*CLIB_ROUTINE SIG_FPTR) (); typedef void (*CLIB_ROUTINE SIG_FPTR) ();
#endif #endif
#endif #endif
#endif
#ifdef DGUX #ifdef DGUX
#define GT_32_SIGNALS #define GT_32_SIGNALS
@ -320,6 +328,7 @@ extern int ib_fprintf();
extern int close(); extern int close();
#endif #endif
extern "C" {
void DLL_EXPORT ISC_enter(void) void DLL_EXPORT ISC_enter(void)
{ {
@ -354,6 +363,8 @@ void DLL_EXPORT ISC_enter(void)
#endif #endif
} }
} // extern "C"
#ifndef REQUESTER #ifndef REQUESTER
void DLL_EXPORT ISC_enable(void) void DLL_EXPORT ISC_enable(void)
@ -412,6 +423,7 @@ void DLL_EXPORT ISC_enable(void)
#endif #endif
extern "C" {
void DLL_EXPORT ISC_exit(void) void DLL_EXPORT ISC_exit(void)
{ {
/************************************** /**************************************
@ -435,6 +447,7 @@ void DLL_EXPORT ISC_exit(void)
ISC_signal_cancel(SIGFPE, (void (*)()) overflow_handler, 0); ISC_signal_cancel(SIGFPE, (void (*)()) overflow_handler, 0);
#endif #endif
} }
} // Extern "C"
#ifndef REQUESTER #ifndef REQUESTER

View File

@ -55,7 +55,7 @@ extern void *ISC_make_signal(BOOLEAN, BOOLEAN, int, int);
extern UCHAR *DLL_EXPORT ISC_map_file(STATUS *, extern UCHAR *DLL_EXPORT ISC_map_file(STATUS *,
TEXT *, TEXT *,
FPTR_VOID, void (*)(void *, struct sh_mem *, int),
void *, SLONG, struct sh_mem *); void *, SLONG, struct sh_mem *);
#ifndef NETWARE_386 #ifndef NETWARE_386
@ -79,6 +79,11 @@ void ISC_semaphore_close(ULONG);
void ISC_sync_init(void); void ISC_sync_init(void);
#endif #endif
#ifdef MMAP_SUPPORTED
extern UCHAR *ISC_map_object(STATUS *, SH_MEM, SLONG, SLONG);
extern BOOLEAN ISC_unmap_object(STATUS *, SH_MEM, UCHAR **, SLONG);
#endif
#ifdef SUPERSERVER #ifdef SUPERSERVER
#ifdef UNIX #ifdef UNIX
extern void ISC_exception_post(ULONG, TEXT *); extern void ISC_exception_post(ULONG, TEXT *);

View File

@ -68,9 +68,13 @@ typedef int (*CLIB_ROUTINE SIG_FPTR) ();
#if ((defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER)) #if ((defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER))
typedef void (CLIB_ROUTINE * SIG_FPTR) (); typedef void (CLIB_ROUTINE * SIG_FPTR) ();
#else #else
#if (defined(DARWIN))
typedef void (*CLIB_ROUTINE SIG_FPTR) (int);
#else
typedef void (*CLIB_ROUTINE SIG_FPTR) (); typedef void (*CLIB_ROUTINE SIG_FPTR) ();
#endif #endif
#endif #endif
#endif
#ifndef REQUESTER #ifndef REQUESTER
static USHORT inhibit_restart; static USHORT inhibit_restart;
@ -128,18 +132,6 @@ static UCHAR *next_shared_memory;
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
#define ISC_MUTEX &isc_mutex
#define ISC_EVENT &isc_condition
static struct mutex isc_mutex = MUTEX_INITIALIZER;
static struct condition isc_condition = CONDITION_INITIALIZER;
#endif // UNIX
#define FTOK_KEY 15 #define FTOK_KEY 15
#define PRIV 0666 #define PRIV 0666
#define LOCAL_SEMAPHORES 4 #define LOCAL_SEMAPHORES 4
@ -182,6 +174,10 @@ typedef int pid_t;
#define SEMUN #define SEMUN
#endif #endif
#ifdef DARWIN
#define SEMUN
#endif
#ifdef LINUX #ifdef LINUX
/* /*
* NOTE: this definition is copied from linux/sem.h: if we do ... * NOTE: this definition is copied from linux/sem.h: if we do ...
@ -272,7 +268,7 @@ static SLONG init_semaphores(STATUS *, SLONG, int);
static void longjmp_sig_handler(int); static void longjmp_sig_handler(int);
#endif // UNIX && SUPERSERVER #endif // UNIX && SUPERSERVER
static BOOLEAN semaphore_wait(int, int, int *); static BOOLEAN semaphore_wait_isc_sync(int, int, int *);
#ifdef NETWARE_386 #ifdef NETWARE_386
static void cleanup_semaphores(ULONG); static void cleanup_semaphores(ULONG);
@ -895,7 +891,7 @@ int ISC_event_wait(
#ifdef HP10 #ifdef HP10
if (micro_seconds > 0 && (ret == -1) && (errno == EAGAIN)) if (micro_seconds > 0 && (ret == -1) && (errno == EAGAIN))
#else #else
#ifdef linux #if (defined linux || defined DARWIN)
if (micro_seconds > 0 && (ret == ETIMEDOUT)) if (micro_seconds > 0 && (ret == ETIMEDOUT))
#else #else
if (micro_seconds > 0 && (ret == ETIME)) if (micro_seconds > 0 && (ret == ETIME))
@ -1095,7 +1091,7 @@ int ISC_event_wait(
EVENT * events, EVENT * events,
SLONG * values, SLONG * values,
SLONG micro_seconds, SLONG micro_seconds,
void (*timeout_handler) (), void *handler_arg) FPTR_VOID timeout_handler, void *handler_arg)
{ {
/************************************** /**************************************
* *
@ -1194,7 +1190,7 @@ int ISC_event_wait(
timeout_handler = alarm_handler; timeout_handler = alarm_handler;
ISC_set_timer(micro_seconds, timeout_handler, handler_arg, ISC_set_timer(micro_seconds, timeout_handler, handler_arg,
&user_timer, &user_handler); (SLONG*)&user_timer, (void**)&user_handler);
} }
/* Go into wait loop */ /* Go into wait loop */
@ -1206,9 +1202,9 @@ int ISC_event_wait(
ret = SUCCESS; ret = SUCCESS;
break; break;
} }
(void) semaphore_wait(count, semid, semnums); (void) semaphore_wait_isc_sync(count, semid, semnums);
if (micro_seconds > 0) { if (micro_seconds > 0) {
/* semaphore_wait() routine may return SUCCESS if our timeout /* semaphore_wait_isc_sync() routine may return SUCCESS if our timeout
handler poked the semaphore. So make sure that the event handler poked the semaphore. So make sure that the event
actually happened. If it didn't, indicate failure. */ actually happened. If it didn't, indicate failure. */
@ -1222,7 +1218,7 @@ int ISC_event_wait(
/* Cancel the handler. We only get here if a timeout was specified. */ /* Cancel the handler. We only get here if a timeout was specified. */
ISC_reset_timer(timeout_handler, handler_arg, &user_timer, &user_handler); ISC_reset_timer(timeout_handler, handler_arg, (SLONG*)&user_timer, (void**)&user_handler);
return ret; return ret;
#endif /* PIPE_IS_SHRLIB */ #endif /* PIPE_IS_SHRLIB */
@ -2655,7 +2651,7 @@ UCHAR *ISC_map_file(STATUS * status_vector,
/* Get an exclusive lock on the file until the initialization process /* Get an exclusive lock on the file until the initialization process
is complete. That way potential race conditions are avoided. */ is complete. That way potential race conditions are avoided. */
#ifndef sun #if !(defined sun || defined DARWIN)
if (lockf(ib_fileno(fp), F_LOCK, 0)) { if (lockf(ib_fileno(fp), F_LOCK, 0)) {
error(status_vector, "lockf", errno); error(status_vector, "lockf", errno);
#else #else
@ -4311,7 +4307,7 @@ UCHAR *DLL_EXPORT ISC_remap_file(STATUS * status_vector,
#if (defined UNIX) #if (defined UNIX)
void ISC_reset_timer( void ISC_reset_timer(
void (*timeout_handler) (), FPTR_VOID timeout_handler,
void *timeout_arg, void *timeout_arg,
SLONG * client_timer, void **client_handler) SLONG * client_timer, void **client_handler)
{ {
@ -4345,9 +4341,9 @@ void ISC_reset_timer(
#ifndef SIGACTION_SUPPORTED #ifndef SIGACTION_SUPPORTED
sigvector(SIGALRM, client_handler, NULL); sigvector(SIGALRM, client_handler, NULL);
#else #else
sigaction(SIGALRM, client_handler, NULL); sigaction(SIGALRM, (struct sigaction*)client_handler, NULL);
#endif #endif
setitimer(ITIMER_REAL, client_timer, NULL); setitimer(ITIMER_REAL, (itimerval*)client_timer, NULL);
#endif #endif
} }
#endif #endif
@ -4356,7 +4352,7 @@ void ISC_reset_timer(
#if (defined UNIX) #if (defined UNIX)
void ISC_set_timer( void ISC_set_timer(
SLONG micro_seconds, SLONG micro_seconds,
void (*timeout_handler) (), FPTR_VOID timeout_handler,
void *timeout_arg, void *timeout_arg,
SLONG * client_timer, void **client_handler) SLONG * client_timer, void **client_handler)
{ {
@ -4936,11 +4932,13 @@ static void make_object_name(
#ifdef UNIX #ifdef UNIX
static BOOLEAN semaphore_wait(int count, int semid, int *semnums) static BOOLEAN semaphore_wait_isc_sync(int count, int semid, int *semnums)
{ {
/************************************** /**************************************
* *
* s e m a p h o r e _ w a i t * s e m a p h o r e _ w a i t _ i s c _ s y n c
*
* (formerly known as: s e m a p h o r e _ w a i t)
* *
************************************** **************************************
* *

View File

@ -1288,7 +1288,7 @@ static position_and_read(journal, block, buffer, length)
SLONG position; SLONG position;
position = (SLONG) (block * BLOCK_SIZE); position = (SLONG) (block * BLOCK_SIZE);
n = lseek((int) journal->jrn_channel, position, 0); n = lseek((int) journal->jrn_channel, LSEEK_OFFSET_CAST position, 0);
if (n == -1) if (n == -1)
error(journal, errno, "lseek", isc_io_read_err); error(journal, errno, "lseek", isc_io_read_err);
@ -1366,7 +1366,7 @@ static position_and_write(journal, block, buffer, length)
int position, n; int position, n;
position = block * BLOCK_SIZE; position = block * BLOCK_SIZE;
n = lseek((int) journal->jrn_channel, position, 0); n = lseek((int) journal->jrn_channel, LSEEK_OFFSET_CAST position, 0);
if (n == -1) if (n == -1)
error(journal, errno, "lseek", isc_io_write_err); error(journal, errno, "lseek", isc_io_write_err);

View File

@ -601,7 +601,7 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status,
/* Initialize special error handling */ /* Initialize special error handling */
tdbb->tdbb_setjmp = (UCHAR *) env; tdbb->tdbb_setjmp = env;
tdbb->tdbb_status_vector = status = user_status; tdbb->tdbb_status_vector = status = user_status;
tdbb->tdbb_attachment = attachment = NULL; tdbb->tdbb_attachment = attachment = NULL;
tdbb->tdbb_request = NULL; tdbb->tdbb_request = NULL;
@ -625,7 +625,7 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status,
if (SETJMP(env)) if (SETJMP(env))
{ {
#ifdef _PPC_ #ifdef _PPC_
tdbb->tdbb_setjmp = (UCHAR *) env1; tdbb->tdbb_setjmp = env1;
if (!SETJMP(env1)) if (!SETJMP(env1))
#else #else
if (!SETJMP(env)) if (!SETJMP(env))
@ -821,6 +821,10 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status,
INI_update_database(); INI_update_database();
} }
/* Attachments to a ReadOnly database need NOT do garbage collection */
if (dbb->dbb_flags & DBB_read_only)
attachment->att_flags |= ATT_no_cleanup;
if (options.dpb_disable_wal) if (options.dpb_disable_wal)
{ {
ERR_post(gds_lock_timeout, gds_arg_gds, gds_obj_in_use, ERR_post(gds_lock_timeout, gds_arg_gds, gds_obj_in_use,
@ -1201,6 +1205,17 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status,
PAG_set_page_buffers(options.dpb_page_buffers); PAG_set_page_buffers(options.dpb_page_buffers);
} }
if (options.dpb_set_db_readonly)
{
if (!CCH_exclusive(tdbb, LCK_EX, WAIT_PERIOD))
{
ERR_post(gds_lock_timeout, gds_arg_gds, gds_obj_in_use,
gds_arg_string, ERR_string(file_name, fl), 0);
}
PAG_set_db_readonly(dbb, options.dpb_db_readonly);
}
#ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM #ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM
/* don't record the attach until now in case the log is added during the attach */ /* don't record the attach until now in case the log is added during the attach */
@ -2670,7 +2685,7 @@ STATUS DLL_EXPORT GDS_QUE_EVENTS(STATUS * user_status,
ATT * handle, ATT * handle,
SLONG * id, SLONG * id,
SSHORT length, SSHORT length,
UCHAR * items, void (*ast) (), void *arg) UCHAR * items, FPTR_VOID ast, void *arg)
{ {
/************************************** /**************************************
* *
@ -4640,7 +4655,7 @@ static STATUS error(STATUS * user_status)
dbb->dbb_use_count = 0; dbb->dbb_use_count = 0;
p = user_status; p = user_status;
*p++ = gds_arg_gds; *p++ = gds_arg_gds;
*p++ = gds__random; *p++ = gds_random;
*p++ = gds_arg_string; *p++ = gds_arg_string;
*p++ = (STATUS) "database use count set on error return"; *p++ = (STATUS) "database use count set on error return";
*p = gds_arg_end; *p = gds_arg_end;
@ -5059,6 +5074,11 @@ static void get_options(UCHAR* dpb,
options->dpb_set_db_sql_dialect = (USHORT) get_parameter(&p); options->dpb_set_db_sql_dialect = (USHORT) get_parameter(&p);
break; break;
case isc_dpb_set_db_readonly:
options->dpb_set_db_readonly = TRUE;
options->dpb_db_readonly = (SSHORT) get_parameter(&p);
break;
default: default:
l = *p++; l = *p++;
p += l; p += l;
@ -5572,7 +5592,7 @@ static STATUS return_success(TDBB tdbb)
dbb->dbb_use_count = 0; dbb->dbb_use_count = 0;
p = user_status; p = user_status;
*p++ = gds_arg_gds; *p++ = gds_arg_gds;
*p++ = gds__random; *p++ = gds_random;
*p++ = gds_arg_string; *p++ = gds_arg_string;
*p++ = (STATUS) "database use count set on success return"; *p++ = (STATUS) "database use count set on success return";
*p = gds_arg_end; *p = gds_arg_end;
@ -6217,4 +6237,4 @@ static void purge_attachment(TDBB tdbb,
} }
} }
} // extern "C" } // extern "C"

View File

@ -705,7 +705,7 @@ typedef struct tdbb
struct req* tdbb_request; struct req* tdbb_request;
struct plb* tdbb_default; struct plb* tdbb_default;
STATUS* tdbb_status_vector; STATUS* tdbb_status_vector;
UCHAR* tdbb_setjmp; void* tdbb_setjmp;
USHORT tdbb_inhibit; /* Inhibit context switch if non-zero */ USHORT tdbb_inhibit; /* Inhibit context switch if non-zero */
SSHORT tdbb_quantum; /* Cycles remaining until voluntary schedule */ SSHORT tdbb_quantum; /* Cycles remaining until voluntary schedule */
USHORT tdbb_flags; USHORT tdbb_flags;
@ -741,7 +741,7 @@ typedef struct ihndl
#ifdef MULTI_THREAD #ifdef MULTI_THREAD
#if (defined DECOSF || defined NETWARE_386 || \ #if (defined DECOSF || defined NETWARE_386 || \
defined SOLARIS_MT || defined WIN_NT || \ defined SOLARIS_MT || defined WIN_NT || \
defined HP10 || defined LINUX) defined HP10 || defined LINUX || defined DARWIN )
#define PLATFORM_GET_THREAD_DATA ((TDBB) THD_get_specific()) #define PLATFORM_GET_THREAD_DATA ((TDBB) THD_get_specific())
#endif #endif
#endif #endif

View File

@ -30,6 +30,10 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef UNIX #ifdef UNIX
#define UNIX_JOURNALLING #define UNIX_JOURNALLING
#define BSD_SOCKETS #define BSD_SOCKETS
@ -857,7 +861,7 @@ USHORT control_length, UCHAR * data, USHORT d_length, USHORT retry)
return ret_val; return ret_val;
} }
if (!connect((int) journal->jrn_channel, &address, sizeof(address))) if (!connect((int) journal->jrn_channel, (sockaddr*)&address, sizeof(address)))
break; break;
sleep(3); sleep(3);

View File

@ -41,6 +41,14 @@
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#include "../jrd/gdsassert.h" #include "../jrd/gdsassert.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef WIN_NT #ifdef WIN_NT
#include <process.h> #include <process.h>
#endif #endif

View File

@ -71,7 +71,7 @@ typedef struct lck {
struct blk *lck_compatible2; /* Sub-level for internal compatibility */ struct blk *lck_compatible2; /* Sub-level for internal compatibility */
struct att *lck_attachment; /* Attachment that owns lock */ struct att *lck_attachment; /* Attachment that owns lock */
struct btb *lck_blocked_threads; /* Threads blocked by lock */ struct btb *lck_blocked_threads; /* Threads blocked by lock */
int (*lck_ast)(); /* Blocking AST routine */ int (*lck_ast)(void*); /* Blocking AST routine */
SLONG lck_id; /* Lock id from lock manager */ SLONG lck_id; /* Lock id from lock manager */
SLONG lck_owner_handle; /* Lock owner handle from the lock manager's point of view */ SLONG lck_owner_handle; /* Lock owner handle from the lock manager's point of view */
USHORT lck_count; /* count of locks taken out by attachment */ USHORT lck_count; /* count of locks taken out by attachment */

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: license.h,v 1.1.1.1 2001-05-23 13:26:19 tamlin Exp $ * $Id: license.h,v 1.2 2001-07-12 05:46:05 bellardo Exp $
* Revision 1.5 2000/12/08 16:18:21 fsg * Revision 1.5 2000/12/08 16:18:21 fsg
* Preliminary changes to get IB_BUILD_NO automatically * Preliminary changes to get IB_BUILD_NO automatically
* increased on commits. * increased on commits.
@ -207,6 +207,11 @@
#define FB_PLATFORM "NB" /* NetBSD */ #define FB_PLATFORM "NB" /* NetBSD */
#endif #endif
#ifdef DARWIN
#define FB_PLATFORM "UP" /* Darwin/PowerPC */
#endif
#ifndef GDS_VERSION #ifndef GDS_VERSION
#define GDS_VERSION FB_PLATFORM "-" FB_BUILD_TYPE FB_MAJOR_VER "." FB_MINOR_VER "." FB_REV_NO "." FB_BUILD_NO " " FB_BUILD_SUFFIX #define GDS_VERSION FB_PLATFORM "-" FB_BUILD_TYPE FB_MAJOR_VER "." FB_MINOR_VER "." FB_REV_NO "." FB_BUILD_NO " " FB_BUILD_SUFFIX
#endif #endif

View File

@ -30,6 +30,18 @@
#include "../jrd/iberr_proto.h" #include "../jrd/iberr_proto.h"
#include "../jrd/llio_proto.h" #include "../jrd/llio_proto.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef NETWARE_386 #ifdef NETWARE_386
#include <fcntl.h> #include <fcntl.h>
#include <share.h> #include <share.h>
@ -617,7 +629,12 @@ int LLIO_seek(
whence = SEEK_END; whence = SEEK_END;
break; break;
} }
if (lseek((int) file_desc, offset, (int) whence) == -1) {
/* Darwin - Add the offset cast because the types are different
* between the implicit declaration and the actual declaration,
* causing problems with the stack frame, etc. Bad.
*/
if (lseek((int) file_desc, LSEEK_OFFSET_CAST offset, (int) whence) == -1) {
if (status_vector) if (status_vector)
io_error(status_vector, "lseek", filename, isc_io_access_err); io_error(status_vector, "lseek", filename, isc_io_access_err);
return FAILURE; return FAILURE;

View File

@ -47,6 +47,10 @@
#include "../jrd/pag_proto.h" #include "../jrd/pag_proto.h"
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
static int close_cur_file(OLD, USHORT); static int close_cur_file(OLD, USHORT);
static int create_file(OLD, SLONG *); static int create_file(OLD, SLONG *);
static void get_wal_offset(USHORT, ULONG *, ULONG *, USHORT); static void get_wal_offset(USHORT, ULONG *, ULONG *, USHORT);

View File

@ -109,6 +109,7 @@ static BOOLEAN find_type(SLONG, WIN *, PAG *, USHORT, USHORT, UCHAR **,
20 LINUX on sparc systems 20 LINUX on sparc systems
21 FreeBSD/i386 21 FreeBSD/i386
22 NetBSD/i386 22 NetBSD/i386
23 Darwin/PowerPC
*/ */
@ -235,6 +236,9 @@ static BOOLEAN find_type(SLONG, WIN *, PAG *, USHORT, USHORT, UCHAR **,
#define CLASS 22 #define CLASS 22
#endif #endif
#ifdef DARWIN
#define CLASS 23
#endif
int PAG_add_clump( int PAG_add_clump(
@ -2047,4 +2051,4 @@ static BOOLEAN find_type(
} }
} }
} // extern "C" } // extern "C"

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: par.cpp,v 1.1.1.1 2001-05-23 13:26:13 tamlin Exp $ $Id: par.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
@ -2057,9 +2057,9 @@ static NOD par_rse(TDBB tdbb, CSB * csb, SSHORT rse_op)
(rse->rse_count == 2 && rse->rse_boolean)) (rse->rse_count == 2 && rse->rse_boolean))
return (NOD) rse; return (NOD) rse;
} }
syntax_error(*csb, (rse_op == blr_rs_stream) ? syntax_error(*csb, (TEXT*)((rse_op == blr_rs_stream) ?
"rse stream clause" : "rse stream clause" :
"record selection expression clause"); "record selection expression clause"));
} }
} }

View File

@ -91,7 +91,7 @@ extern clock_t times();
#endif #endif
API_ROUTINE perf_format( API_ROUTINE int perf_format(
PERF * before, PERF * before,
PERF * after, PERF * after,
SCHAR * string, SCHAR * buffer, SSHORT * buf_len) SCHAR * string, SCHAR * buffer, SSHORT * buf_len)

View File

@ -95,6 +95,7 @@ typedef struct perf {
struct tms perf_times; struct tms perf_times;
} PERF; } PERF;
/* Letter codes controlling printing of statistics: /* Letter codes controlling printing of statistics:
!f - fetches !f - fetches
@ -112,10 +113,11 @@ typedef struct perf {
*/ */
#include "../jrd/perf_proto.h" #if defined(__cplusplus) && defined(NOTIME)
#ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */
#endif #endif
#include "../jrd/perf_proto.h"
#endif /* JRD_PERF_H */ #endif /* JRD_PERF_H */

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: pwd.cpp,v 1.1.1.1 2001-05-23 13:26:09 tamlin Exp $ $Id: pwd.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#include <string.h> #include <string.h>
@ -124,7 +124,7 @@ void PWD_get_user_dbpath(TEXT* path_buffer)
**************************************/ **************************************/
#pragma FB_COMPILER_MESSAGE("TMN: What wierdness is this?") #pragma FB_COMPILER_MESSAGE("TMN: What wierdness is this?")
#if (defined VMS || defined WIN_NT || defined LINUX || defined FREEBSD || defined NETBSD || defined SUPERSERVER || defined AIX_PPC) #if (defined VMS || defined WIN_NT || defined LINUX || defined FREEBSD || defined NETBSD || defined SUPERSERVER || defined AIX_PPC || defined DARWIN )
gds__prefix(path_buffer, USER_INFO_NAME); gds__prefix(path_buffer, USER_INFO_NAME);
#else #else
strcpy(path_buffer, USER_INFO_NAME); strcpy(path_buffer, USER_INFO_NAME);

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: pwd.h,v 1.1.1.1 2001-05-23 13:26:07 tamlin Exp $ $Id: pwd.h,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#ifndef _JRD_PWD_H_ #ifndef _JRD_PWD_H_
@ -51,6 +51,10 @@ $Id: pwd.h,v 1.1.1.1 2001-05-23 13:26:07 tamlin Exp $
#define USER_INFO_NAME "isc4.gdb" #define USER_INFO_NAME "isc4.gdb"
#endif #endif
#ifdef DARWIN
#define USER_INFO_NAME "isc4.gdb"
#endif
#ifdef AIX_PPC #ifdef AIX_PPC
#define USER_INFO_NAME "isc4.gdb" #define USER_INFO_NAME "isc4.gdb"
#endif #endif

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: rse.cpp,v 1.1.1.1 2001-05-23 13:26:16 tamlin Exp $ $Id: rse.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#include <errno.h> #include <errno.h>
@ -66,6 +66,10 @@ $Id: rse.cpp,v 1.1.1.1 2001-05-23 13:26:16 tamlin Exp $
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#include "../jrd/vio_proto.h" #include "../jrd/vio_proto.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if defined(WIN_NT) #if defined(WIN_NT)
#include <io.h> #include <io.h>
#endif #endif
@ -3101,7 +3105,7 @@ static void open_sort(TDBB tdbb, RSB rsb, IRSB_SORT impure)
map->smb_length, map->smb_length,
map->smb_keys, map->smb_keys,
map->smb_key_desc, map->smb_key_desc,
reinterpret_cast < UCHAR(*)() > reinterpret_cast < BOOLEAN(*)() >
((map->smb_flags & SMB_project) ? reject : NULL), 0, ((map->smb_flags & SMB_project) ? reject : NULL), 0,
tdbb->tdbb_attachment); tdbb->tdbb_attachment);

View File

@ -25,6 +25,7 @@
#define _JRD_SBM_PROTO_H_ #define _JRD_SBM_PROTO_H_
#include "../jrd/sbm.h" #include "../jrd/sbm.h"
#include "../jrd/rse.h"
#ifdef DEV_BUILD #ifdef DEV_BUILD
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: sort.cpp,v 1.1.1.1 2001-05-23 13:26:21 tamlin Exp $ * $Id: sort.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#include <errno.h> #include <errno.h>
@ -42,6 +42,18 @@
#include "../jrd/all_proto.h" #include "../jrd/all_proto.h"
#include "../jrd/sch_proto.h" #include "../jrd/sch_proto.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef SOLARIS #ifdef SOLARIS
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
#endif #endif
@ -936,7 +948,7 @@ ULONG SORT_read_block(
while (length) { while (length) {
len = MIN(length, 32768); len = MIN(length, 32768);
for (i = 0; i < IO_RETRY; i++) { for (i = 0; i < IO_RETRY; i++) {
if (lseek(sfb->sfb_file, seek, SEEK_SET) == -1) { if (lseek(sfb->sfb_file, LSEEK_OFFSET_CAST seek, SEEK_SET) == -1) {
THREAD_ENTER; THREAD_ENTER;
SORT_error(status_vector, sfb, "lseek", isc_io_read_err, SORT_error(status_vector, sfb, "lseek", isc_io_read_err,
errno); errno);
@ -1228,7 +1240,7 @@ ULONG SORT_write_block(STATUS * status_vector,
while (length) { while (length) {
len = MIN(length, 32768); len = MIN(length, 32768);
for (i = 0; i < IO_RETRY; i++) { for (i = 0; i < IO_RETRY; i++) {
if (lseek(sfb->sfb_file, seek, SEEK_SET) == -1) { if (lseek(sfb->sfb_file, LSEEK_OFFSET_CAST seek, SEEK_SET) == -1) {
THREAD_ENTER; THREAD_ENTER;
SORT_error(status_vector, sfb, "lseek", isc_io_write_err, SORT_error(status_vector, sfb, "lseek", isc_io_write_err,
errno); errno);
@ -1370,7 +1382,7 @@ static void diddle_key(UCHAR * record, SCB scb, USHORT direction)
fill_char = (key->skd_flags & SKD_binary) ? 0 : ASCII_SPACE; fill_char = (key->skd_flags & SKD_binary) ? 0 : ASCII_SPACE;
if (!(scb->scb_flags & scb_sorted)) { if (!(scb->scb_flags & scb_sorted)) {
*((USHORT *) (record + key->skd_vary_offset)) = l = *((USHORT *) (record + key->skd_vary_offset)) = l =
strlen(p); strlen((char*)p);
fill_pos = p + l; fill_pos = p + l;
fill = n - l; fill = n - l;
if (fill) if (fill)
@ -2717,7 +2729,7 @@ static ULONG order(SCB scb)
if (((SORTP *) output) + scb->scb_longs - 1 <= (SORTP *) lower_limit) { if (((SORTP *) output) + scb->scb_longs - 1 <= (SORTP *) lower_limit) {
/* null the bckptr for this record */ /* null the bckptr for this record */
record->sr_bckptr = record->sr_bckptr =
reinterpret_cast < sort_record ** >((struct SR **) NULL); reinterpret_cast < sort_record ** >((SR **) NULL);
MOVE_32(length, record->sr_sort_record.sort_record_key, output); MOVE_32(length, record->sr_sort_record.sort_record_key, output);
output = output =
reinterpret_cast < sort_record * >((SORTP *) output + length); reinterpret_cast < sort_record * >((SORTP *) output + length);

View File

@ -55,6 +55,18 @@
#include "../jrd/jrd_proto.h" #include "../jrd/jrd_proto.h"
#endif #endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef sparc #ifdef sparc
#ifdef SOLARIS #ifdef SOLARIS
#include <fcntl.h> #include <fcntl.h>
@ -302,7 +314,7 @@ typedef CONST void (*PFN_SERV_t) ();
static const serv services[] = static const serv services[] =
{ {
#if !defined(LINUX) && !(defined FREEBSD || defined NETBSD) #if !(defined LINUX || defined FREEBSD || defined NETBSD)
#ifndef NETWARE386 #ifndef NETWARE386
#ifdef WIN_NT #ifdef WIN_NT
isc_action_max, "print_cache", "-svc", "bin/ibcachpr", NULL, 0, isc_action_max, "print_cache", "-svc", "bin/ibcachpr", NULL, 0,
@ -489,7 +501,7 @@ SVC SVC_attach(
/* Find the service by looking for an exact match. */ /* Find the service by looking for an exact match. */
for (serv = services; serv->serv_name; serv++) for (serv = (struct serv*)services; serv->serv_name; serv++)
if (!strcmp(misc_buf, serv->serv_name)) if (!strcmp(misc_buf, serv->serv_name))
break; break;
@ -1851,7 +1863,7 @@ void *SVC_start(SVC service, USHORT spb_length, SCHAR * spb)
/* The name of the service is the first element of the buffer */ /* The name of the service is the first element of the buffer */
svc_id = *spb; svc_id = *spb;
for (serv = services; serv->serv_action; serv++) for (serv = (struct serv*)services; serv->serv_action; serv++)
if (serv->serv_action == svc_id) if (serv->serv_action == svc_id)
break; break;
@ -3206,8 +3218,8 @@ static void service_get(
buf = buffer; buf = buffer;
if (timeout) { if (timeout) {
ISC_set_timer((SLONG) (timeout * 100000), timeout_handler, service, ISC_set_timer((SLONG) (timeout * 100000), (void(*)())timeout_handler, service,
&sv_timr, &sv_hndlr); (SLONG*)&sv_timr, (void**)&sv_hndlr);
iter = timeout * 10; iter = timeout * 10;
} }
@ -3231,15 +3243,15 @@ static void service_get(
else { else {
errno_save = errno; errno_save = errno;
if (timeout) if (timeout)
ISC_reset_timer(timeout_handler, service, &sv_timr, ISC_reset_timer((void(*)())timeout_handler, service, (SLONG*)&sv_timr,
&sv_hndlr); (void**)&sv_hndlr);
io_error("ib_getc", errno_save, "service pipe", isc_io_read_err, io_error("ib_getc", errno_save, "service pipe", isc_io_read_err,
TRUE); TRUE);
} }
} }
if (timeout) { if (timeout) {
ISC_reset_timer(timeout_handler, service, &sv_timr, &sv_hndlr); ISC_reset_timer((void(*)())timeout_handler, service, (SLONG*)&sv_timr, (void**)&sv_hndlr);
if (!iter) if (!iter)
service->svc_flags |= SVC_timeout; service->svc_flags |= SVC_timeout;
} }

View File

@ -1661,9 +1661,10 @@ void THD_yield(void)
discovered it was redundant with sched_yield() and dropped it. discovered it was redundant with sched_yield() and dropped it.
So, just use sched_yield() instead. POSIX systems on which So, just use sched_yield() instead. POSIX systems on which
sched_yield() is available define _POSIX_PRIORITY_SCHEDULING sched_yield() is available define _POSIX_PRIORITY_SCHEDULING
in <unistd.h>. in <unistd.h>. Darwin defined _POSIX_THREAD_PRIORITY_SCHEDULING
instead of _POSIX_PRIORITY_SCHEDULING.
*/ */
#ifdef _POSIX_PRIORITY_SCHEDULING #if (defined _POSIX_PRIORITY_SCHEDULING || defined _POSIX_THREAD_PRIORITY_SCHEDULING)
sched_yield(); sched_yield();
#else #else
pthread_yield(); pthread_yield();

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: thd.h,v 1.1.1.1 2001-05-23 13:26:19 tamlin Exp $ $Id: thd.h,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#ifndef _JRD_THD_H_ #ifndef _JRD_THD_H_
@ -58,6 +58,11 @@ $Id: thd.h,v 1.1.1.1 2001-05-23 13:26:19 tamlin Exp $
#define MULTI_THREAD 1 #define MULTI_THREAD 1
#endif #endif
#if (defined(DARWIN) && defined(SUPERSERVER))
#define POSIX_THREADS 1
#define MULTI_THREAD 1
#endif
#ifdef VMS #ifdef VMS
#ifndef GATEWAY #ifndef GATEWAY
#define MULTI_THREAD 1 #define MULTI_THREAD 1

View File

@ -62,7 +62,7 @@
#endif #endif
#if defined(_AIX) || defined(IMP) || defined(DELTA) || defined(sgi) || \ #if defined(_AIX) || defined(IMP) || defined(DELTA) || defined(sgi) || \
defined(MAC) || defined(M_I386) defined(MAC) || defined(M_I386) || defined(DARWIN)
#include <time.h> #include <time.h>
#endif #endif

View File

@ -42,6 +42,10 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_UNISTD_
#include <unistd.h>
#endif
#include "../jrd/jrd.h" #include "../jrd/jrd.h"
#include "../jrd/pio.h" #include "../jrd/pio.h"
#include "../jrd/ods.h" #include "../jrd/ods.h"
@ -449,7 +453,7 @@ void PIO_header(DBB dbb, SCHAR * address, int length)
#ifndef PREAD_PWRITE #ifndef PREAD_PWRITE
THD_MUTEX_LOCK(file->fil_mutex); THD_MUTEX_LOCK(file->fil_mutex);
if ((lseek(file->fil_desc, 0, 0)) == -1) { if ((lseek(file->fil_desc, LSEEK_OFFSET_CAST 0, 0)) == -1) {
THD_MUTEX_UNLOCK(file->fil_mutex); THD_MUTEX_UNLOCK(file->fil_mutex);
unix_error("lseek", file, isc_io_read_err, 0); unix_error("lseek", file, isc_io_read_err, 0);
} }
@ -934,7 +938,7 @@ static FIL seek_file(
#else #else
THD_MUTEX_LOCK(file->fil_mutex); THD_MUTEX_LOCK(file->fil_mutex);
if ((lseek(file->fil_desc, (SLONG) (page * dbb->dbb_page_size), 0)) == -1) { if ((lseek(file->fil_desc, LSEEK_OFFSET_CAST (page * dbb->dbb_page_size), 0)) == -1) {
THD_MUTEX_UNLOCK(file->fil_mutex); THD_MUTEX_UNLOCK(file->fil_mutex);
return (FIL) unix_error("lseek", file, isc_io_access_err, return (FIL) unix_error("lseek", file, isc_io_access_err,
status_vector); status_vector);
@ -1006,7 +1010,7 @@ static FIL setup_file(
lock->lck_object = (BLK) dbb; lock->lck_object = (BLK) dbb;
lock->lck_length = l; lock->lck_length = l;
lock->lck_dbb = dbb; lock->lck_dbb = dbb;
lock->lck_ast = CCH_down_grade_dbb; lock->lck_ast = (int (*)(void*)) CCH_down_grade_dbb;
MOVE_FAST(lock_string, lock->lck_key.lck_string, l); MOVE_FAST(lock_string, lock->lck_key.lck_string, l);
/* Try to get an exclusive lock on database. If this fails, insist /* Try to get an exclusive lock on database. If this fails, insist
@ -1149,4 +1153,4 @@ static SLONG pwrite(int fd, SCHAR * buf, SLONG nbytes, SLONG offset)
#endif /* defined PREAD_PWRITE && ! (defined SOLARIS_MT || LINUX) */ #endif /* defined PREAD_PWRITE && ! (defined SOLARIS_MT || LINUX) */
} // extern "C" } // extern "C"

View File

@ -43,6 +43,10 @@
#include "../jrd/blb_proto.h" #include "../jrd/blb_proto.h"
#endif #endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef VMS #ifdef VMS
#include <file.h> #include <file.h>
#include <ib_perror.h> #include <ib_perror.h>
@ -245,7 +249,8 @@ static const TEXT *const impl_class[] = {
"InterBase/SCO_SV Intel", /* 59 *//* 5.5 SCO Port */ "InterBase/SCO_SV Intel", /* 59 *//* 5.5 SCO Port */
"InterBase/linux Intel", /* 60 */ "InterBase/linux Intel", /* 60 */
"InterBase/FreeBSD/i386", /* 61 */ "InterBase/FreeBSD/i386", /* 61 */
"InterBase/NetBSD/i386" /* 62 */ "InterBase/NetBSD/i386", /* 62 */
"Firebird/Darwin/PowerPC" /* 63 */
}; };
@ -1196,7 +1201,7 @@ void API_ROUTINE isc_set_single_user(
int API_ROUTINE gds__version( int API_ROUTINE gds__version(
void **handle, void **handle,
void (*routine) (), void *user_arg) FPTR_VOID routine, void *user_arg)
{ {
/************************************** /**************************************
* *
@ -1217,8 +1222,8 @@ int API_ROUTINE gds__version(
BOOLEAN redo; BOOLEAN redo;
if (!routine) { if (!routine) {
routine = (void (*)()) ib_printf; routine = (FPTR_VOID) ib_printf;
user_arg = "\t%s\n"; user_arg = (void*)"\t%s\n";
} }
buf = buffer; buf = buffer;

View File

@ -1907,8 +1907,8 @@ static RTN walk_relation(TDBB tdbb, VDR control, REL relation)
TEXT s[64], *msg; TEXT s[64], *msg;
tdbb->tdbb_setjmp = (UCHAR *) old_env; tdbb->tdbb_setjmp = (UCHAR *) old_env;
msg = (relation->rel_name) ? msg = (relation->rel_name) ?
"bugcheck during scan of table %d (%s)" : (TEXT*)"bugcheck during scan of table %d (%s)" :
"bugcheck during scan of table %d"; (TEXT*)"bugcheck during scan of table %d";
sprintf(s, msg, relation->rel_id, relation->rel_name); sprintf(s, msg, relation->rel_id, relation->rel_name);
gds__log(s); gds__log(s);
#ifdef VAL_VERBOSE #ifdef VAL_VERBOSE

View File

@ -32,6 +32,6 @@
#define DEBUG_TRACE_ALL 7 #define DEBUG_TRACE_ALL 7
#define DEBUG_TRACE_ALL_INFO 8 #define DEBUG_TRACE_ALL_INFO 8
static debug_flag; static int debug_flag;
#endif /* _JRD_VIO_DEBUG_H_ */ #endif /* _JRD_VIO_DEBUG_H_ */

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: why.c,v 1.1.1.1 2001-05-23 13:26:06 tamlin Exp $ $Id: why.c,v 1.2 2001-07-12 05:46:05 bellardo Exp $
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -484,7 +484,7 @@ static CONST_IMAGE IMAGE images[] =
#endif #endif
#if (defined UNIX) && \ #if (defined UNIX) && \
!(defined SUPERCLIENT || defined SUPERSERVER || defined DECOSF || defined NCR3000 || defined DG_X86 || defined linux || defined FREEBSD || defined NETBSD || defined AIX_PPC /* platforms without a V3 bridge */) !(defined SUPERCLIENT || defined SUPERSERVER || defined DECOSF || defined NCR3000 || defined DG_X86 || defined linux || defined FREEBSD || defined NETBSD || defined AIX_PPC || defined DARWIN /* platforms without a V3 bridge */)
#ifndef PIPE_SERVER_YVALUE #ifndef PIPE_SERVER_YVALUE
#define PIPE_BRIDGE_TO_V3 #define PIPE_BRIDGE_TO_V3
#endif #endif
@ -5812,8 +5812,11 @@ static STATUS open_marker_file(STATUS * status,
} }
/* Place an advisory lock on the marker file. */ /* Place an advisory lock on the marker file. */
#ifdef DARWIN
if (flock(fd, LOCK_EX ) != -1) {
#else
if (lockf(fd, F_TLOCK, 0) != -1) { if (lockf(fd, F_TLOCK, 0) != -1) {
#endif
size = sizeof(marker_contents); size = sizeof(marker_contents);
for (j = 0; j < IO_RETRY; j++) { for (j = 0; j < IO_RETRY; j++) {
if ((bytes = read(fd, marker_contents, size)) != -1) if ((bytes = read(fd, marker_contents, size)) != -1)
@ -5835,7 +5838,7 @@ static STATUS open_marker_file(STATUS * status,
strcpy(single_user, "YES"); strcpy(single_user, "YES");
size = strlen(fildes_str); size = strlen(fildes_str);
for (j = 0; j < IO_RETRY; j++) { for (j = 0; j < IO_RETRY; j++) {
if (lseek(fd, 0L, SEEK_END) == -1) { if (lseek(fd, LSEEK_OFFSET_CAST 0L, SEEK_END) == -1) {
err_routine = "lseek"; err_routine = "lseek";
close(fd); close(fd);
fd = -1; fd = -1;

Some files were not shown because too many files have changed in this diff Show More