diff --git a/src/alice/alice.cpp b/src/alice/alice.cpp index e02093ab1f..e4846c6d4f 100644 --- a/src/alice/alice.cpp +++ b/src/alice/alice.cpp @@ -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" // conditionals, as the engine now fully supports @@ -54,6 +54,10 @@ #include "../jrd/svc_proto.h" #include "../jrd/thd_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef SUPERSERVER #include "../utilities/cmd_util_proto.h" #endif @@ -707,7 +711,7 @@ static void alice_output(CONST SCHAR * format, ...) if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') { exit_code = tdgbl->output_proc(tdgbl->output_data, - reinterpret_cast < UCHAR * >("")); + (UCHAR *)("")); } else if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) { VA_START(arglist, format); @@ -715,7 +719,7 @@ static void alice_output(CONST SCHAR * format, ...) va_end(arglist); exit_code = tdgbl->output_proc(tdgbl->output_data, - reinterpret_cast < UCHAR * >("")); + (UCHAR *)("")); } else { VA_START(arglist, format); @@ -742,4 +746,4 @@ static void expand_filename(TEXT * filename, TEXT * expanded_name) } -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/alice/alice.h b/src/alice/alice.h index af0032f513..34dba90612 100644 --- a/src/alice/alice.h +++ b/src/alice/alice.h @@ -212,7 +212,7 @@ extern struct tgbl *gdgbl; #if defined(__cplusplus) #define EXIT(code) { tdgbl->exit_code = (code); \ if (tdgbl->alice_env != NULL) \ - LONGJMP(reinterpret_cast(const_cast(tdgbl->alice_env)), 1); } + LONGJMP((jmp_buf)(tdgbl->alice_env), 1); } #else #define EXIT(code) { tdgbl->exit_code = (code); \ if (tdgbl->alice_env != NULL) \ diff --git a/src/burp/burp.cpp b/src/burp/burp.cpp index 6c23fcebc5..4c71dd5dec 100644 --- a/src/burp/burp.cpp +++ b/src/burp/burp.cpp @@ -66,6 +66,10 @@ #include "../jrd/why_proto.h" #include "../jrd/gdsassert.h" +#ifdef HAVE_CTYPE_H +#include +#endif + #ifdef SUPERSERVER #include "../utilities/cmd_util_proto.h" #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; in_sw_tab++) 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); } @@ -979,7 +983,7 @@ int DLL_EXPORT BURP_gbak(int argc, break; 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; break; @@ -1559,7 +1563,7 @@ static SSHORT open_files(TEXT * file1, BURP_print(139, file1, 0, 0, 0, 0); isc_version(&tdgbl->db_handle, reinterpret_cast(BURP_output_version), - "\t%s\n"); + (void*) "\t%s\n"); } if (sw_verbose) 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 signal(SIGPIPE, SIG_IGN); #endif - fil->fil_fd = reinterpret_cast(GBAK_STDOUT_DESC); + fil->fil_fd = reinterpret_cast(GBAK_STDOUT_DESC); break; } else @@ -1745,7 +1749,7 @@ static SSHORT open_files(TEXT * file1, tdgbl->action->act_action = ACT_restore; if (!strcmp(fil->fil_name, "stdin")) { - fil->fil_fd = reinterpret_cast(GBAK_STDIN_DESC); + fil->fil_fd = reinterpret_cast(GBAK_STDIN_DESC); tdgbl->file_desc = fil->fil_fd; 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') { exit_code = tdgbl->output_proc(tdgbl->output_data, - reinterpret_cast("")); + (UCHAR*)("")); } else if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) { VA_START(arglist, format); @@ -1944,7 +1948,7 @@ static void burp_output( CONST SCHAR * format, ...) va_end(arglist); exit_code = tdgbl->output_proc(tdgbl->output_data, - reinterpret_cast("")); + (UCHAR*)("")); } else { VA_START(arglist, format); @@ -2252,4 +2256,4 @@ static int api_gbak(int argc, #endif // !SUPERSERVER -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/burp/burp.h b/src/burp/burp.h index 79008a2171..d0e476775f 100644 --- a/src/burp/burp.h +++ b/src/burp/burp.h @@ -33,6 +33,10 @@ #include "../jrd/gds_proto.h" #include "../jrd/thd.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -858,9 +862,10 @@ extern struct tgbl *gdgbl; #endif #if defined(__cplusplus) +// I had funnies with this cast #define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \ if (tdgbl->burp_env != NULL) \ - LONGJMP(reinterpret_cast(const_cast(tdgbl->burp_env)), 1); } + LONGJMP((jmp_buf)(const_cast(tdgbl->burp_env)), 1); } #else #define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \ if (tdgbl->burp_env != NULL) \ diff --git a/src/burp/mvol.cpp b/src/burp/mvol.cpp index 7918eabd70..3963810fa6 100644 --- a/src/burp/mvol.cpp +++ b/src/burp/mvol.cpp @@ -262,7 +262,7 @@ void MVOL_init_write(UCHAR* database_name, BURP_error(269, tdgbl->action->act_file->fil_name, 0, 0, 0, 0); /* msg 269 can't write a header record to file %s */ } - tdgbl->file_desc = next_volume(tdgbl->file_desc, MODE_WRITE, FALSE); + tdgbl->file_desc = (DESC) next_volume(tdgbl->file_desc, MODE_WRITE, FALSE); } 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) { - 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) { break; @@ -678,7 +678,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr) else full_buffer = FALSE; 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) { 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->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 */ diff --git a/src/burp/spit.cpp b/src/burp/spit.cpp index 519f808176..a970f7db5b 100644 --- a/src/burp/spit.cpp +++ b/src/burp/spit.cpp @@ -40,6 +40,10 @@ #include "../burp/spit.h" #include "../burp/burpswi.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef WIN_NT #include /* usage of non-ANSI open/read/write/close functions */ #endif diff --git a/src/dsql/ddl.cpp b/src/dsql/ddl.cpp index 95ac029f8e..b63de6c10c 100644 --- a/src/dsql/ddl.cpp +++ b/src/dsql/ddl.cpp @@ -20,7 +20,7 @@ * All Rights Reserved. * 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, * 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, reinterpret_cast(field->fld_sub_type_name), - reinterpret_cast < UCHAR * >("RDB$FIELD_SUB_TYPE"), + (UCHAR *)("RDB$FIELD_SUB_TYPE"), &blob_sub_type)) { ERRD_post( gds__sqlerr, @@ -1213,7 +1213,7 @@ TEXT * prim_rel_name, TEXT * for_rel_name) return; /* 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); 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; /* 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); 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); /* 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); 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); /* 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); 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_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])) return *p; @@ -5525,4 +5525,4 @@ static void set_nod_value_attributes( NOD node, FLD field) } -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/dsql/dsql.cpp b/src/dsql/dsql.cpp index 4baa22ab62..12cf1ab4cc 100644 --- a/src/dsql/dsql.cpp +++ b/src/dsql/dsql.cpp @@ -24,7 +24,7 @@ * 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. @@ -3150,7 +3150,7 @@ static void map_in_out( REQ request, flag = NULL; if ((null = parameter->par_null) != NULL) { - null_offset = reinterpret_cast(null->par_user_desc.dsc_address); + null_offset = (USHORT)(null->par_user_desc.dsc_address); length = null_offset + sizeof(SSHORT); if (length > msg_length) break; @@ -3959,4 +3959,4 @@ static SCHAR *var_info( } -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/dsql/errd.cpp b/src/dsql/errd.cpp index 54330d451d..435f979ba2 100644 --- a/src/dsql/errd.cpp +++ b/src/dsql/errd.cpp @@ -24,7 +24,9 @@ #include "../jrd/ib_stdio.h" #include #include "../jrd/common.h" +#ifdef HAVE_STDARG_H #include +#endif #include "../dsql/dsql.h" #include "../dsql/sqlda.h" diff --git a/src/dsql/node.h b/src/dsql/node.h index 43ee7dc4f2..3e434cf8c4 100644 --- a/src/dsql/node.h +++ b/src/dsql/node.h @@ -24,6 +24,8 @@ #ifndef _DSQL_NODE_H_ #define _DSQL_NODE_H_ +#include "../dsql/dsql.h" + /* an enumeration of the possible node types in a syntax tree */ typedef ENUM nod_t diff --git a/src/dsql/parse.sed b/src/dsql/parse.sed index e483dfd676..72c70733ef 100644 --- a/src/dsql/parse.sed +++ b/src/dsql/parse.sed @@ -17,6 +17,9 @@ s/yychar/DSQL_yychar/g s/yyerrflag/DSQL_yyerrflag/g s/yyparse/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 s/^static TOK tokens/static CONST TOK FAR_VARIABLE tokens/ s/^__YYSCLASS yytabelem/__YYSCLASS CONST yytabelem FAR_VARIABLE/ @@ -26,6 +29,7 @@ s/^#include * *$//g s/yylex(void)/yylex(USHORT, USHORT, USHORT, BOOLEAN *)/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 __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()/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 diff --git a/src/dsql/parse.y b/src/dsql/parse.y index a13e22a64e..289deba7c0 100644 --- a/src/dsql/parse.y +++ b/src/dsql/parse.y @@ -28,7 +28,7 @@ #include "../jrd/common.h" #include -#include "../jrd/iberror.h" +#include "../include/iberror.h" #include "../dsql/dsql.h" #include "../dsql/node.h" #include "../dsql/sym.h" @@ -46,6 +46,8 @@ #include "../wal/wal.h" #endif +extern "C" TEXT *DLL_EXPORT ERR_string(CONST TEXT*, int); + ASSERT_FILENAME static void yyerror (TEXT *); @@ -1854,13 +1856,13 @@ non_charset_simple_type : national_character_type | TIME { 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_number, client_dialect, gds_arg_string, "TIME", 0); 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_number, db_dialect, gds_arg_string, "TIME", @@ -2037,7 +2039,7 @@ prec_scale : (db_dialect > SQL_DIALECT_V5) ) || ( (client_dialect > SQL_DIALECT_V5) && (db_dialect <= SQL_DIALECT_V5) ) ) - ERRD_post (gds__sqlerr, + ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -817, gds_arg_gds, isc_ddl_not_allowed_by_db_sql_dial, @@ -2094,7 +2096,7 @@ prec_scale : (db_dialect > SQL_DIALECT_V5) ) || ( (client_dialect > SQL_DIALECT_V5) && (db_dialect <= SQL_DIALECT_V5) ) ) - ERRD_post (gds__sqlerr, + ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -817, gds_arg_gds, isc_ddl_not_allowed_by_db_sql_dial, @@ -2989,13 +2991,13 @@ value : column_name datetime_value_expression : CURRENT_DATE { 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_number, client_dialect, gds_arg_string, "DATE", 0); 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_number, db_dialect, gds_arg_string, "DATE", @@ -3005,13 +3007,13 @@ datetime_value_expression : CURRENT_DATE | CURRENT_TIME { 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_number, client_dialect, gds_arg_string, "TIME", 0); 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_number, db_dialect, gds_arg_string, "TIME", @@ -3054,13 +3056,13 @@ u_constant : u_numeric_constant | DATE STRING { 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_number, client_dialect, gds_arg_string, "DATE", 0); 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_number, db_dialect, gds_arg_string, "DATE", @@ -3070,13 +3072,13 @@ u_constant : u_numeric_constant | TIME STRING { 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_number, client_dialect, gds_arg_string, "TIME", 0); 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_number, db_dialect, gds_arg_string, "TIME", @@ -3400,7 +3402,7 @@ for (token = tokens; token->tok_string; ++token) symbol->sym_version = token->tok_version; str = (STR) ALLOCPV (type_str, 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; HSHD_insert (symbol); } @@ -3838,7 +3840,7 @@ static int yylex ( * 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; SSHORT c; USHORT buffer_len; @@ -3883,21 +3885,21 @@ for (;;) } #if (! ( defined JPN_SJIS || defined JPN_EUC) ) - class = classes [c]; + tok_class = classes [c]; #else 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 */ - if (!(class & CHR_WHITE)) + if (!(tok_class & CHR_WHITE)) break; } -/* Depending on class of token, parse token */ +/* Depending on tok_class of token, parse token */ last_token = ptr - 1; -if (class & CHR_INTRODUCER) +if (tok_class & CHR_INTRODUCER) { /* The Introducer (_) is skipped, all other idents are copied * 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 */ -if (class & CHR_QUOTE) +if (tok_class & CHR_QUOTE) { buffer = string; buffer_len = sizeof (string); @@ -4021,7 +4023,7 @@ if (class & CHR_QUOTE) assert(ptr <= end); -if ((class & CHR_DIGIT) || +if ((tok_class & CHR_DIGIT) || ((c == '.') && (ptr < end) && (classes [*ptr] & CHR_DIGIT))) { /* The following variables are used to recognize kinds of numbers. */ @@ -4168,12 +4170,12 @@ if ((class & CHR_DIGIT) || attempt to recognize a number. */ ptr = last_token; 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 */ -if (class & CHR_LETTER) +if (tok_class & CHR_LETTER) { #if (! ( defined JPN_SJIS || defined JPN_EUC) ) p = string; @@ -4269,17 +4271,17 @@ static void yyerror ( **************************************/ if (yychar < 1) - ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, - gds_arg_gds, gds__command_end_err, /* Unexpected end of command */ + ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104, + gds_arg_gds, gds_command_end_err, /* Unexpected end of command */ 0); else { - ERRD_post (gds__sqlerr, gds_arg_number, (SLONG) -104, - gds_arg_gds, gds__dsql_token_unk_err, + ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104, + gds_arg_gds, gds_dsql_token_unk_err, gds_arg_number, (SLONG) lines, gds_arg_number, (SLONG) (last_token - line_start), /* 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, 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); } diff --git a/src/dudley/ddl.cpp b/src/dudley/ddl.cpp index 87c74f9ba7..1837091765 100644 --- a/src/dudley/ddl.cpp +++ b/src/dudley/ddl.cpp @@ -39,6 +39,10 @@ #include "../jrd/gds_proto.h" #include "../jrd/why_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #if defined(WIN_NT) #include #endif @@ -483,7 +487,7 @@ UCHAR *DDL_alloc(register int size) **************************************/ register UCHAR *block, *p; - p = block = gds__alloc((SLONG) size); + p = block = (UCHAR*) gds__alloc((SLONG) size); #ifdef DEBUG_GDS_ALLOC /* For V4.0 we don't care about gdef specific memory leaks */ diff --git a/src/dudley/expand.cpp b/src/dudley/expand.cpp index cc59c2d5ec..f7f3571631 100644 --- a/src/dudley/expand.cpp +++ b/src/dudley/expand.cpp @@ -55,7 +55,7 @@ static GDS__QUAD null_blob; static LLS request_context; 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 MOVE_SYMBOL(symbol, field) move_symbol (symbol, field, sizeof (field)) @@ -109,12 +109,12 @@ static void expand_action( ACT action) switch (action->act_type) { case act_a_field: - expand_field(action->act_object); + expand_field((FLD) action->act_object); break; case act_m_field: case act_d_field: - lookup_field(action->act_object); + lookup_field((FLD) action->act_object); break; case act_d_filter: @@ -130,41 +130,41 @@ static void expand_action( ACT action) */ break; case act_a_gfield: - expand_global_field(action->act_object); + expand_global_field((FLD) action->act_object); break; case act_m_gfield: - lookup_global_field(action->act_object); - expand_global_field(action->act_object); + lookup_global_field((FLD) action->act_object); + expand_global_field((FLD) action->act_object); break; case act_d_gfield: - lookup_global_field(action->act_object); + lookup_global_field((FLD) action->act_object); break; case act_a_index: - expand_index(action->act_object); + expand_index((ACT) action->act_object); break; case act_m_relation: - lookup_relation(action->act_object); + lookup_relation((REL) action->act_object); case act_a_relation: - expand_relation(action->act_object); + expand_relation((REL) action->act_object); break; case act_d_relation: - lookup_relation(action->act_object); + lookup_relation((REL) action->act_object); break; case act_d_trigger: - lookup_trigger(action->act_object); + lookup_trigger((TRG) action->act_object); break; case act_m_trigger: - lookup_trigger(action->act_object); + lookup_trigger((TRG) action->act_object); case act_a_trigger: - expand_trigger(action->act_object); + expand_trigger((TRG) action->act_object); break; case act_c_database: @@ -359,12 +359,12 @@ static void expand_trigger( TRG trigger) * **************************************/ LLS contexts, update; - CTX old, new; + CTX old, new_ctx; REL relation; USHORT old_id; context_id = 2; - old = new = NULL; + old = new_ctx = NULL; request_context = contexts = update = NULL; relation = trigger->trg_relation; @@ -378,10 +378,10 @@ static void expand_trigger( TRG trigger) if ((trigger->trg_type != trg_erase) && (trigger->trg_type != trg_pre_erase)) { - if (!new) - new = make_context("NEW", relation, 1); - LLS_PUSH(new, &contexts); - LLS_PUSH(new, &update); + if (!new_ctx) + new_ctx = make_context("NEW", relation, 1); + LLS_PUSH(new_ctx, &contexts); + LLS_PUSH(new_ctx, &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]; } 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]; } else diff --git a/src/dudley/expr.cpp b/src/dudley/expr.cpp index 25eb5e9163..9fe9105300 100644 --- a/src/dudley/expr.cpp +++ b/src/dudley/expr.cpp @@ -303,7 +303,7 @@ NOD EXPR_value(USHORT * paren_count, USHORT * bool_flag) * **************************************/ NOD node, arg; - enum nod_t operator; + enum nod_t operatr; USHORT local_count, local_flag; if (!paren_count) { @@ -431,19 +431,19 @@ static NOD parse_add( USHORT * paren_count, USHORT * bool_flag) * **************************************/ NOD node, arg; - enum nod_t operator; + enum nod_t operatr; node = parse_multiply(paren_count, bool_flag); while (TRUE) { if (MATCH(KW_PLUS)) - operator = nod_add; + operatr = nod_add; else if (MATCH(KW_MINUS)) - operator = nod_subtract; + operatr = nod_subtract; else return node; arg = node; - node = SYNTAX_NODE(operator, 2); + node = SYNTAX_NODE(operatr, 2); node->nod_arg[0] = arg; 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; - enum nod_t operator; + enum nod_t operatr; node = parse_from(paren_count, bool_flag); while (TRUE) { if (MATCH(KW_ASTERISK)) - operator = nod_multiply; + operatr = nod_multiply; else if (MATCH(KW_SLASH)) - operator = nod_divide; + operatr = nod_divide; else return node; arg = node; - node = SYNTAX_NODE(operator, 2); + node = SYNTAX_NODE(operatr, 2); node->nod_arg[0] = arg; 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; LLS stack; USHORT count, negation; - enum nod_t operator, *rel_ops; + enum nod_t operatr, *rel_ops; USHORT local_flag; local_flag = TRUE; @@ -942,50 +942,50 @@ static NOD parse_relational( USHORT * paren_count) switch (PARSE_keyword()) { case KW_EQUALS: case KW_EQ: - operator = (negation) ? nod_neq : nod_eql; + operatr = (negation) ? nod_neq : nod_eql; negation = FALSE; break; case KW_NE: - operator = (negation) ? nod_eql : nod_neq; + operatr = (negation) ? nod_eql : nod_neq; negation = FALSE; break; case KW_GT: - operator = (negation) ? nod_leq : nod_gtr; + operatr = (negation) ? nod_leq : nod_gtr; negation = FALSE; break; case KW_GE: - operator = (negation) ? nod_lss : nod_geq; + operatr = (negation) ? nod_lss : nod_geq; negation = FALSE; break; case KW_LE: - operator = (negation) ? nod_gtr : nod_leq; + operatr = (negation) ? nod_gtr : nod_leq; negation = FALSE; break; case KW_LT: - operator = (negation) ? nod_geq : nod_lss; + operatr = (negation) ? nod_geq : nod_lss; negation = FALSE; break; case KW_CONTAINING: - operator = nod_containing; + operatr = nod_containing; break; case KW_MATCHES: LEX_token(); expr2 = EXPR_value(0, 0); if (MATCH(KW_USING)) { - operator = nod_sleuth; - node = SYNTAX_NODE(operator, 3); + operatr = nod_sleuth; + node = SYNTAX_NODE(operatr, 3); node->nod_arg[2] = EXPR_value(0, 0); } else { - operator = nod_matches; - node = SYNTAX_NODE(operator, 2); + operatr = nod_matches; + node = SYNTAX_NODE(operatr, 2); } node->nod_arg[0] = expr1; node->nod_arg[1] = expr2; @@ -1026,7 +1026,7 @@ static NOD parse_relational( USHORT * paren_count) if (!node) { LEX_token(); - node = SYNTAX_NODE(operator, 2); + node = SYNTAX_NODE(operatr, 2); node->nod_arg[0] = expr1; 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 as implicit ORs, build them here. */ - if (operator != nod_eql) + if (operatr != nod_eql) return node; /* We have an equality operation, which can take a number of values. Generate diff --git a/src/dudley/generate.cpp b/src/dudley/generate.cpp index 2fe74693c2..236a09d1d1 100644 --- a/src/dudley/generate.cpp +++ b/src/dudley/generate.cpp @@ -69,7 +69,7 @@ int GENERATE_acl( SCL class_, UCHAR * buffer) for (i = 0, id = item->sce_idents; i < id_max; id++, i++) if (q = *id) { *p++ = i; - *p++ = strlen(q); + *p++ = strlen((char*) q); while (c = *q++) *p++ = UPPER(c); } @@ -126,7 +126,7 @@ static void generate( STR blr, NOD node) CON constant; NOD sub, *arg, *end; CTX context; - SCHAR operator, *p; + SCHAR operatr, *p; SLONG value; USHORT l; @@ -375,26 +375,26 @@ static void generate( STR blr, NOD node) case nod_from: switch (node->nod_type) { case nod_count: - operator = blr_count; + operatr = blr_count; break; case nod_max: - operator = blr_maximum; + operatr = blr_maximum; break; case nod_min: - operator = blr_minimum; + operatr = blr_minimum; break; case nod_total: - operator = blr_total; + operatr = blr_total; break; case nod_average: - operator = blr_average; + operatr = blr_average; break; 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; } CHECK_BLR(1); - STUFF(operator); + STUFF(operatr); generate(blr, node->nod_arg[s_stt_rse]); if (sub = node->nod_arg[s_stt_value]) generate(blr, sub); @@ -460,84 +460,84 @@ static void generate( STR blr, NOD node) return; case nod_eql: - operator = blr_eql; + operatr = blr_eql; break; case nod_neq: - operator = blr_neq; + operatr = blr_neq; break; case nod_gtr: - operator = blr_gtr; + operatr = blr_gtr; break; case nod_geq: - operator = blr_geq; + operatr = blr_geq; break; case nod_leq: - operator = blr_leq; + operatr = blr_leq; break; case nod_lss: - operator = blr_lss; + operatr = blr_lss; break; case nod_between: - operator = blr_between; + operatr = blr_between; break; case nod_matches: - operator = blr_matching; + operatr = blr_matching; break; case nod_containing: - operator = blr_containing; + operatr = blr_containing; break; case nod_starts: - operator = blr_starting; + operatr = blr_starting; break; case nod_missing: - operator = blr_missing; + operatr = blr_missing; break; case nod_and: - operator = blr_and; + operatr = blr_and; break; case nod_or: - operator = blr_or; + operatr = blr_or; break; case nod_not: - operator = blr_not; + operatr = blr_not; break; case nod_add: - operator = blr_add; + operatr = blr_add; break; case nod_subtract: - operator = blr_subtract; + operatr = blr_subtract; break; case nod_multiply: - operator = blr_multiply; + operatr = blr_multiply; break; case nod_divide: - operator = blr_divide; + operatr = blr_divide; break; case nod_negate: - operator = blr_negate; + operatr = blr_negate; break; case nod_concatenate: - operator = blr_concatenate; + operatr = blr_concatenate; break; case nod_for: - operator = blr_for; + operatr = blr_for; break; case nod_assignment: - operator = blr_assignment; + operatr = blr_assignment; break; case nod_store: - operator = blr_store; + operatr = blr_store; break; case nod_post: - operator = blr_post; + operatr = blr_post; break; case nod_uppercase: - operator = blr_upcase; + operatr = blr_upcase; break; case nod_sleuth: - operator = blr_matching2; + operatr = blr_matching2; break; - /*case nod_substr: operator = blr_substring; break; */ + /*case nod_substr: operatr = blr_substring; break; */ default: 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 */ - 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)) { - if (operator == blr_neq) { + if (operatr == blr_neq) { CHECK_BLR(1); STUFF(blr_not); } - operator = blr_missing; + operatr = blr_missing; if (arg[0]->nod_type == nod_null) arg++; end = arg + 1; @@ -568,7 +568,7 @@ static void generate( STR blr, NOD node) /* Fall thru on reasonable stuff */ CHECK_BLR(1); - STUFF(operator); + STUFF(operatr); for (; arg < end; arg++) generate(blr, *arg); } diff --git a/src/dudley/lex.cpp b/src/dudley/lex.cpp index 8dff02160a..e9733546b4 100644 --- a/src/dudley/lex.cpp +++ b/src/dudley/lex.cpp @@ -34,6 +34,10 @@ #include "../dudley/lex_proto.h" #include "../jrd/gds_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef PC_PLATFORM #ifndef NETWARE_386 #define SCRATCH "I" diff --git a/src/dudley/parse.cpp b/src/dudley/parse.cpp index 68a1825059..76dfa44d81 100644 --- a/src/dudley/parse.cpp +++ b/src/dudley/parse.cpp @@ -924,7 +924,7 @@ static void define_filter(void) #endif 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) { if (KEYWORD(KW_SEMI)) break; - function_arg = parse_function_arg(function, &position); + function_arg = parse_function_arg(function, (USHORT*) &position); 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)) break; } @@ -984,7 +984,7 @@ static void define_function(void) if (!KEYWORD(KW_SEMI)) 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); 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) *--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(); end_text(trigger->trg_source); - make_action(act_a_trigger, trigger); + make_action(act_a_trigger, (DBB) trigger); } 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 */ } - rel_actions = action = make_action(act_a_relation, relation); + rel_actions = action = make_action(act_a_relation, (DBB) relation); action->act_flags |= ACT_ignore; position = 1; @@ -1270,7 +1270,7 @@ static void define_relation(void) field->fld_flags |= fld_explicit_position; field->fld_name->sym_type = SYM_field; 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; if (!MATCH(KW_COMMA)) break; @@ -1332,7 +1332,7 @@ static void define_security_class(void) 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) 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 */ MATCH(KW_COLON); 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); } else { @@ -1482,7 +1482,7 @@ static void define_trigger(void) 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_object = (CTX) trigger; HSH_insert(trigger->trg_name); @@ -1515,7 +1515,7 @@ static ACT define_type(void) fldtype->typ_type = PARSE_number(); if (KEYWORD(KW_DESCRIPTION)) fldtype->typ_description = parse_description(); - make_action(act_a_type, fldtype); + make_action(act_a_type, (DBB) fldtype); if (!MATCH(KW_COMMA)) break; } @@ -1568,7 +1568,7 @@ static ACT define_view(void) LLS_PUSH(my_context, &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; /* Pick up various fields and clauses */ @@ -1690,7 +1690,7 @@ static void drop_filter(void) filter->filter_name = PARSE_symbol(tok_ident); 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); 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); 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); 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; - 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); 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 = gen_trigger_name(trigger->trg_type, relation); trigger->trg_relation = relation; - make_action(act_d_trigger, trigger); + make_action(act_d_trigger, (DBB) trigger); } } else { trigger = (TRG) DDL_alloc(TRG_LEN); trigger->trg_name = name; - make_action(act_d_trigger, trigger); + make_action(act_d_trigger, (DBB) trigger); } parse_end(); @@ -1907,7 +1907,7 @@ static void drop_type(void) fldtype->typ_field_name = PARSE_symbol(tok_ident); fldtype->typ_name->sym_length = 3; strncpy(fldtype->typ_name->sym_string, "ALL", 3); - make_action(act_d_type, fldtype); + make_action(act_d_type, (DBB) fldtype); } else { fldname = PARSE_symbol(tok_ident); @@ -1915,7 +1915,7 @@ static void drop_type(void) fldtype = (TYP) DDL_alloc(sizeof(struct typ)); fldtype->typ_field_name = fldname; fldtype->typ_name = PARSE_symbol(tok_ident); - make_action(act_d_type, fldtype); + make_action(act_d_type,(DBB) fldtype); if (!MATCH(KW_COMMA)) break; } @@ -2203,7 +2203,7 @@ static void grant_user_privilege(void) 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); - 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, name->sym_string, 0); /* msg 166: Trigger %s does not exist */ modify_trigger_action(trigger, relation); - make_action(act_m_trigger, trigger); + make_action(act_m_trigger, (DBB) trigger); } parse_end(); } @@ -2485,7 +2485,7 @@ static void modify_field(void) 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; } - 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; relation = PARSE_relation(); - make_action(act_m_relation, relation); + make_action(act_m_relation, (DBB) relation); if (MATCH(KW_EXTERNAL_FILE)) { 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_name->sym_type = SYM_field; HSH_insert(field->fld_name); - make_action(act_a_field, field); + make_action(act_a_field, (DBB) field); } } else if (MATCH(KW_MODIFY)) { @@ -2640,7 +2640,7 @@ static void modify_relation(void) field->fld_database = database; if (field->fld_computed) 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)) { if (MATCH(KW_SECURITY_CLASS)) { @@ -2668,7 +2668,7 @@ static void modify_relation(void) field->fld_relation = relation; field->fld_database = database; field->fld_name = PARSE_symbol(tok_ident); - make_action(act_d_field, field); + make_action(act_d_field, (DBB) field); } } else @@ -2726,7 +2726,7 @@ static void modify_security_class(void) } 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; flags = type = sequence = NULL; - get_trigger_attributes(&flags, &type, &sequence); + get_trigger_attributes((int*) &flags, (int*) &type, (int*) &sequence); while (!KEYWORD(KW_SEMI)) { if ((MATCH(KW_MESSAGE)) || (MATCH(KW_MSGADD)) || @@ -2795,11 +2795,11 @@ static void modify_trigger(void) if (trigmsg->trgmsg_number > 255) PARSE_error(178, (TEXT *) trigmsg->trgmsg_number, 0); /* msg 178: message number %d exceeds 255 */ 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) { MATCH(KW_COLON); 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); msg_type = trgmsg_none; @@ -2819,7 +2819,7 @@ static void modify_trigger(void) if (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(); if (KEYWORD(KW_DESCRIPTION)) fldtype->typ_description = parse_description(); - make_action(act_m_type, fldtype); + make_action(act_m_type, (DBB) fldtype); if (!MATCH(KW_COMMA)) break; } @@ -2893,7 +2893,7 @@ static void modify_view(void) USHORT view_modify; relation = PARSE_relation(); - make_action(act_m_relation, relation); + make_action(act_m_relation, (DBB) relation); view_modify = FALSE; while (TRUE) { @@ -2927,7 +2927,7 @@ static void modify_view(void) field->fld_database = database; if (field->fld_computed) 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)) { if (MATCH(KW_DESCRIP)) { @@ -2955,7 +2955,7 @@ static void modify_view(void) field->fld_relation = relation; field->fld_database = database; field->fld_name = PARSE_symbol(tok_ident); - make_action(act_d_field, field); + make_action(act_d_field, (DBB) field); } } else @@ -4020,7 +4020,7 @@ static void revoke_user_privilege(void) } 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); parse_end(); - make_action(act_s_generator, node); + make_action(act_s_generator, (DBB) node); } diff --git a/src/dudley/trn.cpp b/src/dudley/trn.cpp index dc79a4a9ce..6adc2043c2 100644 --- a/src/dudley/trn.cpp +++ b/src/dudley/trn.cpp @@ -128,8 +128,8 @@ void TRN_translate(void) } CHECK_DYN(2); - STUFF(gds__dyn_version_1); - STUFF(gds__dyn_begin); + STUFF(gds_dyn_version_1); + STUFF(gds_dyn_begin); for (action = DDL_actions; action; action = action->act_next) if (!(action->act_flags & ACT_ignore)) @@ -140,107 +140,107 @@ void TRN_translate(void) break; case act_a_relation: - add_relation(dyn, action->act_object); + add_relation(dyn, (REL) action->act_object); break; case act_m_relation: - modify_relation(dyn, action->act_object); + modify_relation(dyn, (REL) action->act_object); break; case act_d_relation: - drop_relation(dyn, action->act_object); + drop_relation(dyn, (REL) action->act_object); break; case act_a_field: - add_field(dyn, action->act_object, NULL); + add_field(dyn, (FLD) action->act_object, NULL); break; case act_m_field: - modify_field(dyn, action->act_object, NULL); + modify_field(dyn, (FLD) action->act_object, NULL); break; case act_d_field: - drop_field(dyn, action->act_object); + drop_field(dyn, (FLD) action->act_object); break; case act_a_filter: - add_filter(dyn, action->act_object); + add_filter(dyn, (FILTER) action->act_object); break; case act_d_filter: - drop_filter(dyn, action->act_object); + drop_filter(dyn, (FILTER) action->act_object); break; case act_a_function: - add_function(dyn, action->act_object); + add_function(dyn, (FUNC) action->act_object); break; case act_a_function_arg: - add_function_arg(dyn, action->act_object); + add_function_arg(dyn, (FUNCARG) action->act_object); break; case act_d_function: - drop_function(dyn, action->act_object); + drop_function(dyn, (FUNC) action->act_object); break; case act_a_generator: - add_generator(dyn, action->act_object); + add_generator(dyn, (SYM) action->act_object); break; case act_a_gfield: - add_global_field(dyn, action->act_object); + add_global_field(dyn, (FLD) action->act_object); break; case act_m_gfield: - modify_global_field(dyn, action->act_object); + modify_global_field(dyn, (FLD) action->act_object); break; case act_d_gfield: - drop_global_field(dyn, action->act_object); + drop_global_field(dyn, (FLD) action->act_object); break; case act_a_index: - add_index(dyn, action->act_object); + add_index(dyn, (DUDLEY_IDX)action->act_object); break; case act_m_index: - modify_index(dyn, action->act_object); + modify_index(dyn, (DUDLEY_IDX)action->act_object); break; case act_d_index: - drop_index(dyn, action->act_object); + drop_index(dyn, (DUDLEY_IDX)action->act_object); break; case act_a_security: - add_security_class(dyn, action->act_object); + add_security_class(dyn, (SCL) action->act_object); break; case act_d_security: - drop_security_class(dyn, action->act_object); + drop_security_class(dyn, (SCL) action->act_object); break; case act_a_trigger: - add_trigger(dyn, action->act_object); + add_trigger(dyn, (TRG) action->act_object); break; case act_d_trigger: - drop_trigger(dyn, action->act_object); + drop_trigger(dyn, (TRG) action->act_object); break; case act_m_trigger: - modify_trigger(dyn, action->act_object); + modify_trigger(dyn, (TRG) action->act_object); break; case act_a_trigger_msg: - add_trigger_msg(dyn, action->act_object); + add_trigger_msg(dyn, (TRGMSG) action->act_object); break; case act_d_trigger_msg: - drop_trigger_msg(dyn, action->act_object); + drop_trigger_msg(dyn, (TRGMSG) action->act_object); break; case act_a_shadow: - add_files(dyn, action->act_object, NULL); + add_files(dyn, (FIL) action->act_object, NULL); break; case act_d_shadow: @@ -248,7 +248,7 @@ void TRN_translate(void) break; case act_m_trigger_msg: - modify_trigger_msg(dyn, action->act_object); + modify_trigger_msg(dyn, (TRGMSG) action->act_object); break; default: @@ -256,29 +256,29 @@ void TRN_translate(void) } CHECK_DYN(2); - STUFF(gds__dyn_end); - STUFF(gds__dyn_eoc); + STUFF(gds_dyn_end); + STUFF(gds_dyn_eoc); switch (language) { case lan_undef: case lan_c: - if (PRETTY_print_dyn(dyn->str_start, gen_dyn_c, 0, 0)) + if (PRETTY_print_dyn(dyn->str_start, (int(*)()) gen_dyn_c, 0, 0)) DDL_err(283, NULL, NULL, NULL, NULL, NULL); /*msg 283: internal error during DYN pretty print */ break; case lan_cxx: - if (PRETTY_print_dyn(dyn->str_start, gen_dyn_cxx, 0, 0)) + if (PRETTY_print_dyn(dyn->str_start, (int(*)()) gen_dyn_cxx, 0, 0)) DDL_err(283, NULL, NULL, NULL, NULL, NULL); /*msg 283: internal error during DYN pretty print */ break; case lan_pascal: length = dyn->str_current - dyn->str_start; - ib_fprintf(output_file, " gds__dyn_length : gds__short := %d;\n", + ib_fprintf(output_file, " gds_dyn_length : gds__short := %d;\n", length); ib_fprintf(output_file, - " gds__dyn : packed array [1..%d] of char := (\n", + " gds_dyn : packed array [1..%d] of char := (\n", length); - if (PRETTY_print_dyn(dyn->str_start, gen_dyn_pas, 0, 1)) + if (PRETTY_print_dyn(dyn->str_start, (int(*)()) gen_dyn_pas, 0, 1)) DDL_err(285, NULL, NULL, NULL, NULL, NULL); /*msg 285: internal error during DYN pretty print */ ib_fprintf(output_file, " ); (* end of DYN string *)\n"); break; @@ -298,10 +298,10 @@ void TRN_translate(void) case lan_pli: length = dyn->str_current - dyn->str_start; ib_fprintf(output_file, - "DECLARE gds__dyn_length FIXED BINARY (15) STATIC INITIAL (%d);\n", + "DECLARE gds_dyn_length FIXED BINARY (15) STATIC INITIAL (%d);\n", length); ib_fprintf(output_file, - "DECLARE gds__dyn (%d) FIXED BINARY (7) STATIC INITIAL (\n", + "DECLARE gds_dyn (%d) FIXED BINARY (7) STATIC INITIAL (\n", length); raw_pli(dyn); break; @@ -309,10 +309,10 @@ void TRN_translate(void) case lan_basic: length = dyn->str_current - dyn->str_start; ib_fprintf(output_file, - " DECLARE WORD CONSTANT gds__dyn_length = %d\n", + " DECLARE WORD CONSTANT gds_dyn_length = %d\n", length); ib_fprintf(output_file, - " DECLARE STRING CONSTANT gds__dyn =&\n", length); + " DECLARE STRING CONSTANT gds_dyn =&\n", length); raw_basic(dyn); break; @@ -366,18 +366,18 @@ static void add_dimensions( STR dyn, FLD field) SLONG *range; USHORT n; - put_symbol(dyn, gds__dyn_delete_dimensions, field->fld_name); + put_symbol(dyn, gds_dyn_delete_dimensions, field->fld_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); for (range = field->fld_ranges, n = 0; n < field->fld_dimension; range += 2, ++n) { - put_number(dyn, gds__dyn_def_dimension, n); - put_symbol(dyn, gds__dyn_fld_name, field->fld_name); - put_number(dyn, gds__dyn_dim_lower, (SSHORT) range[0]); - put_number(dyn, gds__dyn_dim_upper, (SSHORT) range[1]); + put_number(dyn, gds_dyn_def_dimension, n); + put_symbol(dyn, gds_dyn_fld_name, field->fld_name); + put_number(dyn, gds_dyn_dim_lower, (SSHORT) range[0]); + put_number(dyn, gds_dyn_dim_upper, (SSHORT) range[1]); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } } @@ -406,49 +406,49 @@ static void add_field( STR dyn, FLD field, REL view) else relation = field->fld_relation; - put_symbol(dyn, gds__dyn_def_local_fld, name); - put_symbol(dyn, gds__dyn_rel_name, relation->rel_name); + put_symbol(dyn, gds_dyn_def_local_fld, name); + put_symbol(dyn, gds_dyn_rel_name, relation->rel_name); if ((symbol = field->fld_source) && strcmp(symbol->sym_string, name->sym_string) && !field->fld_computed) - put_symbol(dyn, gds__dyn_fld_source, symbol); + put_symbol(dyn, gds_dyn_fld_source, symbol); - put_symbol(dyn, gds__dyn_security_class, field->fld_security_class); - put_symbol(dyn, gds__dyn_fld_edit_string, field->fld_edit_string); - put_symbol(dyn, gds__dyn_fld_query_name, field->fld_query_name); - put_query_header(dyn, gds__dyn_fld_query_header, field->fld_query_header); + put_symbol(dyn, gds_dyn_security_class, field->fld_security_class); + put_symbol(dyn, gds_dyn_fld_edit_string, field->fld_edit_string); + put_symbol(dyn, gds_dyn_fld_query_name, field->fld_query_name); + put_query_header(dyn, gds_dyn_fld_query_header, field->fld_query_header); if (field->fld_system) - put_number(dyn, gds__dyn_system_flag, field->fld_system); + put_number(dyn, gds_dyn_system_flag, field->fld_system); - put_symbol(dyn, gds__dyn_fld_base_fld, field->fld_base); + put_symbol(dyn, gds_dyn_fld_base_fld, field->fld_base); if (field->fld_context) - put_number(dyn, gds__dyn_view_context, + put_number(dyn, gds_dyn_view_context, field->fld_context->ctx_context_id); if (field->fld_computed) { if (!field->fld_context && view) - put_number(dyn, gds__dyn_view_context, 0); - put_blr(dyn, gds__dyn_fld_computed_blr, NULL, field->fld_computed); + put_number(dyn, gds_dyn_view_context, 0); + put_blr(dyn, gds_dyn_fld_computed_blr, NULL, field->fld_computed); source_field = field->fld_source_field; - put_number(dyn, gds__dyn_fld_type, source_field->fld_dtype); - put_number(dyn, gds__dyn_fld_length, source_field->fld_length); - put_number(dyn, gds__dyn_fld_scale, source_field->fld_scale); - put_number(dyn, gds__dyn_fld_sub_type, source_field->fld_sub_type); + put_number(dyn, gds_dyn_fld_type, source_field->fld_dtype); + put_number(dyn, gds_dyn_fld_length, source_field->fld_length); + put_number(dyn, gds_dyn_fld_scale, source_field->fld_scale); + put_number(dyn, gds_dyn_fld_sub_type, source_field->fld_sub_type); if (n = source_field->fld_segment_length) - put_number(dyn, gds__dyn_fld_segment_length, n); + put_number(dyn, gds_dyn_fld_segment_length, n); } - put_text(dyn, gds__dyn_fld_computed_source, field->fld_compute_src); + put_text(dyn, gds_dyn_fld_computed_source, field->fld_compute_src); if (field->fld_flags & fld_explicit_position) - put_number(dyn, gds__dyn_fld_position, field->fld_position); + put_number(dyn, gds_dyn_fld_position, field->fld_position); - put_text(dyn, gds__dyn_description, field->fld_description); + put_text(dyn, gds_dyn_description, field->fld_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -476,20 +476,20 @@ static void add_files( STR dyn, FIL files, DBB database) } if (!database && files) - put_number(dyn, gds__dyn_def_shadow, files->fil_shadow_number); + put_number(dyn, gds_dyn_def_shadow, files->fil_shadow_number); for (file = files; file; file = file->fil_next) { - put_symbol(dyn, gds__dyn_def_file, file->fil_name); - put_number(dyn, gds__dyn_file_start, (SSHORT) (file->fil_start)); - put_number(dyn, gds__dyn_file_length, (SSHORT) (file->fil_length)); - put_number(dyn, gds__dyn_shadow_man_auto, file->fil_manual); - put_number(dyn, gds__dyn_shadow_conditional, file->fil_conditional); + put_symbol(dyn, gds_dyn_def_file, file->fil_name); + put_number(dyn, gds_dyn_file_start, (SSHORT) (file->fil_start)); + put_number(dyn, gds_dyn_file_length, (SSHORT) (file->fil_length)); + put_number(dyn, gds_dyn_shadow_man_auto, file->fil_manual); + put_number(dyn, gds_dyn_shadow_conditional, file->fil_conditional); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } if (!database && files) { CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } } @@ -508,16 +508,16 @@ static void add_filter( STR dyn, FILTER filter) * **************************************/ - put_symbol(dyn, gds__dyn_def_filter, filter->filter_name); - put_number(dyn, gds__dyn_filter_in_subtype, + put_symbol(dyn, gds_dyn_def_filter, filter->filter_name); + put_number(dyn, gds_dyn_filter_in_subtype, filter->filter_input_sub_type); - put_number(dyn, gds__dyn_filter_out_subtype, + put_number(dyn, gds_dyn_filter_out_subtype, filter->filter_output_sub_type); - put_symbol(dyn, gds__dyn_func_entry_point, filter->filter_entry_point); - put_symbol(dyn, gds__dyn_func_module_name, filter->filter_module_name); - put_text(dyn, gds__dyn_description, filter->filter_description); + put_symbol(dyn, gds_dyn_func_entry_point, filter->filter_entry_point); + put_symbol(dyn, gds_dyn_func_module_name, filter->filter_module_name); + put_text(dyn, gds_dyn_description, filter->filter_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -535,14 +535,14 @@ static void add_function( STR dyn, FUNC function) * **************************************/ - put_symbol(dyn, gds__dyn_def_function, function->func_name); - put_symbol(dyn, gds__dyn_fld_query_name, function->func_query_name); - put_symbol(dyn, gds__dyn_func_entry_point, function->func_entry_point); - put_number(dyn, gds__dyn_func_return_argument, function->func_return_arg); - put_symbol(dyn, gds__dyn_func_module_name, function->func_module_name); - put_text(dyn, gds__dyn_description, function->func_description); + put_symbol(dyn, gds_dyn_def_function, function->func_name); + put_symbol(dyn, gds_dyn_fld_query_name, function->func_query_name); + put_symbol(dyn, gds_dyn_func_entry_point, function->func_entry_point); + put_number(dyn, gds_dyn_func_return_argument, function->func_return_arg); + put_symbol(dyn, gds_dyn_func_module_name, function->func_module_name); + put_text(dyn, gds_dyn_description, function->func_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -560,16 +560,16 @@ static void add_function_arg( STR dyn, FUNCARG func_arg) * **************************************/ - put_number(dyn, gds__dyn_def_function_arg, func_arg->funcarg_position); - put_symbol(dyn, gds__dyn_function_name, func_arg->funcarg_funcname); - put_number(dyn, gds__dyn_func_mechanism, func_arg->funcarg_mechanism); - put_number(dyn, gds__dyn_fld_type, func_arg->funcarg_dtype); - put_number(dyn, gds__dyn_fld_scale, func_arg->funcarg_scale); + put_number(dyn, gds_dyn_def_function_arg, func_arg->funcarg_position); + put_symbol(dyn, gds_dyn_function_name, func_arg->funcarg_funcname); + put_number(dyn, gds_dyn_func_mechanism, func_arg->funcarg_mechanism); + put_number(dyn, gds_dyn_fld_type, func_arg->funcarg_dtype); + put_number(dyn, gds_dyn_fld_scale, func_arg->funcarg_scale); if (func_arg->funcarg_has_sub_type) - put_number(dyn, gds__dyn_fld_sub_type, func_arg->funcarg_sub_type); - put_number(dyn, gds__dyn_fld_length, func_arg->funcarg_length); + put_number(dyn, gds_dyn_fld_sub_type, func_arg->funcarg_sub_type); + put_number(dyn, gds_dyn_fld_length, func_arg->funcarg_length); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -587,9 +587,9 @@ static void add_generator( STR dyn, SYM symbol) * **************************************/ - put_symbol(dyn, gds__dyn_def_generator, symbol); + put_symbol(dyn, gds_dyn_def_generator, symbol); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -615,35 +615,35 @@ static void add_global_field( STR dyn, FLD field) name = field->fld_name; - put_symbol(dyn, gds__dyn_def_global_fld, name); - put_symbol(dyn, gds__dyn_fld_edit_string, field->fld_edit_string); - put_symbol(dyn, gds__dyn_fld_query_name, field->fld_query_name); - put_query_header(dyn, gds__dyn_fld_query_header, field->fld_query_header); + put_symbol(dyn, gds_dyn_def_global_fld, name); + put_symbol(dyn, gds_dyn_fld_edit_string, field->fld_edit_string); + put_symbol(dyn, gds_dyn_fld_query_name, field->fld_query_name); + put_query_header(dyn, gds_dyn_fld_query_header, field->fld_query_header); if (field->fld_system) - put_number(dyn, gds__dyn_system_flag, field->fld_system); + put_number(dyn, gds_dyn_system_flag, field->fld_system); - put_number(dyn, gds__dyn_fld_type, field->fld_dtype); - put_number(dyn, gds__dyn_fld_length, field->fld_length); - put_number(dyn, gds__dyn_fld_scale, field->fld_scale); - put_number(dyn, gds__dyn_fld_sub_type, field->fld_sub_type); + put_number(dyn, gds_dyn_fld_type, field->fld_dtype); + put_number(dyn, gds_dyn_fld_length, field->fld_length); + put_number(dyn, gds_dyn_fld_scale, field->fld_scale); + put_number(dyn, gds_dyn_fld_sub_type, field->fld_sub_type); if (n = field->fld_segment_length) - put_number(dyn, gds__dyn_fld_segment_length, n); + put_number(dyn, gds_dyn_fld_segment_length, n); - put_blr(dyn, gds__dyn_fld_missing_value, NULL, field->fld_missing); + put_blr(dyn, gds_dyn_fld_missing_value, NULL, field->fld_missing); - put_blr(dyn, gds__dyn_fld_validation_blr, NULL, field->fld_validation); - put_text(dyn, gds__dyn_fld_validation_source, field->fld_valid_src); - put_text(dyn, gds__dyn_description, field->fld_description); + put_blr(dyn, gds_dyn_fld_validation_blr, NULL, field->fld_validation); + put_text(dyn, gds_dyn_fld_validation_source, field->fld_valid_src); + put_text(dyn, gds_dyn_description, field->fld_description); if (field->fld_dimension) { - put_number(dyn, gds__dyn_fld_dimensions, field->fld_dimension); + put_number(dyn, gds_dyn_fld_dimensions, field->fld_dimension); add_dimensions(dyn, field); } CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -661,23 +661,23 @@ static void add_index( STR dyn, DUDLEY_IDX index) **************************************/ TEXT i; - put_symbol(dyn, gds__dyn_def_idx, index->idx_name); - put_symbol(dyn, gds__dyn_rel_name, index->idx_relation); - put_number(dyn, gds__dyn_idx_unique, index->idx_unique); + put_symbol(dyn, gds_dyn_def_idx, index->idx_name); + put_symbol(dyn, gds_dyn_rel_name, index->idx_relation); + put_number(dyn, gds_dyn_idx_unique, index->idx_unique); if (index->idx_inactive) - put_number(dyn, gds__dyn_idx_inactive, TRUE); + put_number(dyn, gds_dyn_idx_inactive, TRUE); else - put_number(dyn, gds__dyn_idx_inactive, FALSE); + put_number(dyn, gds_dyn_idx_inactive, FALSE); if (index->idx_type) - put_number(dyn, gds__dyn_idx_type, index->idx_type); + put_number(dyn, gds_dyn_idx_type, index->idx_type); - put_text(dyn, gds__dyn_description, index->idx_description); + put_text(dyn, gds_dyn_description, index->idx_description); for (i = 0; i < index->idx_count; i++) - put_symbol(dyn, gds__dyn_fld_name, index->idx_field[i]); + put_symbol(dyn, gds_dyn_fld_name, index->idx_field[i]); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -699,15 +699,15 @@ static void add_relation( STR dyn, REL relation) return; } - put_symbol(dyn, gds__dyn_def_rel, relation->rel_name); - put_symbol(dyn, gds__dyn_security_class, relation->rel_security_class); - put_symbol(dyn, gds__dyn_rel_ext_file, relation->rel_filename); + put_symbol(dyn, gds_dyn_def_rel, relation->rel_name); + put_symbol(dyn, gds_dyn_security_class, relation->rel_security_class); + put_symbol(dyn, gds_dyn_rel_ext_file, relation->rel_filename); if (relation->rel_system) - put_number(dyn, gds__dyn_system_flag, relation->rel_system); - put_text(dyn, gds__dyn_description, relation->rel_description); + put_number(dyn, gds_dyn_system_flag, relation->rel_system); + put_text(dyn, gds_dyn_description, relation->rel_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -724,14 +724,14 @@ static void add_security_class( STR dyn, SCL class_) * **************************************/ - put_symbol(dyn, gds__dyn_def_security_class, class_->scl_name); + put_symbol(dyn, gds_dyn_def_security_class, class_->scl_name); - put_acl(dyn, gds__dyn_scl_acl, class_); + put_acl(dyn, gds_dyn_scl_acl, class_); - put_text(dyn, gds__dyn_description, class_->scl_description); + put_text(dyn, gds_dyn_description, class_->scl_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -753,17 +753,17 @@ static void add_trigger( STR dyn, TRG trigger) relation = trigger->trg_relation; name = trigger->trg_name; - put_symbol(dyn, gds__dyn_def_trigger, name); - put_symbol(dyn, gds__dyn_rel_name, relation->rel_name); - put_number(dyn, gds__dyn_trg_type, trigger->trg_type); - put_number(dyn, gds__dyn_trg_sequence, trigger->trg_sequence); - put_number(dyn, gds__dyn_trg_inactive, trigger->trg_inactive); - put_blr(dyn, gds__dyn_trg_blr, relation, trigger->trg_statement); - put_text(dyn, gds__dyn_trg_source, trigger->trg_source); - put_text(dyn, gds__dyn_description, trigger->trg_description); + put_symbol(dyn, gds_dyn_def_trigger, name); + put_symbol(dyn, gds_dyn_rel_name, relation->rel_name); + put_number(dyn, gds_dyn_trg_type, trigger->trg_type); + put_number(dyn, gds_dyn_trg_sequence, trigger->trg_sequence); + put_number(dyn, gds_dyn_trg_inactive, trigger->trg_inactive); + put_blr(dyn, gds_dyn_trg_blr, relation, trigger->trg_statement); + put_text(dyn, gds_dyn_trg_source, trigger->trg_source); + put_text(dyn, gds_dyn_description, trigger->trg_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -780,12 +780,12 @@ static void add_trigger_msg( STR dyn, TRGMSG trigmsg) * **************************************/ - put_number(dyn, gds__dyn_def_trigger_msg, trigmsg->trgmsg_number); - put_symbol(dyn, gds__dyn_trg_name, trigmsg->trgmsg_trg_name); - put_symbol(dyn, gds__dyn_trg_msg, trigmsg->trgmsg_text); + put_number(dyn, gds_dyn_def_trigger_msg, trigmsg->trgmsg_number); + put_symbol(dyn, gds_dyn_trg_name, trigmsg->trgmsg_trg_name); + put_symbol(dyn, gds_dyn_trg_msg, trigmsg->trgmsg_text); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -806,30 +806,30 @@ static void add_view( STR dyn, REL relation) NOD *arg, contexts; SSHORT i; - put_symbol(dyn, gds__dyn_def_view, relation->rel_name); - put_symbol(dyn, gds__dyn_security_class, relation->rel_security_class); + put_symbol(dyn, gds_dyn_def_view, relation->rel_name); + put_symbol(dyn, gds_dyn_security_class, relation->rel_security_class); if (relation->rel_system) - put_number(dyn, gds__dyn_system_flag, relation->rel_system); - put_text(dyn, gds__dyn_description, relation->rel_description); - put_blr(dyn, gds__dyn_view_blr, relation, relation->rel_rse); - put_text(dyn, gds__dyn_view_source, relation->rel_view_source); + put_number(dyn, gds_dyn_system_flag, relation->rel_system); + put_text(dyn, gds_dyn_description, relation->rel_description); + put_blr(dyn, gds_dyn_view_blr, relation, relation->rel_rse); + put_text(dyn, gds_dyn_view_source, relation->rel_view_source); contexts = relation->rel_rse->nod_arg[s_rse_contexts]; for (i = 0, arg = contexts->nod_arg; i < contexts->nod_count; i++, arg++) { context = (CTX) (*arg)->nod_arg[0]; - put_symbol(dyn, gds__dyn_view_relation, + put_symbol(dyn, gds_dyn_view_relation, context->ctx_relation->rel_name); - put_number(dyn, gds__dyn_view_context, context->ctx_context_id); - put_symbol(dyn, gds__dyn_view_context_name, context->ctx_name); + put_number(dyn, gds_dyn_view_context, context->ctx_context_id); + put_symbol(dyn, gds_dyn_view_context_name, context->ctx_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } for (field = relation->rel_fields; field; field = field->fld_next) add_field(dyn, field, relation); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -899,11 +899,11 @@ static void drop_field( STR dyn, FLD field) name = field->fld_name; relation = field->fld_relation; - put_symbol(dyn, gds__dyn_delete_local_fld, name); - put_symbol(dyn, gds__dyn_rel_name, relation->rel_name); + put_symbol(dyn, gds_dyn_delete_local_fld, name); + put_symbol(dyn, gds_dyn_rel_name, relation->rel_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -923,9 +923,9 @@ static void drop_filter( STR dyn, FILTER filter) * **************************************/ - put_symbol(dyn, gds__dyn_delete_filter, filter->filter_name); + put_symbol(dyn, gds_dyn_delete_filter, filter->filter_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -943,9 +943,9 @@ static void drop_function( STR dyn, FUNC function) * **************************************/ - put_symbol(dyn, gds__dyn_delete_function, function->func_name); + put_symbol(dyn, gds_dyn_delete_function, function->func_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -966,10 +966,10 @@ static void drop_global_field( STR dyn, FLD field) name = field->fld_name; - put_symbol(dyn, gds__dyn_delete_global_fld, name); + put_symbol(dyn, gds_dyn_delete_global_fld, name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -986,9 +986,9 @@ static void drop_index( STR dyn, DUDLEY_IDX index) * **************************************/ - put_symbol(dyn, gds__dyn_delete_idx, index->idx_name); + put_symbol(dyn, gds_dyn_delete_idx, index->idx_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1005,9 +1005,9 @@ static void drop_relation( STR dyn, REL relation) * **************************************/ - put_symbol(dyn, gds__dyn_delete_rel, relation->rel_name); + put_symbol(dyn, gds_dyn_delete_rel, relation->rel_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1024,9 +1024,9 @@ static void drop_security_class( STR dyn, SCL class_) * **************************************/ - put_symbol(dyn, gds__dyn_delete_security_class, class_->scl_name); + put_symbol(dyn, gds_dyn_delete_security_class, class_->scl_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1043,9 +1043,9 @@ static void drop_shadow( STR dyn, SLONG shadow_number) * **************************************/ - put_number(dyn, gds__dyn_delete_shadow, (SSHORT) shadow_number); + put_number(dyn, gds_dyn_delete_shadow, (SSHORT) shadow_number); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1068,9 +1068,9 @@ static void drop_trigger( STR dyn, TRG trigger) name = trigger->trg_name; - put_symbol(dyn, gds__dyn_delete_trigger, name); + put_symbol(dyn, gds_dyn_delete_trigger, name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1087,10 +1087,10 @@ static void drop_trigger_msg( STR dyn, TRGMSG trigmsg) * **************************************/ - put_number(dyn, gds__dyn_delete_trigger_msg, trigmsg->trgmsg_number); - put_symbol(dyn, gds__dyn_trg_name, trigmsg->trgmsg_trg_name); + put_number(dyn, gds_dyn_delete_trigger_msg, trigmsg->trgmsg_number); + put_symbol(dyn, gds_dyn_trg_name, trigmsg->trgmsg_trg_name); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1187,27 +1187,27 @@ static void modify_database( STR dyn, DBB database) return; CHECK_DYN(1); - STUFF(gds__dyn_mod_database); + STUFF(gds_dyn_mod_database); add_files(dyn, database->dbb_files, database); if (database->dbb_flags & DBB_null_security_class) { CHECK_DYN(3); - STUFF(gds__dyn_security_class); + STUFF(gds_dyn_security_class); STUFF_WORD(0); } else - put_symbol(dyn, gds__dyn_security_class, + put_symbol(dyn, gds_dyn_security_class, database->dbb_security_class); if (database->dbb_flags & DBB_null_description) { CHECK_DYN(3); - STUFF(gds__dyn_description); + STUFF(gds_dyn_description); STUFF_WORD(0); } else if (database->dbb_description) - put_text(dyn, gds__dyn_description, database->dbb_description); + put_text(dyn, gds_dyn_description, database->dbb_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1235,59 +1235,59 @@ static void modify_field( STR dyn, FLD field, REL view) else relation = field->fld_relation; - put_symbol(dyn, gds__dyn_mod_local_fld, name); - put_symbol(dyn, gds__dyn_rel_name, relation->rel_name); + put_symbol(dyn, gds_dyn_mod_local_fld, name); + put_symbol(dyn, gds_dyn_rel_name, relation->rel_name); if ((symbol = field->fld_source) && strcmp(symbol->sym_string, name->sym_string) && !field->fld_computed) - put_symbol(dyn, gds__dyn_fld_source, symbol); + put_symbol(dyn, gds_dyn_fld_source, symbol); if (field->fld_flags & fld_null_security_class) { CHECK_DYN(3); - STUFF(gds__dyn_security_class); + STUFF(gds_dyn_security_class); STUFF_WORD(0); } else - put_symbol(dyn, gds__dyn_security_class, field->fld_security_class); + put_symbol(dyn, gds_dyn_security_class, field->fld_security_class); if (field->fld_flags & fld_null_edit_string) { CHECK_DYN(3); - STUFF(gds__dyn_fld_edit_string); + STUFF(gds_dyn_fld_edit_string); STUFF_WORD(0); } else - put_symbol(dyn, gds__dyn_fld_edit_string, field->fld_edit_string); + put_symbol(dyn, gds_dyn_fld_edit_string, field->fld_edit_string); if (field->fld_flags & fld_null_query_name) { CHECK_DYN(3); - STUFF(gds__dyn_fld_query_name); + STUFF(gds_dyn_fld_query_name); STUFF_WORD(0); } else - put_symbol(dyn, gds__dyn_fld_query_name, field->fld_query_name); + put_symbol(dyn, gds_dyn_fld_query_name, field->fld_query_name); if (field->fld_flags & fld_null_query_header) { CHECK_DYN(3); - STUFF(gds__dyn_fld_query_header); + STUFF(gds_dyn_fld_query_header); STUFF_WORD(0); } else - put_query_header(dyn, gds__dyn_fld_query_header, + put_query_header(dyn, gds_dyn_fld_query_header, field->fld_query_header); if (field->fld_system) - put_number(dyn, gds__dyn_system_flag, field->fld_system); + put_number(dyn, gds_dyn_system_flag, field->fld_system); if (field->fld_flags & fld_explicit_position) - put_number(dyn, gds__dyn_fld_position, field->fld_position); + put_number(dyn, gds_dyn_fld_position, field->fld_position); if (field->fld_flags & fld_null_description) { CHECK_DYN(3); - STUFF(gds__dyn_description); + STUFF(gds_dyn_description); STUFF_WORD(0); } else if (field->fld_description) - put_text(dyn, gds__dyn_description, field->fld_description); + put_text(dyn, gds_dyn_description, field->fld_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1315,81 +1315,81 @@ static void modify_global_field( STR dyn, FLD field) name = field->fld_name; - put_symbol(dyn, gds__dyn_mod_global_fld, name); + put_symbol(dyn, gds_dyn_mod_global_fld, name); if (field->fld_flags & fld_null_edit_string) { CHECK_DYN(3); - STUFF(gds__dyn_fld_edit_string); + STUFF(gds_dyn_fld_edit_string); STUFF_WORD(0); } else - put_symbol(dyn, gds__dyn_fld_edit_string, field->fld_edit_string); + put_symbol(dyn, gds_dyn_fld_edit_string, field->fld_edit_string); if (field->fld_flags & fld_null_query_name) { CHECK_DYN(3); - STUFF(gds__dyn_fld_query_name); + STUFF(gds_dyn_fld_query_name); STUFF_WORD(0); } else - put_symbol(dyn, gds__dyn_fld_query_name, field->fld_query_name); + put_symbol(dyn, gds_dyn_fld_query_name, field->fld_query_name); if (field->fld_flags & fld_null_query_header) { CHECK_DYN(3); - STUFF(gds__dyn_fld_query_header); + STUFF(gds_dyn_fld_query_header); STUFF_WORD(0); } else - put_query_header(dyn, gds__dyn_fld_query_header, + put_query_header(dyn, gds_dyn_fld_query_header, field->fld_query_header); if (field->fld_system & fld_explicit_system) - put_number(dyn, gds__dyn_system_flag, field->fld_system); + put_number(dyn, gds_dyn_system_flag, field->fld_system); if (field->fld_dtype) { - put_number(dyn, gds__dyn_fld_type, field->fld_dtype); - put_number(dyn, gds__dyn_fld_length, field->fld_length); - put_number(dyn, gds__dyn_fld_scale, field->fld_scale); + put_number(dyn, gds_dyn_fld_type, field->fld_dtype); + put_number(dyn, gds_dyn_fld_length, field->fld_length); + put_number(dyn, gds_dyn_fld_scale, field->fld_scale); } if (field->fld_has_sub_type) - put_number(dyn, gds__dyn_fld_sub_type, field->fld_sub_type); + put_number(dyn, gds_dyn_fld_sub_type, field->fld_sub_type); if (n = field->fld_segment_length) - put_number(dyn, gds__dyn_fld_segment_length, n); + put_number(dyn, gds_dyn_fld_segment_length, n); if (field->fld_flags & fld_null_missing_value) { CHECK_DYN(3); - STUFF(gds__dyn_fld_missing_value); + STUFF(gds_dyn_fld_missing_value); STUFF_WORD(0); } else if (field->fld_missing) - put_blr(dyn, gds__dyn_fld_missing_value, NULL, field->fld_missing); + put_blr(dyn, gds_dyn_fld_missing_value, NULL, field->fld_missing); if (field->fld_flags & fld_null_validation) { CHECK_DYN(6); - STUFF(gds__dyn_fld_validation_blr); + STUFF(gds_dyn_fld_validation_blr); STUFF_WORD(0); - STUFF(gds__dyn_fld_validation_source); + STUFF(gds_dyn_fld_validation_source); STUFF_WORD(0) } else if (field->fld_validation) { - put_blr(dyn, gds__dyn_fld_validation_blr, NULL, + put_blr(dyn, gds_dyn_fld_validation_blr, NULL, field->fld_validation); - put_text(dyn, gds__dyn_fld_validation_source, field->fld_valid_src); + put_text(dyn, gds_dyn_fld_validation_source, field->fld_valid_src); } if (field->fld_flags & fld_null_description) { CHECK_DYN(3); - STUFF(gds__dyn_description); + STUFF(gds_dyn_description); STUFF_WORD(0); } else if (field->fld_description) - put_text(dyn, gds__dyn_description, field->fld_description); + put_text(dyn, gds_dyn_description, field->fld_description); if (field->fld_dimension) { - put_number(dyn, gds__dyn_fld_dimensions, field->fld_dimension); + put_number(dyn, gds_dyn_fld_dimensions, field->fld_dimension); add_dimensions(dyn, field); } CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1407,28 +1407,28 @@ static void modify_index( STR dyn, DUDLEY_IDX index) **************************************/ TEXT i; - put_symbol(dyn, gds__dyn_mod_idx, index->idx_name); + put_symbol(dyn, gds_dyn_mod_idx, index->idx_name); if (index->idx_flags & IDX_unique_flag) - put_number(dyn, gds__dyn_idx_unique, index->idx_unique); + put_number(dyn, gds_dyn_idx_unique, index->idx_unique); if (index->idx_flags & IDX_active_flag) - put_number(dyn, gds__dyn_idx_inactive, + put_number(dyn, gds_dyn_idx_inactive, (index->idx_inactive) ? TRUE : FALSE); if (index->idx_flags & IDX_type_flag) - put_number(dyn, gds__dyn_idx_type, index->idx_type); + put_number(dyn, gds_dyn_idx_type, index->idx_type); if (index->idx_flags & IDX_null_description) { CHECK_DYN(3); - STUFF(gds__dyn_description); + STUFF(gds_dyn_description); STUFF_WORD(0); } else if (index->idx_description) - put_text(dyn, gds__dyn_description, index->idx_description); + put_text(dyn, gds_dyn_description, index->idx_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1445,35 +1445,35 @@ static void modify_relation( STR dyn, REL relation) * **************************************/ - put_symbol(dyn, gds__dyn_mod_rel, relation->rel_name); + put_symbol(dyn, gds_dyn_mod_rel, relation->rel_name); if (relation->rel_flags & rel_null_security_class) { CHECK_DYN(3); - STUFF(gds__dyn_security_class); + STUFF(gds_dyn_security_class); STUFF_WORD(0); } else - put_symbol(dyn, gds__dyn_security_class, + put_symbol(dyn, gds_dyn_security_class, relation->rel_security_class); if (relation->rel_system) - put_number(dyn, gds__dyn_system_flag, relation->rel_system); + put_number(dyn, gds_dyn_system_flag, relation->rel_system); if (relation->rel_flags & rel_null_description) { CHECK_DYN(3); - STUFF(gds__dyn_description); + STUFF(gds_dyn_description); STUFF_WORD(0); } else if (relation->rel_description) - put_text(dyn, gds__dyn_description, relation->rel_description); + put_text(dyn, gds_dyn_description, relation->rel_description); if (relation->rel_flags & rel_null_ext_file) { CHECK_DYN(3); - STUFF(gds__dyn_rel_ext_file); + STUFF(gds_dyn_rel_ext_file); STUFF_WORD(0); } else - put_symbol(dyn, gds__dyn_rel_ext_file, relation->rel_filename); + put_symbol(dyn, gds_dyn_rel_ext_file, relation->rel_filename); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1497,23 +1497,23 @@ static void modify_trigger( STR dyn, TRG trigger) relation = trigger->trg_relation; name = trigger->trg_name; - put_symbol(dyn, gds__dyn_mod_trigger, name); - put_symbol(dyn, gds__dyn_rel_name, relation->rel_name); + put_symbol(dyn, gds_dyn_mod_trigger, name); + put_symbol(dyn, gds_dyn_rel_name, relation->rel_name); if (trigger->trg_mflag & trg_mflag_onoff) - put_number(dyn, gds__dyn_trg_inactive, trigger->trg_inactive); + put_number(dyn, gds_dyn_trg_inactive, trigger->trg_inactive); if (trigger->trg_mflag & trg_mflag_type) - put_number(dyn, gds__dyn_trg_type, trigger->trg_type); + put_number(dyn, gds_dyn_trg_type, trigger->trg_type); if (trigger->trg_mflag & trg_mflag_seqnum) - put_number(dyn, gds__dyn_trg_sequence, trigger->trg_sequence); + put_number(dyn, gds_dyn_trg_sequence, trigger->trg_sequence); if (trigger->trg_statement) - put_blr(dyn, gds__dyn_trg_blr, relation, trigger->trg_statement); + put_blr(dyn, gds_dyn_trg_blr, relation, trigger->trg_statement); if (trigger->trg_source) - put_text(dyn, gds__dyn_trg_source, trigger->trg_source); + put_text(dyn, gds_dyn_trg_source, trigger->trg_source); if (trigger->trg_description) - put_text(dyn, gds__dyn_description, trigger->trg_description); + put_text(dyn, gds_dyn_description, trigger->trg_description); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1530,12 +1530,12 @@ static void modify_trigger_msg( STR dyn, TRGMSG trigmsg) * **************************************/ - put_number(dyn, gds__dyn_mod_trigger_msg, trigmsg->trgmsg_number); - put_symbol(dyn, gds__dyn_trg_name, trigmsg->trgmsg_trg_name); - put_symbol(dyn, gds__dyn_trg_msg, trigmsg->trgmsg_text); + put_number(dyn, gds_dyn_mod_trigger_msg, trigmsg->trgmsg_number); + put_symbol(dyn, gds_dyn_trg_name, trigmsg->trgmsg_trg_name); + put_symbol(dyn, gds_dyn_trg_msg, trigmsg->trgmsg_text); CHECK_DYN(1); - STUFF(gds__dyn_end); + STUFF(gds_dyn_end); } @@ -1556,7 +1556,7 @@ static void put_acl( STR dyn, UCHAR attribute, SCL class_) if (!class_) return; - length = GENERATE_acl(class_, buffer); + length = GENERATE_acl(class_, (UCHAR*) buffer); assert(length <= 4096); /* to make sure buffer is big enough */ CHECK_DYN(3 + length); diff --git a/src/gpre/ada.cpp b/src/gpre/ada.cpp index f7a06f7519..174288563c 100644 --- a/src/gpre/ada.cpp +++ b/src/gpre/ada.cpp @@ -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" @@ -41,6 +41,10 @@ #include "../gpre/prett_proto.h" #include "../jrd/gds_proto.h" +#ifdef HAVE_STRING_H +#include +#endif + static int align(int); static int asgn_from(ACT, REF, 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. // -static align( int column) +static int align( int column) { int i; if (column < 0) - return; + return 0; ib_putc('\n', out_file); @@ -551,7 +555,7 @@ static align( int column) // a port variable. // -static asgn_from( ACT action, REF reference, int column) +static int asgn_from( ACT action, REF reference, int column) { FLD field; TEXT *value, name[64], variable[20], temp[20]; @@ -620,7 +624,7 @@ static void asgn_sqlda_from( // a port variable. // -static asgn_to( ACT action, REF reference, int column) +static int asgn_to( ACT action, REF reference, int column) { FLD field; REF source; @@ -632,7 +636,7 @@ static asgn_to( ACT action, REF reference, int column) if (field->fld_array_info) { source->ref_value = reference->ref_value; gen_get_or_put_slice(action, source, TRUE, column); - return; + return 0; } // //if (field && (field->fld_flags & FLD_text)) @@ -659,7 +663,7 @@ static asgn_to( ACT action, REF reference, int column) // a port variable. // -static asgn_to_proc( REF reference, int column) +static int asgn_to_proc( REF reference, int column) { SCHAR s[64]; @@ -719,7 +723,7 @@ static int gen_at_end( ACT action, int column) // Substitute for a BASED ON clause. // -static gen_based( ACT action, int column) +static int gen_based( ACT action, int column) { BAS based_on; FLD field; @@ -795,7 +799,7 @@ static gen_based( ACT action, int column) default: sprintf(s2, "datatype %d unknown\n", field->fld_dtype); - return; + return 0; } for (p = s2; *p; p++, q++) *q = *p; @@ -811,7 +815,7 @@ static gen_based( ACT action, int column) // Make a blob FOR loop. // -static gen_blob_close( ACT action, USHORT column) +static int gen_blob_close( ACT action, USHORT column) { TEXT *command; BLB blob; @@ -823,7 +827,8 @@ static gen_blob_close( ACT action, USHORT column) else 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);", command, status_vector(action), blob->blb_ident); @@ -841,7 +846,7 @@ static gen_blob_close( ACT action, USHORT column) // End a blob FOR loop. // -static gen_blob_end( ACT action, USHORT column) +static int gen_blob_end( ACT action, USHORT column) { BLB blob; @@ -862,7 +867,7 @@ static gen_blob_end( ACT action, USHORT column) // 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); @@ -947,7 +952,7 @@ static gen_blob_open( ACT action, USHORT column) // 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; BLB blob; @@ -981,7 +986,7 @@ static gen_blob_open( ACT action, USHORT column) // 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; SCHAR c; @@ -1051,7 +1056,7 @@ static void gen_compatibility_symbol( // Generate text to compile a request. // -static gen_compile( ACT action, int column) +static int gen_compile( ACT action, int column) { REQ request; DBB db; @@ -1108,7 +1113,7 @@ static gen_compile( ACT action, int column) // 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; DBB db; @@ -1207,7 +1212,7 @@ static gen_create_database( ACT action, int column) // 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; @@ -1219,7 +1224,7 @@ static gen_cursor_close( ACT action, REQ request, int column) // 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 @@ -1239,7 +1244,7 @@ static gen_cursor_init( ACT action, int column) // 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; @@ -1253,7 +1258,7 @@ static gen_cursor_open( ACT action, REQ request, int column) // 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; REQ request; @@ -1270,7 +1275,7 @@ static gen_database( ACT action, int column) BOOLEAN array_flag; if (first_flag++ != 0) - return; + return 0; ib_fprintf(out_file, "\n----- GPRE Preprocessor Definitions -----\n"); @@ -1320,7 +1325,7 @@ static gen_database( ACT action, int column) max_count = 0; 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); } @@ -1399,7 +1404,7 @@ static gen_database( ACT action, int column) // Generate a call to update metadata. // -static gen_ddl( ACT action, int column) +static int gen_ddl( ACT action, int column) { REQ request; @@ -1443,7 +1448,7 @@ static gen_ddl( ACT action, int column) // 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; DBB db; @@ -1464,7 +1469,7 @@ static gen_drop_database( ACT action, int column) // Generate a dynamic SQL statement. // -static gen_dyn_close( ACT action, int column) +static int gen_dyn_close( ACT action, int column) { DYN statement; TEXT s[64]; @@ -1482,7 +1487,7 @@ static gen_dyn_close( ACT action, int column) // Generate a dynamic SQL statement. // -static gen_dyn_declare( ACT action, int column) +static int gen_dyn_declare( ACT action, int column) { DYN statement; TEXT s1[64], s2[64]; @@ -1502,7 +1507,7 @@ static gen_dyn_declare( ACT action, int column) // 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; TEXT s[64]; @@ -1523,7 +1528,7 @@ static gen_dyn_describe( ACT action, int column, BOOLEAN input_flag) // Generate a dynamic SQL statement. // -static gen_dyn_execute( ACT action, int column) +static int gen_dyn_execute( ACT action, int column) { DYN statement; TEXT *transaction, s[64]; @@ -1584,7 +1589,7 @@ static gen_dyn_execute( ACT action, int column) // Generate a dynamic SQL statement. // -static gen_dyn_fetch( ACT action, int column) +static int gen_dyn_fetch( ACT action, int column) { DYN statement; TEXT s[64]; @@ -1611,7 +1616,7 @@ static gen_dyn_fetch( ACT action, int column) // 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; DBB database; @@ -1657,7 +1662,7 @@ static gen_dyn_immediate( ACT action, int column) // Generate a dynamic SQL statement. // -static gen_dyn_insert( ACT action, int column) +static int gen_dyn_insert( ACT action, int column) { DYN statement; TEXT s[64]; @@ -1682,7 +1687,7 @@ static gen_dyn_insert( ACT action, int column) // Generate a dynamic SQL statement. // -static gen_dyn_open( ACT action, int column) +static int gen_dyn_open( ACT action, int column) { DYN statement; TEXT *transaction, s[64]; @@ -1732,7 +1737,7 @@ static gen_dyn_open( ACT action, int column) // Generate a dynamic SQL statement. // -static gen_dyn_prepare( ACT action, int column) +static int gen_dyn_prepare( ACT action, int column) { DYN statement; DBB database; @@ -1786,7 +1791,7 @@ static gen_dyn_prepare( ACT action, int column) // Generate substitution text for END_MODIFY. // -static gen_emodify( ACT action, int column) +static int gen_emodify( ACT action, int column) { UPD modify; REF reference, source; @@ -1815,7 +1820,7 @@ static gen_emodify( ACT action, int column) // Generate substitution text for END_STORE. // -static gen_estore( ACT action, int column) +static int gen_estore( ACT action, int column) { REQ request; @@ -1826,7 +1831,7 @@ static gen_estore( ACT action, int column) if (request->req_type == REQ_store2) { if (action->act_error) ENDIF; - return; + return 0; } 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. // -static gen_endfor( ACT action, int column) +static int gen_endfor( ACT action, int column) { REQ request; @@ -1861,7 +1866,7 @@ static gen_endfor( ACT action, int column) // Generate substitution text for ERASE. // -static gen_erase( ACT action, int column) +static int gen_erase( ACT action, int column) { UPD erase; @@ -1914,7 +1919,7 @@ static SSHORT gen_event_block( ACT action) // 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; REF reference; @@ -1979,7 +1984,7 @@ static gen_event_init( ACT action, int column) // 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; NOD event_init; @@ -2042,7 +2047,7 @@ static gen_event_wait( ACT action, int column) // stream fetch). // -static gen_fetch( ACT action, int column) +static int gen_fetch( ACT action, int column) { REQ request; NOD var_list; @@ -2112,7 +2117,7 @@ static gen_fetch( ACT action, int column) if (var_list = (NOD) action->act_object) { 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 for bug#940. mao 6/20/89 */ @@ -2144,7 +2149,7 @@ static gen_fetch( ACT action, int column) // Generate substitution text for FINISH. // -static gen_finish( ACT action, int column) +static int gen_finish( ACT action, int column) { DBB db; REQ request; @@ -2214,7 +2219,7 @@ static gen_finish( ACT action, int column) // Generate substitution text for FOR statement. // -static gen_for( ACT action, int column) +static int gen_for( ACT action, int column) { POR port; REQ request; @@ -2252,7 +2257,7 @@ static gen_for( ACT action, int column) // 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; REQ request; @@ -2294,7 +2299,7 @@ static gen_form_display( ACT action, int column) // 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; FORM form; @@ -2311,7 +2316,7 @@ static gen_form_end( ACT action, int column) // 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; FORM form; @@ -2375,7 +2380,7 @@ static int gen_function( ACT function, int column) if (action->act_type != ACT_any) { IBERROR("can't generate function"); - return; + return 0; } request = action->act_request; @@ -2429,7 +2434,7 @@ static int gen_function( ACT function, int column) default: IBERROR("gen_function: unsupported datatype"); - return; + return 0; } ib_fprintf(out_file, " %s\t%s;\n", dtype, 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. // -static gen_get_or_put_slice( +static int gen_get_or_put_slice( ACT action, 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);"; if (!(reference->ref_flags & REF_fetch_array)) - return; + return 0; args.pat_vector1 = status_vector(action); /* status vector */ 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. // -static gen_get_segment( ACT action, int column) +static int gen_get_segment( ACT action, int column) { BLB blob; REF into; @@ -2561,7 +2566,7 @@ static gen_get_segment( ACT action, int column) // 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; FINT display; @@ -2576,7 +2581,7 @@ static gen_item_end( ACT action, int column) request = action->act_request; if (request->req_type == REQ_menu) { gen_menu_item_end(action, column); - return; + return 0; } 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); printa(column, "%s := %s + 1;", index, index); printa(column, "end loop"); - return; + return 0; } dbb = request->req_database; @@ -2595,7 +2600,7 @@ static gen_item_end( ACT action, int column) for (reference = port->por_references; reference; reference = reference->ref_next) if (master = reference->ref_master) printa(column, "%s := %d;", gen_name(s, reference, TRUE), - PYXIS__OPT_DISPLAY); + PYXIS_OPT_DISPLAY); printa(column, "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. // -static gen_item_for( ACT action, int column) +static int gen_item_for( ACT action, int column) { REQ request, parent; FORM form; @@ -2620,7 +2625,7 @@ static gen_item_for( ACT action, int column) request = action->act_request; if (request->req_type == REQ_menu) { gen_menu_item_for(action, column); - return; + return 0; } column += INDENT; @@ -2639,7 +2644,7 @@ static gen_item_for( ACT action, int column) printa(column, "end if;"); if (action->act_type != ACT_item_for) - return; + return 0; // Build stuff for item loop @@ -2663,7 +2668,7 @@ static gen_item_for( ACT action, int column) // and get the result. // -static gen_loop( ACT action, int column) +static int gen_loop( ACT action, int column) { REQ request; 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; @@ -2704,7 +2709,7 @@ static gen_menu( ACT action, int column) // 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; 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; request = action->act_request; if (request->req_flags & REQ_menu_for) - return; + return 0; printa(column, "when others =>"); 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; @@ -2773,7 +2778,7 @@ static gen_menu_entree( ACT action, int column) // 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; SSHORT ident, length; @@ -2819,7 +2824,7 @@ static gen_menu_entree_att( ACT action, int column) // 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; @@ -2839,7 +2844,7 @@ static gen_menu_for( ACT action, int column) // 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; ENTREE entree; @@ -2847,7 +2852,7 @@ static gen_menu_item_end( ACT action, int column) if (action->act_pair->act_type == ACT_item_for) { column += INDENT; printa(column, "end loop"); - return; + return 0; } entree = (ENTREE) action->act_pair->act_object; @@ -2869,13 +2874,13 @@ static gen_menu_item_end( ACT action, int column) // 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; REQ request; if (action->act_type != ACT_item_for) - return; + return 0; // 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. // -static gen_menu_request( REQ request, int column) +static int gen_menu_request( REQ request, int column) { ACT action; MENU menu; @@ -2983,7 +2988,7 @@ static TEXT *gen_name( TEXT * string, REF reference, BOOLEAN as_blob) // 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; @@ -3003,7 +3008,7 @@ static gen_on_error( ACT action, USHORT column) // Generate code for an EXECUTE PROCEDURE. // -static gen_procedure( ACT action, int column) +static int gen_procedure( ACT action, int column) { PAT args; TEXT *pattern; @@ -3062,7 +3067,7 @@ static gen_procedure( ACT action, int column) // 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; REF from; @@ -3092,7 +3097,7 @@ static gen_put_segment( ACT action, int column) // Generate BLR in raw, numeric form. Ughly but dense. // -static gen_raw( +static int gen_raw( UCHAR * blr, enum req_t request_type, int request_length, int column) { @@ -3127,7 +3132,7 @@ static gen_raw( // Generate substitution text for READY // -static gen_ready( ACT action, int column) +static int gen_ready( ACT action, int column) { RDY ready; DBB db; @@ -3156,7 +3161,7 @@ static gen_ready( ACT action, int column) // 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; @@ -3182,7 +3187,7 @@ static gen_receive( ACT action, int column, POR port) // 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; REQ request; @@ -3211,7 +3216,7 @@ static gen_release( ACT action, int column) // Generate definitions associated with a single request. // -static gen_request( REQ request, int column) +static int gen_request( REQ request, int column) { ACT action; UPD modify; @@ -3302,37 +3307,43 @@ static gen_request( REQ request, int column) case REQ_create_database: case REQ_ready: 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"); break; case REQ_ddl: 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"); break; case REQ_form: 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"); break; case REQ_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"); break; case REQ_slice: 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"); break; default: 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"); } } @@ -3374,7 +3385,7 @@ static gen_request( REQ request, int column) printa(column, "isc_%d\t: CONSTANT interbase.blr (1..%d) := (", 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); printa(column, "); \t--- end of SDL string for isc_%d\n", reference->ref_sdl_ident); @@ -3383,7 +3394,8 @@ static gen_request( REQ request, int column) printa(column, "--- FORMATTED REQUEST SDL FOR GDS_%d = \n", 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"); } } @@ -3418,7 +3430,7 @@ static gen_request( REQ request, int column) // in a store2 statement. // -static gen_return_value( ACT action, int column) +static int gen_return_value( ACT action, int column) { UPD update; REF reference; @@ -3442,7 +3454,7 @@ static gen_return_value( ACT action, int column) // routine, insert local definitions. // -static gen_routine( ACT action, int column) +static int gen_routine( ACT action, int column) { BLB blob; REQ request; @@ -3490,7 +3502,7 @@ static gen_routine( ACT action, int column) // 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; @@ -3522,7 +3534,7 @@ static gen_s_end( ACT action, int column) // Generate substitution text for FETCH. // -static gen_s_fetch( ACT action, int column) +static int gen_s_fetch( ACT action, int column) { REQ request; @@ -3540,7 +3552,7 @@ static gen_s_fetch( ACT action, int column) // 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; POR port; @@ -3580,7 +3592,7 @@ static gen_s_start( ACT action, int column) // 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; @@ -3598,7 +3610,7 @@ static gen_segment( ACT action, int column) // Generate code for standalone SELECT statement. // -static gen_select( ACT action, int column) +static int gen_select( ACT action, int column) { REQ request; POR port; @@ -3619,7 +3631,7 @@ static gen_select( ACT action, int column) if (var_list = (NOD) action->act_object) 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) { gen_receive(action, column, port); 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. // -static gen_send( ACT action, POR port, int column) +static int gen_send( ACT action, POR port, int column) { REQ request; @@ -3661,13 +3673,13 @@ static gen_send( ACT action, POR port, int column) // 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; REF reference, upper, lower; SLC slice; PAT args; - struct slc_repeat *tail, *end; + slc::slc_repeat *tail, *end; TEXT *pattern1 = "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);"; @@ -3731,7 +3743,7 @@ static gen_slice( ACT action, int column) // 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; TEXT *vector; @@ -3772,7 +3784,7 @@ static gen_start( ACT action, POR port, int column) // call and any variable initialization required. // -static gen_store( ACT action, int column) +static int gen_store( ACT action, int column) { REQ request; REF reference; @@ -3803,7 +3815,7 @@ static gen_store( ACT action, int column) // 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; TRA trans; @@ -3818,7 +3830,7 @@ static gen_t_start( ACT action, int column) if (!action || !(trans = (TRA) action->act_object)) { t_start_auto(action, 0, status_vector(action), column, FALSE); - return; + return 0; } // 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 // -static gen_tpb( TPB tpb, int column) +static int gen_tpb( TPB tpb, int column) { TEXT *text, buffer[80], c, *p; int length; @@ -3899,7 +3911,7 @@ static gen_tpb( TPB tpb, int column) // 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) @@ -3946,7 +3958,7 @@ static int gen_type( ACT action, int column) // 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; UPD modify; @@ -3963,7 +3975,7 @@ static gen_update( ACT action, int column) // Substitute for a variable reference. // -static gen_variable( ACT action, int column) +static int gen_variable( ACT action, int column) { 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. // -static gen_whenever( SWE label, int column) +static int gen_whenever( SWE label, int column) { TEXT *condition; @@ -4006,7 +4018,7 @@ static gen_whenever( SWE label, int column) // Create a new window. // -static gen_window_create( ACT action, int column) +static int gen_window_create( ACT action, int column) { printa(column, @@ -4020,7 +4032,7 @@ static gen_window_create( ACT action, int column) // 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)", @@ -4033,7 +4045,7 @@ static gen_window_delete( ACT action, int column) // 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)", @@ -4047,7 +4059,7 @@ static gen_window_suspend( ACT action, int column) // output file. // -static make_array_declaration( REF reference, int column) +static int make_array_declaration( REF reference, int column) { FLD field; 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. if (field->fld_array_info->ary_declared) - return; + return 0; field->fld_array_info->ary_declared = TRUE; @@ -4134,7 +4146,7 @@ static make_array_declaration( REF reference, int column) default: printa(column, "datatype %d unknown for field %s", field->fld_array_info->ary_dtype, name); - return; + return 0; } ib_fprintf(out_file, ";\n"); @@ -4155,7 +4167,7 @@ static make_array_declaration( REF reference, int column) // 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) { @@ -4191,7 +4203,7 @@ static TEXT *make_name( TEXT * string, SYM symbol) // 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) @@ -4208,7 +4220,7 @@ static make_ok_test( ACT action, REQ request, int column) // Insert a port record description in output. // -static make_port( POR port, int column) +static int make_port( POR port, int column) { FLD field; REF reference; @@ -4284,7 +4296,7 @@ static make_port( POR port, int column) sprintf(s, "datatype %d unknown for field %s, msg %d", field->fld_dtype, name, port->por_msg_number); IBERROR(s); - return; + return 0; } } @@ -4313,7 +4325,7 @@ static make_port( POR port, int column) // ready; // -static make_ready( +static int make_ready( DBB db, TEXT * filename, TEXT * vector, USHORT column, REQ request) { @@ -4404,7 +4416,7 @@ static make_ready( // Print a fixed string at a particular column. // -static printa( int column, TEXT * string, ...) +static int printa( int column, TEXT * string, ...) { va_list ptr; @@ -4430,7 +4442,7 @@ static TEXT *request_trans( ACT action, REQ request) return trname; } 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. // -static t_start_auto( +static int t_start_auto( ACT action, REQ request, TEXT * vector, int column, SSHORT test) { diff --git a/src/gpre/c_cxx.cpp b/src/gpre/c_cxx.cpp index c8b90afce5..144613f084 100644 --- a/src/gpre/c_cxx.cpp +++ b/src/gpre/c_cxx.cpp @@ -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" @@ -149,7 +149,7 @@ static TEXT *make_name(TEXT *, SYM); static void make_ok_test(ACT, REQ, int); static void make_port(POR, int); 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 TEXT *request_trans(ACT, REQ); static TEXT *status_vector(ACT); @@ -171,6 +171,10 @@ static TEXT *status_name; #define GDS_INCLUDE "\"interbase:[syslib]gds.h\"" #endif +#ifdef DARWIN +#define GDS_INCLUDE "" +#endif + #ifndef GDS_INCLUDE #define GDS_INCLUDE "" #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, field->fld_length, variable, field->fld_length); 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); else if (reference->ref_source) 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, reference->ref_value); 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); #else /* 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, reference->ref_value); 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); #else /* 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 = "isc_%IFcreate%ELopen%EN_blob2 (%V1, &%DH, &%RT, &%BH, &%FR, (short) %N1, %I1);", *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)) { 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. // -static gen_blr( int *user_arg, int offset, TEXT * string) +static int gen_blr( int *user_arg, int offset, TEXT * string) { int indent, length; TEXT *p, *q, *p1, *q1, c, d, line[256]; @@ -1326,7 +1330,7 @@ static void gen_compatibility_symbol( TEXT * symbol, TEXT * v4_prefix, TEXT * trailer) { - TEXT *v3_prefix; + const char *v3_prefix; v3_prefix = (sw_language == lang_cxx) ? "gds_" : "gds__"; @@ -1347,7 +1351,7 @@ static void gen_compile( ACT action, int column) BLB blob; PAT args; 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)"; 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_length) 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); /* reset the length of the dpb */ @@ -1448,7 +1452,7 @@ static void gen_create_database( ACT action, int column) column += INDENT; BEGIN; 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); printa(column, "if (%s)", trname); column += INDENT; @@ -1459,10 +1463,10 @@ static void gen_create_database( ACT action, int column) trname, request->req_length, request->req_ident); column -= INDENT; 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); 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); SET_SQLCODE; END; @@ -1477,7 +1481,7 @@ static void gen_create_database( ACT action, int column) // 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; TEXT *pattern1 = @@ -1521,7 +1525,7 @@ static void gen_cursor_init( ACT action, int column) // 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; TEXT s[64]; @@ -1770,10 +1774,10 @@ static void gen_ddl( ACT action, int column) if (sw_auto) { column -= INDENT; 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); 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); } @@ -2129,7 +2133,7 @@ static void gen_emodify( ACT action, int column) ib_fprintf(out_file, "%s = %s;", s2, s1); #if (! (defined JPN_SJIS || defined JPN_EUC) ) 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); else ib_fprintf(out_file, "isc_ftof (%s, %d, %s, %d);", @@ -2499,15 +2503,15 @@ static void gen_finish( ACT action, int column) RDY ready; PAT args; TEXT *pattern1 = "if (%S2)\n\ - isc_%S1_transaction (%V1, &%S2);"; + isc_%S1_transaction (%V1, (void**) &%S2);"; args.pat_vector1 = status_vector(action); args.pat_string2 = transaction_name; if (sw_auto || ((action->act_flags & ACT_sql) && (action->act_type != ACT_disconnect))) { - args.pat_string1 = - (action->act_type != ACT_rfinish) ? "commit" : "rollback"; + args.pat_string1 = (TEXT*) + ((action->act_type != ACT_rfinish) ? "commit" : "rollback"); PATTERN_expand((USHORT) column, pattern1, &args); } @@ -2590,7 +2594,8 @@ static void gen_form_display( ACT action, int column) REF reference, master; POR port; DBB dbb; - TEXT s[32], *status, out[16]; + TEXT s[32], out[16]; + const char *status; int code; display = (FINT) action->act_object; @@ -2643,7 +2648,7 @@ static void gen_form_for( ACT action, int column) { REQ request; FORM form; - TEXT *status; + const char *status; DBB dbb; column += INDENT; @@ -2909,7 +2914,8 @@ static void gen_item_end( ACT action, int column) REF reference, master; POR port; DBB dbb; - TEXT s[32], *status; + TEXT s[32]; + const char *status; request = action->act_request; if (request->req_type == REQ_menu) { @@ -3519,7 +3525,7 @@ static void gen_receive( ACT action, int column, POR port) { PAT args; 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_vector1 = status_vector(action); @@ -3977,7 +3983,7 @@ static void gen_send( ACT action, POR port, int column) { PAT args; 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_vector1 = status_vector(action); @@ -4072,8 +4078,8 @@ static void gen_start( ACT action, POR port, int column, BOOLEAN sending) { PAT args; TEXT *pattern1 = - "isc_start_and_send (%V1, &%RH, &%S1, (short) %PN, (short) %PL, &%PI, (short) %RL);"; - TEXT *pattern2 = "isc_start_request (%V1, &%RH, &%S1, (short) %RL);"; + "isc_start_and_send (%V1, (void**) &%RH, (void**) &%S1, (short) %PN, (short) %PL, &%PI, (short) %RL);"; + TEXT *pattern2 = "isc_start_request (%V1, (void**) &%RH, (void**) &%S1, (short) %RL);"; REF reference; 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, (trans->tra_handle) ? trans->tra_handle : transaction_name, trans->tra_db_count); @@ -4251,13 +4257,13 @@ static void gen_trans( ACT action, int column) { 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), (action->act_object) ? (TEXT *) (action-> act_object) : transaction_name); else - printa(column, "isc_%s_transaction (%s, &%s);", + printa(column, "isc_%s_transaction (%s, (void**) &%s);", (action->act_type == ACT_commit) ? "commit" : (action->act_type == ACT_rollback) ? "rollback" : @@ -4688,7 +4694,7 @@ static void make_ready( if (request && request->req_flags & REQ_extend_dpb) { if (request->req_length) 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); /* reset the length of the dpb */ @@ -4703,7 +4709,7 @@ static void make_ready( // 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; @@ -4815,7 +4821,7 @@ static void t_start_auto( else 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); // Some systems don't like infinitely long lines. Limit them to 256. diff --git a/src/gpre/cmd.cpp b/src/gpre/cmd.cpp index 1a0a3de593..15b6f0b6e4 100644 --- a/src/gpre/cmd.cpp +++ b/src/gpre/cmd.cpp @@ -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 @@ -110,6 +110,7 @@ static void set_statistics(REQ, ACT); // numbers, and internal idents. Compute length of request. // +int CMD_compile_ddl(register REQ request) { ACT action; diff --git a/src/gpre/cmp.cpp b/src/gpre/cmp.cpp index 9548b41160..a93e08bcf4 100644 --- a/src/gpre/cmp.cpp +++ b/src/gpre/cmp.cpp @@ -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 @@ -329,6 +329,7 @@ void CMP_compile_request( register REQ request) // override of the field, -1 is returned. // +int CMP_display_code(FINT display, REF reference) { int code; diff --git a/src/gpre/cob.cpp b/src/gpre/cob.cpp index 5c70b651e1..10803c796c 100644 --- a/src/gpre/cob.cpp +++ b/src/gpre/cob.cpp @@ -25,10 +25,10 @@ // //____________________________________________________________ // -// $Id: cob.cpp,v 1.1.1.1 2001-05-23 13:25:30 tamlin Exp $ +// $Id: cob.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $ // - /* $Id: cob.cpp,v 1.1.1.1 2001-05-23 13:25:30 tamlin Exp $ */ + /* $Id: cob.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $ */ #include "../jrd/ib_stdio.h" #include "../jrd/common.h" @@ -43,6 +43,12 @@ #include "../gpre/cmp_proto.h" #include "../gpre/lang_proto.h" #include "../gpre/pat_proto.h" +#include "../gpre/prett_proto.h" +#include "../gpre/gpre_proto.h" + +#ifdef HAVE_STRING_H +#include +#endif // vms requires all caps in function call names; hp requires lc @@ -149,6 +155,10 @@ #define MICROFOCUS #endif +#ifdef DARWIN +#define MICROFOCUS +#endif + #if defined FREEBSD || defined NETBSD #define MICROFOCUS #endif @@ -963,7 +973,7 @@ static int align( int column) int i; if (column < 0) - return; + return 0; ib_putc('\n', out_file); @@ -982,7 +992,7 @@ static int align( int column) // a port variable. // -static asgn_from( ACT action, REF reference) +static int asgn_from( ACT action, REF reference) { FLD field; TEXT *value, name[64], variable[20], temp[20]; @@ -1062,7 +1072,7 @@ static int asgn_sqlda_from( // a port variable. // -static asgn_to( ACT action, REF reference) +static int asgn_to( ACT action, REF reference) { FLD field; REF source; @@ -1075,7 +1085,7 @@ static asgn_to( ACT action, REF reference) if (field->fld_array_info) { source->ref_value = reference->ref_value; gen_get_or_put_slice(action, source, TRUE); - return; + return 0; } field = reference->ref_field; @@ -1100,7 +1110,7 @@ static asgn_to( ACT action, REF reference) // a port variable. // -static asgn_to_proc( REF reference) +static int asgn_to_proc( REF reference) { FLD field; TEXT s[64]; @@ -1148,7 +1158,7 @@ static int gen_any( ACT action) // Generate code for AT END clause of FETCH. // -static gen_at_end( ACT action) +static int gen_at_end( ACT action) { REQ request; TEXT s[20]; @@ -1165,7 +1175,7 @@ static gen_at_end( ACT action) // Substitute for a BASED ON clause. // -static gen_based( ACT action) +static int gen_based( ACT action) { BAS based_on; FLD field; @@ -1247,7 +1257,7 @@ static gen_based( ACT action) default: sprintf(s, "datatype %d unknown\n", field->fld_dtype); CPR_error(s); - return; + return 0; } if (*based_on->bas_terminator == '.') @@ -1260,7 +1270,7 @@ static gen_based( ACT action) // Make a blob FOR loop. // -static gen_blob_close( ACT action) +static int gen_blob_close( ACT action) { TEXT *command, buffer[80]; BLB blob; @@ -1272,7 +1282,7 @@ static gen_blob_close( ACT action) else 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; sprintf(buffer, ISC_BLOB, command); printa(names[COLUMN], TRUE, "CALL \"%s\" USING %s, %s%s%d", @@ -1288,7 +1298,7 @@ static gen_blob_close( ACT action) // End a blob FOR loop. // -static gen_blob_end( ACT action) +static int gen_blob_end( ACT action) { BLB blob; @@ -1315,7 +1325,7 @@ static gen_blob_end( ACT action) // Make a blob FOR loop. // -static gen_blob_for( ACT action) +static int gen_blob_for( ACT action) { gen_blob_open(action); @@ -1332,7 +1342,7 @@ static gen_blob_for( ACT action) // Generate the call to open (or create) a blob. // -static gen_blob_open( ACT action) +static int gen_blob_open( ACT action) { BLB blob; USHORT column; @@ -1410,7 +1420,7 @@ static gen_blob_open( ACT action) // 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, comment, i, max_line, max_diff; TEXT *p, *q, c; @@ -1484,10 +1494,10 @@ static int gen_clear_handles( ACT action) for (request = requests; request; request = request->req_next) { if (!(request->req_flags & REQ_exp_hand)) - printa(names[COLUMN], "%s = 0;", request->req_handle); + printa(names[COLUMN], TRUE, "%s = 0;", request->req_handle); if (request->req_form_handle && !(request->req_flags & REQ_exp_form_handle)) - printa(names[COLUMN], "%s = 0;", request->req_form_handle); + printa(names[COLUMN], (USHORT) "%s = 0;", request->req_form_handle); } } @@ -1497,7 +1507,7 @@ static int gen_clear_handles( ACT action) // Generate text to compile a request. // -static gen_compile( ACT action) +static int gen_compile( ACT action) { REQ request; DBB db; @@ -1559,7 +1569,7 @@ static gen_compile( ACT action) // Generate a call to create a database. // -static gen_create_database( ACT action) +static int gen_create_database( ACT action) { REQ request; DBB db, dbisc; @@ -1717,7 +1727,7 @@ static gen_create_database( ACT action) // Generate substitution text for END_STREAM. // -static gen_cursor_close( ACT action, REQ request) +static int gen_cursor_close( ACT action, REQ request) { printa(names[COLUMN], FALSE, "IF %s%dS NOT = 0 THEN", @@ -1736,7 +1746,7 @@ static gen_cursor_close( ACT action, REQ request) // Generate text to initialize a cursor. // -static gen_cursor_init( ACT action) +static int gen_cursor_init( ACT action) { // If blobs are present, zero out all of the blob handles. After this @@ -1754,7 +1764,7 @@ static gen_cursor_init( ACT action) // Generate text to open an embedded SQL cursor. // -static gen_cursor_open( ACT action, REQ request) +static int gen_cursor_open( ACT action, REQ request) { TEXT s[64]; @@ -1811,7 +1821,7 @@ static gen_cursor_open( ACT action, REQ request) // Generate insertion text for the database statement. // -static gen_database( ACT action) +static int gen_database( ACT action) { DBB db; REQ request; @@ -1830,7 +1840,7 @@ static gen_database( ACT action) LLS stack_ptr; if (first_flag++ != 0) - return; + return 0; sprintf(output_buffer, "\n%s**** GDS Preprocessor Definitions ****\n\n", names[COMMENT]); @@ -2034,7 +2044,7 @@ static gen_database( ACT action) max_count = 0; for (stack_ptr = events; stack_ptr; stack_ptr = stack_ptr->lls_next) { - count = gen_event_block(stack_ptr->lls_object); + count = gen_event_block((ACT) stack_ptr->lls_object); max_count = MAX(count, max_count); } @@ -2063,7 +2073,7 @@ static gen_database( ACT action) // Generate a call to update metadata. // -static gen_ddl( ACT action) +static int gen_ddl( ACT action) { REQ request; @@ -2110,7 +2120,7 @@ static gen_ddl( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_close( ACT action) +static int gen_dyn_close( ACT action) { DYN statement; TEXT s[64]; @@ -2133,7 +2143,7 @@ static gen_dyn_close( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_declare( ACT action) +static int gen_dyn_declare( ACT action) { DYN statement; TEXT s1[64], s2[64]; @@ -2160,7 +2170,7 @@ static gen_dyn_declare( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_describe( ACT action, BOOLEAN bind_flag) +static int gen_dyn_describe( ACT action, BOOLEAN bind_flag) { DYN statement; TEXT s[64]; @@ -2188,7 +2198,7 @@ static gen_dyn_describe( ACT action, BOOLEAN bind_flag) // Generate a dynamic SQL statement. // -static gen_dyn_execute( ACT action) +static int gen_dyn_execute( ACT action) { DYN statement; TEXT *transaction, s[64]; @@ -2218,8 +2228,8 @@ static gen_dyn_execute( ACT action) printa(names[COLUMN], TRUE, (statement->dyn_sqlda2) ? - "CALL \"%s\" USING %s, %s%s, %s%s, %s%d%s, %s%s, %s%s" : - "CALL \"%s\" USING %s, %s%s, %s%s, %s%d%s, %s%s", + (TEXT*) "CALL \"%s\" USING %s, %s%s, %s%s, %s%d%s, %s%s, %s%s" : + (TEXT*) "CALL \"%s\" USING %s, %s%s, %s%s, %s%d%s, %s%s", (statement->dyn_sqlda2) ? ISC_EXECUTE2 : ISC_EXECUTE, status_vector(action), BY_REF, transaction, @@ -2242,7 +2252,7 @@ static gen_dyn_execute( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_fetch( ACT action) +static int gen_dyn_fetch( ACT action) { DYN statement; TEXT s[64]; @@ -2283,7 +2293,7 @@ static gen_dyn_fetch( ACT action) // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. // -static gen_dyn_immediate( ACT action) +static int gen_dyn_immediate( ACT action) { DYN statement; DBB database; @@ -2325,8 +2335,8 @@ static gen_dyn_immediate( ACT action) printa(names[COLUMN], TRUE, (statement->dyn_sqlda2) ? - "CALL \"%s\" USING %s, %s%s, %s%s,%s %s%s, %s%d%s, %s%s, %s%s" : - "CALL \"%s\" USING %s, %s%s, %s%s,%s %s%s, %s%d%s, %s%s", + (TEXT*) "CALL \"%s\" USING %s, %s%s, %s%s,%s %s%s, %s%d%s, %s%s, %s%s" : + (TEXT*) "CALL \"%s\" USING %s, %s%s, %s%s,%s %s%s, %s%d%s, %s%s", (statement-> dyn_sqlda2) ? ISC_EXECUTE_IMMEDIATE2 : ISC_EXECUTE_IMMEDIATE, status_vector(action), BY_REF, database->dbb_name->sym_string, @@ -2348,7 +2358,7 @@ static gen_dyn_immediate( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_insert( ACT action) +static int gen_dyn_insert( ACT action) { DYN statement; TEXT s[64]; @@ -2379,7 +2389,7 @@ static gen_dyn_insert( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_open( ACT action) +static int gen_dyn_open( ACT action) { DYN statement; TEXT *transaction, s[64]; @@ -2409,8 +2419,8 @@ static gen_dyn_open( ACT action) printa(names[COLUMN], TRUE, (statement->dyn_sqlda2) ? - "CALL \"%s\" USING %s, %s%s, %s%s, %s%d%s, %s%s, %s%s" : - "CALL \"%s\" USING %s, %s%s, %s%s, %s%d%s, %s%s", + (TEXT*) "CALL \"%s\" USING %s, %s%s, %s%s, %s%d%s, %s%s, %s%s" : + (TEXT*) "CALL \"%s\" USING %s, %s%s, %s%s, %s%d%s, %s%s", (statement->dyn_sqlda2) ? ISC_OPEN2 : ISC_OPEN, status_vector(action), BY_REF, transaction, @@ -2433,7 +2443,7 @@ static gen_dyn_open( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_prepare( ACT action) +static int gen_dyn_prepare( ACT action) { DYN statement; DBB database; @@ -2494,7 +2504,7 @@ static gen_dyn_prepare( ACT action) // Generate substitution text for END_MODIFY. // -static gen_emodify( ACT action) +static int gen_emodify( ACT action) { UPD modify; REF reference, source; @@ -2531,7 +2541,7 @@ static gen_emodify( ACT action) // Generate substitution text for END_STORE. // -static gen_estore( ACT action) +static int gen_estore( ACT action) { REQ request; @@ -2545,7 +2555,7 @@ static gen_estore( ACT action) // Generate end-if for AT_END if statement // -static gen_end_fetch( ACT action) +static int gen_end_fetch( ACT action) { printa(names[COLUMN], FALSE, "END-IF"); @@ -2558,7 +2568,7 @@ static gen_end_fetch( ACT action) // Generate definitions associated with a single request. // -static gen_endfor( ACT action) +static int gen_endfor( ACT action) { REQ request; @@ -2576,7 +2586,7 @@ static gen_endfor( ACT action) // Generate substitution text for ERASE. // -static gen_erase( ACT action) +static int gen_erase( ACT action) { UPD erase; @@ -2619,7 +2629,7 @@ static SSHORT gen_event_block( ACT action) // Generate substitution text for EVENT_INIT. // -static gen_event_init( ACT action) +static int gen_event_init( ACT action) { NOD init, event_list, *ptr, *end, node; REF reference; @@ -2698,7 +2708,7 @@ static gen_event_init( ACT action) // Generate substitution text for EVENT_WAIT. // -static gen_event_wait( ACT action) +static int gen_event_wait( ACT action) { PAT args; NOD event_init; @@ -2760,7 +2770,7 @@ static gen_event_wait( ACT action) // stream fetch). // -static gen_fetch( ACT action) +static int gen_fetch( ACT action) { REQ request; NOD var_list; @@ -2823,7 +2833,7 @@ static gen_fetch( ACT action) printa(names[COLUMN], FALSE, "MOVE 0 TO SQLCODE"); if (var_list = (NOD) action->act_object) for (i = 0; i < var_list->nod_count; i++) { - asgn_to(action, var_list->nod_arg[i]); + asgn_to(action, (REF) var_list->nod_arg[i]); } printa(names[COLUMN], FALSE, "ELSE"); printa(names[COLUMN], FALSE, "MOVE 100 TO SQLCODE"); @@ -2841,7 +2851,7 @@ static gen_fetch( ACT action) // Generate substitution text for FINISH // -static gen_finish( ACT action) +static int gen_finish( ACT action) { DBB db; RDY ready; @@ -2900,7 +2910,7 @@ static gen_finish( ACT action) // Generate substitution text for FOR statement. // -static gen_for( ACT action) +static int gen_for( ACT action) { REQ request; TEXT s[20]; @@ -2927,7 +2937,7 @@ static gen_for( ACT action) // Generate code for a form interaction. // -static gen_form_display( ACT action) +static int gen_form_display( ACT action) { FINT display; REQ request; @@ -2974,7 +2984,7 @@ static gen_form_display( ACT action) // Generate code for a form block. // -static gen_form_end( ACT action) +static int gen_form_end( ACT action) { printa(names[COLUMN], TRUE, "CALL \"%s\" USING %s%s", @@ -3000,7 +3010,7 @@ static int gen_function( ACT function) if (action->act_type != ACT_any) { IBERROR("can't generate function"); - return; + return 0; } request = action->act_request; @@ -3055,7 +3065,7 @@ static int gen_function( ACT function) default: IBERROR("gen_function: unsupported datatype"); - return; + return 0; } ib_fprintf(out_file, " %s\t%s;\n", dtype, gen_name(s, reference->ref_source, TRUE)); @@ -3087,7 +3097,7 @@ static int gen_function( ACT function) // Generate code for a form block. // -static gen_form_for( ACT action) +static int gen_form_for( ACT action) { REQ request; FORM form; @@ -3150,7 +3160,7 @@ static gen_form_for( ACT action) // or isc_put_slice for an array. // -static gen_get_or_put_slice( ACT action, REF reference, BOOLEAN get) +static int gen_get_or_put_slice( ACT action, REF reference, BOOLEAN get) { int column; PAT args; @@ -3161,7 +3171,7 @@ static gen_get_or_put_slice( ACT action, REF reference, BOOLEAN get) "CALL \"%S7\" USING %V1, %RF%DH%RE, %RF%S1%RE, %RF%S2%RE, %VF%N1%VE, %RF%S3%RE, %VF%N2%VE, %VF%S4%VE, %VF%L1%VE, %RF%S5%RE"; if (!(reference->ref_flags & REF_fetch_array)) - return; + return 0; column = strlen(names[COLUMN]); @@ -3194,7 +3204,7 @@ static gen_get_or_put_slice( ACT action, REF reference, BOOLEAN get) } args.pat_string6 = names[ISC_ARRAY_LENGTH]; /* return length */ - args.pat_string7 = (get) ? ISC_GET_SLICE : ISC_PUT_SLICE; + args.pat_string7 = (get) ? (TEXT*) ISC_GET_SLICE : (TEXT*) ISC_PUT_SLICE; PATTERN_expand(column, (get) ? pattern1 : pattern2, &args); ib_fprintf(out_file, "\n"); @@ -3206,7 +3216,7 @@ static gen_get_or_put_slice( ACT action, REF reference, BOOLEAN get) // Generate the code to do a get segment. // -static gen_get_segment( ACT action) +static int gen_get_segment( ACT action) { BLB blob; REF into; @@ -3255,7 +3265,7 @@ static gen_get_segment( ACT action) // Generate end of block for PUT_ITEM and FOR_ITEM. // -static gen_item_end( ACT action) +static int gen_item_end( ACT action) { REQ request; REF reference; @@ -3267,7 +3277,7 @@ static gen_item_end( ACT action) if (request->req_type == REQ_menu) { gen_menu_item_end(action); - return; + return 0; } if (action->act_pair->act_type == ACT_item_for) { @@ -3282,7 +3292,7 @@ static gen_item_end( ACT action) BY_REF, request->req_handle, BY_REF, names[ISC_], request->req_ports->por_ident); printa(names[COLUMN], FALSE, "END-PERFORM"); - return; + return 0; } dbb = request->req_database; @@ -3293,7 +3303,7 @@ static gen_item_end( ACT action) for (reference = port->por_references; reference; reference = reference->ref_next) if (reference->ref_master) printa(names[COLUMN], FALSE, - "MOVE %d TO %s", PYXIS__OPT_DISPLAY, + "MOVE %d TO %s", PYXIS_OPT_DISPLAY, gen_name(s, reference, TRUE)); printa(names[COLUMN], TRUE, @@ -3311,7 +3321,7 @@ static gen_item_end( ACT action) // Generate insert text for FOR_ITEM and PUT_ITEM. // -static gen_item_for( ACT action) +static int gen_item_for( ACT action) { REQ request, parent; FORM form; @@ -3321,7 +3331,7 @@ static gen_item_for( ACT action) if (request->req_type == REQ_menu) { gen_menu_item_for(action); - return; + return 0; } form = request->req_form; @@ -3341,7 +3351,7 @@ static gen_item_for( ACT action) printa(names[COLUMN], FALSE, "END-IF"); if (action->act_type != ACT_item_for) - return; + return 0; // Build stuff for item loop @@ -3367,7 +3377,7 @@ static gen_item_for( ACT action) // // -static gen_loop( ACT action) +static int gen_loop( ACT action) { REQ request; POR port; @@ -3390,7 +3400,7 @@ static gen_loop( ACT action) // // -static gen_menu( ACT action) +static int gen_menu( ACT action) { REQ request; @@ -3419,7 +3429,7 @@ static gen_menu( ACT action) // Generate code for a menu interaction. // -static gen_menu_display( ACT action) +static int gen_menu_display( ACT action) { MENU menu; REQ request, display_request; @@ -3459,14 +3469,14 @@ static gen_menu_display( ACT action) // // -static gen_menu_end( ACT action) +static int gen_menu_end( ACT action) { REQ request; request = action->act_request; if (request->req_flags & REQ_menu_for) - return; + return 0; printa(names[COLUMN], FALSE, "END-IF"); } @@ -3476,7 +3486,7 @@ static gen_menu_end( ACT action) // // -static gen_menu_entree( ACT action) +static int gen_menu_entree( ACT action) { REQ request; @@ -3494,7 +3504,7 @@ static gen_menu_entree( ACT action) // // Generate code for a reference to a menu or entree attribute. -static gen_menu_entree_att( ACT action) +static int gen_menu_entree_att( ACT action) { MENU menu; SSHORT ident, length; @@ -3540,7 +3550,7 @@ static gen_menu_entree_att( ACT action) // Generate code for a menu block. // -static gen_menu_for( ACT action) +static int gen_menu_for( ACT action) { REQ request; @@ -3560,7 +3570,7 @@ static gen_menu_for( ACT action) // for a dynamic menu. // -static gen_menu_item_end( ACT action) +static int gen_menu_item_end( ACT action) { REQ request; ENTREE entree; @@ -3579,7 +3589,7 @@ static gen_menu_item_end( ACT action) BY_REF, names[ISC_], entree->entree_end); printa(names[COLUMN], FALSE, "END-PERFORM"); - return; + return 0; } printa(names[COLUMN], @@ -3599,13 +3609,13 @@ static gen_menu_item_end( ACT action) // for a dynamic menu. // -static gen_menu_item_for( ACT action) +static int gen_menu_item_for( ACT action) { ENTREE entree; REQ request; if (action->act_type != ACT_item_for) - return; + return 0; // Build stuff for item loop @@ -3633,7 +3643,7 @@ static gen_menu_item_for( ACT action) // Generate definitions associated with a dynamic menu request. // -static gen_menu_request( REQ request) +static int gen_menu_request( REQ request) { ACT action; MENU menu; @@ -3714,7 +3724,7 @@ static TEXT *gen_name( TEXT * string, REF reference, BOOLEAN as_blob) // Generate a block to handle errors. // -static gen_on_error( ACT action) +static int gen_on_error( ACT action) { printa(names[COLUMN], FALSE, "IF %s (2) NOT = 0 THEN", names[ISC_STATUS]); @@ -3727,7 +3737,7 @@ static gen_on_error( ACT action) // Generate code for an EXECUTE PROCEDURE. // -static gen_procedure( ACT action) +static int gen_procedure( ACT action) { PAT args; TEXT *pattern; @@ -3793,7 +3803,7 @@ static gen_procedure( ACT action) // Generate the code to do a put segment. // -static gen_put_segment( ACT action) +static int gen_put_segment( ACT action) { BLB blob; REF from; @@ -3836,7 +3846,7 @@ static gen_put_segment( ACT action) // Generate BLR in raw, numeric form. Ughly but dense. // -static gen_raw( +static int gen_raw( UCHAR * blr, enum req_t request_type, int request_length, int ident) { @@ -3895,7 +3905,7 @@ static gen_raw( // string literals as CALL parameters. // -static gen_ready( ACT action) +static int gen_ready( ACT action) { RDY ready; DBB db, dbisc; @@ -3951,7 +3961,7 @@ static gen_ready( ACT action) // a serious error, it will be caught on the next statement. // -static gen_release( ACT action) +static int gen_release( ACT action) { DBB db, exp_db; REQ request; @@ -3980,7 +3990,7 @@ static gen_release( ACT action) // Generate a send or receive call for a port. // -static gen_receive( ACT action, POR port) +static int gen_receive( ACT action, POR port) { REQ request; @@ -4010,7 +4020,7 @@ static gen_receive( ACT action, POR port) // fields. // -static gen_request( REQ request) +static int gen_request( REQ request) { REF reference; BLB blob; @@ -4084,38 +4094,38 @@ static gen_request( REQ request) case REQ_create_database: case REQ_ready: 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"); break; case REQ_ddl: 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"); break; case REQ_form: 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"); break; case REQ_menu: string_type = "menu"; - if (PRETTY_print_menu(request->req_blr, gen_blr, 0, 0)) + if (PRETTY_print_menu((SCHAR*) request->req_blr, (int(*)()) gen_blr, 0, 0)) IBERROR("internal error during menu generation"); break; case REQ_slice: 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"); break; default: 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"); } } @@ -4158,10 +4168,10 @@ static gen_request( REQ request) reference = reference->ref_next) if (reference->ref_sdl) { printa(names[COLUMN_0], FALSE, "01 %s%d.", names[ISC_], reference->ref_sdl_ident); - gen_raw(reference->ref_sdl, REQ_slice, + gen_raw((UCHAR*) reference->ref_sdl, REQ_slice, reference->ref_sdl_length, reference->ref_sdl_ident); if (!sw_raw) - if (PRETTY_print_sdl(reference->ref_sdl, gen_blr, 0, 0)) + if (PRETTY_print_sdl(reference->ref_sdl, (int(*)()) gen_blr, 0, 0)) IBERROR("internal error during SDL generation"); printa(names[COMMENT], FALSE, " "); @@ -4176,7 +4186,7 @@ static gen_request( REQ request) printa(names[COLUMN_0], FALSE, "01 %s%d.", names[ISC_], blob->blb_bpb_ident); gen_raw(blob->blb_bpb, request->req_type, blob->blb_bpb_length, - request); + (int) request); printa(names[COMMENT], FALSE, " "); } @@ -4204,7 +4214,7 @@ static gen_request( REQ request) // Generate substitution text for END_STREAM. // -static gen_s_end( ACT action) +static int gen_s_end( ACT action) { REQ request; @@ -4234,7 +4244,7 @@ static gen_s_end( ACT action) // Generate substitution text for FETCH. // -static gen_s_fetch( ACT action) +static int gen_s_fetch( ACT action) { REQ request; @@ -4252,7 +4262,7 @@ static gen_s_fetch( ACT action) // used both by START_STREAM and FOR // -static gen_s_start( ACT action) +static int gen_s_start( ACT action) { REQ request; POR port; @@ -4299,7 +4309,7 @@ static gen_s_start( ACT action) // Generate a send call for a port. // -static gen_send( ACT action, POR port) +static int gen_send( ACT action, POR port) { REQ request; @@ -4326,14 +4336,14 @@ static gen_send( ACT action, POR port) // Generate support for get/put slice statement. // -static gen_slice( ACT action) +static int gen_slice( ACT action) { REQ request, parent_request; REF reference, upper, lower; SLC slice; USHORT column; PAT args; - struct slc_repeat *tail, *end; + slc::slc_repeat *tail, *end; TEXT *pattern1 = "CALL \"%S7\" USING %V1, %RF%DH%RE, %RF%RT%RE, %RF%FR%RE, %VF%N1%VE, %RF%I1%RE, %VF%N2%VE, %RF%I1v%RE, %VF%I1s%VE, %RF%S5%RE, %RF%S6%RE"; TEXT *pattern2 = @@ -4385,7 +4395,7 @@ static gen_slice( ACT action) args.pat_string5 = reference->ref_value; /* array name */ args.pat_string6 = names[ISC_ARRAY_LENGTH]; args.pat_string7 = - (action->act_type == ACT_get_slice) ? ISC_GET_SLICE : ISC_PUT_SLICE; + (action->act_type == ACT_get_slice) ? (TEXT*) ISC_GET_SLICE : (TEXT*) ISC_PUT_SLICE; PATTERN_expand(column, (action->act_type == ACT_get_slice) ? pattern1 : pattern2, @@ -4398,7 +4408,7 @@ static gen_slice( ACT action) // Substitute for a segment, segment length, or blob handle. // -static gen_segment( ACT action) +static int gen_segment( ACT action) { BLB blob; @@ -4416,7 +4426,7 @@ static gen_segment( ACT action) // // -static gen_select( ACT action) +static int gen_select( ACT action) { REQ request; POR port; @@ -4438,7 +4448,7 @@ static gen_select( ACT action) printa(names[COLUMN], FALSE, "IF %s NOT = 0 THEN", name); if (var_list = (NOD) action->act_object) for (i = 0; i < var_list->nod_count; i++) { - asgn_to(action, var_list->nod_arg[i]); + asgn_to(action, (REF) var_list->nod_arg[i]); } if (request->req_database->dbb_flags & DBB_v3) { @@ -4463,7 +4473,7 @@ static gen_select( ACT action) // on whether or a not a port is present. // -static gen_start( ACT action, POR port) +static int gen_start( ACT action, POR port) { REQ request; TEXT *vector; @@ -4513,7 +4523,7 @@ static gen_start( ACT action, POR port) // call and any variable initialization required. // -static gen_store( ACT action) +static int gen_store( ACT action) { REQ request; REF reference; @@ -4542,7 +4552,7 @@ static gen_store( ACT action) // Generate substitution text for START_TRANSACTION. // -static gen_t_start( ACT action) +static int gen_t_start( ACT action) { DBB db; TRA trans; @@ -4554,7 +4564,7 @@ static gen_t_start( ACT action) if (!action || !(trans = (TRA) action->act_object)) { t_start_auto(0, status_vector(action), action, FALSE); - return; + return 0; } // build a complete statement, including tpb's. Ready db's as req. @@ -4602,7 +4612,7 @@ static gen_t_start( ACT action) // Initialize a TPB in the output file // -static gen_tpb( TPB tpb) +static int gen_tpb( TPB tpb) { UCHAR *text, *c; int length, char_len; @@ -4653,7 +4663,7 @@ static gen_tpb( TPB tpb) // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE // -static gen_trans( ACT action) +static int gen_trans( ACT action) { if (action->act_type == ACT_commit_retain_context) @@ -4686,7 +4696,7 @@ static gen_trans( ACT action) static int gen_type( ACT action) { - printa(names[COLUMN], "%ld", action->act_object); + printa(names[COLUMN], TRUE, "%ld", action->act_object); } @@ -4695,7 +4705,7 @@ static int gen_type( ACT action) // Generate substitution text for UPDATE ... WHERE CURRENT OF ... // -static gen_update( ACT action) +static int gen_update( ACT action) { POR port; UPD modify; @@ -4712,7 +4722,7 @@ static gen_update( ACT action) // Substitute for a variable reference. // -static gen_variable( ACT action) +static int gen_variable( ACT action) { TEXT s[20]; REF reference; @@ -4728,7 +4738,7 @@ static gen_variable( ACT action) // Generate tests for any WHENEVER clauses that may have been declared. // -static gen_whenever( SWE label) +static int gen_whenever( SWE label) { TEXT *condition; @@ -4761,7 +4771,7 @@ static gen_whenever( SWE label) // Create a new window. // -static gen_window_create( ACT action) +static int gen_window_create( ACT action) { printa(names[COLUMN], TRUE, @@ -4777,7 +4787,7 @@ static gen_window_create( ACT action) // Delete a window. // -static gen_window_delete( ACT action) +static int gen_window_delete( ACT action) { printa(names[COLUMN], TRUE, "CALL \"%s\" USING %s%s", @@ -4790,7 +4800,7 @@ static gen_window_delete( ACT action) // Suspend a window. // -static gen_window_suspend( ACT action) +static int gen_window_suspend( ACT action) { printa(names[COLUMN], TRUE, "CALL \"%s\" USING %s%s", @@ -4804,7 +4814,7 @@ static gen_window_suspend( ACT action) // output file. // -static make_array_declaration( REF reference) +static int make_array_declaration( REF reference) { FLD field; TEXT *name, space[128], string1[256], *p; @@ -4818,7 +4828,7 @@ static make_array_declaration( REF reference) // Don't generate multiple declarations for the array. V3 Bug 569. if (field->fld_array_info->ary_declared) - return; + return 0; field->fld_array_info->ary_declared = TRUE; @@ -4912,7 +4922,7 @@ static make_array_declaration( REF reference) sprintf(space, "datatype %d unknown for field %s", field->fld_array_info->ary_dtype, name); IBERROR(space); - return; + return 0; } printa(space, FALSE, string1); @@ -4965,7 +4975,7 @@ static TEXT *make_name_formatted( TEXT * string, TEXT * format, SYM symbol) // Insert a port record description in output. // -static make_port( POR port) +static int make_port( POR port) { FLD field; REF reference; @@ -5038,7 +5048,7 @@ static make_port( POR port) sprintf(s, "datatype %d unknown for field %s, msg %d", field->fld_dtype, name, port->por_msg_number); CPR_error(s); - return; + return 0; } } @@ -5051,7 +5061,7 @@ static make_port( POR port) // Generate the actual ready call. // -static make_ready( +static int make_ready( DBB db, TEXT * filename, TEXT * vector, REQ request, USHORT namelength) @@ -5227,7 +5237,7 @@ static make_ready( // Print a fixed string at a particular COLUMN. // -static printa( TEXT * column, BOOLEAN call, TEXT * string, ...) +static int printa( TEXT * column, BOOLEAN call, TEXT * string, ...) { va_list ptr; TEXT s[256]; @@ -5279,7 +5289,7 @@ static TEXT *request_trans( ACT action, REQ request) // generate a CALL to the appropriate SQLCODE routine. // Note that not all COBOLs have the concept of a function. -static set_sqlcode( ACT action) +static int set_sqlcode( ACT action) { TEXT buffer[128]; @@ -5320,7 +5330,7 @@ static TEXT *status_vector( ACT action) // call. // -static t_start_auto( REQ request, TEXT * vector, ACT action, SSHORT test) +static int t_start_auto( REQ request, TEXT * vector, ACT action, SSHORT test) { DBB db; int count, stat; diff --git a/src/gpre/exp.cpp b/src/gpre/exp.cpp index d12c0ee0d6..cc0a12d79f 100644 --- a/src/gpre/exp.cpp +++ b/src/gpre/exp.cpp @@ -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 @@ -406,7 +406,7 @@ void EXP_left_paren( TEXT * string) { if (!MATCH(KW_LEFT_PAREN)) - SYNTAX_ERROR((string) ? string : "left parenthesis"); + SYNTAX_ERROR((string) ? string : (char*)"left parenthesis"); } diff --git a/src/gpre/form.cpp b/src/gpre/form.cpp index cf43e2fd37..11da37d538 100644 --- a/src/gpre/form.cpp +++ b/src/gpre/form.cpp @@ -20,7 +20,7 @@ // // All Rights Reserved. // 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 // Fixed bugs in gpre to handle PYXIS forms // 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" @@ -48,7 +48,10 @@ 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; @@ -74,13 +77,13 @@ FLD FORM_lookup_field( FORM form, HANDLE object, char *string) for (field = form->form_fields; field; field = field->fld_next) { symbol = field->fld_symbol; - if (!strcmp(name, symbol->sym_string)) + if (!strcmp((char*)name, symbol->sym_string)) return field; } // 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; // 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; form->form_fields = field; 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_length = (int) GET_VALUE(handle, att_length); 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 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; } @@ -138,7 +141,7 @@ FORM FORM_lookup_form(DBB dbb, UCHAR * string) 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 && (form = (FORM) symbol->sym_object) && form->form_dbb == dbb) return form; @@ -147,8 +150,8 @@ FORM FORM_lookup_form(DBB dbb, UCHAR * string) form = (FORM) ALLOC(sizeof(struct form)); pyxis__load_form(status, - &dbb->dbb_handle, &dbb->dbb_transaction, - &form->form_object, 0, name); + (SLONG*)&dbb->dbb_handle, (SLONG*)&dbb->dbb_transaction, + (SLONG*)&form->form_object, 0, (SCHAR*)name); if (!form->form_object) return NULL; @@ -159,7 +162,7 @@ FORM FORM_lookup_form(DBB dbb, UCHAR * string) // 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); return form; diff --git a/src/gpre/ftn.cpp b/src/gpre/ftn.cpp index adf9ac0ba3..31a3f1e533 100644 --- a/src/gpre/ftn.cpp +++ b/src/gpre/ftn.cpp @@ -24,7 +24,7 @@ // //____________________________________________________________ // -// $Id: ftn.cpp,v 1.1.1.1 2001-05-23 13:25:32 tamlin Exp $ +// $Id: ftn.cpp,v 1.2 2001-07-12 05:46:04 bellardo Exp $ // #include "../jrd/ib_stdio.h" @@ -41,6 +41,10 @@ #include "../gpre/prett_proto.h" #include "../jrd/isc_proto.h" +#ifdef HAVE_STRING_H +#include +#endif + extern UCHAR fortran_labels[]; extern DBB isc_databases; extern REQ requests; @@ -259,6 +263,25 @@ static ADL array_decl_list; #define COMMA "," #endif +#if defined DARWIN +#define INCLUDE_ISC_FTN " INCLUDE '/Library/Frameworks/Firebird.framework/Headers/gds.f\' \n\n" +#define INCLUDE_FTN_FILE "Firebird/gds.f" +#define DOUBLE_DCL "DOUBLE PRECISION" +#define I2CONST_1 "" +#define I2CONST_2 "" +#define I2_1 "" +#define I2_2 "" +#define VAL_1 "" +#define VAL_2 "" +#define REF_1 "" +#define REF_2 "" +#define I4CONST_1 "" +#define I4CONST_2 "" +#define COMMENT "* " +#define INLINE_COMMENT "\n* " +#define COMMA "," +#endif + #ifdef sgi #define INCLUDE_ISC_FTN " INCLUDE '%s\' \n\n" #define INCLUDE_FTN_FILE "include/gds.f" @@ -772,7 +795,7 @@ void FTN_print_buffer( TEXT * output_buffer) // a port variable. // -static asgn_from( ACT action, REF reference) +static int asgn_from( ACT action, REF reference) { FLD field; SCHAR *value, name[64], variable[20], temp[20]; @@ -828,7 +851,7 @@ static asgn_from( ACT action, REF reference) // a port variable. // -static asgn_to( ACT action, REF reference) +static int asgn_to( ACT action, REF reference) { SCHAR s[128]; REF source; @@ -839,7 +862,7 @@ static asgn_to( ACT action, REF reference) if (field->fld_array_info) { source->ref_value = reference->ref_value; gen_get_or_put_slice(action, source, TRUE); - return; + return 0; } gen_name(s, source, TRUE); @@ -869,7 +892,7 @@ static asgn_to( ACT action, REF reference) // a port variable. // -static asgn_to_proc( REF reference) +static int asgn_to_proc( REF reference) { FLD field; SCHAR s[64]; @@ -896,7 +919,7 @@ static asgn_to_proc( REF reference) // Generate code for AT END clause of FETCH. // -static gen_at_end( ACT action) +static int gen_at_end( ACT action) { REQ request; SCHAR s[20]; @@ -913,7 +936,7 @@ static gen_at_end( ACT action) // Substitute for a BASED ON clause. // -static gen_based( ACT action) +static int gen_based( ACT action) { BAS based_on; FLD field; @@ -969,7 +992,7 @@ static gen_based( ACT action) default: sprintf(s, "datatype %d unknown\n", field->fld_dtype); CPR_error(s); - return; + return 0; } // print the first variable, then precede the rest with commas @@ -1017,7 +1040,7 @@ static gen_based( ACT action) // Make a blob FOR loop. // -static gen_blob_close( ACT action) +static int gen_blob_close( ACT action) { TEXT *command; BLB blob; @@ -1029,7 +1052,7 @@ static gen_blob_close( ACT action) else 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, "CALL ISC_%s_BLOB (%s, isc_%d)", command, status_vector(action), blob->blb_ident); @@ -1047,7 +1070,7 @@ static gen_blob_close( ACT action) // End a blob FOR loop. // -static gen_blob_end( ACT action) +static int gen_blob_end( ACT action) { BLB blob; @@ -1068,7 +1091,7 @@ static gen_blob_end( ACT action) // Make a blob FOR loop. // -static gen_blob_for( ACT action) +static int gen_blob_for( ACT action) { BLB blob; @@ -1093,7 +1116,7 @@ static gen_blob_for( ACT action) // Generate the call to open (or create) a blob. // -static gen_blob_open( ACT action) +static int gen_blob_open( ACT action) { USHORT column = 6; BLB blob; @@ -1164,7 +1187,7 @@ static gen_blob_open( ACT action) // 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; TEXT c; @@ -1195,7 +1218,7 @@ static gen_blr( int *user_arg, int offset, TEXT * string) // Generate text to compile a request. // -static gen_compile( ACT action) +static int gen_compile( ACT action) { REQ request; DBB db; @@ -1253,7 +1276,7 @@ static gen_compile( ACT action) // Generate a call to create a database. // -static gen_create_database( ACT action) +static int gen_create_database( ACT action) { REQ request; DBB db; @@ -1370,7 +1393,7 @@ static gen_create_database( ACT action) // Generate substitution text for END_STREAM. // -static gen_cursor_close( ACT action, REQ request) +static int gen_cursor_close( ACT action, REQ request) { printa(COLUMN, "IF (isc_%ds .NE. 0) THEN", request->req_ident); @@ -1387,7 +1410,7 @@ static gen_cursor_close( ACT action, REQ request) // Generate text to initialize a cursor. // -static gen_cursor_init( ACT action) +static int gen_cursor_init( ACT action) { // If blobs are present, zero out all of the blob handles. After this @@ -1408,7 +1431,7 @@ static gen_cursor_init( ACT action) // Generate text to open an embedded SQL cursor. // -static gen_cursor_open( ACT action, REQ request) +static int gen_cursor_open( ACT action, REQ request) { TEXT s[64]; @@ -1465,11 +1488,11 @@ static gen_cursor_open( ACT action, REQ request) // Generate insertion text for the database statement. // -static gen_database( ACT action) +static int gen_database( ACT action) { if (first_flag++ != 0) - return; + return 0; sprintf(output_buffer, "\n%s **** GDS Preprocessor Definitions ****\n\n", COMMENT); @@ -1487,7 +1510,7 @@ static gen_database( ACT action) // Generate insertion text for global DATA statements. // -static gen_database_data( ACT action) +static int gen_database_data( ACT action) { DBB db; TPB tpb; @@ -1549,7 +1572,7 @@ static gen_database_data( ACT action) // data declarations. // -static gen_database_decls( ACT action) +static int gen_database_decls( ACT action) { DBB db; REQ request; @@ -1713,7 +1736,7 @@ static gen_database_decls( ACT action) max_count = 0; for (stack_ptr = events; stack_ptr; stack_ptr = stack_ptr->lls_next) { - count = gen_event_block(stack_ptr->lls_object); + count = gen_event_block((ACT) stack_ptr->lls_object); max_count = MAX(count, max_count); } @@ -1736,7 +1759,7 @@ static gen_database_decls( ACT action) // Generate a call to update metadata. // -static gen_ddl( ACT action) +static int gen_ddl( ACT action) { REQ request; @@ -1776,7 +1799,7 @@ static gen_ddl( ACT action) // Generate a call to create a database. // -static gen_drop_database( ACT action) +static int gen_drop_database( ACT action) { DBB db; @@ -1798,7 +1821,7 @@ static gen_drop_database( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_close( ACT action) +static int gen_dyn_close( ACT action) { DYN statement; TEXT s[64]; @@ -1816,7 +1839,7 @@ static gen_dyn_close( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_declare( ACT action) +static int gen_dyn_declare( ACT action) { DYN statement; TEXT s1[64], s2[64]; @@ -1836,7 +1859,7 @@ static gen_dyn_declare( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_describe( ACT action, BOOLEAN bind_flag) +static int gen_dyn_describe( ACT action, BOOLEAN bind_flag) { DYN statement; TEXT s[64]; @@ -1858,7 +1881,7 @@ static gen_dyn_describe( ACT action, BOOLEAN bind_flag) // Generate a dynamic SQL statement. // -static gen_dyn_execute( ACT action) +static int gen_dyn_execute( ACT action) { DYN statement; TEXT *transaction, s1[64], s2[64], s3[64], *sqlda, *sqlda2; @@ -1895,8 +1918,8 @@ static gen_dyn_execute( ACT action) printa(COLUMN, (sqlda2) ? - "CALL %s (isc_status, %s, %s, %s%d%s, %s, %s)" : - "CALL %s (isc_status, %s, %s, %s%d%s, %s)", + (SCHAR*) "CALL %s (isc_status, %s, %s, %s%d%s, %s, %s)" : + (SCHAR*) "CALL %s (isc_status, %s, %s, %s%d%s, %s)", (sqlda2) ? ISC_EMBED_DSQL_EXECUTE2 : ISC_EMBED_DSQL_EXECUTE, transaction, make_name(s1, statement->dyn_statement_name), @@ -1915,7 +1938,7 @@ static gen_dyn_execute( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_fetch( ACT action) +static int gen_dyn_fetch( ACT action) { DYN statement; TEXT s1[64], s2[64], *sqlda; @@ -1947,7 +1970,7 @@ static gen_dyn_fetch( ACT action) // Generate code for an EXECUTE IMMEDIATE dynamic SQL statement. // -static gen_dyn_immediate( ACT action) +static int gen_dyn_immediate( ACT action) { DYN statement; DBB database; @@ -1987,8 +2010,8 @@ static gen_dyn_immediate( ACT action) printa(COLUMN, (sqlda2) ? - "CALL %s (isc_status, %s, %s, %sLEN(%s)%s, %s%s%s, %s%d%s, %s, %s)" - : "CALL %s (isc_status, %s, %s, %sLEN(%s)%s, %s%s%s, %s%d%s, %s)", + (SCHAR*) "CALL %s (isc_status, %s, %s, %sLEN(%s)%s, %s%s%s, %s%d%s, %s, %s)" + : (SCHAR*) "CALL %s (isc_status, %s, %s, %sLEN(%s)%s, %s%s%s, %s%d%s, %s)", (sqlda2) ? ISC_EMBED_DSQL_EXECUTE_IMMEDIATE2 : ISC_EMBED_DSQL_EXECUTE_IMMEDIATE, transaction, database->dbb_name->sym_string, DSQL_I2CONST_1, @@ -2009,7 +2032,7 @@ static gen_dyn_immediate( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_insert( ACT action) +static int gen_dyn_insert( ACT action) { DYN statement; TEXT s1[64], s2[64], *sqlda; @@ -2040,7 +2063,7 @@ static gen_dyn_insert( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_open( ACT action) +static int gen_dyn_open( ACT action) { DYN statement; TEXT *transaction, s1[64], s2[64], s3[64], *sqlda, *sqlda2; @@ -2077,8 +2100,8 @@ static gen_dyn_open( ACT action) printa(COLUMN, (sqlda2) ? - "CALL %s (isc_status, %s, %s, %s%d%s, %s, %s)" : - "CALL %s (isc_status, %s, %s, %s%d%s, %s)", + (SCHAR*) "CALL %s (isc_status, %s, %s, %s%d%s, %s, %s)" : + (SCHAR*) "CALL %s (isc_status, %s, %s, %s%d%s, %s)", (sqlda2) ? ISC_EMBED_DSQL_OPEN2 : ISC_EMBED_DSQL_OPEN, transaction, make_name(s1, statement->dyn_cursor_name), @@ -2097,7 +2120,7 @@ static gen_dyn_open( ACT action) // Generate a dynamic SQL statement. // -static gen_dyn_prepare( ACT action) +static int gen_dyn_prepare( ACT action) { DYN statement; DBB database; @@ -2150,7 +2173,7 @@ static gen_dyn_prepare( ACT action) // Generate substitution text for END_MODIFY. // -static gen_emodify( ACT action) +static int gen_emodify( ACT action) { UPD modify; REF reference, source; @@ -2186,7 +2209,7 @@ static gen_emodify( ACT action) // Generate substitution text for END_STORE. // -static gen_estore( ACT action) +static int gen_estore( ACT action) { REQ request; @@ -2196,7 +2219,7 @@ static gen_estore( ACT action) // we already executed the store, so go home quietly if (request->req_type == REQ_store2) - return; + return 0; gen_start(action, request->req_primary); if (action->act_error || (action->act_flags & ACT_sql)) @@ -2210,7 +2233,7 @@ static gen_estore( ACT action) // the AT_END clause. // -static gen_end_fetch(void) +static int gen_end_fetch(void) { printa(COLUMN, "END IF"); @@ -2222,7 +2245,7 @@ static gen_end_fetch(void) // Generate definitions associated with a single request. // -static gen_endfor( ACT action) +static int gen_endfor( ACT action) { REQ request; @@ -2241,7 +2264,7 @@ static gen_endfor( ACT action) // Generate substitution text for ERASE. // -static gen_erase( ACT action) +static int gen_erase( ACT action) { UPD erase; @@ -2281,7 +2304,7 @@ static SSHORT gen_event_block( ACT action) // Generate substitution text for EVENT_INIT. // -static gen_event_init( ACT action) +static int gen_event_init( ACT action) { NOD init, event_list, *ptr, *end, node; REF reference; @@ -2356,7 +2379,7 @@ static gen_event_init( ACT action) // Generate substitution text for EVENT_WAIT. // -static gen_event_wait( ACT action) +static int gen_event_wait( ACT action) { PAT args; NOD event_init; @@ -2414,7 +2437,7 @@ static gen_event_wait( ACT action) // stream fetch). // -static gen_fetch( ACT action) +static int gen_fetch( ACT action) { REQ request; NOD var_list; @@ -2433,7 +2456,7 @@ static gen_fetch( ACT action) printa(COLUMN, "SQLCODE = 0"); if (var_list = (NOD) action->act_object) for (i = 0; i < var_list->nod_count; i++) { - asgn_to(action, var_list->nod_arg[i]); + asgn_to(action, (REF) var_list->nod_arg[i]); } printa(COLUMN, "ELSE"); printa(COLUMN, "SQLCODE = 100"); @@ -2449,7 +2472,7 @@ static gen_fetch( ACT action) // Generate substitution text for FINISH // -static gen_finish( ACT action) +static int gen_finish( ACT action) { DBB db; RDY ready; @@ -2499,7 +2522,7 @@ static gen_finish( ACT action) // Generate substitution text for FOR statement. // -static gen_for( ACT action) +static int gen_for( ACT action) { POR port; REQ request; @@ -2537,7 +2560,7 @@ static gen_for( ACT action) // Generate code for a form interaction. // -static gen_form_display( ACT action) +static int gen_form_display( ACT action) { FINT display; REQ request; @@ -2580,7 +2603,7 @@ static gen_form_display( ACT action) // Generate code for a form block. // -static gen_form_end( ACT action) +static int gen_form_end( ACT action) { printa(COLUMN, "CALL PYXIS__POP_WINDOW (isc_window)"); @@ -2592,7 +2615,7 @@ static gen_form_end( ACT action) // Generate code for a form block. // -static gen_form_for( ACT action) +static int gen_form_for( ACT action) { REQ request; FORM form; @@ -2647,12 +2670,12 @@ static gen_form_for( ACT action) // or isc_put_slice for an array. // -static gen_get_or_put_slice( ACT action, REF reference, BOOLEAN get) +static int gen_get_or_put_slice( ACT action, REF reference, BOOLEAN get) { TEXT s[25]; if (!(reference->ref_flags & REF_fetch_array)) - return; + return 0; if (get) { if (action->act_flags & ACT_sql) { @@ -2730,7 +2753,7 @@ static gen_get_or_put_slice( ACT action, REF reference, BOOLEAN get) // Generate the code to do a get segment. // -static gen_get_segment( ACT action) +static int gen_get_segment( ACT action) { BLB blob; REF into; @@ -2778,7 +2801,7 @@ static gen_get_segment( ACT action) // Generate end of block for PUT_ITEM and FOR_ITEM. // -static gen_item_end( ACT action) +static int gen_item_end( ACT action) { REQ request; REF reference, master; @@ -2791,7 +2814,7 @@ static gen_item_end( ACT action) if (request->req_type == REQ_menu) { gen_menu_item_end(action); - return; + return 0; } if (action->act_pair->act_type == ACT_item_for) { @@ -2799,7 +2822,7 @@ static gen_item_end( ACT action) printa(COLUMN_INDENT, "%s = %s + 1", index, index); printa(COLUMN, "GOTO %d", request->req_top_label); printa("", "%-6dCONTINUE", request->req_btm_label); - return; + return 0; } dbb = request->req_database; @@ -2810,7 +2833,7 @@ static gen_item_end( ACT action) for (reference = port->por_references; reference; reference = reference->ref_next) if (master = reference->ref_master) printa(COLUMN_INDENT, "%s = %d", gen_name(s, reference, TRUE), - PYXIS__OPT_DISPLAY); + PYXIS_OPT_DISPLAY); printa(COLUMN, "CALL PYXIS__INSERT (isc_status, %s, %s, %s, %sisc_%d%s)", @@ -2828,7 +2851,7 @@ static gen_item_end( ACT action) // Generate insert text for FOR_ITEM and PUT_ITEM. // -static gen_item_for( ACT action) +static int gen_item_for( ACT action) { REQ request, parent; FORM form; @@ -2838,7 +2861,7 @@ static gen_item_for( ACT action) if (request->req_type == REQ_menu) { gen_menu_item_for(action); - return; + return 0; } form = request->req_form; @@ -2857,7 +2880,7 @@ static gen_item_for( ACT action) printa(COLUMN, "END IF"); if (action->act_type != ACT_item_for) - return; + return 0; // Build stuff for item loop @@ -2893,7 +2916,7 @@ static gen_item_for( ACT action) // used both by START_STREAM and FOR // -static gen_loop( ACT action) +static int gen_loop( ACT action) { REQ request; POR port; @@ -2915,7 +2938,7 @@ static gen_loop( ACT action) // // -static gen_menu( ACT action) +static int gen_menu( ACT action) { REQ request; @@ -2932,7 +2955,7 @@ static gen_menu( ACT action) // Generate code for a menu interaction. // -static gen_menu_display( ACT action) +static int gen_menu_display( ACT action) { MENU menu; REQ request, display_request; @@ -2970,14 +2993,14 @@ static gen_menu_display( ACT action) // // -static gen_menu_end( ACT action) +static int gen_menu_end( ACT action) { REQ request; request = action->act_request; if (request->req_flags & REQ_menu_for) - return; + return 0; printa(COLUMN, "END IF"); } @@ -2987,7 +3010,7 @@ static gen_menu_end( ACT action) // // -static gen_menu_entree( ACT action) +static int gen_menu_entree( ACT action) { REQ request; @@ -3007,7 +3030,7 @@ static gen_menu_entree( ACT action) // // Generate code for a reference to a menu or entree attribute. -static gen_menu_entree_att( ACT action) +static int gen_menu_entree_att( ACT action) { MENU menu; SSHORT ident; @@ -3055,7 +3078,7 @@ static gen_menu_entree_att( ACT action) // Generate code for a menu block. // -static gen_menu_for( ACT action) +static int gen_menu_for( ACT action) { REQ request; @@ -3075,7 +3098,7 @@ static gen_menu_for( ACT action) // for a dynamic menu. // -static gen_menu_item_end( ACT action) +static int gen_menu_item_end( ACT action) { REQ request; ENTREE entree; @@ -3086,7 +3109,7 @@ static gen_menu_item_end( ACT action) if (action->act_pair->act_type == ACT_item_for) { printa(COLUMN, "GOTO %d", request->req_top_label); printa("", "%-6dCONTINUE", request->req_btm_label); - return; + return 0; } printa(COLUMN, @@ -3103,13 +3126,13 @@ static gen_menu_item_end( ACT action) // for a dynamic menu. // -static gen_menu_item_for( ACT action) +static int gen_menu_item_for( ACT action) { ENTREE entree; REQ request; if (action->act_type != ACT_item_for) - return; + return 0; // Build stuff for item loop @@ -3137,7 +3160,7 @@ static gen_menu_item_for( ACT action) // Generate definitions associated with a dynamic menu request. // -static gen_menu_request( REQ request) +static int gen_menu_request( REQ request) { ACT action; MENU menu; @@ -3217,7 +3240,7 @@ static TEXT *gen_name( SCHAR * string, REF reference, BOOLEAN as_blob) // Generate a block to handle errors. // -static gen_on_error( ACT action) +static int gen_on_error( ACT action) { ACT err_action; @@ -3237,7 +3260,7 @@ static gen_on_error( ACT action) // Generate code for an EXECUTE PROCEDURE. // -static gen_procedure( ACT action) +static int gen_procedure( ACT action) { PAT args; TEXT *pattern; @@ -3293,7 +3316,7 @@ static gen_procedure( ACT action) // Generate the code to do a put segment. // -static gen_put_segment( ACT action) +static int gen_put_segment( ACT action) { BLB blob; REF from; @@ -3326,7 +3349,7 @@ static gen_put_segment( ACT action) // Generate BLR in raw, numeric form. Ughly but dense. // -static gen_raw( +static int gen_raw( UCHAR * blr, enum req_t request_type, int request_length, int begin_c, int end_c) @@ -3384,7 +3407,7 @@ static gen_raw( // Generate substitution text for READY // -static gen_ready( ACT action) +static int gen_ready( ACT action) { RDY ready; DBB db; @@ -3411,7 +3434,7 @@ static gen_ready( ACT action) // Generate a send or receive call for a port. // -static gen_receive( ACT action, POR port) +static int gen_receive( ACT action, POR port) { REQ request; @@ -3441,7 +3464,7 @@ static gen_receive( ACT action, POR port) // a serious error, it will be caught on the next statement. // -static gen_release( ACT action) +static int gen_release( ACT action) { DBB db, exp_db; REQ request; @@ -3467,7 +3490,7 @@ static gen_release( ACT action) // Generate definitions associated with a single request. // -static gen_request_data( REQ request) +static int gen_request_data( REQ request) { POR port; REF reference; @@ -3536,37 +3559,37 @@ static gen_request_data( REQ request) case REQ_create_database: case REQ_ready: 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"); break; case REQ_ddl: 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"); break; case REQ_form: 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"); break; case REQ_menu: string_type = "menu"; - if (PRETTY_print_menu(request->req_blr, gen_blr, 0, 0)) + if (PRETTY_print_menu((SCHAR*)request->req_blr, (int(*)())gen_blr, 0, 0)) IBERROR("internal error during menu generation"); break; case REQ_slice: 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"); break; default: 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"); } } @@ -3616,12 +3639,12 @@ static gen_request_data( REQ request) reference->ref_sdl_ident, COMMA, (begin_i / sizeof(SLONG)) + 1, (end_i / sizeof(SLONG)) + 1); - gen_raw(reference->ref_sdl, REQ_slice, + gen_raw((UCHAR*) reference->ref_sdl, REQ_slice, reference->ref_sdl_length, begin_i, end_i); } if (!(sw_raw)) { printa(COMMENT, " "); - if (PRETTY_print_sdl(reference->ref_sdl, gen_blr, 0, 0)) + if (PRETTY_print_sdl(reference->ref_sdl, (int(*)()) gen_blr, 0, 0)) IBERROR("internal error during SDL generation"); printa(COMMENT, " "); printa(COMMENT, "END OF SDL STRING FOR REQUEST isc_%d\n", @@ -3656,7 +3679,7 @@ static gen_request_data( REQ request) // Generate definitions associated with a single request. // -static gen_request_decls( REQ request) +static int gen_request_decls( REQ request) { int length; REF reference; @@ -3744,7 +3767,7 @@ static gen_request_decls( REQ request) // in a store2 statement. // -static gen_return_value( ACT action) +static int gen_return_value( ACT action) { UPD update; REF reference; @@ -3768,7 +3791,7 @@ static gen_return_value( ACT action) // routine, insert local definitions. // -static gen_routine( ACT action) +static int gen_routine( ACT action) { BLB blob; REQ request; @@ -3800,7 +3823,7 @@ static gen_routine( ACT action) // Generate substitution text for END_STREAM. // -static gen_s_end( ACT action) +static int gen_s_end( ACT action) { REQ request; @@ -3827,7 +3850,7 @@ static gen_s_end( ACT action) // Generate substitution text for FETCH. // -static gen_s_fetch( ACT action) +static int gen_s_fetch( ACT action) { REQ request; @@ -3845,7 +3868,7 @@ static gen_s_fetch( ACT action) // used both by START_STREAM and FOR // -static gen_s_start( ACT action) +static int gen_s_start( ACT action) { REQ request; POR port; @@ -3882,7 +3905,7 @@ static gen_s_start( ACT action) // Substitute for a segment, segment length, or blob handle. // -static gen_segment( ACT action) +static int gen_segment( ACT action) { BLB blob; @@ -3901,7 +3924,7 @@ static gen_segment( ACT action) // // -static gen_select( ACT action) +static int gen_select( ACT action) { REQ request; POR port; @@ -3919,7 +3942,7 @@ static gen_select( ACT action) printa(COLUMN, "IF (%s .NE. 0) THEN", name); if (var_list = (NOD) action->act_object) for (i = 0; i < var_list->nod_count; i++) - asgn_to(action, var_list->nod_arg[i]); + asgn_to(action, (REF) var_list->nod_arg[i]); if (request->req_database->dbb_flags & DBB_v3) { gen_receive(action, port); @@ -3942,7 +3965,7 @@ static gen_select( ACT action) // Generate a send call for a port. // -static gen_send( ACT action, POR port) +static int gen_send( ACT action, POR port) { REQ request; @@ -3965,13 +3988,13 @@ static gen_send( ACT action, POR port) // Generate support for get/put slice statement. // -static gen_slice( ACT action) +static int gen_slice( ACT action) { REQ request, parent_request; REF reference, upper, lower; SLC slice; PAT args; - struct slc_repeat *tail, *end; + slc::slc_repeat *tail, *end; TEXT buffer[256], temp[64]; TEXT *pattern1 = "CALL ISC_GET_SLICE (%V1, %RF%DH%RE, %RF%RT%RE, %RF%FR%RE, %N1, \ @@ -4037,7 +4060,7 @@ static gen_slice( ACT action) // on whether or a not a port is present. // -static gen_start( ACT action, POR port) +static int gen_start( ACT action, POR port) { REQ request; TEXT *vector; @@ -4082,7 +4105,7 @@ static gen_start( ACT action, POR port) // call and any variable initialization required. // -static gen_store( ACT action) +static int gen_store( ACT action) { REQ request; REF reference; @@ -4113,7 +4136,7 @@ static gen_store( ACT action) // Generate substitution text for START_TRANSACTION. // -static gen_t_start( ACT action) +static int gen_t_start( ACT action) { DBB db; TRA trans; @@ -4125,7 +4148,7 @@ static gen_t_start( ACT action) if (!action || !(trans = (TRA) action->act_object)) { t_start_auto(0, status_vector(action), action, FALSE); - return; + return 0; } // build a complete statement, including tpb's. Ready db's as req. @@ -4185,7 +4208,7 @@ static gen_t_start( ACT action) // Initialize a TPB in the output file // -static gen_tpb_data( TPB tpb) +static int gen_tpb_data( TPB tpb) { TEXT *p; UCHAR *text, *c; @@ -4238,7 +4261,7 @@ static gen_tpb_data( TPB tpb) // TPB in the output file // -static gen_tpb_decls( TPB tpb) +static int gen_tpb_decls( TPB tpb) { int length; @@ -4254,7 +4277,7 @@ static gen_tpb_decls( TPB tpb) // Generate substitution text for COMMIT, ROLLBACK, PREPARE, and SAVE // -static gen_trans( ACT action) +static int gen_trans( ACT action) { if (action->act_type == ACT_commit_retain_context) @@ -4280,7 +4303,7 @@ static gen_trans( ACT action) // Generate substitution text for UPDATE ... WHERE CURRENT OF ... // -static gen_update( ACT action) +static int gen_update( ACT action) { POR port; UPD modify; @@ -4297,7 +4320,7 @@ static gen_update( ACT action) // Substitute for a variable reference. // -static gen_variable( ACT action) +static int gen_variable( ACT action) { SCHAR s[20]; REF reference; @@ -4316,7 +4339,7 @@ static gen_variable( ACT action) // Generate tests for any WHENEVER clauses that may have been declared. // -static gen_whenever( SWE label) +static int gen_whenever( SWE label) { TEXT *condition; @@ -4345,7 +4368,7 @@ static gen_whenever( SWE label) // Create a new window. // -static gen_window_create( ACT action) +static int gen_window_create( ACT action) { printa(COLUMN, @@ -4358,7 +4381,7 @@ static gen_window_create( ACT action) // Delete a window. // -static gen_window_delete( ACT action) +static int gen_window_delete( ACT action) { printa(COLUMN, "CALL PYXIS__DELETE_WINDOW (isc_window)"); @@ -4370,7 +4393,7 @@ static gen_window_delete( ACT action) // Suspend a window. // -static gen_window_suspend( ACT action) +static int gen_window_suspend( ACT action) { printa(COLUMN, "CALL PYXIS__SUSPEND_WINDOW (isc_window)"); @@ -4383,7 +4406,7 @@ static gen_window_suspend( ACT action) // output file. // -static make_array_declaration( REF reference) +static int make_array_declaration( REF reference) { FLD field; SCHAR *name; @@ -4400,7 +4423,7 @@ static make_array_declaration( REF reference) for (this_array = array_decl_list; this_array; this_array = this_array->adl_next) if (field->fld_array_info->ary_ident == - this_array->adl_gds_ident) return; + this_array->adl_gds_ident) return 0; // If not, add it to the "declared" list and declare it this_array = (ADL) ALLOC(ADL_LEN); @@ -4442,7 +4465,7 @@ static make_array_declaration( REF reference) default: sprintf(s, "datatype %d unknown\n", field->fld_dtype); CPR_error(s); - return; + return 0; } // Print out the dimension part of the declaration @@ -4488,7 +4511,7 @@ static TEXT *make_name( TEXT * string, SYM symbol) // active transaction // -static make_ok_test( ACT action, REQ request) +static int make_ok_test( ACT action, REQ request) { if (sw_auto) @@ -4504,7 +4527,7 @@ static make_ok_test( ACT action, REQ request) // Insert a port record description in output. // -static make_port( POR port) +static int make_port( POR port) { FLD field; REF reference; @@ -4565,7 +4588,7 @@ static make_port( POR port) sprintf(s, "datatype %d unknown for field %s, msg %d", field->fld_dtype, name, port->por_msg_number); CPR_error(s); - return; + return 0; } } @@ -4584,7 +4607,7 @@ static make_port( POR port) // Generate the actual ready call. // -static make_ready( DBB db, TEXT * filename, TEXT * vector, REQ request) +static int make_ready( DBB db, TEXT * filename, TEXT * vector, REQ request) { TEXT s1[32], s2[32]; @@ -4719,7 +4742,7 @@ static make_ready( DBB db, TEXT * filename, TEXT * vector, REQ request) // label as used. // -static next_label(void) +static int next_label(void) { USHORT label; UCHAR *byte, target_byte; @@ -4742,7 +4765,7 @@ static next_label(void) // Print a fixed string at a particular COLUMN. // -static printa( SCHAR * column, SCHAR * string, ...) +static int printa( SCHAR * column, SCHAR * string, ...) { va_list ptr; SCHAR s[256]; @@ -4771,7 +4794,7 @@ static TEXT *request_trans( ACT action, REQ request) return trname; } else - return (request) ? request->req_trans : "GDS__TRANS"; + return (request) ? request->req_trans : (TEXT*) "GDS__TRANS"; } @@ -4782,7 +4805,7 @@ static TEXT *request_trans( ACT action, REQ request) // ISC_NULL from FORTRAN // -static status_and_stop( ACT action) +static int status_and_stop( ACT action) { if (action && (action->act_flags & ACT_sql)) @@ -4818,7 +4841,7 @@ static TEXT *status_vector( ACT action) // continue after errors as that destroys evidence. // -static t_start_auto( REQ request, TEXT * vector, ACT action, SSHORT test) +static int t_start_auto( REQ request, TEXT * vector, ACT action, SSHORT test) { DBB db; int count; @@ -5013,7 +5036,7 @@ static int gen_function( ACT function) if (action->act_type != ACT_any) { IBERROR("can't generate function"); - return; + return 0; } request = action->act_request; @@ -5068,7 +5091,7 @@ static int gen_function( ACT function) default: IBERROR("gen_function: unsupported datatype"); - return; + return 0; } ib_fprintf(out_file, " %s\t%s;\n", dtype, gen_name(s, reference->ref_source, TRUE)); diff --git a/src/gpre/gpre.cpp b/src/gpre/gpre.cpp index 76aaeed01f..f7f41b546a 100644 --- a/src/gpre/gpre.cpp +++ b/src/gpre/gpre.cpp @@ -20,7 +20,7 @@ // // All Rights Reserved. // 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 // Added new switch -verbose to gpre that will dump // 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 @@ -60,6 +60,10 @@ #include "../jrd/gds_proto.h" #include "../gpre/gpreswi.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef VMS #include extern "C" { @@ -647,6 +651,32 @@ int main(int argc, char* argv[]) sw_interp = ttype_metadata; 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: sw_ids = TRUE; break; @@ -1285,7 +1315,7 @@ static BOOLEAN all_digits(char *str1) // 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; @@ -1609,7 +1639,7 @@ static void finish_based( ACT action) // 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) { return (int) *--input_char; @@ -1745,6 +1775,17 @@ static BOOLEAN get_switches(int argc, sw_tab--; 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: sw_language = lang_internal; sw_tab--; @@ -1780,6 +1821,11 @@ static BOOLEAN get_switches(int argc, sw_tab--; break; + case IN_SW_GPRE_LANG_INTERNAL : + sw_language = lang_internal; + /*sw_tab--;*/ + break; + case IN_SW_GPRE_D: if (!arg_is_string (--argc, argv, @@ -2299,7 +2345,7 @@ static TOK get_token() // Also, for Fortran, mark the beginning of a statement // -static nextchar() +static int nextchar() { SSHORT c; diff --git a/src/gpre/gpre_meta.h b/src/gpre/gpre_meta.h index 05bd01a069..b4c905051e 100644 --- a/src/gpre/gpre_meta.h +++ b/src/gpre/gpre_meta.h @@ -25,7 +25,7 @@ #define GPRE_GPRE_META_H #ifdef __cplusplus -extern "C" { +//extern "C" { #endif 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 *); #ifdef __cplusplus -} /* extern "C" */ +//} /* extern "C" */ #endif #endif /* GPRE_GPRE_META_H */ diff --git a/src/gpre/gpreswi.h b/src/gpre/gpreswi.h index 69bd303062..2602e940a0 100644 --- a/src/gpre/gpreswi.h +++ b/src/gpre/gpreswi.h @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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 * Added new switch -verbose to gpre that will dump * parsed lines to stderr @@ -51,6 +51,7 @@ enum gpre_cmd_switch IN_SW_GPRE_E, /* accept either case */ IN_SW_GPRE_F, /* source is FORTRAN */ 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_M, /* don't generate READY/START_TRANS */ IN_SW_GPRE_N, /* don't generate debug lines */ @@ -84,6 +85,12 @@ enum gpre_cmd_switch */ 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 switch value. 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", #endif 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, "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, "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_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", diff --git a/src/gpre/hsh.cpp b/src/gpre/hsh.cpp index 06eff58725..a0a53981aa 100644 --- a/src/gpre/hsh.cpp +++ b/src/gpre/hsh.cpp @@ -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" @@ -227,7 +227,7 @@ void HSH_remove( register SYM symbol) // Returns the hash function of a string. // -static hash( register SCHAR * string) +static int hash( register SCHAR * string) { register SLONG value; SCHAR c; diff --git a/src/gpre/lang_proto.h b/src/gpre/lang_proto.h index c40d98faee..db1e603190 100644 --- a/src/gpre/lang_proto.h +++ b/src/gpre/lang_proto.h @@ -39,6 +39,7 @@ extern void FTN_action(ACT, int); extern void FTN_fini(void); extern void FTN_print_buffer(TEXT *); extern void INT_action(ACT, int); +extern void INT_CXX_action(ACT, int); extern void PAS_action(ACT, int); extern int PLI_action(ACT, int); diff --git a/src/gpre/par.cpp b/src/gpre/par.cpp index c951823aee..54accdf074 100644 --- a/src/gpre/par.cpp +++ b/src/gpre/par.cpp @@ -20,7 +20,7 @@ // // All Rights Reserved. // 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 // Fixed bugs in gpre to handle PYXIS forms // 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 @@ -2522,11 +2522,11 @@ static ACT par_form_for() if (!MATCH(KW_DOT)) SYNTAX_ERROR("."); dbb = (DBB) dbb_symbol->sym_object; - form = FORM_lookup_form(dbb, token.tok_string); + form = FORM_lookup_form(dbb, (UCHAR*)token.tok_string); } else 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; // Pick up form diff --git a/src/gpre/parse.h b/src/gpre/parse.h index 8003b7d069..5ebff4d0e5 100644 --- a/src/gpre/parse.h +++ b/src/gpre/parse.h @@ -30,6 +30,8 @@ typedef enum kwwords { KW_max } KWWORDS; +#include "../gpre/gpre.h" + #define MATCH(keyword) MSC_match(keyword) #define KEYWORD(kw) ((int) token.tok_keyword == (int) kw) #define ADVANCE_TOKEN PAR_get_token () diff --git a/src/gpre/pat.h b/src/gpre/pat.h index 2cd766edb7..c85f7f6476 100644 --- a/src/gpre/pat.h +++ b/src/gpre/pat.h @@ -67,7 +67,7 @@ Substitution codes: */ -typedef struct pat { +struct pat { DBB pat_database; REQ pat_request; TRA pat_transaction; @@ -93,6 +93,8 @@ typedef struct pat { SLONG pat_long2; BOOLEAN pat_condition; REF pat_reference; -} PAT; +}; + +typedef pat PAT; #endif /* _GPRE_PAT_H_ */ diff --git a/src/gpre/pretty.cpp b/src/gpre/pretty.cpp index 1d0701460e..6611b9ec16 100644 --- a/src/gpre/pretty.cpp +++ b/src/gpre/pretty.cpp @@ -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" @@ -237,6 +237,7 @@ int PRETTY_print_dyn( } +int PRETTY_print_form_map(SCHAR * blr, //____________________________________________________________ // @@ -346,6 +347,7 @@ int PRETTY_print_mblr( } +int PRETTY_print_menu(SCHAR * blr, //____________________________________________________________ // @@ -416,6 +418,7 @@ PRETTY_print_menu(SCHAR * blr, } +int PRETTY_print_sdl(SCHAR * blr, //____________________________________________________________ // @@ -520,7 +523,7 @@ static int indent( CTL control, SSHORT level) // data described. // -static print_blr_dtype( CTL control, BOOLEAN print_object) +static int print_blr_dtype( CTL control, BOOLEAN print_object) { unsigned short dtype; SCHAR *string; @@ -993,7 +996,7 @@ static SLONG print_long( CTL control, SSHORT offset) // 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; 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. // -static print_word( CTL control, SSHORT offset) +static int print_word( CTL control, SSHORT offset) { UCHAR v1, v2; diff --git a/src/include/jrd/gds.h b/src/include/jrd/gds.h index 61c031beaa..7e585cbc19 100644 --- a/src/include/jrd/gds.h +++ b/src/include/jrd/gds.h @@ -1,7 +1,7 @@ #ifndef INCLUDE_JRD_GDS_H #define INCLUDE_JRD_GDS_H -#include "../../jrd/ibase.h" -#include "../../jrd/gdsold.h" +#include "../jrd/ibase.h" +#include "../jrd/gdsold.h" #endif diff --git a/src/isql/isql.h b/src/isql/isql.h index 1cc58c175f..333dda61c0 100644 --- a/src/isql/isql.h +++ b/src/isql/isql.h @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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 * Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans * Fixed Bug #122563 in extract.e get_procedure_args @@ -352,7 +352,7 @@ typedef struct sqltypes { #endif #else #ifndef ISQL_FREE -#define ISQL_FREE(x) {isc_free (x); x = NULL;} +#define ISQL_FREE(x) {isc_free ((char*) x); x = NULL;} #endif #endif /* GUI_TOOLS */ diff --git a/src/jrd/ail.cpp b/src/jrd/ail.cpp index 37b4774b38..123e86cc65 100644 --- a/src/jrd/ail.cpp +++ b/src/jrd/ail.cpp @@ -58,6 +58,10 @@ #include "../wal/walc_proto.h" #include "../wal/walf_proto.h" +#if HAVE_UNISTD_H +#include +#endif + extern "C" { diff --git a/src/jrd/alt.cpp b/src/jrd/alt.cpp index db1529af2b..0c2c003bd7 100644 --- a/src/jrd/alt.cpp +++ b/src/jrd/alt.cpp @@ -893,6 +893,9 @@ int API_ROUTINE isc_add_user(STATUS * status, USER_SEC_DATA * user_data) * Return > 0 if any error occurs. * **************************************/ +#ifdef PHASE_1 +return 1; +#else USHORT retval = 0, l; struct user_data userInfo; 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); } return status[1]; /* security database not opened */ +#endif } 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. * **************************************/ +#ifdef PHASE_1 +return 1; +#else USHORT retval = 0, l; void *db_handle; 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); } return status[1]; /* security database not opened */ +#endif } 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. * **************************************/ +#ifdef PHASE_1 +return 1; +#else USHORT retval = 0, l; struct user_data userInfo; 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); } return status[1]; /* security database not opened */ +#endif } void *open_security_db( @@ -1288,6 +1300,9 @@ void *open_security_db( * Returns NULL otherwise * **************************************/ +#ifdef PHASE_1 +return 0; +#else short dpb_length, l = 0; char dpb_buffer[256], *dpb, *p; TEXT default_security_db[512], connect_string[1024], *database; @@ -1355,6 +1370,7 @@ void *open_security_db( NULL; return db_handle; +#endif } void get_security_error(STATUS * status, int gsec_err) diff --git a/src/jrd/blb.cpp b/src/jrd/blb.cpp index 058234715c..f7f6d6c3bc 100644 --- a/src/jrd/blb.cpp +++ b/src/jrd/blb.cpp @@ -24,7 +24,7 @@ * 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 @@ -198,8 +198,8 @@ BLB BLB_create2(TDBB tdbb, type = gds__parse_bpb2(bpb_length, bpb, - reinterpret_cast < USHORT * >(&from), - reinterpret_cast < USHORT * >(&to), + reinterpret_cast < SSHORT * >(&from), + reinterpret_cast < SSHORT * >(&to), reinterpret_cast < USHORT * >(&from_charset), reinterpret_cast < USHORT * >(&to_charset)); blob = allocate_blob(tdbb, transaction); @@ -224,7 +224,7 @@ BLB BLB_create2(TDBB tdbb, if ((to_charset != CS_NONE) && (from_charset != to_charset)) { filter = (BLF) ALLOCP(type_blf); filter->blf_filter = - reinterpret_cast < long (*) () > (filter_transliterate_text); + reinterpret_cast < STATUS (*) (USHORT, CTL) > (filter_transliterate_text); filter_required = TRUE; } } @@ -995,8 +995,8 @@ BLB BLB_open2(TDBB tdbb, gds__parse_bpb2(bpb_length, bpb, - reinterpret_cast < USHORT * >(&from), - reinterpret_cast < USHORT * >(&to), + reinterpret_cast < SSHORT * >(&from), + reinterpret_cast < SSHORT * >(&to), reinterpret_cast < USHORT * >(&from_charset), reinterpret_cast < USHORT * >(&to_charset)); @@ -1024,7 +1024,7 @@ BLB BLB_open2(TDBB tdbb, if ((to_charset != CS_NONE) && (from_charset != to_charset)) { filter = (BLF) ALLOCP(type_blf); filter->blf_filter = - reinterpret_cast < long (*) () > (filter_transliterate_text); + reinterpret_cast < STATUS (*) (USHORT, CTL) > (filter_transliterate_text); filter_required = TRUE; } } @@ -2421,4 +2421,4 @@ static BLB store_array(TDBB tdbb, TRA transaction, BID blob_id) } -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/jrd/blf_proto.h b/src/jrd/blf_proto.h index 4d1e79af2d..721dbad185 100644 --- a/src/jrd/blf_proto.h +++ b/src/jrd/blf_proto.h @@ -25,7 +25,7 @@ #define _JRD_BLF_PROTO_H_ #ifdef __cplusplus -extern "C" { +//extern "C" { #endif 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 *); #ifdef __cplusplus -} /* extern "C" */ +//} /* extern "C" */ #endif #endif /* _JRD_BLF_PROTO_H_ */ diff --git a/src/jrd/blob_filter.h b/src/jrd/blob_filter.h index 2be9d370d2..5ac95206e4 100644 --- a/src/jrd/blob_filter.h +++ b/src/jrd/blob_filter.h @@ -32,14 +32,14 @@ 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 */ SSHORT ctl_to_sub_type; /* Target type */ SSHORT ctl_from_sub_type; /* Source type */ USHORT ctl_buffer_length; /* Length of buffer */ USHORT ctl_segment_length; /* Length of current segment */ 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 */ SLONG ctl_max_segment; /* Length of longest segment */ 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 */ } *CTL; -typedef STATUS(*PTR) (); +typedef STATUS(*PTR) (USHORT, CTL); /* Blob filter management */ @@ -60,7 +60,7 @@ typedef struct blf struct blf* blf_next; /* Next known filter */ SSHORT blf_from; /* Source 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 */ } *BLF; diff --git a/src/jrd/cch.cpp b/src/jrd/cch.cpp index 51ccc81e29..fc428292f8 100644 --- a/src/jrd/cch.cpp +++ b/src/jrd/cch.cpp @@ -71,7 +71,7 @@ extern "C" { 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_insert(DBB, BDB); static void btc_remove(BDB); @@ -2575,7 +2575,7 @@ static BDB alloc_bdb(TDBB tdbb, BCB bcb, UCHAR ** memory) #ifndef PAGE_LATCHING if (!(bdb->bdb_lock = lock = CCH_page_lock(tdbb, ERR_val))) { - ALL_release(bdb); + ALL_release((FRB)bdb); return 0; } lock->lck_ast = blocking_ast_bdb; @@ -2595,7 +2595,7 @@ static BDB alloc_bdb(TDBB tdbb, BCB bcb, UCHAR ** memory) #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) { #ifndef PAGE_LATCHING if (bdb->bdb_lock) - ALL_release(bdb->bdb_lock); + ALL_release((FRB)bdb->bdb_lock); #endif QUE_DELETE(bdb->bdb_que); ALL_release(reinterpret_cast < frb * >(bdb)); @@ -5548,4 +5548,4 @@ static void unmark(TDBB tdbb, WIN * window) } } -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/jrd/cmp.cpp b/src/jrd/cmp.cpp index 06f223840b..9ac47845f0 100644 --- a/src/jrd/cmp.cpp +++ b/src/jrd/cmp.cpp @@ -21,7 +21,7 @@ * 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" @@ -3683,14 +3683,14 @@ static RSE pass1_rse( if (boolean) { if (rse->rse_boolean) { - NOD and; + NOD additional; - and = PAR_make_node(tdbb, 2); - and->nod_type = nod_and; - and->nod_arg[0] = boolean; - and->nod_arg[1] = + additional = PAR_make_node(tdbb, 2); + additional->nod_type = nod_and; + additional->nod_arg[0] = boolean; + additional->nod_arg[1] = pass1(tdbb, csb, rse->rse_boolean, view, view_stream, FALSE); - rse->rse_boolean = and; + rse->rse_boolean = additional; } else rse->rse_boolean = boolean; @@ -3791,13 +3791,13 @@ static void pass1_source( pass1(tdbb, csb, sub_rse->rse_boolean, parent_view, view_stream, FALSE); if (*boolean) { - NOD and; + NOD additional; - and = PAR_make_node(tdbb, 2); - and->nod_type = nod_and; - and->nod_arg[0] = node; - and->nod_arg[1] = *boolean; - *boolean = and; + additional = PAR_make_node(tdbb, 2); + additional->nod_type = nod_and; + additional->nod_arg[0] = node; + additional->nod_arg[1] = *boolean; + *boolean = additional; } else *boolean = node; @@ -3948,17 +3948,17 @@ static void pass1_source( copy(tdbb, csb, view_rse->rse_boolean, map, 0, FALSE), view, stream, FALSE); if (*boolean) { - NOD and; + NOD additional; /* The order of the nodes here is important! The boolean from the view must appear first so that it gets expanded first in pass1. */ - and = PAR_make_node(tdbb, 2); - and->nod_type = nod_and; - and->nod_arg[0] = node; - and->nod_arg[1] = *boolean; - *boolean = and; + additional = PAR_make_node(tdbb, 2); + additional->nod_type = nod_and; + additional->nod_arg[0] = node; + additional->nod_arg[1] = *boolean; + *boolean = additional; } else *boolean = node; diff --git a/src/jrd/common.h b/src/jrd/common.h index 36063606f2..33639fc7fd 100644 --- a/src/jrd/common.h +++ b/src/jrd/common.h @@ -27,12 +27,14 @@ * 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 #define JRD_COMMON_H +#include "objs/jrd/autoconfig.h" + #ifndef INCLUDE_FB_MACROS_H #include "../include/fb_macros.h" #endif @@ -55,6 +57,10 @@ $Id: common.h,v 1.2 2001-07-10 17:35:13 awharrison Exp $ #define CANCEL_OPERATION #endif +#ifndef GDS_FAR +#define GDS_FAR +#endif + /* Linux for Intel platforms*/ #ifdef LINUX @@ -90,6 +96,39 @@ $Id: common.h,v 1.2 2001-07-10 17:35:13 awharrison Exp $ #define VOLATILE volatile #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 +#endif +#endif /* Darwin Platforms */ + + /* FreeBSD for Intel platforms */ #ifdef FREEBSD @@ -1098,8 +1137,12 @@ typedef unsigned long DWORD; #endif #define NULL_PTR ((void*) 0) +#ifndef TRUE #define TRUE 1 +#endif +#ifndef FALSE #define FALSE 0 +#endif #define SUCCESS 0 #define FAILURE 1 @@ -1179,10 +1222,10 @@ typedef char SBYTE; /* Signed byte - rare usage */ typedef long STATUS; typedef long IPTR; typedef unsigned long U_IPTR; -typedef void (*FPTR_VOID) (); -typedef void (*FPTR_VOID_PTR) (void *); -typedef int (*FPTR_INT) (); -typedef int (*FPTR_INT_VOID_PTR) (void *); +typedef void (GDS_FAR *FPTR_VOID) (); +typedef void (GDS_FAR *FPTR_VOID_PTR) (void *); +typedef int (GDS_FAR *FPTR_INT) (); +typedef int (GDS_FAR *FPTR_INT_VOID_PTR) (void *); typedef ULONG RCRD_OFFSET; typedef USHORT FLD_LENGTH; @@ -1402,6 +1445,10 @@ void GDS_breakpoint(int); #define BUFFER_SMALL 256 #define BUFFER_TINY 128 +#ifndef LSEEK_OFFSET_CAST +#define LSEEK_OFFSET_CAST +#endif + #ifndef DOUBLE_MULTIPLY #define DOUBLE_MULTIPLY(a,b) (((double) (a)) * ((double) (b))) #endif @@ -1436,4 +1483,4 @@ typedef struct in_sw_tab_t { } *IN_SW_TAB; -#endif /* JRD_COMMON_H */ \ No newline at end of file +#endif /* JRD_COMMON_H */ diff --git a/src/jrd/cvt.cpp b/src/jrd/cvt.cpp index 3e4589a33e..54318842a5 100644 --- a/src/jrd/cvt.cpp +++ b/src/jrd/cvt.cpp @@ -44,6 +44,15 @@ #include "../jrd/intl_proto.h" #include "../jrd/thd_proto.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + #if !(defined REQUESTER && defined SUPERCLIENT) #include "../jrd/intlobj.h" #endif @@ -204,7 +213,6 @@ static CONST TEXT *CONST months[] = { #include "../jrd/quad.cpp" #endif - #pragma FB_COMPILER_MESSAGE("Fix this! Ugly function pointer cast!") typedef void (*pfn_cvt_private_cludge) (int, int); typedef void (*pfn_cvt_private_cludge2) (int, int, ...); diff --git a/src/jrd/dbg.cpp b/src/jrd/dbg.cpp index bdcb967888..de2a7ea4d7 100644 --- a/src/jrd/dbg.cpp +++ b/src/jrd/dbg.cpp @@ -40,6 +40,7 @@ #include "../jrd/que.h" #include "../jrd/cch_proto.h" #include "../jrd/dbg_proto.h" +#include "../jrd/err_proto.h" #ifdef SUPERSERVER #include "../jrd/thd_proto.h" @@ -882,7 +883,7 @@ int DBG_pretty(register NOD node, register int column) return TRUE; } - +extern "C" int DBG_supervisor(int arg) { /************************************** diff --git a/src/jrd/divorce.cpp b/src/jrd/divorce.cpp index 86a7d5f726..07eae81e74 100644 --- a/src/jrd/divorce.cpp +++ b/src/jrd/divorce.cpp @@ -68,6 +68,14 @@ #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_FCNTL_H +#include +#endif + #ifndef NOFILE #define NOFILE 20 #endif diff --git a/src/jrd/dyn.h b/src/jrd/dyn.h index f0dc99fd4b..80251d7abb 100644 --- a/src/jrd/dyn.h +++ b/src/jrd/dyn.h @@ -39,9 +39,9 @@ #define CHECK_CNSTRT "CHECK" #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 FLD_SRC_LEN 32 diff --git a/src/jrd/dyn_md_proto.h b/src/jrd/dyn_md_proto.h index 7f6bb67263..3f53a211bd 100644 --- a/src/jrd/dyn_md_proto.h +++ b/src/jrd/dyn_md_proto.h @@ -33,5 +33,7 @@ extern void DYN_modify_procedure(GBL, UCHAR **); extern void DYN_modify_relation(GBL, UCHAR **); extern void DYN_modify_trigger(GBL, UCHAR **); 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_ */ diff --git a/src/jrd/enc.cpp b/src/jrd/enc.cpp index 8ea3e35c60..e95e22a758 100644 --- a/src/jrd/enc.cpp +++ b/src/jrd/enc.cpp @@ -8,10 +8,15 @@ static TEXT *local_crypt(TEXT *, TEXT *); #endif +#if defined(HAVE_UNISTD_H) && !defined(NO_CRYPT) +#include +#define CRYPT_FUNC crypt +#else #ifndef NO_CRYPT extern TEXT *crypt(); #define CRYPT_FUNC crypt #endif +#endif extern "C" { diff --git a/src/jrd/err.cpp b/src/jrd/err.cpp index 445891edf6..8e5ae84600 100644 --- a/src/jrd/err.cpp +++ b/src/jrd/err.cpp @@ -519,7 +519,7 @@ void DLL_EXPORT ERR_punt(void) 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]); } #endif diff --git a/src/jrd/err_proto.h b/src/jrd/err_proto.h index 7256ed3e06..321be1cc64 100644 --- a/src/jrd/err_proto.h +++ b/src/jrd/err_proto.h @@ -45,13 +45,20 @@ extern void DLL_EXPORT ERR_post(STATUS, ...); extern void DLL_EXPORT ERR_punt(void); extern void DLL_EXPORT ERR_warning(STATUS, ...); 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 } /* extern "C" */ #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 */ diff --git a/src/jrd/event.cpp b/src/jrd/event.cpp index 9f41e71725..36108d3296 100644 --- a/src/jrd/event.cpp +++ b/src/jrd/event.cpp @@ -36,6 +36,15 @@ #include "../jrd/isc_s_proto.h" #include "../jrd/sch_proto.h" #include "../jrd/thd_proto.h" +#include "../jrd/isc_i_proto.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif #pragma FB_COMPILER_MESSAGE("FIXFIXFIX!!! - DANGER!") // 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 #ifndef AST_TYPE -#define AST_TYPE +#define AST_TYPE void #endif #ifndef MUTEX @@ -373,7 +382,7 @@ SLONG EVENT_que(STATUS * status_vector, USHORT string_length, TEXT * string, 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)) 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 if (!header) { RELEASE; diff --git a/src/jrd/evl.cpp b/src/jrd/evl.cpp index 9f94d8d886..6a426d7aa2 100644 --- a/src/jrd/evl.cpp +++ b/src/jrd/evl.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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 = SORT_init(tdbb->tdbb_status_vector, ROUNDUP_LONG(sort_key->skd_length), 1, sort_key, - reinterpret_cast < UCHAR(*)() > (reject_duplicate), 0, + reinterpret_cast < BOOLEAN(*)() > (reject_duplicate), 0, tdbb->tdbb_attachment); if (!(asb_impure->iasb_sort_handle = (SLONG *) handle)) diff --git a/src/jrd/exe.cpp b/src/jrd/exe.cpp index 246162a517..205759ed76 100644 --- a/src/jrd/exe.cpp +++ b/src/jrd/exe.cpp @@ -21,7 +21,7 @@ * 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 @@ -3208,8 +3208,9 @@ static void set_error(TDBB tdbb, XCP condition) if (condition->xcp_rpt[0].xcp_code == gds__check_constraint) { MET_lookup_cnstrt_for_trigger(tdbb, name, relation_name, request->req_trg_name); - s = (name[0]) ? name : ""; - r = (relation_name[0]) ? relation_name : ""; + // CONST CAST + s = (name[0]) ? name : (TEXT*)""; + r = (relation_name[0]) ? relation_name : (TEXT*)""; ERR_post(condition->xcp_rpt[0].xcp_code, gds_arg_string, ERR_cstring(s), gds_arg_string, ERR_cstring(r), 0); diff --git a/src/jrd/file_params.h b/src/jrd/file_params.h index 8a684ec700..cdb80a60cd 100644 --- a/src/jrd/file_params.h +++ b/src/jrd/file_params.h @@ -126,9 +126,15 @@ #ifdef LINUX #define ISC_PREFIX "/opt/interbase/" #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/" #endif #endif +#endif /* keep MSG_FILE_LANG in sync with build_file.e */ diff --git a/src/jrd/filters.cpp b/src/jrd/filters.cpp index 1cf667951b..e804bbd1f0 100644 --- a/src/jrd/filters.cpp +++ b/src/jrd/filters.cpp @@ -753,7 +753,7 @@ STATUS filter_transliterate_text(USHORT action, CTL control) control->ctl_source_handle = aux->ctlaux_subfilter; control->ctl_source = - reinterpret_cast < long (*) () > (filter_transliterate_text); + reinterpret_cast < STATUS (*) (USHORT, CTL) > (filter_transliterate_text); source = control->ctl_source_handle; if (action == ACTION_open) { diff --git a/src/jrd/flu.cpp b/src/jrd/flu.cpp index 8745d66e2c..c755f3a971 100644 --- a/src/jrd/flu.cpp +++ b/src/jrd/flu.cpp @@ -21,7 +21,7 @@ * 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" @@ -80,11 +80,20 @@ static int condition_handler(int *, int *, int *); #define IB_UDF_DIR "UDF/" #endif +#ifdef DARWIN +#include +#include +#define IB_UDF_DIR "UDF/" +#endif + #if defined FREEBSD || defined NETBSD #include #define DYNAMIC_SHARED_LIBRARIES #include #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. * !! WARNING !! WARNING !! WARNING !! @@ -225,6 +234,11 @@ void FLU_unregister_module(MOD module) * **************************************/ MOD *mod; + #ifdef DARWIN + NSSymbol symbol; + void (*fini)(void); + #endif + /* Module is in-use by other databases.*/ @@ -253,6 +267,17 @@ void FLU_unregister_module(MOD module) FreeLibrary(module->mod_handle); #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); } @@ -1240,6 +1265,311 @@ static void adjust_loadlib_name(TEXT * access_path, TEXT * load_path) } #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 .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 FPTR_INT ISC_lookup_entrypoint(TEXT* module, diff --git a/src/jrd/functions.cpp b/src/jrd/functions.cpp index 85c9c96fbf..c5243dd42b 100644 --- a/src/jrd/functions.cpp +++ b/src/jrd/functions.cpp @@ -23,6 +23,7 @@ #include "../jrd/ib_stdio.h" #include +#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)(); */ @@ -72,7 +73,7 @@ FPTR_INT FUNCTIONS_entrypoint(char *module, char *entrypoint) * **************************************/ FN *function; - char *p, temp[128], *ep; + char *p, temp[MAX_PATH_LENGTH + 128], *ep; /* Bug #126614 Fix */ p = temp; diff --git a/src/jrd/gds.cpp b/src/jrd/gds.cpp index 56178aa821..701da3d239 100644 --- a/src/jrd/gds.cpp +++ b/src/jrd/gds.cpp @@ -49,6 +49,11 @@ #include "../jrd/time.h" #include "../jrd/misc.h" +#ifdef DARWIN +#include +#include +#endif + #if (defined PC_PLATFORM && !defined NETWARE_386) #include #endif @@ -159,7 +164,7 @@ extern int ib_printf(); #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 SCHAR *sys_errlist[]; extern int sys_nerr; @@ -196,7 +201,7 @@ typedef int pid_t; #endif #ifndef GETTIMEOFDAY -#define GETTIMEOFDAY(time,tz) gettimeofday (time, tz) +#define GETTIMEOFDAY(time,tz) gettimeofday ((struct timeval*)time, (struct timezone*)tz) #define TIMEOFDAY_TZ #endif @@ -389,7 +394,7 @@ void GDS_breakpoint(int); 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_print_blr(CTL, UCHAR); static SCHAR blr_print_byte(CTL); @@ -1773,7 +1778,7 @@ SLONG API_ROUTINE gds__interprete(char *s, STATUS ** vector) break; 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); else if (code == 60) strcpy(s, "connection timed out"); @@ -1797,7 +1802,7 @@ SLONG API_ROUTINE gds__interprete(char *s, STATUS ** vector) #ifndef NETWARE_386 #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); else if (code == 60) strcpy(s, "connection timed out"); @@ -2178,7 +2183,7 @@ SSHORT API_ROUTINE gds__msg_lookup(void *handle, position = message->msg_top_tree; 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; else if (read(message->msg_file, message->msg_bucket, 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. * **************************************/ + #ifdef DARWIN /* Variables needed for Darwin specific code */ + CFBundleRef ibaseBundle; + CFURLRef msgFileUrl; + CFStringRef msgFilePath; + #endif string[0] = 0; if (ib_prefix == NULL) { - if (!(ib_prefix = getenv(ISC_ENV))) + if ( !(ib_prefix = getenv(ISC_ENV)) || ib_prefix[0] == 0) { #if defined(WIN_NT) ib_prefix = ib_prefix_val; @@ -2428,8 +2438,22 @@ void API_ROUTINE gds__prefix(TEXT * string, TEXT * root) } } #else // WIN_NT - ib_prefix = ISC_PREFIX; - strcat(ib_prefix_val, ib_prefix); +#ifdef DARWIN + 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 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, UCHAR * bpb, - USHORT * source, - USHORT * target, + SSHORT * source, + SSHORT * target, USHORT * source_interp, USHORT * target_interp) { @@ -2847,7 +2873,7 @@ SLONG API_ROUTINE gds__ftof(register SCHAR * string, int API_ROUTINE gds__print_blr( UCHAR * blr, - void (*routine) (), + FPTR_VOID routine, SCHAR * user_arg, SSHORT language) { /************************************** @@ -3131,9 +3157,13 @@ void* API_ROUTINE gds__sys_alloc(SLONG size) #ifdef UNIX #ifdef MAP_ANONYMOUS memory = mmap(NULL, size, (PROT_READ | PROT_WRITE), +#ifdef MAP_ANONYMOUS (MAP_ANONYMOUS | -#ifndef LINUX -/* In LINUX, there is no such thing as MAP_VARIABLE. Hence, it gives +#else + (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, if you do not specify MAP_FIXED */ 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) { /************************************** * diff --git a/src/jrd/gds_proto.h b/src/jrd/gds_proto.h index de6c1ff1c6..583b296a17 100644 --- a/src/jrd/gds_proto.h +++ b/src/jrd/gds_proto.h @@ -106,7 +106,7 @@ void API_ROUTINE gds__prefix_msg(TEXT*, TEXT*); SLONG API_ROUTINE gds__get_prefix(SSHORT, TEXT*); STATUS API_ROUTINE gds__print_status(STATUS*); 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*); SLONG API_ROUTINE gds__ftof(SCHAR*, USHORT GDS_VAL(length1), SCHAR*, USHORT GDS_VAL(length2)); diff --git a/src/jrd/gdsold.h b/src/jrd/gdsold.h index 5793f2506c..11a4dad492 100644 --- a/src/jrd/gdsold.h +++ b/src/jrd/gdsold.h @@ -21,6 +21,7 @@ * Contributor(s): ______________________________________. */ + #ifndef _JRD_GDSOLD_H_ #define _JRD_GDSOLD_H_ @@ -55,7 +56,9 @@ /* define type, export and other stuff based on c/c++ and Windows */ /******************************************************************/ +#ifndef GDS_FAR #define GDS_FAR ISC_FAR +#endif #define GDS_EXPORT ISC_EXPORT typedef void GDS_FAR *gds_db_handle; @@ -279,7 +282,7 @@ void GDS_EXPORT gds__vtov(CONST SCHAR GDS_FAR*, SSHORT); int GDS_EXPORT gds__version(void GDS_FAR * GDS_FAR *, - void (GDS_FAR *) (), + FPTR_VOID, void 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_netware 16 #define gds_arg_win32 17 +#define gds_arg_warning 18 #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_netware = 16; const GDS_LONG gds_arg_win32 = 17; +const GDS_LONG gds_arg_warning = 18; #endif @@ -2413,7 +2418,10 @@ const unsigned char gds_dyn_last_dyn_value = 210; #else /* c++ definitions */ 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_rid = 3; 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_HORIZONTAL = 6; 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 diff --git a/src/jrd/ibase.h b/src/jrd/ibase.h index 5c6cccc81b..678ea0c134 100644 --- a/src/jrd/ibase.h +++ b/src/jrd/ibase.h @@ -22,7 +22,7 @@ * 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 @@ -132,7 +132,8 @@ typedef GDS_QUAD GDS__QUAD; /* TMN: What *is* really the right definition of these structs?! */ /* 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 { unsigned long uquad_high; diff --git a/src/jrd/iberr.h b/src/jrd/iberr.h index 4ca32b8ee3..3d92f751e6 100644 --- a/src/jrd/iberr.h +++ b/src/jrd/iberr.h @@ -25,7 +25,7 @@ #define JRD_IBERR_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 diff --git a/src/jrd/idx.cpp b/src/jrd/idx.cpp index 95031f1088..d1fb6603b2 100644 --- a/src/jrd/idx.cpp +++ b/src/jrd/idx.cpp @@ -234,7 +234,7 @@ void IDX_create_index( key_length + sizeof(struct isr), 1, &key_desc, - reinterpret_cast < UCHAR(*)() > (duplicate_key), + reinterpret_cast < BOOLEAN(*)() > (duplicate_key), &ifl_data, tdbb->tdbb_attachment); if (!sort_handle) diff --git a/src/jrd/isc.cpp b/src/jrd/isc.cpp index 76f038a97c..1802c81181 100644 --- a/src/jrd/isc.cpp +++ b/src/jrd/isc.cpp @@ -24,7 +24,7 @@ * 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" @@ -1444,6 +1444,14 @@ void isc_internal_set_config_value(UCHAR key, ULONG * value1, ULONG * value2) #ifdef UNIX +#ifdef AIX_PPC +#define _UNIX95 +#endif +#include +#ifdef AIX_PPC +#undef _UNIX95 +#endif + 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 --- * **************************************/ -#ifdef AIX_PPC -#define _UNIX95 -#endif -#include -#ifdef AIX_PPC -#undef _UNIX95 -#endif +#ifndef DARWIN extern struct group *getgrnam(); +#endif struct group *user_group; SLONG n; diff --git a/src/jrd/isc_file.cpp b/src/jrd/isc_file.cpp index 7855877ef7..6cc72b572a 100644 --- a/src/jrd/isc_file.cpp +++ b/src/jrd/isc_file.cpp @@ -101,6 +101,12 @@ typedef struct itm { #define MTAB_CLOSE(stream) ib_fclose (stream) #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 #define NON_MNTENT #define MTAB "/etc/mount" @@ -135,7 +141,7 @@ typedef struct itm { #include #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) #endif @@ -1474,7 +1480,7 @@ int ISC_strip_extension(TEXT * file_name) #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) { /************************************** * diff --git a/src/jrd/isc_i_proto.h b/src/jrd/isc_i_proto.h index 65908f4247..6c8b0ab427 100644 --- a/src/jrd/isc_i_proto.h +++ b/src/jrd/isc_i_proto.h @@ -24,9 +24,18 @@ #ifndef _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_enable(void); void DLL_EXPORT ISC_exit(void); + +#ifdef __cplusplus +} +#endif + +void DLL_EXPORT ISC_enable(void); void DLL_EXPORT ISC_inhibit(void); #ifdef WIN_NT diff --git a/src/jrd/isc_ipc.cpp b/src/jrd/isc_ipc.cpp index d026ed58ef..30a93c6398 100644 --- a/src/jrd/isc_ipc.cpp +++ b/src/jrd/isc_ipc.cpp @@ -22,7 +22,7 @@ * 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 #define LOCAL_SHLIB_DEFS @@ -47,6 +47,10 @@ #endif #endif +#ifdef DARWIN +#include +#endif + #ifdef SOLX86 #define HANDLER_ADDR_ARG #endif @@ -77,9 +81,13 @@ typedef int (*CLIB_ROUTINE SIG_FPTR) (); #if ((defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER)) typedef void (CLIB_ROUTINE * SIG_FPTR) (); #else +#if (defined(DARWIN)) +typedef void (*CLIB_ROUTINE SIG_FPTR) (int); +#else typedef void (*CLIB_ROUTINE SIG_FPTR) (); #endif #endif +#endif #ifdef DGUX #define GT_32_SIGNALS @@ -320,6 +328,7 @@ extern int ib_fprintf(); extern int close(); #endif +extern "C" { void DLL_EXPORT ISC_enter(void) { @@ -354,6 +363,8 @@ void DLL_EXPORT ISC_enter(void) #endif } +} // extern "C" + #ifndef REQUESTER void DLL_EXPORT ISC_enable(void) @@ -412,6 +423,7 @@ void DLL_EXPORT ISC_enable(void) #endif +extern "C" { void DLL_EXPORT ISC_exit(void) { /************************************** @@ -435,6 +447,7 @@ void DLL_EXPORT ISC_exit(void) ISC_signal_cancel(SIGFPE, (void (*)()) overflow_handler, 0); #endif } +} // Extern "C" #ifndef REQUESTER diff --git a/src/jrd/isc_s_proto.h b/src/jrd/isc_s_proto.h index 51a6cd2e1d..7bb1196bbd 100644 --- a/src/jrd/isc_s_proto.h +++ b/src/jrd/isc_s_proto.h @@ -55,7 +55,7 @@ extern void *ISC_make_signal(BOOLEAN, BOOLEAN, int, int); extern UCHAR *DLL_EXPORT ISC_map_file(STATUS *, TEXT *, - FPTR_VOID, + void (*)(void *, struct sh_mem *, int), void *, SLONG, struct sh_mem *); #ifndef NETWARE_386 @@ -79,6 +79,11 @@ void ISC_semaphore_close(ULONG); void ISC_sync_init(void); #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 UNIX extern void ISC_exception_post(ULONG, TEXT *); diff --git a/src/jrd/isc_sync.cpp b/src/jrd/isc_sync.cpp index e650b3b508..15f626c489 100644 --- a/src/jrd/isc_sync.cpp +++ b/src/jrd/isc_sync.cpp @@ -68,9 +68,13 @@ typedef int (*CLIB_ROUTINE SIG_FPTR) (); #if ((defined(WIN32) || defined(_WIN32)) && defined(_MSC_VER)) typedef void (CLIB_ROUTINE * SIG_FPTR) (); #else +#if (defined(DARWIN)) +typedef void (*CLIB_ROUTINE SIG_FPTR) (int); +#else typedef void (*CLIB_ROUTINE SIG_FPTR) (); #endif #endif +#endif #ifndef REQUESTER static USHORT inhibit_restart; @@ -128,18 +132,6 @@ static UCHAR *next_shared_memory; #include #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 PRIV 0666 #define LOCAL_SEMAPHORES 4 @@ -182,6 +174,10 @@ typedef int pid_t; #define SEMUN #endif +#ifdef DARWIN +#define SEMUN +#endif + #ifdef LINUX /* * 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); #endif // UNIX && SUPERSERVER -static BOOLEAN semaphore_wait(int, int, int *); +static BOOLEAN semaphore_wait_isc_sync(int, int, int *); #ifdef NETWARE_386 static void cleanup_semaphores(ULONG); @@ -895,7 +891,7 @@ int ISC_event_wait( #ifdef HP10 if (micro_seconds > 0 && (ret == -1) && (errno == EAGAIN)) #else -#ifdef linux +#if (defined linux || defined DARWIN) if (micro_seconds > 0 && (ret == ETIMEDOUT)) #else if (micro_seconds > 0 && (ret == ETIME)) @@ -1095,7 +1091,7 @@ int ISC_event_wait( EVENT * events, SLONG * values, 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; ISC_set_timer(micro_seconds, timeout_handler, handler_arg, - &user_timer, &user_handler); + (SLONG*)&user_timer, (void**)&user_handler); } /* Go into wait loop */ @@ -1206,9 +1202,9 @@ int ISC_event_wait( ret = SUCCESS; break; } - (void) semaphore_wait(count, semid, semnums); + (void) semaphore_wait_isc_sync(count, semid, semnums); 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 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. */ - 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; #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 is complete. That way potential race conditions are avoided. */ -#ifndef sun +#if !(defined sun || defined DARWIN) if (lockf(ib_fileno(fp), F_LOCK, 0)) { error(status_vector, "lockf", errno); #else @@ -4311,7 +4307,7 @@ UCHAR *DLL_EXPORT ISC_remap_file(STATUS * status_vector, #if (defined UNIX) void ISC_reset_timer( - void (*timeout_handler) (), + FPTR_VOID timeout_handler, void *timeout_arg, SLONG * client_timer, void **client_handler) { @@ -4345,9 +4341,9 @@ void ISC_reset_timer( #ifndef SIGACTION_SUPPORTED sigvector(SIGALRM, client_handler, NULL); #else - sigaction(SIGALRM, client_handler, NULL); + sigaction(SIGALRM, (struct sigaction*)client_handler, NULL); #endif - setitimer(ITIMER_REAL, client_timer, NULL); + setitimer(ITIMER_REAL, (itimerval*)client_timer, NULL); #endif } #endif @@ -4356,7 +4352,7 @@ void ISC_reset_timer( #if (defined UNIX) void ISC_set_timer( SLONG micro_seconds, - void (*timeout_handler) (), + FPTR_VOID timeout_handler, void *timeout_arg, SLONG * client_timer, void **client_handler) { @@ -4936,11 +4932,13 @@ static void make_object_name( #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) * ************************************** * diff --git a/src/jrd/jio.cpp b/src/jrd/jio.cpp index 6d9e455f78..e3c025f47b 100644 --- a/src/jrd/jio.cpp +++ b/src/jrd/jio.cpp @@ -1288,7 +1288,7 @@ static position_and_read(journal, block, buffer, length) SLONG position; 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) error(journal, errno, "lseek", isc_io_read_err); @@ -1366,7 +1366,7 @@ static position_and_write(journal, block, buffer, length) int position, n; 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) error(journal, errno, "lseek", isc_io_write_err); diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 2fa10111ba..692279d0e7 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -601,7 +601,7 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status, /* Initialize special error handling */ - tdbb->tdbb_setjmp = (UCHAR *) env; + tdbb->tdbb_setjmp = env; tdbb->tdbb_status_vector = status = user_status; tdbb->tdbb_attachment = attachment = NULL; tdbb->tdbb_request = NULL; @@ -625,7 +625,7 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status, if (SETJMP(env)) { #ifdef _PPC_ - tdbb->tdbb_setjmp = (UCHAR *) env1; + tdbb->tdbb_setjmp = env1; if (!SETJMP(env1)) #else if (!SETJMP(env)) @@ -821,6 +821,10 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status, 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) { 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); } + 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 /* 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, SLONG * id, 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; p = user_status; *p++ = gds_arg_gds; - *p++ = gds__random; + *p++ = gds_random; *p++ = gds_arg_string; *p++ = (STATUS) "database use count set on error return"; *p = gds_arg_end; @@ -5059,6 +5074,11 @@ static void get_options(UCHAR* dpb, options->dpb_set_db_sql_dialect = (USHORT) get_parameter(&p); break; + case isc_dpb_set_db_readonly: + options->dpb_set_db_readonly = TRUE; + options->dpb_db_readonly = (SSHORT) get_parameter(&p); + break; + default: l = *p++; p += l; @@ -5572,7 +5592,7 @@ static STATUS return_success(TDBB tdbb) dbb->dbb_use_count = 0; p = user_status; *p++ = gds_arg_gds; - *p++ = gds__random; + *p++ = gds_random; *p++ = gds_arg_string; *p++ = (STATUS) "database use count set on success return"; *p = gds_arg_end; @@ -6217,4 +6237,4 @@ static void purge_attachment(TDBB tdbb, } } -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/jrd/jrd.h b/src/jrd/jrd.h index d56cfc6b7c..96de6f8cfd 100644 --- a/src/jrd/jrd.h +++ b/src/jrd/jrd.h @@ -705,7 +705,7 @@ typedef struct tdbb struct req* tdbb_request; struct plb* tdbb_default; STATUS* tdbb_status_vector; - UCHAR* tdbb_setjmp; + void* tdbb_setjmp; USHORT tdbb_inhibit; /* Inhibit context switch if non-zero */ SSHORT tdbb_quantum; /* Cycles remaining until voluntary schedule */ USHORT tdbb_flags; @@ -741,7 +741,7 @@ typedef struct ihndl #ifdef MULTI_THREAD #if (defined DECOSF || defined NETWARE_386 || \ 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()) #endif #endif diff --git a/src/jrd/jrn.cpp b/src/jrd/jrn.cpp index bcf0e7362d..29cb3a57d6 100644 --- a/src/jrd/jrn.cpp +++ b/src/jrd/jrn.cpp @@ -30,6 +30,10 @@ #include #include +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef UNIX #define UNIX_JOURNALLING #define BSD_SOCKETS @@ -857,7 +861,7 @@ USHORT control_length, UCHAR * data, USHORT d_length, USHORT retry) return ret_val; } - if (!connect((int) journal->jrn_channel, &address, sizeof(address))) + if (!connect((int) journal->jrn_channel, (sockaddr*)&address, sizeof(address))) break; sleep(3); diff --git a/src/jrd/lck.cpp b/src/jrd/lck.cpp index 993e6b367a..ff21970282 100644 --- a/src/jrd/lck.cpp +++ b/src/jrd/lck.cpp @@ -41,6 +41,14 @@ #include "../jrd/thd_proto.h" #include "../jrd/gdsassert.h" +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef WIN_NT #include #endif diff --git a/src/jrd/lck.h b/src/jrd/lck.h index d84ff06858..da6508eab0 100644 --- a/src/jrd/lck.h +++ b/src/jrd/lck.h @@ -71,7 +71,7 @@ typedef struct lck { struct blk *lck_compatible2; /* Sub-level for internal compatibility */ struct att *lck_attachment; /* Attachment that owns 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_owner_handle; /* Lock owner handle from the lock manager's point of view */ USHORT lck_count; /* count of locks taken out by attachment */ diff --git a/src/jrd/license.h b/src/jrd/license.h index 2fb8a3f0ca..fcddf9ff68 100644 --- a/src/jrd/license.h +++ b/src/jrd/license.h @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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 * Preliminary changes to get IB_BUILD_NO automatically * increased on commits. @@ -207,6 +207,11 @@ #define FB_PLATFORM "NB" /* NetBSD */ #endif +#ifdef DARWIN +#define FB_PLATFORM "UP" /* Darwin/PowerPC */ +#endif + + #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 #endif diff --git a/src/jrd/llio.cpp b/src/jrd/llio.cpp index 62139c3032..1394376186 100644 --- a/src/jrd/llio.cpp +++ b/src/jrd/llio.cpp @@ -30,6 +30,18 @@ #include "../jrd/iberr_proto.h" #include "../jrd/llio_proto.h" +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef NETWARE_386 #include #include @@ -617,7 +629,12 @@ int LLIO_seek( whence = SEEK_END; 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) io_error(status_vector, "lseek", filename, isc_io_access_err); return FAILURE; diff --git a/src/jrd/old.cpp b/src/jrd/old.cpp index f222dbbcc6..4eff31232c 100644 --- a/src/jrd/old.cpp +++ b/src/jrd/old.cpp @@ -47,6 +47,10 @@ #include "../jrd/pag_proto.h" #include "../jrd/thd_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + static int close_cur_file(OLD, USHORT); static int create_file(OLD, SLONG *); static void get_wal_offset(USHORT, ULONG *, ULONG *, USHORT); diff --git a/src/jrd/pag.cpp b/src/jrd/pag.cpp index a11c153b7e..5fd13b4966 100644 --- a/src/jrd/pag.cpp +++ b/src/jrd/pag.cpp @@ -109,6 +109,7 @@ static BOOLEAN find_type(SLONG, WIN *, PAG *, USHORT, USHORT, UCHAR **, 20 LINUX on sparc systems 21 FreeBSD/i386 22 NetBSD/i386 + 23 Darwin/PowerPC */ @@ -235,6 +236,9 @@ static BOOLEAN find_type(SLONG, WIN *, PAG *, USHORT, USHORT, UCHAR **, #define CLASS 22 #endif +#ifdef DARWIN +#define CLASS 23 +#endif int PAG_add_clump( @@ -2047,4 +2051,4 @@ static BOOLEAN find_type( } } -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index a838518848..10dd546153 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -21,7 +21,7 @@ * 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" @@ -2057,9 +2057,9 @@ static NOD par_rse(TDBB tdbb, CSB * csb, SSHORT rse_op) (rse->rse_count == 2 && rse->rse_boolean)) return (NOD) rse; } - syntax_error(*csb, (rse_op == blr_rs_stream) ? + syntax_error(*csb, (TEXT*)((rse_op == blr_rs_stream) ? "rse stream clause" : - "record selection expression clause"); + "record selection expression clause")); } } diff --git a/src/jrd/perf.cpp b/src/jrd/perf.cpp index d312003ef0..fd80810430 100644 --- a/src/jrd/perf.cpp +++ b/src/jrd/perf.cpp @@ -91,7 +91,7 @@ extern clock_t times(); #endif -API_ROUTINE perf_format( +API_ROUTINE int perf_format( PERF * before, PERF * after, SCHAR * string, SCHAR * buffer, SSHORT * buf_len) diff --git a/src/jrd/perf.h b/src/jrd/perf.h index 1687a326c6..0e77989295 100644 --- a/src/jrd/perf.h +++ b/src/jrd/perf.h @@ -95,6 +95,7 @@ typedef struct perf { struct tms perf_times; } PERF; + /* Letter codes controlling printing of statistics: !f - fetches @@ -112,10 +113,11 @@ typedef struct perf { */ -#include "../jrd/perf_proto.h" - -#ifdef __cplusplus +#if defined(__cplusplus) && defined(NOTIME) } /* extern "C" */ #endif + +#include "../jrd/perf_proto.h" + #endif /* JRD_PERF_H */ diff --git a/src/jrd/pwd.cpp b/src/jrd/pwd.cpp index cad55ddd6f..6fed93b3e8 100644 --- a/src/jrd/pwd.cpp +++ b/src/jrd/pwd.cpp @@ -21,7 +21,7 @@ * 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 @@ -124,7 +124,7 @@ void PWD_get_user_dbpath(TEXT* path_buffer) **************************************/ #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); #else strcpy(path_buffer, USER_INFO_NAME); diff --git a/src/jrd/pwd.h b/src/jrd/pwd.h index 028742eaae..fa0d303a8d 100644 --- a/src/jrd/pwd.h +++ b/src/jrd/pwd.h @@ -21,7 +21,7 @@ * 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_ @@ -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" #endif +#ifdef DARWIN +#define USER_INFO_NAME "isc4.gdb" +#endif + #ifdef AIX_PPC #define USER_INFO_NAME "isc4.gdb" #endif diff --git a/src/jrd/rse.cpp b/src/jrd/rse.cpp index c4a57e5dd7..b98e8d321c 100644 --- a/src/jrd/rse.cpp +++ b/src/jrd/rse.cpp @@ -21,7 +21,7 @@ * 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 @@ -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/vio_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #if defined(WIN_NT) #include #endif @@ -3101,7 +3105,7 @@ static void open_sort(TDBB tdbb, RSB rsb, IRSB_SORT impure) map->smb_length, map->smb_keys, map->smb_key_desc, - reinterpret_cast < UCHAR(*)() > + reinterpret_cast < BOOLEAN(*)() > ((map->smb_flags & SMB_project) ? reject : NULL), 0, tdbb->tdbb_attachment); diff --git a/src/jrd/sbm_proto.h b/src/jrd/sbm_proto.h index 6b7eb73a93..310a41c3d8 100644 --- a/src/jrd/sbm_proto.h +++ b/src/jrd/sbm_proto.h @@ -25,6 +25,7 @@ #define _JRD_SBM_PROTO_H_ #include "../jrd/sbm.h" +#include "../jrd/rse.h" #ifdef DEV_BUILD #include "../jrd/ib_stdio.h" diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index b8b51428e6..18612ed683 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * 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 @@ -42,6 +42,18 @@ #include "../jrd/all_proto.h" #include "../jrd/sch_proto.h" +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_UIO_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef SOLARIS #include "../jrd/ib_stdio.h" #endif @@ -936,7 +948,7 @@ ULONG SORT_read_block( while (length) { len = MIN(length, 32768); 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; SORT_error(status_vector, sfb, "lseek", isc_io_read_err, errno); @@ -1228,7 +1240,7 @@ ULONG SORT_write_block(STATUS * status_vector, while (length) { len = MIN(length, 32768); 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; SORT_error(status_vector, sfb, "lseek", isc_io_write_err, 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; if (!(scb->scb_flags & scb_sorted)) { *((USHORT *) (record + key->skd_vary_offset)) = l = - strlen(p); + strlen((char*)p); fill_pos = p + l; fill = n - l; if (fill) @@ -2717,7 +2729,7 @@ static ULONG order(SCB scb) if (((SORTP *) output) + scb->scb_longs - 1 <= (SORTP *) lower_limit) { /* null the bckptr for this record */ 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); output = reinterpret_cast < sort_record * >((SORTP *) output + length); diff --git a/src/jrd/svc.cpp b/src/jrd/svc.cpp index b5369ebf4a..5333352237 100644 --- a/src/jrd/svc.cpp +++ b/src/jrd/svc.cpp @@ -55,6 +55,18 @@ #include "../jrd/jrd_proto.h" #endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef sparc #ifdef SOLARIS #include @@ -302,7 +314,7 @@ typedef CONST void (*PFN_SERV_t) (); static const serv services[] = { -#if !defined(LINUX) && !(defined FREEBSD || defined NETBSD) +#if !(defined LINUX || defined FREEBSD || defined NETBSD) #ifndef NETWARE386 #ifdef WIN_NT 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. */ - for (serv = services; serv->serv_name; serv++) + for (serv = (struct serv*)services; serv->serv_name; serv++) if (!strcmp(misc_buf, serv->serv_name)) 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 */ 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) break; @@ -3206,8 +3218,8 @@ static void service_get( buf = buffer; if (timeout) { - ISC_set_timer((SLONG) (timeout * 100000), timeout_handler, service, - &sv_timr, &sv_hndlr); + ISC_set_timer((SLONG) (timeout * 100000), (void(*)())timeout_handler, service, + (SLONG*)&sv_timr, (void**)&sv_hndlr); iter = timeout * 10; } @@ -3231,15 +3243,15 @@ static void service_get( else { errno_save = errno; 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); io_error("ib_getc", errno_save, "service pipe", isc_io_read_err, TRUE); } } 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) service->svc_flags |= SVC_timeout; } diff --git a/src/jrd/thd.cpp b/src/jrd/thd.cpp index 95d1d268e1..79ff35011c 100644 --- a/src/jrd/thd.cpp +++ b/src/jrd/thd.cpp @@ -1661,9 +1661,10 @@ void THD_yield(void) discovered it was redundant with sched_yield() and dropped it. So, just use sched_yield() instead. POSIX systems on which sched_yield() is available define _POSIX_PRIORITY_SCHEDULING - in . + in . 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(); #else pthread_yield(); diff --git a/src/jrd/thd.h b/src/jrd/thd.h index dcaa84fd66..94e822e973 100644 --- a/src/jrd/thd.h +++ b/src/jrd/thd.h @@ -21,7 +21,7 @@ * 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_ @@ -58,6 +58,11 @@ $Id: thd.h,v 1.1.1.1 2001-05-23 13:26:19 tamlin Exp $ #define MULTI_THREAD 1 #endif +#if (defined(DARWIN) && defined(SUPERSERVER)) +#define POSIX_THREADS 1 +#define MULTI_THREAD 1 +#endif + #ifdef VMS #ifndef GATEWAY #define MULTI_THREAD 1 diff --git a/src/jrd/time.h b/src/jrd/time.h index 2b2e0795ba..4e21391e85 100644 --- a/src/jrd/time.h +++ b/src/jrd/time.h @@ -62,7 +62,7 @@ #endif #if defined(_AIX) || defined(IMP) || defined(DELTA) || defined(sgi) || \ - defined(MAC) || defined(M_I386) + defined(MAC) || defined(M_I386) || defined(DARWIN) #include #endif diff --git a/src/jrd/unix.cpp b/src/jrd/unix.cpp index 09b2d9144a..e9de34e808 100644 --- a/src/jrd/unix.cpp +++ b/src/jrd/unix.cpp @@ -42,6 +42,10 @@ #include #endif +#ifdef HAVE_UNISTD_ +#include +#endif + #include "../jrd/jrd.h" #include "../jrd/pio.h" #include "../jrd/ods.h" @@ -449,7 +453,7 @@ void PIO_header(DBB dbb, SCHAR * address, int length) #ifndef PREAD_PWRITE 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); unix_error("lseek", file, isc_io_read_err, 0); } @@ -934,7 +938,7 @@ static FIL seek_file( #else 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); return (FIL) unix_error("lseek", file, isc_io_access_err, status_vector); @@ -1006,7 +1010,7 @@ static FIL setup_file( lock->lck_object = (BLK) dbb; lock->lck_length = l; 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); /* 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) */ -} // extern "C" \ No newline at end of file +} // extern "C" diff --git a/src/jrd/utl.cpp b/src/jrd/utl.cpp index fa2fa6dab8..5ee193964f 100644 --- a/src/jrd/utl.cpp +++ b/src/jrd/utl.cpp @@ -43,6 +43,10 @@ #include "../jrd/blb_proto.h" #endif +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef VMS #include #include @@ -245,7 +249,8 @@ static const TEXT *const impl_class[] = { "InterBase/SCO_SV Intel", /* 59 *//* 5.5 SCO Port */ "InterBase/linux Intel", /* 60 */ "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( void **handle, - void (*routine) (), void *user_arg) + FPTR_VOID routine, void *user_arg) { /************************************** * @@ -1217,8 +1222,8 @@ int API_ROUTINE gds__version( BOOLEAN redo; if (!routine) { - routine = (void (*)()) ib_printf; - user_arg = "\t%s\n"; + routine = (FPTR_VOID) ib_printf; + user_arg = (void*)"\t%s\n"; } buf = buffer; diff --git a/src/jrd/val.cpp b/src/jrd/val.cpp index 7183ffe89a..43ed7d4fd1 100644 --- a/src/jrd/val.cpp +++ b/src/jrd/val.cpp @@ -1907,8 +1907,8 @@ static RTN walk_relation(TDBB tdbb, VDR control, REL relation) TEXT s[64], *msg; tdbb->tdbb_setjmp = (UCHAR *) old_env; msg = (relation->rel_name) ? - "bugcheck during scan of table %d (%s)" : - "bugcheck during scan of table %d"; + (TEXT*)"bugcheck during scan of table %d (%s)" : + (TEXT*)"bugcheck during scan of table %d"; sprintf(s, msg, relation->rel_id, relation->rel_name); gds__log(s); #ifdef VAL_VERBOSE diff --git a/src/jrd/vio_debug.h b/src/jrd/vio_debug.h index 054a8f694d..213a3bfaf8 100644 --- a/src/jrd/vio_debug.h +++ b/src/jrd/vio_debug.h @@ -32,6 +32,6 @@ #define DEBUG_TRACE_ALL 7 #define DEBUG_TRACE_ALL_INFO 8 -static debug_flag; +static int debug_flag; #endif /* _JRD_VIO_DEBUG_H_ */ diff --git a/src/jrd/why.c b/src/jrd/why.c index 7e41989167..8cea2ca8b9 100644 --- a/src/jrd/why.c +++ b/src/jrd/why.c @@ -21,7 +21,7 @@ * 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 @@ -484,7 +484,7 @@ static CONST_IMAGE IMAGE images[] = #endif #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 #define PIPE_BRIDGE_TO_V3 #endif @@ -5812,8 +5812,11 @@ static STATUS open_marker_file(STATUS * status, } /* Place an advisory lock on the marker file. */ - + #ifdef DARWIN + if (flock(fd, LOCK_EX ) != -1) { + #else if (lockf(fd, F_TLOCK, 0) != -1) { + #endif size = sizeof(marker_contents); for (j = 0; j < IO_RETRY; j++) { if ((bytes = read(fd, marker_contents, size)) != -1) @@ -5835,7 +5838,7 @@ static STATUS open_marker_file(STATUS * status, strcpy(single_user, "YES"); size = strlen(fildes_str); 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"; close(fd); fd = -1; diff --git a/src/lock/lock.cpp b/src/lock/lock.cpp index 4934ed8db4..e8958a8edc 100644 --- a/src/lock/lock.cpp +++ b/src/lock/lock.cpp @@ -21,7 +21,7 @@ * Contributor(s): ______________________________________. */ /* -$Id: lock.cpp,v 1.1.1.1 2001-05-23 13:26:25 tamlin Exp $ +$Id: lock.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $ */ #include "../jrd/time.h" @@ -46,6 +46,18 @@ $Id: lock.cpp,v 1.1.1.1 2001-05-23 13:26:25 tamlin Exp $ #include "../jrd/thd_proto.h" #include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + #ifdef sparc #ifndef SOLARIS #include @@ -165,7 +177,7 @@ SSHORT LOCK_debug_level = 0; #define DUMMY_OWNER_DELETE ((PTR) -2) #define DUMMY_OWNER_SHUTDOWN ((PTR) -3) -#if !(defined linux || defined NETWARE_386 || defined WIN_NT || defined FREEBSD || defined NETBSD) +#if !(defined linux || defined NETWARE_386 || defined WIN_NT || defined FREEBSD || defined NETBSD || defined DARWIN) extern SCHAR *sys_errlist[]; #endif @@ -718,7 +730,7 @@ void LOCK_fini( STATUS * status_vector, PTR * owner_offset) #else #ifdef MMAP_SUPPORTED if (LOCK_owner) { - ISC_unmap_object(status_vector, &LOCK_data, &LOCK_owner, + ISC_unmap_object(status_vector, &LOCK_data,(UCHAR**)&LOCK_owner, sizeof(struct own)); LOCK_owner_offset = 0; } @@ -739,7 +751,8 @@ void LOCK_fini( STATUS * status_vector, PTR * owner_offset) release_mutex(); #if !(defined NETWARE_386 || defined WIN_NT || defined SOLARIS_MT || POSIX_THREADS) - ISC_signal_cancel(LOCK_block_signal, blocking_action, (void *) offset); + ISC_signal_cancel(LOCK_block_signal, ( void (*)()) blocking_action, + (void *) offset); #endif *owner_offset = NULL; @@ -811,10 +824,10 @@ If this happens on another classic platform add that platform too. - Shailesh #endif #if !(defined NETWARE_386 || defined WIN_NT || defined SOLARIS_MT || POSIX_THREADS) -#if defined(SCO_EV) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) || defined(AIX_PPC) +#if defined(SCO_EV) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) || defined(AIX_PPC) || defined(DARWIN) if (LOCK_owner_offset) /* 5.5 SCO port: gds_drop */ #endif - ISC_signal(LOCK_block_signal, blocking_action, + ISC_signal(LOCK_block_signal, (void(*)()) blocking_action, (void *) LOCK_owner_offset); #endif @@ -873,7 +886,7 @@ If this happens on another classic platform add that platform too. - Shailesh return FAILURE; } #else -#if defined(SCO_EV) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) || defined(AIX_PPC) +#if defined(SCO_EV) || defined(LINUX) || defined(FREEBSD) || defined(NETBSD) || defined(AIX_PPC) || defined(DARWIN) if (LOCK_owner_offset) /* 5.5 SCO Port: gds_drop */ #endif if (!(LOCK_owner = (OWN) ISC_map_object(status_vector, &LOCK_data, @@ -2674,8 +2687,8 @@ static void exit_handler( void *arg) #else #ifdef MMAP_SUPPORTED if (LOCK_owner) - ISC_unmap_object(local_status, &LOCK_data, &LOCK_owner, - sizeof(struct own)); + ISC_unmap_object(local_status, &LOCK_data, + (UCHAR**)&LOCK_owner, sizeof(struct own)); #endif #endif if (owner_offset != LOCK_header->lhb_active_owner) @@ -3062,7 +3075,7 @@ static STATUS init_lock_table( STATUS * status_vector) LOCK_data.sh_mem_semaphores = 1; #endif if (!(LOCK_header = (LHB) ISC_map_file(status_vector, lock_file, - reinterpret_cast < void (*)() > + reinterpret_cast < void (*)(void*, SH_MEM, int) > (lock_initialize), 0, LOCK_shm_size, &LOCK_data))) { @@ -5004,7 +5017,7 @@ static USHORT wait_for_request( AST_ENABLE; ret = ISC_event_wait(1, &event_ptr, &value, (timeout - current_time) * 1000000, - lock_alarm_handler, event_ptr); + (void(*)())lock_alarm_handler, event_ptr); AST_DISABLE; #ifdef SUPERSERVER THREAD_ENTER; diff --git a/src/lock/lock.h b/src/lock/lock.h index bed3ebc129..3d92bcdfbd 100644 --- a/src/lock/lock.h +++ b/src/lock/lock.h @@ -51,11 +51,13 @@ #ifndef SOLARIS_MT #if !(defined(HP10) && defined(SUPERSERVER)) #if !(defined(LINUX) && defined(SUPERSERVER)) +#ifndef DARWIN #define MANAGER_PROCESS #endif #endif #endif #endif +#endif #ifdef WIN_NT #define DEFAULT_SIZE 32768 diff --git a/src/lock/lockv3.h b/src/lock/lockv3.h index f6b8ff3202..d31deedff7 100644 --- a/src/lock/lockv3.h +++ b/src/lock/lockv3.h @@ -32,7 +32,7 @@ #include "../jrd/common.h" #include "../lock/fparamv3.h" -#if (defined linux || defined FREEBSD || defined NETBSD) +#if (defined linux || defined FREEBSD || defined NETBSD || defined DARWIN ) #define SEMUN #endif diff --git a/src/lock/manager.cpp b/src/lock/manager.cpp index f2838c717f..c1f87153fd 100644 --- a/src/lock/manager.cpp +++ b/src/lock/manager.cpp @@ -25,12 +25,20 @@ #include "../jrd/ib_stdio.h" #include "../jrd/jrd.h" #include "../jrd/lck.h" +#include "../jrd/divorce.h" #ifdef LINKS_EXIST #include "../isc_lock/lock_proto.h" #else #include "../lock/lock_proto.h" #endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif void main( int argc, char **argv) @@ -57,7 +65,12 @@ void main( int argc, char **argv) owner_handle = 0; if (!LOCK_init (status_vector, TRUE, getpid(), LCK_OWNER_process, - &owner_handle)) LOCK_manager(owner_handle); + &owner_handle)) +#ifdef MANAGER_PROCESS + LOCK_manager(owner_handle); +#else + ; +#endif LOCK_fini(status_vector, &owner_handle); } diff --git a/src/lock/print.cpp b/src/lock/print.cpp index 1bd405e32f..2e57361498 100644 --- a/src/lock/print.cpp +++ b/src/lock/print.cpp @@ -41,6 +41,10 @@ #include "../jrd/isc_s_proto.h" #include "../lock/prtv3_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #if (defined DELTA || defined sgi || defined ultrix) #include #endif @@ -382,7 +386,7 @@ int CLIB_ROUTINE main( int argc, char *argv[]) #else LOCK_size_mapped = DEFAULT_SIZE; /* length == 0 not supported by all non-UNIX */ #endif - LOCK_header = (LHB) ISC_map_file(status_vector, lock_file, prt_lock_init, 0, -LOCK_size_mapped, /* Negative to NOT truncate file */ + LOCK_header = (LHB) ISC_map_file(status_vector, lock_file, (void (*)(void*, sh_mem*, int)) prt_lock_init, 0, -LOCK_size_mapped, /* Negative to NOT truncate file */ &shmem_data); sprintf(expanded_lock_filename, lock_file, @@ -616,7 +620,7 @@ int CLIB_ROUTINE main( int argc, char *argv[]) #if !(defined WIN_NT || defined NETWARE_386) if (!sw_nobridge) { FPRINTF(outfile, "\nBRIDGE RESOURCES\n\n"); - V3_lock_print(orig_argc, orig_argv); + V3_lock_print(orig_argc, (UCHAR**) orig_argv); } #endif @@ -647,7 +651,7 @@ static void prt_lock_activity( ULONG factor; clock = time(NULL); - d = *localtime(&clock); + d = *localtime((time_t*)&clock); FPRINTF(outfile, "%02d:%02d:%02d ", d.tm_hour, d.tm_min, d.tm_sec); @@ -687,7 +691,7 @@ static void prt_lock_activity( #endif #endif clock = time(NULL); - d = *localtime(&clock); + d = *localtime((time_t*)&clock); FPRINTF(outfile, "%02d:%02d:%02d ", d.tm_hour, d.tm_min, d.tm_sec); @@ -959,7 +963,7 @@ static void prt_lock( (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '/') *p++ = c; else { - sprintf(p, "<%d>", c); + sprintf((char*) p, "<%d>", c); while (*p) p++; } @@ -1122,12 +1126,12 @@ static void prt_owner_wait_cycle( waiters->waitque_entry[waiters->waitque_depth++] = REL_PTR(owner); FPRINTF(outfile, "\n"); - owner_request = ABS_PTR(owner->own_pending_request); + owner_request = (LRQ) ABS_PTR(owner->own_pending_request); assert(owner_request->lrq_type == type_lrq); owner_conversion = (owner_request->lrq_state > LCK_null) ? TRUE : FALSE; - lock = ABS_PTR(owner_request->lrq_lock); + lock = (LBL) ABS_PTR(owner_request->lrq_lock); assert(lock->lbl_type == type_lbl); counter = 0; @@ -1169,7 +1173,7 @@ static void prt_owner_wait_cycle( (owner_request->lrq_requested, lock_request->lrq_state)) continue; }; - lock_owner = ABS_PTR(lock_request->lrq_owner); + lock_owner = (OWN) ABS_PTR(lock_request->lrq_owner); prt_owner_wait_cycle(outfile, LOCK_header, lock_owner, indent + 4, waiters); } diff --git a/src/lock/printv3.cpp b/src/lock/printv3.cpp index baaaae813e..4bb56ef6a4 100644 --- a/src/lock/printv3.cpp +++ b/src/lock/printv3.cpp @@ -30,9 +30,14 @@ #include "../jrd/common.h" #include "../jrd/isc.h" +#include "../jrd/isc_proto.h" +#include "../jrd/isc_s_proto.h" +#include "../jrd/gds_proto.h" #include "../lock/lockv3.h" #include "../lock/prtv3_proto.h" +#include + #ifndef FOPEN_READ_TYPE #define FOPEN_READ_TYPE "r" #endif @@ -41,7 +46,7 @@ #define MAXPATHLEN 256 #endif -extern LHB ISC_map_file(); +//extern LHB ISC_map_file(); static USHORT sw_requests, sw_processes, sw_locks, sw_series, sw_history, sw_mutex; @@ -57,7 +62,13 @@ static struct { } LOCK_hdrtbl[] = { "SHMSIZE", &LOCK_shm_size, NULL, NULL}; -static prt_lock_init(); +static int prt_lock_init(); +static int get_lock_header(); +static int prt_history(PTR, char *); +static int prt_lock(LBL ); +static int prt_process(PRB ); +static int prt_request(LRQ ); +static int prt_que(UCHAR *, SRQ ); static TEXT *history_names[] = { "n/a", "ENQ", "DEQ", "CONVERT", "SIGNAL", "POST", "WAIT", @@ -83,9 +94,7 @@ static UCHAR compatibility[] = { #define COMPATIBLE(st1, st2) compatibility [st1 * LCK_max + st2] -V3_lock_print(argc, argv) - USHORT argc; - UCHAR *argv[]; +int V3_lock_print(USHORT argc, UCHAR **argv) { /************************************** * @@ -116,7 +125,7 @@ V3_lock_print(argc, argv) sw_processes = TRUE; while (--argc) { - p = *argv++; + p = (UCHAR*) *argv++; while (c = *p++) switch (c) { case 'o': /* Owners: compatible with v4 */ @@ -144,7 +153,7 @@ V3_lock_print(argc, argv) break; case 's': - sw_series = atoi(*argv++); + sw_series = atoi((char*) *argv++); --argc; break; @@ -176,7 +185,7 @@ V3_lock_print(argc, argv) #ifdef UNIX shmem_data.sh_mem_semaphores = 0; #endif - LOCK_header = (LHB) ISC_map_file(status_vector, LOCK_FILE, prt_lock_init, 0, 0, /* Map entire length of segment */ + LOCK_header = (LHB) ISC_map_file(status_vector, LOCK_FILE, (void (*)(void *, sh_mem *, int)) prt_lock_init, 0, 0, /* Map entire length of segment */ &shmem_data); /* if there's nothing mapped, there's nothing to print */ @@ -236,17 +245,17 @@ V3_lock_print(argc, argv) shb->shb_insert_prior); } - prt_que("\tProcesses", &LOCK_header->lhb_processes); - prt_que("\tFree processes", &LOCK_header->lhb_free_processes); - prt_que("\tFree locks", &LOCK_header->lhb_free_locks); - prt_que("\tFree requests", &LOCK_header->lhb_free_requests); + prt_que((UCHAR*) "\tProcesses", &LOCK_header->lhb_processes); + prt_que((UCHAR*) "\tFree processes", &LOCK_header->lhb_free_processes); + prt_que((UCHAR*) "\tFree locks", &LOCK_header->lhb_free_locks); + prt_que((UCHAR*) "\tFree requests", &LOCK_header->lhb_free_requests); ib_printf("\n"); /* Print known processes */ if (sw_processes) QUE_LOOP(LOCK_header->lhb_processes, que) - prt_process((UCHAR *) que - OFFSET(PRB, prb_lhb_processes)); + prt_process((PRB)(UCHAR *) que - OFFSET(PRB, prb_lhb_processes)); /* Print known locks */ @@ -255,7 +264,7 @@ V3_lock_print(argc, argv) i < LOCK_header->lhb_hash_slots; slot++, i++) for (que = (SRQ) ABS_PTR(slot->srq_forward); que != slot; que = (SRQ) ABS_PTR(que->srq_forward)) - prt_lock((UCHAR *) que - OFFSET(LBL, lbl_lhb_hash)); + prt_lock((LBL)(UCHAR *) que - OFFSET(LBL, lbl_lhb_hash)); if (sw_history) prt_history(LOCK_header->lhb_history, "History"); @@ -267,7 +276,7 @@ V3_lock_print(argc, argv) } -static get_lock_header() +static int get_lock_header() { /************************************* * @@ -282,7 +291,7 @@ static get_lock_header() ************************************/ IB_FILE *fd; char *p, *q, buf[40]; - int i, atoi(); + int i; if (fd = ib_fopen(LOCK_HEADER, FOPEN_READ_TYPE)) { while (p = ib_fgets(buf, 40, fd)) @@ -299,7 +308,7 @@ static get_lock_header() } -static prt_lock_init() +static int prt_lock_init() { /************************************** * @@ -315,9 +324,7 @@ static prt_lock_init() } -static prt_history(history_header, title) - PTR history_header; - char *title; +static int prt_history(PTR history_header, char *title) { /************************************** * @@ -346,8 +353,7 @@ static prt_history(history_header, title) } -static prt_lock(lock) - LBL lock; +static int prt_lock(LBL lock) { /************************************** * @@ -365,7 +371,7 @@ static prt_lock(lock) LRQ request; if (sw_series && lock->lbl_series != sw_series) - return; + return 0; if (LOCK_header->lhb_version >= LHB_VERSION7) q = lock->lbl_key7; @@ -376,7 +382,7 @@ static prt_lock(lock) if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '/') *p++ = c; else { - sprintf(p, "<%d>", c); + sprintf((char*) p, "<%d>", c); while (*p) p++; } @@ -403,9 +409,9 @@ static prt_lock(lock) else ib_printf("\tKey: %s\n", temp); - prt_que("\tHash que", &lock->lbl_lhb_hash); + prt_que((UCHAR*) "\tHash que", &lock->lbl_lhb_hash); - prt_que("\tRequests", &lock->lbl_requests); + prt_que((UCHAR*) "\tRequests", &lock->lbl_requests); QUE_LOOP(lock->lbl_requests, que) { request = (LRQ) ((UCHAR *) que - OFFSET(LRQ, lrq_lbl_requests)); ib_printf("\t\tRequest %d, Process: %d, State: %d (%d), Flags: %d\n", @@ -417,8 +423,7 @@ static prt_lock(lock) } -static prt_process(process) - PRB process; +static int prt_process(PRB process) { /************************************** * @@ -440,18 +445,17 @@ static prt_process(process) (LOCK_header->lhb_version >= LHB_VERSION7) ? process->prb_semaphore7 : process->prb_semaphore5); - prt_que("\tRequests", &process->prb_requests); - prt_que("\tBlocks", &process->prb_blocks); + prt_que((UCHAR*) "\tRequests", &process->prb_requests); + prt_que((UCHAR*) "\tBlocks", &process->prb_blocks); ib_printf("\n"); if (sw_requests) QUE_LOOP(process->prb_requests, que) - prt_request((UCHAR *) que - OFFSET(LRQ, lrq_prb_requests)); + prt_request((LRQ) (UCHAR *) que - OFFSET(LRQ, lrq_prb_requests)); } -static prt_request(request) - LRQ request; +static int prt_request(LRQ request) { /************************************** * @@ -474,9 +478,7 @@ static prt_request(request) } -static prt_que(string, que) - UCHAR *string; - SRQ que; +static int prt_que(UCHAR *string, SRQ que) { /************************************** * @@ -495,7 +497,7 @@ static prt_que(string, que) if (offset == que->srq_forward && offset == que->srq_backward) { ib_printf("%s: *empty*\n", string); - return; + return 0; } count = 0; diff --git a/src/lock/prtv3_proto.h b/src/lock/prtv3_proto.h index 871e2b374a..09bb001f7a 100644 --- a/src/lock/prtv3_proto.h +++ b/src/lock/prtv3_proto.h @@ -24,6 +24,6 @@ #ifndef _LOCK_PRTV3_PROTO_H_ #define _LOCK_PRTV3_PROTO_H_ -extern int V3_lock_print(int, UCHAR **); +extern int V3_lock_print(USHORT , UCHAR **); #endif /* _LOCK_PRTV3_PROTO_H_ */ diff --git a/src/pipe/allp.cpp b/src/pipe/allp.cpp index 7248f6a22a..ad650b1913 100644 --- a/src/pipe/allp.cpp +++ b/src/pipe/allp.cpp @@ -23,6 +23,10 @@ #include "../pipe/pipe.h" +#ifdef HAVE_STRING_H +#include +#endif + #define BLKDEF(type, root, tail) sizeof (struct root), tail, static struct { SSHORT typ_root_length; @@ -52,7 +56,7 @@ UCHAR *ALLP_alloc ( * **************************************/ -return gds__alloc (size); +return (UCHAR*) gds__alloc (size); } BLK ALLP_block ( @@ -125,5 +129,5 @@ void ALLP_release ( * **************************************/ -ALLP_free (block); +ALLP_free ((UCHAR*) block); } diff --git a/src/pipe/head.cpp b/src/pipe/head.cpp index cb42b3c933..b9949ecea2 100644 --- a/src/pipe/head.cpp +++ b/src/pipe/head.cpp @@ -22,7 +22,7 @@ * Solaris x86 changes - Konstantin Kuznetsov, Neil McCalden */ - /* $Id: head.cpp,v 1.1.1.1 2001-05-23 13:26:33 tamlin Exp $ */ + /* $Id: head.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $ */ #include "../jrd/ib_stdio.h" #include @@ -39,8 +39,13 @@ #include "../pipe/head_proto.h" #include "../jrd/gds_proto.h" #include "../jrd/isc_proto.h" +#include "../jrd/isc_i_proto.h" #include "../remote/merge_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef sparc #ifdef SOLARIS #include @@ -181,7 +186,7 @@ static RDB connection = NULL; #define GET_HANDLE_EVENT getw (event_pipe) #define PUT_BYTE(byte) PUTC_UNLOCKED (byte, write_pipe) #define PUT_WORD(word) putw (word, write_pipe) -#define PUT_HANDLE(word) putw (word, write_pipe) +#define PUT_HANDLE(word) putw ((int)(word), write_pipe) #endif #define GET_STRING(length,ptr) if (l = (length))\ @@ -415,7 +420,7 @@ RDB rdb; NULL_CHECK (handle, gds__bad_db_handle); if (!(rdb = init (user_status, op_attach, - file_name, GDS_VAL (file_length), dpb, GDS_VAL (dpb_length)))) + (UCHAR*)file_name, GDS_VAL (file_length), (UCHAR*)dpb, GDS_VAL (dpb_length)))) return user_status [1]; *handle = rdb; @@ -448,7 +453,7 @@ RDB rdb; NULL_CHECK (handle, gds__bad_svc_handle); if (!(rdb = init (user_status, op_attach_service, - service_name, service_length, spb, spb_length))) + (UCHAR*)service_name, service_length, (UCHAR*)spb, spb_length))) return user_status [1]; *handle = rdb; @@ -739,7 +744,7 @@ if (check_response (user_status)) /* Allocate request block */ *req_handle = request = (RRQ) ALLOC (type_rrq); -request->rrq_handle = GET_HANDLE; +request->rrq_handle = (int*) GET_HANDLE; request->rrq_rdb = rdb; request->rrq_next = rdb->rdb_requests; rdb->rdb_requests = request; @@ -787,7 +792,7 @@ if (check_response (user_status)) return user_status [1]; *blob_handle = blob = (RBL) ALLOCV (type_rbl, BLOB_LENGTH); -blob->rbl_handle = GET_HANDLE; +blob->rbl_handle = (int*) GET_HANDLE; blob->rbl_buffer_length = BLOB_LENGTH; blob->rbl_rdb = rdb; blob->rbl_rtr = transaction; @@ -850,7 +855,7 @@ if (check_response (user_status)) return user_status [1]; *blob_handle = blob = (RBL) ALLOCV (type_rbl, BLOB_LENGTH); -blob->rbl_handle = GET_HANDLE; +blob->rbl_handle = (int*) GET_HANDLE; blob->rbl_buffer_length = BLOB_LENGTH; blob->rbl_rdb = rdb; blob->rbl_rtr = transaction; @@ -895,8 +900,8 @@ NULL_CHECK (handle, gds__bad_db_handle); if (!(l = GDS_VAL (file_length))) l = strlen (file_name); -if (!(rdb = init (user_status, op_create, file_name, l, - dpb, GDS_VAL (dpb_length)))) +if (!(rdb = init (user_status, op_create, (UCHAR*)file_name, l, + (UCHAR*)dpb, GDS_VAL (dpb_length)))) return user_status [1]; *handle = rdb; @@ -948,7 +953,7 @@ else GET_STRING (GET_WORD, temp_buffer); MERGE_database_info (temp_buffer, buffer, GDS_VAL (buffer_length), - IMPLEMENTATION, 7, 1, GDS_VERSION, "", 0); + IMPLEMENTATION, 7, 1, (UCHAR*) GDS_VERSION, (UCHAR*) "", 0); if (buffer_length > sizeof (temp)) ALLP_free (temp_buffer); @@ -1060,7 +1065,7 @@ fclose (rdb->rdb_pipes.cnct_write_pipe); ALLP_release (rdb); #else -ALLP_release (rdb); +ALLP_release ((BLK) rdb); #endif *handle = NULL; @@ -1096,7 +1101,7 @@ ESTABLISH_PIPES; if (release_object (op_detach_service, rdb->rdb_handle, user_status)) return user_status [1]; -ALLP_release (rdb); +ALLP_release ((BLK) rdb); *handle = NULL; @@ -1149,7 +1154,7 @@ while (rdb->rdb_sql_requests) while (rdb->rdb_transactions) release_transaction (rdb->rdb_transactions); -ALLP_release (rdb); +ALLP_release ((BLK) rdb); *handle = NULL; @@ -1197,7 +1202,7 @@ if (check_response (user_status)) /* Allocate SQL request block */ *stmt_handle = statement = (RSR) ALLOC (type_rsr); -statement->rsr_handle = GET_HANDLE; +statement->rsr_handle = (int*) GET_HANDLE; statement->rsr_rdb = rdb; statement->rsr_next = rdb->rdb_sql_requests; rdb->rdb_sql_requests = statement; @@ -1253,7 +1258,7 @@ PUT_WORD (msg_length); PUT_STRING (msg_length, msg); (void) check_response (user_status); -handle = GET_HANDLE; +handle = (int*) GET_HANDLE; if (transaction && !handle) { release_transaction (transaction); @@ -1326,7 +1331,7 @@ PUT_WORD (out_msg_type); PUT_WORD (out_msg_length); (void) check_response (user_status); -handle = GET_HANDLE; +handle = (int*) GET_HANDLE; if (transaction && !handle) { release_transaction (transaction); @@ -1383,7 +1388,7 @@ if (transaction = *rtr_handle) ESTABLISH_PIPES; if (!length) - length = strlen (string); + length = strlen ((char*)string); PUT_BYTE (op_exec_immediate); PUT_HANDLE (rdb->rdb_handle); @@ -1398,7 +1403,7 @@ PUT_WORD (msg_length); PUT_STRING (msg_length, msg); (void) check_response (user_status); -handle = GET_HANDLE; +handle = (int*) GET_HANDLE; if (transaction && !handle) { release_transaction (transaction); @@ -1458,7 +1463,7 @@ if (transaction = *rtr_handle) ESTABLISH_PIPES; if (!length) - length = strlen (string); + length = strlen ((char*) string); PUT_BYTE (op_exec_immediate2); PUT_HANDLE (rdb->rdb_handle); @@ -1478,7 +1483,7 @@ PUT_WORD (out_msg_length); (void) check_response (user_status); -handle = GET_HANDLE; +handle = (int*) GET_HANDLE; if (transaction && !handle) { release_transaction (transaction); @@ -1584,7 +1589,7 @@ PUT_WORD (option); if (check_response (user_status)) return user_status [1]; -statement->rsr_handle = GET_HANDLE; +statement->rsr_handle = (int*) GET_HANDLE; if (!statement->rsr_handle) { release_sql_request (statement); @@ -1682,7 +1687,7 @@ if (transaction = *rtr_handle) ESTABLISH_PIPES; if (!length) - length = strlen (string); + length = strlen ((char*) string); PUT_BYTE (op_prepare_stmt); PUT_HANDLE ((transaction) ? transaction->rtr_handle : (HANDLE) NULL); @@ -1733,7 +1738,7 @@ CHECK_HANDLE (rdb, type_rdb, gds__bad_db_handle); ESTABLISH_PIPES; -cursor_length = name_length (cursor) + 1; +cursor_length = name_length ((TEXT*) cursor) + 1; PUT_BYTE (op_set_cursor); PUT_HANDLE (statement->rsr_handle); @@ -2070,7 +2075,7 @@ if (check_response (user_status)) return user_status [1]; *blob_handle = blob = (RBL) ALLOCV (type_rbl, BLOB_LENGTH); -blob->rbl_handle = GET_HANDLE; +blob->rbl_handle = (int*) GET_HANDLE; blob->rbl_buffer_length = BLOB_LENGTH; blob->rbl_rdb = rdb; blob->rbl_rtr = transaction; @@ -2131,7 +2136,7 @@ if (check_response (user_status)) return user_status [1]; *blob_handle = blob = (RBL) ALLOCV (type_rbl, BLOB_LENGTH); -blob->rbl_handle = GET_HANDLE; +blob->rbl_handle = (int*) GET_HANDLE; blob->rbl_buffer_length = BLOB_LENGTH; blob->rbl_rdb = rdb; blob->rbl_rtr = transaction; @@ -2434,14 +2439,14 @@ ESTABLISH_PIPES; PUT_BYTE (op_info_service); PUT_HANDLE (rdb->rdb_handle); PUT_WORD (send_item_length); -PUT_STRING (send_item_length, send_items); +PUT_STRING (send_item_length, (UCHAR*)send_items); PUT_WORD (recv_item_length); -PUT_STRING (recv_item_length, recv_items); +PUT_STRING (recv_item_length, (UCHAR*)recv_items); PUT_WORD (buffer_length); if (check_response (user_status)) return user_status [1]; -GET_STRING (GET_WORD, buffer); +GET_STRING (GET_WORD, (UCHAR*)buffer); RETURN_SUCCESS; } @@ -2540,7 +2545,7 @@ PUT_STRING (l, id); if (check_response (user_status)) return user_status [1]; -*rtr_handle = make_transaction (rdb, GET_HANDLE); +*rtr_handle = make_transaction (rdb, (int*) GET_HANDLE); RETURN_SUCCESS; } @@ -2887,7 +2892,7 @@ for (i = 0; i < GDS_VAL (count); i++) if (check_response (user_status)) return user_status [1]; -*rtr_handle = make_transaction (rdb, GET_HANDLE); +*rtr_handle = make_transaction (rdb, (int*) GET_HANDLE); RETURN_SUCCESS; } @@ -2946,7 +2951,7 @@ for (i = 0; i < GDS_VAL (count); i++) if (check_response (user_status)) return user_status [1]; -*rtr_handle = make_transaction (rdb, GET_HANDLE); +*rtr_handle = make_transaction (rdb, (int*) GET_HANDLE); RETURN_SUCCESS; } @@ -3215,7 +3220,7 @@ ast = (PTR) GET_HANDLE_EVENT; if ((long) ast == -1) return; -arg = GET_HANDLE_EVENT; +arg = (void*) GET_HANDLE_EVENT; length = GET_WORD_EVENT; if (l = length) @@ -3224,7 +3229,7 @@ if (l = length) do *p++ = GET_BYTE_EVENT; while (--l); } -(*ast) (arg, length, events); +(*((void (*)(void*, SSHORT, UCHAR*))ast)) (arg, length, events); } #endif @@ -3579,7 +3584,7 @@ if (!read_pipe || !write_pipe) /* Send the operation over */ if (file_length == 0) - file_length = strlen (file_name); + file_length = strlen ((char*)file_name); PUT_BYTE ((SCHAR) op); PUT_WORD (file_length); @@ -3622,7 +3627,7 @@ if (status) #endif rdb = (RDB) ALLOC (type_rdb); -rdb->rdb_handle = GET_HANDLE; +rdb->rdb_handle = (int*) GET_HANDLE; #ifdef GATEWAY rdb->rdb_next = PSI_databases; @@ -3805,7 +3810,7 @@ for (p = &transaction->rtr_blobs; *p; p = &(*p)->rbl_next) break; } -ALLP_release (blob); +ALLP_release ((BLK) blob); } static STATUS release_object ( @@ -3859,7 +3864,7 @@ for (p = &rdb->rdb_requests; *p; p = &(*p)->rrq_next) break; } -ALLP_release (request); +ALLP_release ((BLK) request); } static void release_transaction ( @@ -3887,7 +3892,7 @@ for (p = &rdb->rdb_transactions; *p; p = &(*p)->rtr_next) break; } -ALLP_release (transaction); +ALLP_release ((BLK) transaction); } static void release_sql_request ( @@ -3915,7 +3920,7 @@ for (p = &rdb->rdb_sql_requests; *p; p = &(*p)->rsr_next) break; } -ALLP_release (stmt); +ALLP_release ((BLK) stmt); } static STATUS send_blob ( diff --git a/src/pyxis/all.h b/src/pyxis/all.h index e934787190..0e0e82a78b 100644 --- a/src/pyxis/all.h +++ b/src/pyxis/all.h @@ -52,4 +52,8 @@ typedef struct hnk { struct hnk *hnk_next; /* next memory hunk in structure */ } *HNK; +int PYXIS_free(SCHAR *memory); +int PYXIS_release(register FRB block); + + #endif /* _PYXIS_ALL_H_ */ diff --git a/src/pyxis/allp.cpp b/src/pyxis/allp.cpp index 22fe2adb31..d5bd56efb2 100644 --- a/src/pyxis/allp.cpp +++ b/src/pyxis/allp.cpp @@ -21,13 +21,19 @@ * Contributor(s): ______________________________________. */ /* -$Id: allp.cpp,v 1.1.1.1 2001-05-23 13:26:33 tamlin Exp $ +$Id: allp.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $ */ #include "../pyxis/everything.h" +#include "../jrd/gds_proto.h" + +#ifdef HAVE_STRING_H +#include +#endif extern UCHAR *gds__alloc(); +static int extend_pool(PLB pool, int size); PLB PYXIS_pool(); UCHAR *PYXIS_malloc(); @@ -47,10 +53,7 @@ static struct { #undef BLKDEF -BLK PYXIS_alloc(pool, type, count) - PLB pool; - UCHAR type; - int count; +BLK PYXIS_alloc(PLB pool, UCHAR type, int count) { /************************************** * @@ -135,9 +138,7 @@ BLK PYXIS_alloc(pool, type, count) } -BLK PYXIS_extend(pointer, size) - BLK *pointer; - int size; +BLK PYXIS_extend(BLK *pointer, int size) { /************************************** * @@ -149,16 +150,16 @@ BLK PYXIS_extend(pointer, size) * Extend a repeating block, copying the constant part. * **************************************/ - BLK block, new; + BLK block, new_blk; register int length, l; register SLONG *p1, *p2; register SCHAR *c1, *c2; block = *pointer; - new = PYXIS_alloc(pools->vec_object[block->blk_pool_id], + new_blk = (BLK) PYXIS_alloc((PLB) pools->vec_object[block->blk_pool_id], block->blk_type, size); - length = MIN(block->blk_length, new->blk_length) - sizeof(struct blk); - p1 = (SLONG *) ((SCHAR *) new + sizeof(struct blk)); + length = MIN(block->blk_length, new_blk->blk_length) - sizeof(struct blk); + p1 = (SLONG *) ((SCHAR *) new_blk + sizeof(struct blk)); p2 = (SLONG *) ((SCHAR *) block + sizeof(struct blk)); if (l = length >> SHIFTLONG) @@ -174,17 +175,17 @@ BLK PYXIS_extend(pointer, size) while (--length); } - PYXIS_release(block); + PYXIS_release((FRB) block); - if (new->blk_type == (SCHAR) type_vec) - ((VEC) new)->vec_count = size; + if (new_blk->blk_type == (SCHAR) type_vec) + ((VEC) new_blk)->vec_count = size; - *pointer = new; - return new; + *pointer = new_blk; + return new_blk; } -PYXIS_alloc_fini() +int PYXIS_alloc_fini() { /************************************** * @@ -210,8 +211,7 @@ PYXIS_alloc_fini() } -PYXIS_free(memory) - SCHAR *memory; +int PYXIS_free(SCHAR *memory) { /************************************** * @@ -228,7 +228,7 @@ PYXIS_free(memory) } -PYXIS_alloc_init() +int PYXIS_alloc_init() { /************************************** * @@ -254,8 +254,7 @@ PYXIS_alloc_init() } -UCHAR *PYXIS_malloc(size) - SLONG size; +UCHAR *PYXIS_malloc(SLONG size) { /************************************** * @@ -301,7 +300,7 @@ PLB PYXIS_pool() break; if (pool_id >= pools->vec_count) - PYXIS_extend(&pools, pool_id + 10); + PYXIS_extend((BLK*) &pools, pool_id + 10); pools->vec_object[pool_id] = (BLK) & temp_pool; temp_pool.plb_free = NULL; @@ -310,7 +309,7 @@ PLB PYXIS_pool() if (pool_id == 0) PYXIS_permanent_pool = &temp_pool; - pool = (PLB) PYXIS_alloc(&temp_pool, type_plb); + pool = (PLB) PYXIS_alloc(&temp_pool, type_plb, sizeof(struct plb)); pool->plb_pool_id = pool_id; pool->plb_free = temp_pool.plb_free; pool->plb_hunks = temp_pool.plb_hunks; @@ -323,9 +322,7 @@ PLB PYXIS_pool() } -PYXIS_push(object, stack) - BLK object; - register LLS *stack; +int PYXIS_push(BLK object, register LLS *stack) { /************************************** * @@ -345,7 +342,7 @@ PYXIS_push(object, stack) if (node = pool->plb_lls) pool->plb_lls = node->lls_next; else - node = (LLS) PYXIS_alloc(pool, type_lls); + node = (LLS) PYXIS_alloc(pool, type_lls, sizeof(struct lls)); node->lls_object = object; node->lls_next = *stack; @@ -353,8 +350,7 @@ PYXIS_push(object, stack) } -BLK PYXIS_pop(stack) - register LLS *stack; +BLK PYXIS_pop(register LLS *stack) { /************************************** * @@ -380,8 +376,7 @@ BLK PYXIS_pop(stack) } -PYXIS_release(block) - register FRB block; +int PYXIS_release(register FRB block) { /************************************** * @@ -450,8 +445,7 @@ PYXIS_release(block) } -PYXIS_rlpool(pool) - PLB pool; +int PYXIS_rlpool(PLB pool) { /************************************** * @@ -475,9 +469,7 @@ PYXIS_rlpool(pool) } -static extend_pool(pool, size) - PLB pool; - int size; +static int extend_pool(PLB pool, int size) { /************************************** * @@ -500,9 +492,9 @@ static extend_pool(pool, size) block->blk_length = size; block->blk_type = (SCHAR) type_frb; block->blk_pool_id = pool->plb_pool_id; - PYXIS_release(block); + PYXIS_release((FRB) block); - hunk = (HNK) PYXIS_alloc(pool, type_hnk); + hunk = (HNK) PYXIS_alloc(pool, type_hnk, sizeof(hnk) ); hunk->hnk_address = (SCHAR *) block; hunk->hnk_length = size; hunk->hnk_next = pool->plb_hunks; diff --git a/src/pyxis/altp.cpp b/src/pyxis/altp.cpp index 402c4bddbd..3ff1e005c8 100644 --- a/src/pyxis/altp.cpp +++ b/src/pyxis/altp.cpp @@ -23,13 +23,15 @@ #include "../jrd/common.h" #include "../include/jrd/gds.h" +#include "../pyxis/pyxis.h" +#include "../pyxis/phase3.h" STATUS isc_compile_map(STATUS * status_vector, void **form_handle, void **map_handle, SSHORT * length, SCHAR * map) { return pyxis__compile_map(status_vector, - form_handle, map_handle, length, map); + (p_obj**)form_handle, (MAP*) map_handle, (USHORT*) length, map); } STATUS isc_compile_menu(STATUS * status_vector, @@ -40,7 +42,7 @@ STATUS isc_compile_menu(STATUS * status_vector, status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__compile_menu(win_handle, menu_handle, length, menu); + return pyxis__compile_menu((WIN*) win_handle, (MENU*) menu_handle, (USHORT*) length, menu); } STATUS isc_compile_sub_map(STATUS * status_vector, @@ -48,7 +50,7 @@ STATUS isc_compile_sub_map(STATUS * status_vector, void **submap_handle, SSHORT * length, SCHAR * map) { return pyxis__compile_sub_map(status_vector, - map_handle, submap_handle, length, map); + (MAP*) map_handle, (MAP*) submap_handle, (USHORT*) length, map); } STATUS isc_create_window(STATUS * status_vector, @@ -60,8 +62,9 @@ STATUS isc_create_window(STATUS * status_vector, status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__create_window(win_handle, - filename_length, filename, width, height); + return pyxis__create_window((WIN*) win_handle, + (USHORT*) filename_length, (TEXT*) filename, + (USHORT*) width, (USHORT*) height); } STATUS isc_delete_window(STATUS * status_vector, void **win_handle) @@ -70,7 +73,7 @@ STATUS isc_delete_window(STATUS * status_vector, void **win_handle) status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__delete_window(win_handle); + return pyxis__delete_window((SLONG*) win_handle); } STATUS isc_drive_form(STATUS * status_vector, @@ -80,9 +83,10 @@ STATUS isc_drive_form(STATUS * status_vector, void **map_handle, UCHAR * input, UCHAR * output) { return pyxis__drive_form(status_vector, - db_handle, - tra_handle, - win_handle, map_handle, input, output); + (SLONG**) db_handle, + (SLONG*) tra_handle, + (WIN*) win_handle, (MAP*)map_handle, + input, output); } STATUS isc_drive_menu(STATUS * status_vector, @@ -100,13 +104,15 @@ STATUS isc_drive_menu(STATUS * status_vector, status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__drive_menu(win_handle, - menu_handle, - blr_length, + return pyxis__drive_menu((WIN*) win_handle, + (MENU*) menu_handle, + (USHORT*) blr_length, blr, - title_length, - title, - terminator, entree_length, entree, entree_value); + (USHORT*) title_length, + (TEXT*) title, + (USHORT*) terminator, + (USHORT*) entree_length, (TEXT*)entree, + entree_value); } STATUS isc_form_delete(STATUS * status_vector, void **map_handle) @@ -115,7 +121,7 @@ STATUS isc_form_delete(STATUS * status_vector, void **map_handle) status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__delete(map_handle); + return pyxis__delete((p_obj**) map_handle); } STATUS isc_form_fetch(STATUS * status_vector, @@ -123,7 +129,9 @@ STATUS isc_form_fetch(STATUS * status_vector, void **tra_handle, void **map_handle, UCHAR * output) { return pyxis__fetch(status_vector, - db_handle, tra_handle, map_handle, output); + (SLONG**) db_handle, + (SLONG*) tra_handle, + (MAP*) map_handle, output); } STATUS isc_form_insert(STATUS * status_vector, @@ -131,7 +139,8 @@ STATUS isc_form_insert(STATUS * status_vector, void **tra_handle, void **map_handle, UCHAR * input) { return pyxis__insert(status_vector, - db_handle, tra_handle, map_handle, input); + (SLONG**) db_handle, (SLONG*) tra_handle, + (MAP*) map_handle, input); } STATUS isc_get_entree(STATUS * status_vector, @@ -144,8 +153,9 @@ STATUS isc_get_entree(STATUS * status_vector, status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__get_entree(menu_handle, - entree_length, entree, entree_value, entree_end); + return pyxis__get_entree((MENU*) menu_handle, + (USHORT*) entree_length, (TEXT*) entree, + entree_value, (USHORT*) entree_end); } STATUS isc_initialize_menu(STATUS * status_vector, void **menu_handle) @@ -154,7 +164,7 @@ STATUS isc_initialize_menu(STATUS * status_vector, void **menu_handle) status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__initialize_menu(menu_handle); + return pyxis__initialize_menu((MENU*) menu_handle); } STATUS isc_load_form(STATUS * status_vector, @@ -163,7 +173,8 @@ STATUS isc_load_form(STATUS * status_vector, void **form_handle, SSHORT * length, SCHAR * name) { return pyxis__load_form(status_vector, - db_handle, tra_handle, form_handle, length, name); + (SLONG*) db_handle, (SLONG*) tra_handle, + (SLONG*) form_handle, length, name); } STATUS isc_menu(STATUS * status_vector, @@ -174,7 +185,8 @@ STATUS isc_menu(STATUS * status_vector, status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__menu(win_handle, menu_handle, length, source); + return (long int) pyxis__menu((WIN*) win_handle, (MENU*) menu_handle, + (USHORT*) length, (TEXT*) source); } STATUS isc_pop_window(STATUS * status_vector, void **win_handle) @@ -183,7 +195,7 @@ STATUS isc_pop_window(STATUS * status_vector, void **win_handle) status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__pop_window(win_handle); + return pyxis__pop_window((WIN*) win_handle); } STATUS isc_put_entree(STATUS * status_vector, @@ -195,13 +207,14 @@ STATUS isc_put_entree(STATUS * status_vector, status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__put_entree(menu_handle, - entree_length, entree, entree_value); + return pyxis__put_entree((MENU*) menu_handle, + (USHORT*) entree_length, (TEXT*) entree, + entree_value); } STATUS isc_reset_form(STATUS * status_vector, void **map_handle) { - return pyxis__reset_form(status_vector, map_handle); + return pyxis__reset_form(status_vector, (MAP*) map_handle); } STATUS isc_suspend_window(STATUS * status_vector, void **win_handle) @@ -210,5 +223,5 @@ STATUS isc_suspend_window(STATUS * status_vector, void **win_handle) status_vector[0] = 1; status_vector[1] = 0; } - return pyxis__suspend_window(win_handle); + return pyxis__suspend_window((SLONG*) win_handle); } diff --git a/src/pyxis/cdm.cpp b/src/pyxis/cdm.cpp index 7b4ef1d79c..634c007f13 100644 --- a/src/pyxis/cdm.cpp +++ b/src/pyxis/cdm.cpp @@ -70,16 +70,30 @@ static FILE *log_file; #endif +#ifdef DARWIN +#define getmaxx(s) ((s)->maxx) +#define getmaxy(s) ((s)->maxy) +#else #ifndef NETBSD #define getmaxx(s) ((s)->_maxx) #define getmaxy(s) ((s)->_maxy) #endif +#endif static USHORT disabled = 1; static USHORT debug_curses = 0; -static int clear_window(), disable(), fini(), get_char(), text(), -update_window(); +static int clear_window(WIN); +static int enable(WIN); +static int disable(WIN); +static int fini(WIN); +static int get_char(WIN, int, int); +static int text(WIN , UCHAR *, SSHORT , SSHORT , SSHORT , USHORT); +static int update_window(WIN, int, int); +static int get_input(WIN, UCHAR *); +static int read_char(WIN); + + typedef struct seq { UCHAR seq_key; @@ -217,8 +231,7 @@ static UCHAR key_pad[256], keypad_equiv[] = { }; -CDM_create_window(window) - WIN window; +int CDM_create_window(WIN window) { /************************************** * @@ -236,12 +249,12 @@ CDM_create_window(window) /* Populate window with action routines */ - window->win_clear = clear_window; - window->win_disable = disable; - window->win_fini = fini; - window->win_getchar = get_char; + window->win_clear = (int (*)()) clear_window; + window->win_disable = (int (*)()) disable; + window->win_fini = (int (*)()) fini; + window->win_getchar = (int (*)()) get_char; window->win_text = text; - window->win_update = update_window; + window->win_update = (int (*)()) update_window; #ifdef DEBUG_CURSES if (debug_curses) @@ -283,8 +296,7 @@ CDM_create_window(window) } -static clear_window(window) - WIN window; +static int clear_window(WIN window) { /************************************** * @@ -297,7 +309,7 @@ static clear_window(window) * **************************************/ - enable(); + enable(window); clear(); wrefresh(stdscr); #ifdef DEBUG_CURSES @@ -309,8 +321,7 @@ static clear_window(window) } -static disable(window) - WIN window; +static int disable(WIN window) { /************************************** * @@ -327,7 +338,7 @@ static disable(window) #endif if (disabled) - return; + return 0; wmove(stdscr, getmaxy(stdscr) - 1, 0); clear(); @@ -390,8 +401,7 @@ static disable(window) } -static enable(window) - WIN window; +static int enable(WIN window) { /************************************** * @@ -405,7 +415,7 @@ static enable(window) **************************************/ if (!disabled) - return; + return 0; #ifdef DISABLE_BUG /* @@ -457,8 +467,7 @@ static enable(window) } -static fini(window) - WIN window; +static int fini(WIN window) { /************************************** * @@ -480,8 +489,7 @@ static fini(window) } -static get_char(window, x, y) - WIN window; +static int get_char(WIN window, int x, int y) { /************************************** * @@ -545,9 +553,7 @@ fflush (window->win_output); -static get_input(window, buffer) - WIN window; - UCHAR *buffer; +static int get_input(WIN window, UCHAR *buffer) { /************************************** * @@ -622,8 +628,7 @@ static get_input(window, buffer) } -static read_char(window) - WIN window; +static int read_char(WIN window) { /************************************** * @@ -649,11 +654,8 @@ static read_char(window) } -static text(window, string, length, x, y, mode) - WIN window; - UCHAR *string; - USHORT length, x, y; - USHORT mode; +static int text(WIN window, UCHAR *string, SSHORT length, SSHORT x, + SSHORT y, USHORT mode) { /************************************** * @@ -698,7 +700,7 @@ static text(window, string, length, x, y, mode) wstandout(stdscr); } - mvwaddstr(stdscr, y, x, string); + mvwaddstr(stdscr, y, x, (char*)string); #ifdef DEBUG_CURSES if (debug_curses) fprintf(log_file, "mvwaddstr %d %d %s\n", y, x, string); @@ -714,9 +716,7 @@ static text(window, string, length, x, y, mode) } -static update_window(window, x, y) - WIN window; - int x, y; +static int update_window(WIN window, int x, int y) { /************************************** * diff --git a/src/pyxis/debug.cpp b/src/pyxis/debug.cpp index 192f60fd69..7b3c842864 100644 --- a/src/pyxis/debug.cpp +++ b/src/pyxis/debug.cpp @@ -19,7 +19,7 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * $Id: debug.cpp,v 1.1.1.1 2001-05-23 13:26:33 tamlin Exp $ + * $Id: debug.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $ * Revision 1.2 2000/11/24 17:23:02 fsg * Another little fix in pyxis/debug.c that nobody * ever will notice :-) @@ -30,6 +30,8 @@ #include "../pyxis/pyxis.h" #include "../pyxis/scr.h" +#include + #define INDENT 2 extern OBJ PYXIS_get_attribute_value(); @@ -70,9 +72,7 @@ static ATT_N special_attributes[] = { -PYXIS_print(object, level) - OBJ object; - USHORT level; +int PYXIS_print(OBJ object, USHORT level) { /************************************** * @@ -128,9 +128,7 @@ PYXIS_print(object, level) } -PYXIS_print_screen(screen, text) - SCR screen; - UCHAR *text; +int PYXIS_print_screen(SCR screen, UCHAR *text) { /************************************** * diff --git a/src/pyxis/form_ddl.h b/src/pyxis/form_ddl.h index b8f2ba7a11..b28f508320 100644 --- a/src/pyxis/form_ddl.h +++ b/src/pyxis/form_ddl.h @@ -16,53 +16,53 @@ * All Rights Reserved. * Contributor(s): ______________________________________. */ - gds__dyn_version_1, - gds__dyn_begin, - gds__dyn_def_global_fld, 10,0, 'P','Y','X','I','S','$','F','O','R','M', - gds__dyn_system_flag, 2,0, 2,0, - gds__dyn_fld_type, 2,0, 5,1, - gds__dyn_fld_length, 2,0, 8,0, - gds__dyn_fld_scale, 2,0, 0,0, - gds__dyn_fld_sub_type, 2,0, 0,0, - gds__dyn_fld_segment_length, 2,0, 'P',0, - gds__dyn_end, - gds__dyn_def_global_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E', - gds__dyn_system_flag, 2,0, 2,0, - gds__dyn_fld_type, 2,0, 14,0, - gds__dyn_fld_length, 2,0, 31,0, - gds__dyn_fld_scale, 2,0, 0,0, - gds__dyn_fld_sub_type, 2,0, 0,0, - gds__dyn_end, - gds__dyn_def_global_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','T','Y','P','E', - gds__dyn_system_flag, 2,0, 2,0, - gds__dyn_fld_type, 2,0, 14,0, - gds__dyn_fld_length, 2,0, 16,0, - gds__dyn_fld_scale, 2,0, 0,0, - gds__dyn_fld_sub_type, 2,0, 0,0, - gds__dyn_end, - gds__dyn_def_rel, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', - gds__dyn_system_flag, 2,0, 2,0, - gds__dyn_end, - gds__dyn_def_local_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E', - gds__dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', - gds__dyn_system_flag, 2,0, 2,0, - gds__dyn_fld_position, 2,0, 1,0, - gds__dyn_end, - gds__dyn_def_local_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','T','Y','P','E', - gds__dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', - gds__dyn_system_flag, 2,0, 2,0, - gds__dyn_fld_position, 2,0, 2,0, - gds__dyn_end, - gds__dyn_def_local_fld, 10,0, 'P','Y','X','I','S','$','F','O','R','M', - gds__dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', - gds__dyn_system_flag, 2,0, 2,0, - gds__dyn_fld_position, 2,0, 3,0, - gds__dyn_end, - gds__dyn_def_idx, 11,0, 'P','Y','X','I','S','$','I','N','D','E','X', - gds__dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', - gds__dyn_idx_unique, 2,0, 1,0, - gds__dyn_idx_inactive, 2,0, 0,0, - gds__dyn_fld_name, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E', - gds__dyn_end, - gds__dyn_end, - gds__dyn_eoc + gds_dyn_version_1, + gds_dyn_begin, + gds_dyn_def_global_fld, 10,0, 'P','Y','X','I','S','$','F','O','R','M', + gds_dyn_system_flag, 2,0, 2,0, + gds_dyn_fld_type, 2,0, 5,1, + gds_dyn_fld_length, 2,0, 8,0, + gds_dyn_fld_scale, 2,0, 0,0, + gds_dyn_fld_sub_type, 2,0, 0,0, + gds_dyn_fld_segment_length, 2,0, 'P',0, + gds_dyn_end, + gds_dyn_def_global_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E', + gds_dyn_system_flag, 2,0, 2,0, + gds_dyn_fld_type, 2,0, 14,0, + gds_dyn_fld_length, 2,0, 31,0, + gds_dyn_fld_scale, 2,0, 0,0, + gds_dyn_fld_sub_type, 2,0, 0,0, + gds_dyn_end, + gds_dyn_def_global_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','T','Y','P','E', + gds_dyn_system_flag, 2,0, 2,0, + gds_dyn_fld_type, 2,0, 14,0, + gds_dyn_fld_length, 2,0, 16,0, + gds_dyn_fld_scale, 2,0, 0,0, + gds_dyn_fld_sub_type, 2,0, 0,0, + gds_dyn_end, + gds_dyn_def_rel, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', + gds_dyn_system_flag, 2,0, 2,0, + gds_dyn_end, + gds_dyn_def_local_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E', + gds_dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', + gds_dyn_system_flag, 2,0, 2,0, + gds_dyn_fld_position, 2,0, 1,0, + gds_dyn_end, + gds_dyn_def_local_fld, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','T','Y','P','E', + gds_dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', + gds_dyn_system_flag, 2,0, 2,0, + gds_dyn_fld_position, 2,0, 2,0, + gds_dyn_end, + gds_dyn_def_local_fld, 10,0, 'P','Y','X','I','S','$','F','O','R','M', + gds_dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', + gds_dyn_system_flag, 2,0, 2,0, + gds_dyn_fld_position, 2,0, 3,0, + gds_dyn_end, + gds_dyn_def_idx, 11,0, 'P','Y','X','I','S','$','I','N','D','E','X', + gds_dyn_rel_name, 11,0, 'P','Y','X','I','S','$','F','O','R','M','S', + gds_dyn_idx_unique, 2,0, 1,0, + gds_dyn_idx_inactive, 2,0, 0,0, + gds_dyn_fld_name, 15,0, 'P','Y','X','I','S','$','F','O','R','M','_','N','A','M','E', + gds_dyn_end, + gds_dyn_end, + gds_dyn_eoc diff --git a/src/pyxis/menu.cpp b/src/pyxis/menu.cpp index 906cb1f387..f0b13bec4b 100644 --- a/src/pyxis/menu.cpp +++ b/src/pyxis/menu.cpp @@ -26,17 +26,13 @@ #include "../pyxis/pyxis.h" -ATT PYXIS_get_attribute(), PYXIS_put_attribute(), REPLACE_ATTRIBUTE(), -PYXIS_find_object(), PYXIS_navigate(); -OBJ PYXIS_create_object(), PYXIS_get_attribute_value(); - -static ATT lookup_entree(); +static ATT lookup_entree(OBJ , ATT , TEXT *); -PYXIS_box(object) +int PYXIS_box(int object) { /************************************** * @@ -50,11 +46,11 @@ PYXIS_box(object) **************************************/ USHORT width, height; - width = GET_VALUE(object, att_width); - height = GET_VALUE(object, att_height); + width = GET_VALUE((OBJ) object, att_width); + height = GET_VALUE((OBJ) object, att_height); if (!width || !height) { - PYXIS_compute_size(object, &width, &height); + PYXIS_compute_size((OBJ) object, &width, &height); width += 3; height += 3; } @@ -67,10 +63,7 @@ PYXIS_box(object) } -ATT PYXIS_create_entree(menu, string, type, value) - OBJ menu; - TEXT *string; - BLK value; +ATT PYXIS_create_entree(OBJ menu, TEXT *string, int type, BLK value) { /************************************** * @@ -87,16 +80,13 @@ ATT PYXIS_create_entree(menu, string, type, value) object = PYXIS_create_object(string, att_literal_string); if (type) - PUT_ATTRIBUTE(object, att_entree_value, type, value); + PUT_ATTRIBUTE(object, att_entree_value,(enum att_t)type, (OBJ) value); return PUT_ATTRIBUTE(menu, att_entree, attype_object, object); } -OBJ PYXIS_drive_menu(window, menu, terminator) - WIN window; - OBJ menu; - USHORT *terminator; +OBJ PYXIS_drive_menu(WIN window, OBJ menu, USHORT *terminator) { /************************************** * @@ -203,10 +193,8 @@ OBJ PYXIS_drive_menu(window, menu, terminator) } } - -PYXIS_format_menu(menu, string, horizontal) - OBJ menu; - TEXT *string; +extern "C" +int PYXIS_format_menu(OBJ menu, TEXT *string, int horizontal) { /************************************** * @@ -290,13 +278,11 @@ PYXIS_format_menu(menu, string, horizontal) } if (!horizontal) - PYXIS_box(menu); + PYXIS_box((int) menu); } - -OBJ PYXIS_menu(window, menu) - WIN window; - OBJ menu; +extern "C" +OBJ PYXIS_menu(WIN window, OBJ menu) { /************************************** * @@ -314,12 +300,8 @@ OBJ PYXIS_menu(window, menu) } - -PYXIS_select(window, menu, attribute_name, start) - WIN window; - OBJ menu; - ATT_N attribute_name; - ATT start; +extern "C" +int PYXIS_select(WIN window, OBJ menu, ATT_N attribute_name, ATT start) { /************************************** * @@ -385,10 +367,7 @@ PYXIS_select(window, menu, attribute_name, start) } -static ATT lookup_entree(menu, attribute, string) - OBJ menu; - ATT attribute; - TEXT *string; +static ATT lookup_entree(OBJ menu, ATT attribute, TEXT *string) { /************************************** * diff --git a/src/pyxis/phase2.cpp b/src/pyxis/phase2.cpp index 6d5f040165..7257c3a99b 100644 --- a/src/pyxis/phase2.cpp +++ b/src/pyxis/phase2.cpp @@ -25,22 +25,25 @@ #include "../pyxis/pyxis.h" #include "../pyxis/phase2.h" -static OBJ walk_form(), walk_repeating(); -static ATT find_starting(); +#include "../jrd/val.h" -extern PIC PICSTR_analyze(); -extern OBJ PYXIS_find_field(), PYXIS_get_attribute_value(), -PYXIS_find_index(), PYXIS_update(), PYXIS_menu(), -PYXIS_clone(), PYXIS_create_object(); -extern ATT PYXIS_replicate_prototype(), PYXIS_find_object(), -PYXIS_put_attribute(), PYXIS_replace_attribute(), -PYXIS_get_attribute(), PYXIS_navigate(); +static OBJ walk_repeating(WIN , OBJ , LLS *, USHORT *); +static OBJ walk_form(WIN , OBJ , LLS *, USHORT *); +static ATT find_starting(OBJ , USHORT , USHORT , LLS *); +static int set_fld_options(OBJ , SLONG , SLONG ); + +extern int MOVP_get_string( DSC *, TEXT **, VARY *, USHORT ); +extern BLK PYXIS_pop(register LLS *); +extern int PYXIS_push(BLK , register LLS *); + + +extern PIC PICSTR_analyze(TEXT*, DSC*); +extern int PICSTR_edit ( DSC*, PIC, TEXT**,USHORT); -OBJ PYXIS_find_field(form, field_name) - OBJ form; - TEXT *field_name; +extern "C" +OBJ PYXIS_find_field(OBJ form, TEXT *field_name) { /************************************** * @@ -73,9 +76,8 @@ OBJ PYXIS_find_field(form, field_name) } -OBJ PYXIS_find_index(form, index) - OBJ form; - USHORT index; +extern "C" +OBJ PYXIS_find_index(OBJ form, USHORT index) { /************************************** * @@ -101,10 +103,7 @@ OBJ PYXIS_find_index(form, index) } -TEXT *PYXIS_format_field(field, desc, buffer) - OBJ field; - DSC *desc; - TEXT *buffer; +TEXT *PYXIS_format_field(OBJ field, DSC *desc, TEXT *buffer) { /************************************** * @@ -131,7 +130,7 @@ TEXT *PYXIS_format_field(field, desc, buffer) if (!(edit_string = GET_STRING(field, att_edit_string))) return NULL; picture = PICSTR_analyze(edit_string, &desc2); - PUT_ATTRIBUTE(field, att_picture, attype_other, picture); + PUT_ATTRIBUTE(field, att_picture, attype_other, (OBJ)picture); } PICSTR_edit(desc, picture, &buffer, 32000); @@ -141,10 +140,7 @@ TEXT *PYXIS_format_field(field, desc, buffer) } -TEXT *PYXIS_get_string(form, field_name, type) - OBJ form; - TEXT *field_name; - USHORT type; +TEXT *PYXIS_get_string(OBJ form, TEXT *field_name, USHORT type) { /************************************** * @@ -183,11 +179,8 @@ TEXT *PYXIS_get_string(form, field_name, type) return GET_STRING (field, att_data);*/ } - -PYXIS_get_updated(form, field_name, p) - OBJ form; - TEXT *field_name; - TEXT **p; +extern "C" +int PYXIS_get_updated(OBJ form, TEXT *field_name, TEXT **p) { /************************************** * @@ -218,9 +211,8 @@ PYXIS_get_updated(form, field_name, p) } -PYXIS_purge_segments(field, index) - OBJ field; - int index; +extern "C" +int PYXIS_purge_segments(OBJ field, int index) { /************************************** * @@ -251,9 +243,7 @@ PYXIS_purge_segments(field, index) } -PYXIS_put_desc(field, desc) - OBJ field; - DSC *desc; +int PYXIS_put_desc(OBJ field, DSC *desc) { /************************************** * @@ -272,7 +262,7 @@ PYXIS_put_desc(field, desc) if (!PYXIS_format_field(field, desc, edit_buffer)) { p = edit_buffer; if (l = - MOVP_get_string(desc, &edit_string, edit_buffer, + MOVP_get_string(desc, &edit_string, (VARY*)edit_buffer, sizeof(edit_buffer))) do *p++ = *edit_string++; @@ -289,9 +279,8 @@ PYXIS_put_desc(field, desc) } -PYXIS_put_segment(field, string, index) - OBJ field; - TEXT *string; +extern "C" +int PYXIS_put_segment(OBJ field, TEXT *string, int index) { /************************************** * @@ -329,10 +318,7 @@ PYXIS_put_segment(field, string, index) } -ATT PYXIS_replicate_prototype(form, prototype, index) - OBJ form; - OBJ prototype; - USHORT index; +ATT PYXIS_replicate_prototype(OBJ form, OBJ prototype, USHORT index) { /************************************** * @@ -365,10 +351,7 @@ ATT PYXIS_replicate_prototype(form, prototype, index) } -PYXIS_set_field_options(form, field_name, options, mask) - OBJ form; - TEXT *field_name; - SLONG options, mask; +int PYXIS_set_field_options(OBJ form, TEXT *field_name, SLONG options, SLONG mask) { /************************************** * @@ -402,11 +385,7 @@ PYXIS_set_field_options(form, field_name, options, mask) } -OBJ PYXIS_update(window, form, context_stack, terminator) - WIN window; - OBJ form; - LLS *context_stack; - USHORT *terminator; +OBJ PYXIS_update(WIN window, OBJ form, LLS *context_stack, USHORT *terminator) { /************************************** * @@ -449,11 +428,7 @@ OBJ PYXIS_update(window, form, context_stack, terminator) } -static ATT find_starting(form, direction, any, out_stack) - OBJ form; - USHORT direction; - USHORT any; - LLS *out_stack; +static ATT find_starting(OBJ form, USHORT direction, USHORT any, LLS *out_stack) { /************************************** * @@ -497,7 +472,7 @@ static ATT find_starting(form, direction, any, out_stack) } } if (attr) - LLS_PUSH(attr, out_stack); + LLS_PUSH((BLK)attr, out_stack); return start; } @@ -511,14 +486,12 @@ static ATT find_starting(form, direction, any, out_stack) break; } if (attr) - LLS_PUSH(attr, out_stack); + LLS_PUSH((BLK)attr, out_stack); return start; } -static set_fld_options(field, options, mask) - OBJ field; - SLONG options, mask; +static int set_fld_options(OBJ field, SLONG options, SLONG mask) { /************************************** * @@ -616,11 +589,7 @@ static set_fld_options(field, options, mask) } -static OBJ walk_form(window, form, context, terminator) - WIN window; - OBJ form; - LLS *context; - USHORT *terminator; +static OBJ walk_form(WIN window, OBJ form, LLS *context, USHORT *terminator) { /************************************** * @@ -686,7 +655,7 @@ static OBJ walk_form(window, form, context, terminator) } if (!new_field) { - LLS_PUSH(field, context); + LLS_PUSH((BLK) field, context); return NULL; } field = new_field; @@ -710,11 +679,7 @@ static OBJ walk_form(window, form, context, terminator) -static OBJ walk_repeating(window, form, context, terminator) - WIN window; - OBJ form; - LLS *context; - USHORT *terminator; +static OBJ walk_repeating(WIN window, OBJ form, LLS *context, USHORT *terminator) { /************************************** * diff --git a/src/pyxis/phase2.h b/src/pyxis/phase2.h index c46280be50..c1bcbfb272 100644 --- a/src/pyxis/phase2.h +++ b/src/pyxis/phase2.h @@ -59,4 +59,22 @@ #define PYXIS_reset (-1 &~ PYXIS_fill_displayed) +#ifdef __cplusplus +extern "C" { +#endif + +extern OBJ PYXIS_find_field(OBJ , TEXT *); +extern OBJ PYXIS_update(WIN , OBJ , LLS *, USHORT *); +extern OBJ PYXIS_find_index(OBJ , USHORT ); +extern ATT PYXIS_replicate_prototype(OBJ , OBJ , USHORT ); +extern int PYXIS_put_desc(OBJ , DSC *); +extern int PYXIS_set_field_options(OBJ , TEXT *, SLONG , SLONG ); +extern int PYXIS_purge_segments(OBJ , int ); +int PYXIS_get_updated(OBJ , TEXT *, TEXT **); +int PYXIS_put_segment(OBJ , TEXT *, int ); + +#ifdef __cplusplus +}; +#endif + #endif /* _PYXIS_PHASE2_H_ */ diff --git a/src/pyxis/phase3.cpp b/src/pyxis/phase3.cpp index 2b5e61e96d..624f4910cb 100644 --- a/src/pyxis/phase3.cpp +++ b/src/pyxis/phase3.cpp @@ -21,46 +21,59 @@ * Contributor(s): ______________________________________. */ /* -$Id: phase3.cpp,v 1.1.1.1 2001-05-23 13:26:34 tamlin Exp $ +$Id: phase3.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $ */ +#include + #include #include "../jrd/common.h" #include #include "../include/jrd/gds.h" +#include "../jrd/gds_proto.h" +#include "../pyxis/everything.h" #include "../pyxis/pyxis.h" #include "../pyxis/phase2.h" +#include "../pyxis/save.h" -extern OBJ PYXIS_find_field(), PYXIS_get_attribute_value(), -PYXIS_find_index(), PYXIS_update(), PYXIS_drive_menu(), PYXIS_menu(), -PYXIS_clone(), PYXIS_create_object(); -extern WIN PYXIS_create_window(); -extern ATT PYXIS_replicate_prototype(), PYXIS_find_object(), PYXIS_navigate(); +BLK PYXIS_alloc(PLB , UCHAR , int ); +void MOVP_move( DSC *, DSC *); +SLONG MOVP_get_long(DSC * , SSHORT ); +BLK PYXIS_pop(register LLS *); +int PYXIS_push(BLK , register LLS *); -extern PYXIS_init(); +static MENU par_menu(WIN , USHORT *, SCHAR *); +static int get_field_value(WIN , OBJ , OBJ , DSC *); +static OBJ find_field(MAP , OBJ , map::map_repeat *); +static int get_blob(OBJ , DSC *, SLONG **, SLONG **); +static MAP par_message(STATUS *, TEXT **); +static int par_word(TEXT **); +static int propogate_options(map::map_repeat *, SLONG ); +static int put_blob(OBJ , DSC *, SLONG **, SLONG **); +static int put_value(MAP , USHORT , UCHAR *, SLONG ); +static int unwind(TEXT *); +static int error(STATUS *, TEXT *, ...); + +int pyxis__insert(STATUS *, SLONG **, SLONG *, MAP *, UCHAR *); +int pyxis__fetch(STATUS *, SLONG **, SLONG *, MAP *, UCHAR *); +int pyxis__initialize_menu(MENU *); + +extern "C" int PYXIS_format_menu(OBJ , TEXT *, int ); +extern OBJ PYXIS_drive_menu(WIN , OBJ , USHORT *); +extern "C" OBJ PYXIS_menu(WIN , OBJ ); +extern ATT PYXIS_create_entree(OBJ , TEXT *, int , BLK ); -static MAP par_message(); -static MENU par_menu(); -static OBJ find_field(); #define BLR_BYTE (*p++) #define BLR_WORD par_word (&p) -extern WIN PYXIS_create_window(); - -static int error(STATUS *, TEXT *, ...); static jmp_buf unwind_env; static TEXT error_buffer[256]; -static unwind(); -pyxis__compile_map(status, form_handle, map_handle, length, source) - STATUS *status; - OBJ *form_handle; - MAP *map_handle; - USHORT *length; - SCHAR *source; +int pyxis__compile_map(STATUS *status, OBJ *form_handle, MAP *map_handle, + USHORT *length, SCHAR *source) { /************************************** * @@ -78,25 +91,25 @@ pyxis__compile_map(status, form_handle, map_handle, length, source) STR string; SCHAR *p, c; TEXT *q, name[32]; - struct map_repeat *tail; + map::map_repeat *tail; form = *form_handle; p = source; c = BLR_BYTE; - if (c != PYXIS__MAP_VERSION1) + if (c != PYXIS_MAP_VERSION1) return error(status, "unsupported map version %d", c); - while ((c = BLR_BYTE) != PYXIS__MAP_END) + while ((c = BLR_BYTE) != PYXIS_MAP_END) switch (c) { - case PYXIS__MAP_MESSAGE: + case PYXIS_MAP_MESSAGE: if (!(map = par_message(status, &p))) return FALSE; map->map_form = form; break; - case PYXIS__MAP_FIELD1: - case PYXIS__MAP_FIELD2: + case PYXIS_MAP_FIELD1: + case PYXIS_MAP_FIELD2: q = name; if (n = BLR_BYTE) do @@ -107,13 +120,13 @@ pyxis__compile_map(status, form_handle, map_handle, length, source) tail = map->map_rpt + n; if (!(tail->map_field = PYXIS_find_field(form, name))) return error(status, "field %s not defined", name); - if (c == PYXIS__MAP_FIELD2) { + if (c == PYXIS_MAP_FIELD2) { tail->map_field_flags |= MAP_options; tail->map_option = BLR_WORD; } break; - case PYXIS__MAP_SUB_FIELD: + case PYXIS_MAP_SUB_FIELD: /* Get repeating group field name */ @@ -151,23 +164,23 @@ pyxis__compile_map(status, form_handle, map_handle, length, source) tail->map_option = BLR_WORD; break; - case PYXIS__MAP_OPAQUE: + case PYXIS_MAP_OPAQUE: map->map_flags &= ~MAP_transparent; break; - case PYXIS__MAP_TRANSPARENT: + case PYXIS_MAP_TRANSPARENT: map->map_flags |= MAP_transparent; break; - case PYXIS__MAP_TAG: + case PYXIS_MAP_TAG: map->map_flags |= MAP_tag; break; - case PYXIS__MAP_TERMINATOR: + case PYXIS_MAP_TERMINATOR: map->map_terminator = par_word(&p) + 1; break; - case PYXIS__MAP_TERMINATING_FIELD: + case PYXIS_MAP_TERMINATING_FIELD: map->map_terminating_field = par_word(&p) + 1; break; @@ -179,11 +192,8 @@ pyxis__compile_map(status, form_handle, map_handle, length, source) } -pyxis__compile_menu(window_handle, menu_handle, length, source) - WIN *window_handle; - MENU *menu_handle; - USHORT *length; - TEXT *source; +int pyxis__compile_menu(WIN *window_handle, MENU *menu_handle, USHORT *length, + TEXT *source) { /************************************** * @@ -200,12 +210,8 @@ pyxis__compile_menu(window_handle, menu_handle, length, source) } -pyxis__compile_sub_map(status, parent_handle, map_handle, length, source) - STATUS *status; - MAP *parent_handle; - MAP *map_handle; - USHORT *length; - SCHAR *source; +int pyxis__compile_sub_map(STATUS *status, MAP *parent_handle, MAP *map_handle, + USHORT *length, SCHAR *source) { /************************************** * @@ -222,23 +228,23 @@ pyxis__compile_sub_map(status, parent_handle, map_handle, length, source) STR string; SCHAR *p, c; TEXT *q, name[32]; - struct map_repeat *tail; + map::map_repeat *tail; parent = *parent_handle; p = source; c = BLR_BYTE; - if (c != PYXIS__MAP_VERSION1) + if (c != PYXIS_MAP_VERSION1) return error(status, "unsupported map version %d", c); - while ((c = BLR_BYTE) != PYXIS__MAP_END) + while ((c = BLR_BYTE) != PYXIS_MAP_END) switch (c) { - case PYXIS__MAP_MESSAGE: + case PYXIS_MAP_MESSAGE: if (!(map = par_message(status, &p))) return FALSE; break; - case PYXIS__MAP_SUB_FORM: + case PYXIS_MAP_SUB_FORM: q = name; if (n = BLR_BYTE) do @@ -255,8 +261,8 @@ pyxis__compile_sub_map(status, parent_handle, map_handle, length, source) name); break; - case PYXIS__MAP_FIELD1: - case PYXIS__MAP_FIELD2: + case PYXIS_MAP_FIELD1: + case PYXIS_MAP_FIELD2: n = BLR_BYTE; string = (STR) ALLOCPV(type_str, n); q = string->str_data; @@ -272,13 +278,13 @@ pyxis__compile_sub_map(status, parent_handle, map_handle, length, source) tail->map_name)) return error(status, "field %s not defined", tail->map_name); - if (c == PYXIS__MAP_FIELD2) { + if (c == PYXIS_MAP_FIELD2) { tail->map_field_flags |= MAP_options; tail->map_option = BLR_WORD; } break; - case PYXIS__MAP_ITEM_INDEX: + case PYXIS_MAP_ITEM_INDEX: map->map_item_index = par_word(&p) + 1; break; @@ -291,12 +297,8 @@ pyxis__compile_sub_map(status, parent_handle, map_handle, length, source) -pyxis__create_window(window_handle, file_name_length, file_name, width, - height) - WIN *window_handle; - USHORT *file_name_length; - TEXT *file_name; - SSHORT *width, *height; +int pyxis__create_window(WIN *window_handle, USHORT *file_name_length, + TEXT *file_name, USHORT *width, USHORT *height) { /************************************** * @@ -317,8 +319,7 @@ pyxis__create_window(window_handle, file_name_length, file_name, width, } -pyxis__delete(object) - OBJ *object; +int pyxis__delete(OBJ *object) { /************************************** * @@ -338,8 +339,7 @@ pyxis__delete(object) -pyxis__delete_window(window_handle) - SLONG *window_handle; +int pyxis__delete_window(SLONG *window_handle) { /************************************** * @@ -353,19 +353,15 @@ pyxis__delete_window(window_handle) **************************************/ if (*window_handle) { - PYXIS_delete_window(*window_handle); + PYXIS_delete_window((WIN) *window_handle); *window_handle = NULL; } } -pyxis__drive_form(status, db_handle, tra_handle, window_handle, map_handle, - input, output) - STATUS *status; - SLONG **db_handle, *tra_handle; - WIN *window_handle; - MAP *map_handle; - UCHAR *input, *output; +int pyxis__drive_form(STATUS *status, SLONG **db_handle, SLONG *tra_handle, + WIN *window_handle, MAP *map_handle, + UCHAR *input, UCHAR *output) { /************************************** * @@ -451,19 +447,9 @@ pyxis__drive_form(status, db_handle, tra_handle, window_handle, map_handle, } -pyxis__drive_menu(window_handle, menu_handle, blr_length, blr_source, - title_length, title, terminator, entree_length, entree_text, - entree_value) - WIN *window_handle; - MENU *menu_handle; - USHORT *blr_length; - SCHAR *blr_source; - USHORT *title_length; - TEXT *title; - USHORT *terminator; - USHORT *entree_length; - TEXT *entree_text; - SLONG *entree_value; +int pyxis__drive_menu(WIN *window_handle, MENU *menu_handle, USHORT *blr_length, + SCHAR *blr_source, USHORT *title_length, TEXT *title, USHORT *terminator, + USHORT *entree_length, TEXT *entree_text, SLONG *entree_value) { /************************************** * @@ -495,32 +481,32 @@ pyxis__drive_menu(window_handle, menu_handle, blr_length, blr_source, p = blr_source; c = BLR_BYTE; - if (c != PYXIS__MENU_VERSION1) { + if (c != PYXIS_MENU_VERSION1) { error(0, "unsupported map version %d", c); return NULL; } - while ((c = BLR_BYTE) != PYXIS__MENU_END) + while ((c = BLR_BYTE) != PYXIS_MENU_END) switch (c) { - case PYXIS__MENU_OPAQUE: + case PYXIS_MENU_OPAQUE: menu->menu_flags &= ~MENU_transparent; break; - case PYXIS__MENU_TRANSPARENT: + case PYXIS_MENU_TRANSPARENT: menu->menu_flags |= MENU_transparent; break; - case PYXIS__MENU_HORIZONTAL: + case PYXIS_MENU_HORIZONTAL: object->obj_flags |= OBJ_menu_horizontal; break; - case PYXIS__MENU_VERTICAL: + case PYXIS_MENU_VERTICAL: object->obj_flags &= ~OBJ_menu_horizontal; break; default: error(0, "invalid menu"); - return; + return 0; } for (i = *title_length, fp = title, tp = title_buffer; i > 0; @@ -559,11 +545,8 @@ pyxis__drive_menu(window_handle, menu_handle, blr_length, blr_source, } -pyxis__fetch(status, db_handle, tra_handle, map_handle, output) - STATUS *status; - SLONG **db_handle, *tra_handle; - MAP *map_handle; - UCHAR *output; +int pyxis__fetch(STATUS *status, SLONG **db_handle, SLONG *tra_handle, + MAP *map_handle, UCHAR *output) { /************************************** * @@ -580,7 +563,7 @@ pyxis__fetch(status, db_handle, tra_handle, map_handle, output) OBJ form, field; USHORT source; SSHORT n; - struct map_repeat *tail, *end; + map::map_repeat *tail, *end; map = *map_handle; @@ -592,7 +575,7 @@ pyxis__fetch(status, db_handle, tra_handle, map_handle, output) n = MOVP_get_long(&desc, 0); if (!(form = PYXIS_find_index(map->map_parent, n))) { put_value(map, map->map_item_index - 1, output, 0); - return; + return 0; } } else @@ -609,7 +592,7 @@ pyxis__fetch(status, db_handle, tra_handle, map_handle, output) desc = tail->map_desc; desc.dsc_address = output + (SLONG) desc.dsc_address; if (desc.dsc_dtype == dtype_blob) - source = get_blob(field, &desc, db_handle, tra_handle); + source = get_blob(field, &desc, db_handle, (SLONG**) tra_handle); else source = get_field_value(map->map_window, form, field, &desc); put_value(map, tail->map_option, output, source); @@ -619,13 +602,8 @@ pyxis__fetch(status, db_handle, tra_handle, map_handle, output) } -pyxis__get_entree(menu_handle, entree_length, entree_text, entree_value, - entree_end) - MENU *menu_handle; - USHORT *entree_length; - TEXT *entree_text; - SLONG *entree_value; - USHORT *entree_end; +int pyxis__get_entree(MENU *menu_handle, USHORT *entree_length, + TEXT *entree_text, SLONG *entree_value, USHORT *entree_end) { /************************************** * @@ -642,7 +620,7 @@ pyxis__get_entree(menu_handle, entree_length, entree_text, entree_value, if (!(menu = *menu_handle)) { *entree_end = TRUE; - return; + return 0; } menu->menu_current_entree = @@ -665,8 +643,7 @@ pyxis__get_entree(menu_handle, entree_length, entree_text, entree_value, } -pyxis__initialize_menu(menu_handle) - MENU *menu_handle; +int pyxis__initialize_menu(MENU *menu_handle) { /************************************** * @@ -691,17 +668,14 @@ pyxis__initialize_menu(menu_handle) else menu = (MENU) ALLOCP(type_menu); - menu->menu_object = PYXIS_create_object(0, 0); + menu->menu_object = PYXIS_create_object(0, (enum att_n)0); *menu_handle = menu; } -pyxis__insert(status, db_handle, tra_handle, map_handle, input) - STATUS *status; - SLONG **db_handle, *tra_handle; - MAP *map_handle; - UCHAR *input; +int pyxis__insert(STATUS *status, SLONG **db_handle, SLONG *tra_handle, + MAP *map_handle, UCHAR *input) { /************************************** * @@ -718,7 +692,7 @@ pyxis__insert(status, db_handle, tra_handle, map_handle, input) OBJ form, field; ATT attribute; SSHORT n, max_index; - struct map_repeat *tail, *end; + map::map_repeat *tail, *end; map = *map_handle; @@ -755,41 +729,38 @@ pyxis__insert(status, db_handle, tra_handle, map_handle, input) } if (!(field = find_field(map, form, tail))) continue; - if (n & PYXIS__OPT_DISPLAY) { + if (n & PYXIS_OPT_DISPLAY) { desc = tail->map_desc; desc.dsc_address = input + (SLONG) desc.dsc_address; if (desc.dsc_dtype == dtype_blob) - put_blob(field, &desc, db_handle, tra_handle); + put_blob(field, &desc, db_handle, (SLONG**)tra_handle); else PYXIS_put_desc(field, &desc); PYXIS_set_field_options(field, 0, PYXIS_update_present, PYXIS_clear); } - if (n & PYXIS__OPT_POSITION) { + if (n & PYXIS_OPT_POSITION) { while (map->map_context) LLS_POP(&map->map_context); for (attribute = NULL; attribute = PYXIS_find_object(form, attribute, att_field, TRUE);) if ((OBJ) attribute->att_value == field) { - LLS_PUSH(attribute, &map->map_context); + LLS_PUSH((BLK)attribute, &map->map_context); break; } } - if (n & PYXIS__OPT_UPDATE) + if (n & PYXIS_OPT_UPDATE) PYXIS_set_field_options(field, 0, PYXIS_updatable, PYXIS_updatable); - if (n & PYXIS__OPT_WAKEUP) + if (n & PYXIS_OPT_WAKEUP) PYXIS_set_field_options(field, 0, PYXIS_wakeup, PYXIS_wakeup); } } -pyxis__load_form(status, db, trans, form, length, name) - STATUS *status; - SLONG *db, *trans, *form; - SSHORT *length; - SCHAR *name; +int pyxis__load_form(STATUS *status, SLONG *db, SLONG *trans, SLONG *form, + SSHORT *length, SCHAR *name) { /************************************** * @@ -803,15 +774,12 @@ pyxis__load_form(status, db, trans, form, length, name) * **************************************/ - return PYXIS_load_form(status, db, trans, form, length, name); + return (int) PYXIS_load_form((int*)status, (SLONG**)db, (SLONG**)trans, (OBJ*)form, (USHORT*) length, name); } -OBJ pyxis__menu(window_handle, menu_handle, length, source) - WIN *window_handle; - MENU *menu_handle; - USHORT *length; - TEXT *source; +OBJ pyxis__menu(WIN *window_handle, MENU *menu_handle, USHORT *length, + TEXT *source) { /************************************** * @@ -851,12 +819,8 @@ OBJ pyxis__menu(window_handle, menu_handle, length, source) } -pyxis__menu_d(window_handle, menu_handle, length, source, object) - WIN *window_handle; - MENU *menu_handle; - USHORT *length; - TEXT *source; - OBJ *object; +int pyxis__menu_d(WIN *window_handle, MENU *menu_handle, USHORT *length, + TEXT *source, OBJ *object) { /************************************** * @@ -873,9 +837,8 @@ pyxis__menu_d(window_handle, menu_handle, length, source, object) *object = pyxis__menu(window_handle, menu_handle, length, source); } - -pyxis__pop_window(window_handle) - WIN *window_handle; +extern "C" +int pyxis__pop_window(WIN *window_handle) { /************************************** * @@ -894,11 +857,8 @@ pyxis__pop_window(window_handle) } -pyxis__put_entree(menu_handle, entree_length, entree_text, entree_value) - MENU *menu_handle; - USHORT *entree_length; - TEXT *entree_text; - SLONG *entree_value; +int pyxis__put_entree(MENU *menu_handle, USHORT *entree_length, + TEXT *entree_text, SLONG *entree_value) { /************************************** * @@ -927,14 +887,12 @@ pyxis__put_entree(menu_handle, entree_length, entree_text, entree_value) *tp = *fp; *tp = '\0'; - PYXIS_create_entree(object, entree_buffer, attype_numeric, *entree_value); + PYXIS_create_entree(object, entree_buffer, attype_numeric, (BLK) *entree_value); } -pyxis__reset_form(status, map_handle) - STATUS *status; - MAP *map_handle; +int pyxis__reset_form(STATUS *status, MAP *map_handle) { /************************************** * @@ -966,8 +924,7 @@ pyxis__reset_form(status, map_handle) } -pyxis__suspend_window(window_handle) - SLONG *window_handle; +int pyxis__suspend_window(SLONG *window_handle) { /************************************** * @@ -981,11 +938,11 @@ pyxis__suspend_window(window_handle) **************************************/ if (*window_handle) - PYXIS_disable_window(*window_handle); + PYXIS_disable_window((WIN) *window_handle); } -static error(STATUS * status, TEXT * text, ...) +static int error(STATUS * status, TEXT * text, ...) { /************************************** * @@ -1006,10 +963,7 @@ static error(STATUS * status, TEXT * text, ...) } -static OBJ find_field(map, form, tail) - MAP map; - OBJ form; - struct map_repeat *tail; +static OBJ find_field(MAP map, OBJ form, map::map_repeat *tail) { /************************************** * @@ -1046,11 +1000,7 @@ static OBJ find_field(map, form, tail) } -static get_blob(form, desc, db_handle, tra_handle) - OBJ form; - DSC *desc; - SLONG **db_handle; - SLONG **tra_handle; +static int get_blob(OBJ form, DSC *desc, SLONG **db_handle, SLONG **tra_handle) { /************************************** * @@ -1069,7 +1019,7 @@ static get_blob(form, desc, db_handle, tra_handle) SLONG *blob_handle, *blob_id; STATUS status_vector[20]; - source = PYXIS__OPT_NULL; + source = PYXIS_OPT_NULL; if (!*db_handle || !*tra_handle) return source; @@ -1080,7 +1030,7 @@ static get_blob(form, desc, db_handle, tra_handle) attribute = PYXIS_find_object(form, attribute, att_field, TRUE);) { field = attribute->att_value; if (GET_VALUE(field, att_data)) { - source = PYXIS__OPT_INITIAL; + source = PYXIS_OPT_INITIAL; break; } } @@ -1096,7 +1046,7 @@ static get_blob(form, desc, db_handle, tra_handle) attribute = PYXIS_find_object(form, attribute, att_field, TRUE);) { field = attribute->att_value; if (GET_VALUE(field, att_update_data)) { - source = PYXIS__OPT_USER_DATA; + source = PYXIS_OPT_USER_DATA; break; } } @@ -1109,11 +1059,11 @@ static get_blob(form, desc, db_handle, tra_handle) blob_handle = NULL; if (gds__create_blob(status_vector, - GDS_VAL(db_handle), - GDS_VAL(tra_handle), - GDS_REF(blob_handle), GDS_VAL(desc->dsc_address))) { + (void**)GDS_VAL(db_handle), + (void**)GDS_VAL(tra_handle), + (void**)GDS_REF(blob_handle), (GDS__QUAD*)GDS_VAL(desc->dsc_address))) { gds__print_status(status_vector); - return PYXIS__OPT_NULL; + return PYXIS_OPT_NULL; } for (n = 1;; n++) { @@ -1128,19 +1078,16 @@ static get_blob(form, desc, db_handle, tra_handle) *p = 0; length = p - buffer; if (gds__put_segment(status_vector, - GDS_REF(blob_handle), length, buffer)) break; + (void**)GDS_REF(blob_handle), length, buffer)) break; } - gds__close_blob(status_vector, GDS_REF(blob_handle)); + gds__close_blob(status_vector, (void**)GDS_REF(blob_handle)); return source; } -static get_field_value(window, form, field, desc) - WIN window; - OBJ form, field; - DSC *desc; +static int get_field_value(WIN window, OBJ form, OBJ field, DSC *desc) { /************************************** * @@ -1162,24 +1109,24 @@ static get_field_value(window, form, field, desc) desc2.dsc_length = 256; desc2.dsc_scale = 0; - PYXIS_push_handler(unwind); + PYXIS_push_handler((int (*)()) unwind); if (desc2.dsc_address = (UCHAR *) GET_STRING(field, att_update_data)) - source = PYXIS__OPT_USER_DATA; + source = PYXIS_OPT_USER_DATA; else if (desc2.dsc_address = (UCHAR *) GET_STRING(field, att_data)) - source = PYXIS__OPT_INITIAL; + source = PYXIS_OPT_INITIAL; else if (desc2.dsc_address = (UCHAR *) GET_STRING(field, att_default_data)) source = - PYXIS__OPT_DEFAULT; + PYXIS_OPT_DEFAULT; else if (desc2.dsc_address = (UCHAR *) GET_STRING(field, att_enumeration)) - source = PYXIS__OPT_DEFAULT; + source = PYXIS_OPT_DEFAULT; else { /* desc2.dsc_address = " "; */ - source = PYXIS__OPT_NULL; + source = PYXIS_OPT_NULL; return source; } -/* if (source == PYXIS__OPT_INITIAL) +/* if (source == PYXIS_OPT_INITIAL) return source; */ @@ -1189,7 +1136,7 @@ static get_field_value(window, form, field, desc) PYXIS_set_field_options(form, "all", PYXIS_updatable | PYXIS_wakeup, PYXIS_clear); PYXIS_set_field_options(field, 0, PYXIS_updatable, PYXIS_updatable); - PYXIS_push_form(window, form); + PYXIS_push_form(window, form, 0); if (!(field_name = GET_STRING(field, att_field_name))) field_name = "(unnamed)"; sprintf(buffer, "*** %s for field %s ***", error_string, field_name); @@ -1199,33 +1146,30 @@ static get_field_value(window, form, field, desc) PYXIS_pop_form(window); PYXIS_pop_form(window); if (desc2.dsc_address = (UCHAR *) GET_STRING(field, att_update_data)) - source = PYXIS__OPT_USER_DATA; + source = PYXIS_OPT_USER_DATA; else if (desc2.dsc_address = (UCHAR *) GET_STRING(field, att_data)) - source = PYXIS__OPT_INITIAL; + source = PYXIS_OPT_INITIAL; else if (desc2.dsc_address = (UCHAR *) GET_STRING(field, att_default_data)) source = - PYXIS__OPT_DEFAULT; + PYXIS_OPT_DEFAULT; else if (desc2.dsc_address = (UCHAR *) GET_STRING(field, att_enumeration)) source = - PYXIS__OPT_DEFAULT; + PYXIS_OPT_DEFAULT; else { - source = PYXIS__OPT_NULL; - PYXIS_pop_handler(); + source = PYXIS_OPT_NULL; + PYXIS_pop_handler(0); return source; } } MOVP_move(&desc2, desc); - PYXIS_pop_handler(); + PYXIS_pop_handler(0); return source; } -static MENU par_menu(window, length, source) - WIN window; - USHORT *length; - SCHAR *source; +static MENU par_menu(WIN window, USHORT *length, SCHAR *source) { /************************************** * @@ -1247,18 +1191,18 @@ static MENU par_menu(window, length, source) p = source; c = BLR_BYTE; - object = PYXIS_create_object(0, 0); + object = PYXIS_create_object(0, (enum att_n) 0); label[0] = 0; flags = horizontal = 0; - if (c != PYXIS__MENU_VERSION1) { + if (c != PYXIS_MENU_VERSION1) { error(0, "unsupported map version %d", c); return NULL; } - while ((c = BLR_BYTE) != PYXIS__MENU_END) + while ((c = BLR_BYTE) != PYXIS_MENU_END) switch (c) { - case PYXIS__MENU_LABEL: + case PYXIS_MENU_LABEL: q = label; if (n = BLR_BYTE) do @@ -1267,7 +1211,7 @@ static MENU par_menu(window, length, source) *q = 0; break; - case PYXIS__MENU_ENTREE: + case PYXIS_MENU_ENTREE: value = BLR_BYTE; q = string; if (n = BLR_BYTE) @@ -1275,21 +1219,21 @@ static MENU par_menu(window, length, source) *q++ = BLR_BYTE; while (--n); *q = 0; - PYXIS_create_entree(object, string, attype_numeric, value); + PYXIS_create_entree(object, string, attype_numeric, (BLK) value); break; - case PYXIS__MENU_OPAQUE: + case PYXIS_MENU_OPAQUE: break; - case PYXIS__MENU_TRANSPARENT: + case PYXIS_MENU_TRANSPARENT: flags |= MENU_transparent; break; - case PYXIS__MENU_HORIZONTAL: + case PYXIS_MENU_HORIZONTAL: horizontal = TRUE; break; - case PYXIS__MENU_VERTICAL: + case PYXIS_MENU_VERTICAL: break; default: @@ -1319,9 +1263,7 @@ static MENU par_menu(window, length, source) } -static MAP par_message(status, ptr) - STATUS *status; - TEXT **ptr; +static MAP par_message(STATUS *status, TEXT **ptr) { /************************************** * @@ -1337,7 +1279,7 @@ static MAP par_message(status, ptr) TEXT *p; DSC *desc; MAP map; - struct map_repeat *tail, *end; + map::map_repeat *tail, *end; /* Get message number, register it in the compile scratch block, and allocate a node to represent the message */ @@ -1443,8 +1385,7 @@ static MAP par_message(status, ptr) } -static par_word(ptr) - TEXT **ptr; +static int par_word(TEXT **ptr) { /************************************** * @@ -1475,9 +1416,7 @@ static par_word(ptr) } -static propogate_options(tail, options) - struct map_repeat *tail; - SLONG options; +static int propogate_options(map::map_repeat *tail, SLONG options) { /************************************** * @@ -1503,10 +1442,10 @@ static propogate_options(tail, options) || attribute->att_name == att_field) { item = attribute->att_value; if (field = PYXIS_find_field(item, name)) { - if (options & PYXIS__OPT_UPDATE) + if (options & PYXIS_OPT_UPDATE) PYXIS_set_field_options(field, 0, PYXIS_updatable, PYXIS_updatable); - if (options & PYXIS__OPT_WAKEUP) + if (options & PYXIS_OPT_WAKEUP) PYXIS_set_field_options(field, 0, PYXIS_wakeup, PYXIS_wakeup); } @@ -1514,11 +1453,7 @@ static propogate_options(tail, options) } -static put_blob(field, desc, db_handle, tra_handle) - OBJ field; - DSC *desc; - SLONG **db_handle; - SLONG **tra_handle; +static int put_blob(OBJ field, DSC *desc, SLONG **db_handle, SLONG **tra_handle) { /************************************** * @@ -1544,16 +1479,16 @@ static put_blob(field, desc, db_handle, tra_handle) return FALSE; if (gds__open_blob(status_vector, - GDS_VAL(db_handle), - GDS_VAL(tra_handle), - GDS_REF(blob_handle), GDS_VAL(desc->dsc_address))) { + (void**)GDS_VAL(db_handle), + (void**)GDS_VAL(tra_handle), + (void**)GDS_REF(blob_handle), (GDS__QUAD*) GDS_VAL(desc->dsc_address))) { gds__print_status(status_vector); return FALSE; } for (index = 1;; index++) { if (gds__get_segment(status_vector, - GDS_REF(blob_handle), + (void**)GDS_REF(blob_handle), GDS_REF(length), sizeof(buffer), buffer)) break; buffer[length] = 0; @@ -1566,17 +1501,13 @@ static put_blob(field, desc, db_handle, tra_handle) PUT_ATTRIBUTE(field, att_field, attype_object, segment); } - gds__close_blob(status_vector, GDS_REF(blob_handle)); + gds__close_blob(status_vector, (void**)GDS_REF(blob_handle)); return TRUE; } -static put_value(map, slot, record, value) - MAP map; - USHORT slot; - UCHAR *record; - SLONG value; +static int put_value(MAP map, USHORT slot, UCHAR *record, SLONG value) { /************************************** * @@ -1602,8 +1533,7 @@ static put_value(map, slot, record, value) } -static unwind(error_string) - TEXT *error_string; +static int unwind(TEXT *error_string) { /************************************** * diff --git a/src/pyxis/pyxis.cpp b/src/pyxis/pyxis.cpp index f42ee186ef..111b4f8ddc 100644 --- a/src/pyxis/pyxis.cpp +++ b/src/pyxis/pyxis.cpp @@ -24,26 +24,38 @@ #include "../jrd/ib_stdio.h" #include #define PYXIS_SOURCE +#include "../pyxis/everything.h" #include "../pyxis/pyxis.h" +#include "../pyxis/scr.h" +#include "../jrd/gds_proto.h" + +#include #define BLKCHK(block, type) if (((BLK) block)->blk_type != (SCHAR)type) PYXIS_bugcheck ("bad block"); #define ABS(n) ((n >= 0) ? n : -n) -OBJ PYXIS_get_attribute_value(); - static WIN PYXIS_window; static LLS PYXIS_handlers; -ATT PYXIS_get_attribute(), PYXIS_put_attribute(), -PYXIS_replace_attribute(), PYXIS_find_object(), PYXIS_navigate(); +static int cleanup(); +static int auto_scroll(OBJ , int , int ); +static int clear_change(OBJ ); +static int get_enumerated(WIN , OBJ , ATT_N , OBJ , USHORT *); +static int related(OBJ , OBJ ); +static int reset_attribute(OBJ , ATT_N ); +static int scroll(OBJ , USHORT , SSHORT , SSHORT ); +static int set_attribute(OBJ , ATT_N , int *); -OBJ PYXIS_create_object(); - -static cleanup(); +extern BLK PYXIS_alloc(PLB , UCHAR , int ); +extern int PYXIS_release(register FRB ); +extern int PYXIS_alloc_fini(); +extern int PYXIS_alloc_init(); +extern BLK PYXIS_pop(register LLS *); +extern int PYXIS_push(BLK , register LLS *); +extern void MOVP_fast( register SCHAR * , register SCHAR * , register ULONG ); -PYXIS_bugcheck(string) - TEXT *string; +int PYXIS_bugcheck(TEXT *string) { /************************************** * @@ -61,8 +73,7 @@ PYXIS_bugcheck(string) } -OBJ PYXIS_clone(object) - OBJ object; +OBJ PYXIS_clone(OBJ object) { /************************************** * @@ -75,21 +86,21 @@ OBJ PYXIS_clone(object) * **************************************/ OBJ clone; - ATT attribute, new; + ATT attribute, new_att; BLK value; - clone = PYXIS_create_object(0, 0); + clone = PYXIS_create_object(0, (enum att_n)0); for (attribute = object->obj_attributes; attribute; attribute = attribute->att_next) { value = (BLK) attribute->att_value; if (attribute->att_type == attype_object) - value = (BLK) PYXIS_clone(value); - new = + value = (BLK) PYXIS_clone((OBJ)value); + new_att = PUT_ATTRIBUTE(clone, attribute->att_name, attribute->att_type, - value); + (OBJ) value); if (attribute == object->obj_display_attribute) - PYXIS_set_display_attribute(clone, new); + PYXIS_set_display_attribute(clone, new_att); } clone->obj_rel_x = object->obj_rel_x; @@ -106,9 +117,7 @@ OBJ PYXIS_clone(object) } -PYXIS_compute_size(object, width_ptr, height_ptr) - OBJ object; - USHORT *width_ptr, *height_ptr; +int PYXIS_compute_size(OBJ object, USHORT *width_ptr, USHORT *height_ptr) { /************************************** * @@ -149,9 +158,7 @@ PYXIS_compute_size(object, width_ptr, height_ptr) } -OBJ PYXIS_create_object(string, name) - TEXT *string; - ATT_N name; +OBJ PYXIS_create_object(TEXT *string, ATT_N name) { /************************************** * @@ -174,18 +181,17 @@ OBJ PYXIS_create_object(string, name) object = (OBJ) ALLOCP(type_obj); if (string) { - attribute = PUT_ATTRIBUTE(object, name, attype_string, string); + attribute = PUT_ATTRIBUTE(object, name, attype_string, (OBJ) string); PYXIS_set_display_attribute(object, attribute); PUT_ATTRIBUTE(object, att_width, attype_numeric, - attribute->att_length); + (OBJ) attribute->att_length); } return object; } -WIN PYXIS_create_window(width, height) - USHORT width, height; +WIN PYXIS_create_window(USHORT width, USHORT height) { /************************************** * @@ -206,23 +212,21 @@ WIN PYXIS_create_window(width, height) window = (WIN) ALLOCP(type_win); window->win_width = width; window->win_height = height; - window->win_form = PYXIS_create_object(0, 0); + window->win_form = PYXIS_create_object(0, (enum att_n) 0); if (SCR_create_window(window)) return NULL; PUT_ATTRIBUTE(window->win_form, att_width, attype_numeric, - window->win_width); + (OBJ) window->win_width); PUT_ATTRIBUTE(window->win_form, att_height, attype_numeric, - window->win_height); + (OBJ) window->win_height); return window; } -PYXIS_delete_attribute(object, attribute) - OBJ object; - ATT attribute; +int PYXIS_delete_attribute(OBJ object, ATT attribute) { /************************************** * @@ -258,13 +262,11 @@ PYXIS_delete_attribute(object, attribute) if (attribute->att_type == attype_object) PYXIS_delete_object(attribute->att_value); - PYXIS_release(attribute); + PYXIS_release((FRB) attribute); } -PYXIS_delete_named_attribute(object, name) - OBJ object; - ATT_N name; +int PYXIS_delete_named_attribute(OBJ object, ATT_N name) { /************************************** * @@ -279,15 +281,14 @@ PYXIS_delete_named_attribute(object, name) ATT attribute; if (reset_attribute(object, name)) - return; + return 0; while (attribute = GET_ATTRIBUTE(object, name)) PYXIS_delete_attribute(object, attribute); } -PYXIS_delete_object(object) - OBJ object; +int PYXIS_delete_object(OBJ object) { /************************************** * @@ -305,17 +306,16 @@ PYXIS_delete_object(object) BLKCHK(object, type_obj); if (--object->obj_reference_count) - return; + return 0; while (attribute = object->obj_attributes) PYXIS_delete_attribute(object, attribute); - PYXIS_release(object); + PYXIS_release((FRB) object); } -PYXIS_delete_window(window) - WIN window; +int PYXIS_delete_window(WIN window) { /************************************** * @@ -339,8 +339,7 @@ PYXIS_delete_window(window) } -PYXIS_disable_window(window) - WIN window; +int PYXIS_disable_window(WIN window) { /************************************** * @@ -357,8 +356,7 @@ PYXIS_disable_window(window) } -PYXIS_error(string) - TEXT *string; +int PYXIS_error(TEXT *string) { /************************************** * @@ -370,10 +368,10 @@ PYXIS_error(string) * We've got a user error. * **************************************/ - int (*handler) (); + int (*handler) (TEXT*); if (PYXIS_handlers) { - handler = (int (*)()) PYXIS_handlers->lls_object; + handler = (int (*)(TEXT*)) PYXIS_handlers->lls_object; return (*handler) (string); } @@ -381,10 +379,7 @@ PYXIS_error(string) } -ATT PYXIS_find_enumeration(parent, attribute, direction) - OBJ parent; - ATT attribute; - USHORT direction; +ATT PYXIS_find_enumeration(OBJ parent, ATT attribute, USHORT direction) { /************************************** * @@ -418,11 +413,7 @@ ATT PYXIS_find_enumeration(parent, attribute, direction) -ATT PYXIS_find_object(parent, attribute, name, direction) - OBJ parent; - ATT attribute; - ATT_N name; - USHORT direction; +ATT PYXIS_find_object(OBJ parent, ATT attribute, ATT_N name, USHORT direction) { /************************************** * @@ -456,7 +447,7 @@ ATT PYXIS_find_object(parent, attribute, name, direction) } -PYXIS_fini() +int PYXIS_fini() { /************************************** * @@ -473,9 +464,7 @@ PYXIS_fini() } -PYXIS_format_form(form, width, height) - OBJ form; - USHORT width, height; +int PYXIS_format_form(OBJ form, USHORT width, USHORT height) { /************************************** * @@ -555,9 +544,7 @@ PYXIS_format_form(form, width, height) -ATT PYXIS_get_attribute(object, name) - OBJ object; - ATT_N name; +ATT PYXIS_get_attribute(OBJ object, ATT_N name) { /************************************** * @@ -580,9 +567,7 @@ ATT PYXIS_get_attribute(object, name) } -OBJ PYXIS_get_attribute_value(object, name) - OBJ object; - ATT_N name; +OBJ PYXIS_get_attribute_value(OBJ object, ATT_N name) { /************************************** * @@ -660,10 +645,7 @@ OBJ PYXIS_get_attribute_value(object, name) } -PYXIS_get_char(window, object, x_offset, y_offset) - WIN window; - OBJ object; - int x_offset, y_offset; +int PYXIS_get_char(WIN window, OBJ object, int x_offset, int y_offset) { /************************************** * @@ -705,12 +687,7 @@ PYXIS_get_char(window, object, x_offset, y_offset) } -PYXIS_get_data(window, object, name, form, term_char) - WIN window; - OBJ object; - ATT_N name; - OBJ form; - USHORT *term_char; +int PYXIS_get_data(WIN window, OBJ object, ATT_N name, OBJ form, USHORT *term_char) { /************************************** * @@ -931,9 +908,8 @@ PYXIS_get_data(window, object, name, form, term_char) return length; } - -OBJ PYXIS_get_value(attribute) - ATT attribute; +extern "C" +OBJ PYXIS_get_value(ATT attribute) { /************************************** * @@ -952,9 +928,7 @@ OBJ PYXIS_get_value(attribute) } -SCHAR *PYXIS_get_keyname(window, key_code) - WIN window; - UCHAR key_code; +SCHAR *PYXIS_get_keyname(WIN window, UCHAR key_code) { /************************************** * @@ -978,7 +952,7 @@ SCHAR *PYXIS_get_keyname(window, key_code) } -PYXIS_init() +int PYXIS_init() { /************************************** * @@ -992,14 +966,13 @@ PYXIS_init() **************************************/ if (!PYXIS_permanent_pool) { - gds__register_cleanup(cleanup, 0); + gds__register_cleanup((void (*)(void*)) cleanup, 0); PYXIS_alloc_init(); } } -PYXIS_move(form, object) - OBJ form, object; +int PYXIS_move(OBJ form, OBJ object) { /************************************** * @@ -1023,7 +996,7 @@ PYXIS_move(form, object) break; if (!attribute) - return; + return 0; /* Indicate form needs refreshing */ @@ -1033,7 +1006,7 @@ PYXIS_move(form, object) if (form->obj_attributes == form->obj_end_attributes && form->obj_attributes == attribute) - return; + return 0; /* Splice attribute out of list */ @@ -1062,7 +1035,7 @@ PYXIS_move(form, object) prior->att_next = attribute; else form->obj_attributes = attribute; - return; + return 0; } } @@ -1077,11 +1050,7 @@ PYXIS_move(form, object) } -ATT PYXIS_navigate(form, attribute, name, c) - OBJ form; - ATT attribute; - ATT_N name; - USHORT c; +ATT PYXIS_navigate(OBJ form, ATT attribute, ATT_N name, USHORT c) { /************************************** * @@ -1213,8 +1182,7 @@ ATT PYXIS_navigate(form, attribute, name, c) } -PYXIS_pop_form(window) - WIN window; +int PYXIS_pop_form(WIN window) { /************************************** * @@ -1267,9 +1235,8 @@ if (!object) return (int) form; } - -PYXIS_pop_handler(handler) - int (*handler) (); +extern "C" +int PYXIS_pop_handler( int (*handler)() ) { /************************************** * @@ -1286,9 +1253,7 @@ PYXIS_pop_handler(handler) } -PYXIS_position(object, x, y) - OBJ object; - USHORT x, y; +int PYXIS_position(OBJ object, USHORT x, USHORT y) { /************************************** * @@ -1306,10 +1271,7 @@ PYXIS_position(object, x, y) } -PYXIS_push_form(window, form, occlude) - WIN window; - OBJ form; - USHORT occlude; +int PYXIS_push_form(WIN window, OBJ form, USHORT occlude) { /************************************** * @@ -1329,7 +1291,7 @@ PYXIS_push_form(window, form, occlude) if ((attribute = PYXIS_find_object(window->win_form, 0, att_form, FALSE)) && attribute->att_value == form) - return; + return 0; if (occlude) { SCR_clear_window(window); @@ -1358,9 +1320,8 @@ PYXIS_push_form(window, form, occlude) PUT_ATTRIBUTE(window->win_form, att_form, attype_object, form); } - -PYXIS_push_handler(handler) - int (*handler) (); +extern "C" +int PYXIS_push_handler( int (*handler)() ) { /************************************** * @@ -1373,13 +1334,11 @@ PYXIS_push_handler(handler) * **************************************/ - LLS_PUSH(handler, &PYXIS_handlers); + LLS_PUSH((BLK) handler, &PYXIS_handlers); } -PYXIS_push_tag(window, object) - WIN window; - OBJ object; +int PYXIS_push_tag(WIN window, OBJ object) { /************************************** * @@ -1401,11 +1360,7 @@ PYXIS_push_tag(window, object) -ATT PYXIS_put_attribute(object, name, type, value) - OBJ object; - ATT_N name; - ATT_T type; - OBJ value; +ATT PYXIS_put_attribute(OBJ object, ATT_N name, ATT_T type, OBJ value) { /************************************** * @@ -1429,7 +1384,7 @@ ATT PYXIS_put_attribute(object, name, type, value) /* If the attribute is special cased, don't do anything else */ - if (set_attribute(object, name, value)) + if (set_attribute(object, name, (int*) value)) return NULL; /* If value is an object, bump reference count */ @@ -1442,7 +1397,7 @@ ATT PYXIS_put_attribute(object, name, type, value) /* Allocate new attribute block */ - length = (type == attype_string) ? strlen(value) : 0; + length = (type == attype_string) ? strlen((char*) value) : 0; attribute = (ATT) ALLOCPV(type_att, length); attribute->att_type = type; attribute->att_name = name; @@ -1467,15 +1422,14 @@ ATT PYXIS_put_attribute(object, name, type, value) /* Attribute is a string, sigh, and strings must be copied */ attribute->att_value = (OBJ) attribute->att_data; - MOVP_fast(value, attribute->att_value, length); + MOVP_fast((SCHAR*) value, (SCHAR*) attribute->att_value, length); attribute->att_length = length; return attribute; } -PYXIS_reference(object) - OBJ object; +int PYXIS_reference(OBJ object) { /************************************** * @@ -1492,11 +1446,7 @@ PYXIS_reference(object) } -ATT PYXIS_replace_attribute(object, name, type, value) - OBJ object; - ATT_N name; - ATT_T type; - OBJ value; +ATT PYXIS_replace_attribute(OBJ object, ATT_N name, ATT_T type, OBJ value) { /************************************** * @@ -1518,7 +1468,7 @@ ATT PYXIS_replace_attribute(object, name, type, value) /* Handle special cased attributes */ - if (set_attribute(object, name, value)) + if (set_attribute(object, name, (int*) value)) return NULL; if (type == attype_object) { @@ -1541,9 +1491,9 @@ ATT PYXIS_replace_attribute(object, name, type, value) attribute->att_value = value; return attribute; } - length = strlen(value); + length = strlen((char*) value); if (length <= attribute->att_length) { - strcpy(attribute->att_data, value); + strcpy((char*)attribute->att_data, (char*)value); attribute->att_length = length; return attribute; } @@ -1561,9 +1511,7 @@ ATT PYXIS_replace_attribute(object, name, type, value) } -PYXIS_return_char(window, character) - WIN window; - USHORT character; +int PYXIS_return_char(WIN window, USHORT character) { /************************************** * @@ -1581,8 +1529,7 @@ PYXIS_return_char(window, character) } -PYXIS_scroll_reset(object) - OBJ object; +int PYXIS_scroll_reset(OBJ object) { /************************************** * @@ -1609,9 +1556,7 @@ PYXIS_scroll_reset(object) } -PYXIS_set_display_attribute(object, attribute) - OBJ object; - ATT attribute; +int PYXIS_set_display_attribute(OBJ object, ATT attribute) { /************************************** * @@ -1634,8 +1579,7 @@ PYXIS_set_display_attribute(object, attribute) } -PYXIS_top_form(window) - WIN window; +int PYXIS_top_form(WIN window) { /************************************** * @@ -1656,9 +1600,7 @@ PYXIS_top_form(window) } -PYXIS_trace_in(window, name) - WIN window; - SCHAR *name; +int PYXIS_trace_in(WIN window, SCHAR *name) { /************************************** * @@ -1687,9 +1629,7 @@ PYXIS_trace_in(window, name) } -PYXIS_trace_out(window, name) - WIN window; - SCHAR *name; +int PYXIS_trace_out(WIN window, SCHAR *name) { /************************************** * @@ -1714,10 +1654,7 @@ PYXIS_trace_out(window, name) } -PYXIS_update_window(window, object, x_offset, y_offset) - WIN window; - OBJ object; - int x_offset, y_offset; +int PYXIS_update_window(WIN window, OBJ object, int x_offset, int y_offset) { /************************************** * @@ -1736,9 +1673,7 @@ PYXIS_update_window(window, object, x_offset, y_offset) } -static auto_scroll(object, x_offset, y_offset) - OBJ object; - int x_offset, y_offset; +static int auto_scroll(OBJ object, int x_offset, int y_offset) { /************************************** * @@ -1810,7 +1745,7 @@ static auto_scroll(object, x_offset, y_offset) } -static cleanup() +static int cleanup() { /************************************** * @@ -1828,9 +1763,7 @@ static cleanup() } - -static clear_change(object) - OBJ object; +static int clear_change(OBJ object) { /************************************** * @@ -1846,18 +1779,14 @@ static clear_change(object) if (!(object->obj_flags & OBJ_displayed) || !PYXIS_window || !related(PYXIS_window->win_form, object)) - return; + return 0; SCR_clear_object(PYXIS_window, object); } -static get_enumerated(window, object, name, form, term_char) - WIN window; - OBJ object; - ATT_N name; - OBJ form; - USHORT *term_char; +static int get_enumerated(WIN window, OBJ object, ATT_N name, OBJ form, + USHORT *term_char) { /************************************** * @@ -1947,14 +1876,14 @@ static get_enumerated(window, object, name, form, term_char) for (temp = attribute; temp; temp = PYXIS_find_enumeration(object, temp, TRUE)) - if (!strncmp(buffer, temp->att_value, length)) + if (!strncmp(buffer, (char*)temp->att_value, length)) break; /* Check preceding attributes */ if (!temp) while (temp = PYXIS_find_enumeration(object, temp, TRUE)) - if (!strncmp(buffer, temp->att_value, length)) + if (!strncmp(buffer, (char*)temp->att_value, length)) break; /* Still can't find it, start over with string */ @@ -1965,7 +1894,7 @@ static get_enumerated(window, object, name, form, term_char) *p = 0; for (temp = NULL; temp = PYXIS_find_enumeration(object, temp, TRUE);) - if (!(strncmp(buffer, temp->att_value, 1))) + if (!(strncmp(buffer, (char*)temp->att_value, 1))) break; } @@ -1997,8 +1926,7 @@ static get_enumerated(window, object, name, form, term_char) } -static related(parent, object) - OBJ parent, object; +static int related(OBJ parent, OBJ object) { /************************************** * @@ -2028,9 +1956,7 @@ static related(parent, object) } -static reset_attribute(object, name) - OBJ object; - ATT_N name; +static int reset_attribute(OBJ object, ATT_N name) { /************************************** * @@ -2124,10 +2050,7 @@ static reset_attribute(object, name) } -static scroll(parent, relative, delta_x, delta_y) - OBJ parent; - USHORT relative; - SSHORT delta_x, delta_y; +static int scroll(OBJ parent, USHORT relative, SSHORT delta_x, SSHORT delta_y) { /************************************** * @@ -2166,10 +2089,7 @@ static scroll(parent, relative, delta_x, delta_y) -static set_attribute(object, name, value) - OBJ object; - ATT_N name; - int *value; +static int set_attribute(OBJ object, ATT_N name, int *value) { /************************************** * diff --git a/src/pyxis/pyxis.h b/src/pyxis/pyxis.h index 24b3705c47..3849fc25be 100644 --- a/src/pyxis/pyxis.h +++ b/src/pyxis/pyxis.h @@ -28,9 +28,9 @@ #include "../pyxis/keys.h" #include "../pyxis/phase1.h" -#define ALLOCD(type) PYXIS_alloc (PYXIS_default_pool, type) +#define ALLOCD(type) PYXIS_alloc (PYXIS_default_pool, type, 1) #define ALLOCDV(type,repeat) PYXIS_alloc (PYXIS_default_pool, type, repeat) -#define ALLOCP(type) PYXIS_alloc (PYXIS_permanent_pool, type) +#define ALLOCP(type) PYXIS_alloc (PYXIS_permanent_pool, type, 1) #define ALLOCPV(type,repeat) PYXIS_alloc (PYXIS_permanent_pool, type, repeat) #define IBERROR(string) PYXIS_error (string) #define BUGCHECK(string) PYXIS_bugcheck (string) @@ -39,7 +39,7 @@ #define GET_STRING(obj, att) (TEXT*) PYXIS_get_attribute_value (obj, att) #define GET_OBJECT(obj, att) PYXIS_get_attribute_value (obj, att) #define GET_ATTRIBUTE(obj, att) PYXIS_get_attribute (obj, att) -#define REPLACE_ATTRIBUTE PYXIS_replace_attribute +#define REPLACE_ATTRIBUTE(a,b,c,d) PYXIS_replace_attribute((OBJ)(a),b,c,(OBJ)(d)) #define PUT_ATTRIBUTE PYXIS_put_attribute #define SET_DISPLAY PYXIS_set_display @@ -77,129 +77,8 @@ typedef struct lls { struct lls *lls_next; } *LLS; -/* Attribute block names, types, and block */ - -typedef struct att { - struct blk att_header; - struct att *att_next; /* next attribute in object */ - struct att *att_prior; /* prior attribute in object */ - ATT_T att_type; /* attribute type */ - ATT_N att_name; /* attribute name */ - struct p_obj *att_value; - USHORT att_length; /* Allocated length for string */ - UCHAR att_data[2]; /* room for data */ -} *ATT; - -/* Menus */ - -typedef struct menx { - UCHAR *menx_string; - USHORT menx_entree; -} *MENX; - -typedef struct p_obj { - struct blk obj_header; - struct p_obj *obj_parent; - USHORT obj_reference_count; - ATT obj_attributes; /* list of attributes */ - ATT obj_end_attributes; /* end of attribute list */ - ATT obj_display_attribute; /* attribute for display (if any) */ - USHORT obj_flags; /* misc stuff */ - SSHORT obj_x; /* absolute position */ - SSHORT obj_y; /* absoute position */ - SSHORT obj_scroll_x; /* scrolled delta */ - SSHORT obj_scroll_y; /* scrolled delta */ - SSHORT obj_rel_x; /* relative position */ - SSHORT obj_rel_y; /* relative position */ - USHORT obj_width; /* displayed width */ - USHORT obj_height; /* displayed height */ - USHORT obj_occluded; - USHORT *obj_display_address; - USHORT obj_display_length; - USHORT obj_display_height; - USHORT obj_border; /* Size of border, if any */ - USHORT obj_index; /* Index in repeating group */ -} *OBJ; - -#define OBJ_changed 1 /* object has been updated */ -#define OBJ_displayed 2 /* object is currently displayed */ -#define OBJ_inactive 4 /* don't display object */ -#define OBJ_reverse_video 8 /* reverse video */ -#define OBJ_insert_right 16 /* (10) insert from right (numeric) */ -#define OBJ_bold 32 /* (20) field is bold */ -#define OBJ_underline 64 /* (40) field is underlined */ -#define OBJ_box 128 /* (80) draw box around object */ -#define OBJ_blank 256 /* (100) blank fill before drawing */ -#define OBJ_updatable_flag 512 /* (200) object may be updated*/ -#define OBJ_wakeup_flag 1024 /* (400) object will trigger wakeup*/ -#define OBJ_reverse_for_update 2048 /* (800) when updatable, set reverse video*/ -#define OBJ_menu_horizontal 4096 /* (1000) menu is horizontal*/ - - -/* Window definition */ - -/* Key names for special keys. */ - -typedef struct knm { - UCHAR knm_keycode; - SCHAR *knm_keyname; -} *KNM; - -typedef struct win { - struct blk win_header; /* Block header */ - struct win *win_parent; /* Parent window */ - struct win *win_sibling; /* Next sibling window */ - struct scr *win_logical; /* Logical screen */ - struct scr *win_physical; /* Physical screen */ - USHORT win_flags; - USHORT win_x; - USHORT win_y; - USHORT win_width; - USHORT win_height; - USHORT win_pending_char; /* "returned" character */ - OBJ win_form; - int *win_input; - int *win_output; - int *win_trace_in; - int *win_trace_out; - int win_current_x; - int win_current_y; - int win_current_mode; - int (*win_clear)(); - int (*win_disable)(); - int (*win_fini)(); - int (*win_getchar)(); - int (*win_text)(); - int (*win_update)(); - KNM win_keyname_table; -} *WIN; - -#define WIN_disabled 1 /* Forms are diabled */ -#define WIN_reset_80 2 /* Reset 80 column mode at end */ -#define WIN_synthesized 4 /* Input char was synthesized from mouse movement */ -#define WIN_sensitive 8 /* Mouse movement is sensitive */ - -/* Program wide globals */ - -#ifdef PYXIS_SOURCE -struct plb *PYXIS_default_pool = 0; -struct plb *PYXIS_permanent_pool = 0; -#else -#ifndef FRED_SOURCE -extern struct plb *PYXIS_default_pool; -extern struct plb *PYXIS_permanent_pool; -#endif -#endif - -/* Descriptor format */ - -#include "../jrd/dsc.h" - -/* Picture string handling block */ - -#include "../qli/format.h" - -/* Phase 3 record <-> form map */ +/* Grab all our function prototypes */ +#include "../pyxis/pyxis_proto.h" typedef struct map { struct blk map_header; @@ -230,18 +109,6 @@ typedef struct map { #define MAP_transparent 8 #define MAP_tag 16 -/* Menu block */ - -typedef struct menu { - struct blk menu_header; - OBJ menu_object; - USHORT menu_flags; - ATT menu_current_entree; /* current entree in dynamic menu */ -} *MENU; - -/* #define MENU_horizontal 1 moved to object block */ -#define MENU_transparent 2 - /* Random string block -- jack of all kludges */ typedef struct str { @@ -250,4 +117,5 @@ typedef struct str { SCHAR str_data[2]; } *STR; + #endif /* _PYXIS_PYXIS_H_ */ diff --git a/src/pyxis/scr.cpp b/src/pyxis/scr.cpp index 7759d320dc..67c64f14dc 100644 --- a/src/pyxis/scr.cpp +++ b/src/pyxis/scr.cpp @@ -23,10 +23,12 @@ #include "../pyxis/pyxis.h" #include "../pyxis/scr.h" +#include "../pyxis/all.h" +#include -static SCR create_screen(); - -static windows; +extern int CDM_create_window(WIN ); +extern int VT100_create_window(WIN ); +extern BLK PYXIS_alloc(PLB , UCHAR , int ); typedef struct { SSHORT min_x; @@ -35,14 +37,23 @@ typedef struct { SSHORT max_y; } REGION; +static SCR create_screen(); +static int clear_object(SCR, OBJ); +static SCR create_screen(USHORT , USHORT ); +static int display(SCR , REGION , OBJ , OBJ , USHORT ); +static int update_line(WIN , USHORT , USHORT *, USHORT *); +static int set_point(USHORT , USHORT , REGION , SCR , USHORT ); +static int display_box(SCR , REGION , OBJ ); +static int clear_screen(SCR ); + +static int windows; + #ifdef DEBUG static debug; #endif -SCR_clear_object(window, object) - WIN window; - OBJ object; +int SCR_clear_object(WIN window, OBJ object) { /************************************** * @@ -59,8 +70,7 @@ SCR_clear_object(window, object) } -SCR_clear_window(window) - WIN window; +int SCR_clear_window(WIN window) { /************************************** * @@ -80,8 +90,7 @@ SCR_clear_window(window) } -SCR_create_window(window) - WIN window; +int SCR_create_window(WIN window) { /************************************** * @@ -124,14 +133,13 @@ SCR_create_window(window) create_screen(window->win_width, window->win_height); window->win_physical = create_screen(window->win_width, window->win_height); - (*window->win_clear) (window); + (*(int (*)(WIN))window->win_clear) (window); return SUCCESS; } -SCR_disable(window) - WIN window; +int SCR_disable(WIN window) { /************************************** * @@ -145,13 +153,12 @@ SCR_disable(window) * **************************************/ - (*window->win_disable) (window); + (*(int (*)(WIN)) window->win_disable) (window); clear_screen(window->win_physical); } -SCR_fini(window) - WIN window; +int SCR_fini(WIN window) { /************************************** * @@ -165,16 +172,13 @@ SCR_fini(window) **************************************/ --windows; - (*window->win_fini) (window); - PYXIS_release(window->win_logical); - PYXIS_release(window->win_physical); + (*(int (*)(WIN)) window->win_fini) (window); + PYXIS_release((FRB) window->win_logical); + PYXIS_release((FRB) window->win_physical); } -SCR_getchar(window, object, x_offset, y_offset) - WIN window; - OBJ object; - int x_offset, y_offset; +int SCR_getchar(WIN window, OBJ object, int x_offset, int y_offset) { /************************************** * @@ -194,19 +198,16 @@ SCR_getchar(window, object, x_offset, y_offset) } if (!object) - return (*window->win_getchar) (window, x_offset, y_offset); + return (*(int (*)(WIN, int, int)) window->win_getchar) (window, x_offset, y_offset); x = object->obj_x + x_offset; y = object->obj_y + y_offset; - return (*window->win_getchar) (window, x, y); + return (*(int (*)(WIN, int, int)) window->win_getchar) (window, x, y); } -SCR_refresh_window(window, object, x_offset, y_offset) - WIN window; - OBJ object; - int x_offset, y_offset; +int SCR_refresh_window(WIN window, OBJ object, int x_offset, int y_offset) { /************************************** * @@ -220,7 +221,7 @@ SCR_refresh_window(window, object, x_offset, y_offset) **************************************/ OBJ form; - (*window->win_clear) (window); + (*(int (*)(WIN)) window->win_clear) (window); clear_screen(window->win_physical); form = window->win_form; form->obj_flags |= OBJ_changed; @@ -228,10 +229,7 @@ SCR_refresh_window(window, object, x_offset, y_offset) } -SCR_update_window(window, object, x_offset, y_offset) - WIN window; - OBJ object; - int x_offset, y_offset; +int SCR_update_window(WIN window, OBJ object, int x_offset, int y_offset) { /************************************** * @@ -269,7 +267,7 @@ SCR_update_window(window, object, x_offset, y_offset) thing now. */ if (logical->scr_flags & SCR_clear) { - (*window->win_clear) (window); + (*(int (*)(WIN)) window->win_clear) (window); clear_screen(physical); logical->scr_flags &= ~SCR_clear; } @@ -296,13 +294,11 @@ SCR_update_window(window, object, x_offset, y_offset) y = window->win_height; } - (*window->win_update) (window, x, y); + (*(int(*)(WIN, int, int)) window->win_update) (window, x, y); } -static clear_box(screen, object) - SCR screen; - OBJ object; +static int clear_box(SCR screen, OBJ object) { /************************************** * @@ -334,9 +330,7 @@ static clear_box(screen, object) -static clear_object(screen, object) - SCR screen; - OBJ object; +static int clear_object(SCR screen, OBJ object) { /************************************** * @@ -353,7 +347,7 @@ static clear_object(screen, object) SSHORT l; if (object->obj_occluded || (object->obj_flags & OBJ_inactive)) - return; + return 0; object->obj_flags &= ~OBJ_displayed; @@ -383,8 +377,7 @@ static clear_object(screen, object) } -static clear_screen(screen) - SCR screen; +static int clear_screen(SCR screen) { /************************************** * @@ -406,8 +399,7 @@ static clear_screen(screen) } -static SCR create_screen(width, height) - USHORT width, height; +static SCR create_screen(USHORT width, USHORT height) { /************************************** * @@ -436,11 +428,7 @@ static SCR create_screen(width, height) } -static display(screen, clip, object, parent, force) - SCR screen; - REGION clip; - OBJ object, parent; - USHORT force; +static int display(SCR screen, REGION clip, OBJ object, OBJ parent, USHORT force) { /************************************** * @@ -458,7 +446,7 @@ static display(screen, clip, object, parent, force) ATT attribute; if (object->obj_occluded || (object->obj_flags & OBJ_inactive)) - return; + return 0; if (object->obj_flags & OBJ_changed) force = TRUE; @@ -563,10 +551,7 @@ static display(screen, clip, object, parent, force) } -static display_box(screen, clip, object) - SCR screen; - REGION clip; - OBJ object; +static int display_box(SCR screen, REGION clip, OBJ object) { /************************************** * @@ -590,7 +575,7 @@ static display_box(screen, clip, object) max_y = MIN(bottom, clip.max_y); if (min_x >= max_x || min_y >= max_y) - return; + return 0; object->obj_display_length = max_x - min_x; object->obj_display_height = max_y - min_y; @@ -624,7 +609,7 @@ static display_box(screen, clip, object) /* Unless the object is explicitly outlined, we're done */ if (!(object->obj_flags & OBJ_box)) - return; + return 0; /* Groan -- fill in the corners */ @@ -634,16 +619,12 @@ static display_box(screen, clip, object) set_point(object->obj_x, object->obj_y + object->obj_height - 1, clip, screen, C_LL_CORNER | mode); set_point(object->obj_x + object->obj_width - 1, - object->obj_y + object->obj_height - 1, clip, screen, - C_LR_CORNER | mode); + object->obj_y + object->obj_height - 1, clip, + screen, C_LR_CORNER | mode); } -static set_point(x, y, clip, screen, value) - USHORT x, y; - REGION clip; - SCR screen; - USHORT value; +static int set_point(USHORT x, USHORT y, REGION clip, SCR screen, USHORT value) { /************************************** * @@ -667,9 +648,7 @@ static set_point(x, y, clip, screen, value) } -static update_line(window, y, logical, physical) - WIN window; - USHORT y, *logical, *physical; +static int update_line(WIN window, USHORT y, USHORT *logical, USHORT *physical) { /************************************** * diff --git a/src/pyxis/scr.h b/src/pyxis/scr.h index 7746813963..5a286a87be 100644 --- a/src/pyxis/scr.h +++ b/src/pyxis/scr.h @@ -49,4 +49,13 @@ typedef struct scr { #define SCR_bold 2 /* Bold characters */ #define SCR_underline 4 /* Underlined text */ +extern int SCR_create_window(WIN ); +extern int SCR_fini(WIN ); +extern int SCR_disable(WIN ); +extern int SCR_getchar(WIN , OBJ , int , int ); +extern int SCR_refresh_window(WIN , OBJ , int , int ); +extern int SCR_clear_window(WIN ); +extern int SCR_update_window(WIN , OBJ , int , int ); +extern int SCR_clear_object(WIN , OBJ ); + #endif /* _PYXIS_SCR_H_ */ diff --git a/src/pyxis/sun_ftn_pyxis.cpp b/src/pyxis/sun_ftn_pyxis.cpp index 03efb78cbb..df5c6564cf 100644 --- a/src/pyxis/sun_ftn_pyxis.cpp +++ b/src/pyxis/sun_ftn_pyxis.cpp @@ -29,6 +29,7 @@ #include #include "../jrd/common.h" #include "../include/jrd/gds.h" +#include "../pyxis/everything.h" #undef GDS_VAL #define GDS_VAL(val) (*val) @@ -58,12 +59,7 @@ typedef struct handle { #define PYXIS_SUSPEND_WINDOW pyxis__suspend_window_ -PYXIS_COMPILE_MAP(status, form_handle, map_handle, length, source) - STATUS *status; - OBJ *form_handle; - MAP *map_handle; - ULONG *length; - TEXT *source; +int PYXIS_COMPILE_MAP(STATUS *status, OBJ *form_handle, MAP *map_handle, ULONG *length, TEXT *source) { /************************************** * @@ -83,11 +79,7 @@ PYXIS_COMPILE_MAP(status, form_handle, map_handle, length, source) } -PYXIS_COMPILE_MENU(window_handle, menu_handle, length, source) - WIN *window_handle; - MENU *menu_handle; - USHORT *length; - TEXT *source; +int PYXIS_COMPILE_MENU(WIN *window_handle, MENU *menu_handle, USHORT *length, TEXT *source) { /************************************** * @@ -105,12 +97,7 @@ PYXIS_COMPILE_MENU(window_handle, menu_handle, length, source) -PYXIS_COMPILE_SUB_MAP(status, parent_handle, map_handle, length, source) - STATUS *status; - MAP *parent_handle; - MAP *map_handle; - ULONG *length; - TEXT *source; +int PYXIS_COMPILE_SUB_MAP(STATUS *status, MAP *parent_handle, MAP *map_handle, ULONG *length, TEXT *source) { /************************************** * @@ -131,12 +118,7 @@ PYXIS_COMPILE_SUB_MAP(status, parent_handle, map_handle, length, source) -PYXIS_CREATE_WINDOW(window_handle, file_name_length, file_name, width, height) - - WIN *window_handle; - ULONG *file_name_length; - TEXT *file_name; - USHORT *width, *height; +int PYXIS_CREATE_WINDOW(WIN *window_handle, ULONG *file_name_length, TEXT *file_name, USHORT *width, USHORT *height) { /************************************** * @@ -157,8 +139,7 @@ PYXIS_CREATE_WINDOW(window_handle, file_name_length, file_name, width, height) } -PYXIS_DELETE(object) - OBJ *object; +int PYXIS_DELETE(OBJ *object) { /************************************** * @@ -174,8 +155,7 @@ PYXIS_DELETE(object) } -PYXIS_DELETE_WINDOW(window_handle) - SLONG *window_handle; +int PYXIS_DELETE_WINDOW(SLONG *window_handle) { /************************************** * @@ -191,13 +171,8 @@ PYXIS_DELETE_WINDOW(window_handle) } -PYXIS_DRIVE_FORM(status, db_handle, tra_handle, window_handle, map_handle, - input, output) - STATUS *status; - SLONG **db_handle, *tra_handle; - WIN *window_handle; - MAP *map_handle; - UCHAR *input, *output; +int PYXIS_DRIVE_FORM(STATUS *status, SLONG **db_handle, SLONG **tra_handle, WIN *window_handle, MAP *map_handle, + UCHAR *input, UCHAR *output) { /************************************** * @@ -214,19 +189,9 @@ PYXIS_DRIVE_FORM(status, db_handle, tra_handle, window_handle, map_handle, } -PYXIS_DRIVE_MENU(window_handle, menu_handle, blr_length, - blr_source, title_length, title, terminator, - entree_length, entree_text, entree_value) - WIN *window_handle; - MENU *menu_handle; - SLONG *blr_length; - TEXT *blr_source; - USHORT *title_length; - TEXT *title; - USHORT *terminator; - USHORT *entree_length; - TEXT *entree_text; - SLONG *entree_value; +int PYXIS_DRIVE_MENU(WIN *window_handle, MENU *menu_handle, SLONG *blr_length, + TEXT *blr_source, USHORT *title_length, TEXT *title, USHORT *terminator, + USHORT *entree_length, TEXT *entree_text, SLONG *entree_value) { /************************************** * @@ -246,12 +211,8 @@ PYXIS_DRIVE_MENU(window_handle, menu_handle, blr_length, entree_length, entree_text, entree_value); } - -PYXIS_FETCH(status, db_handle, tra_handle, map_handle, output) - STATUS *status; - SLONG **db_handle, *tra_handle; - MAP *map_handle; - UCHAR *output; +int +PYXIS_FETCH(STATUS *status, SLONG **db_handle, SLONG *tra_handle, MAP *map_handle, UCHAR *output) { /************************************** * @@ -267,13 +228,8 @@ PYXIS_FETCH(status, db_handle, tra_handle, map_handle, output) } -PYXIS_GET_ENTREE(menu_handle, entree_length, - entree_text, entree_value, entree_end) - MENU *menu_handle; - USHORT *entree_length; - TEXT *entree_text; - SLONG *entree_value; - USHORT *entree_end; +int PYXIS_GET_ENTREE(MENU *menu_handle, USHORT *entree_length, + TEXT *entree_text, SLONG *entree_value, USHORT *entree_end) { /************************************** * @@ -290,8 +246,7 @@ PYXIS_GET_ENTREE(menu_handle, entree_length, } -PYXIS_INITIALIZE_MENU(menu_handle) - MENU *menu_handle; +int PYXIS_INITIALIZE_MENU(MENU *menu_handle) { /************************************** * @@ -307,11 +262,7 @@ PYXIS_INITIALIZE_MENU(menu_handle) } -PYXIS_INSERT(status, db_handle, tra_handle, map_handle, input) - STATUS *status; - SLONG **db_handle, *tra_handle; - MAP *map_handle; - UCHAR *input; +int PYXIS_INSERT(STATUS *status, SLONG **db_handle, SLONG *tra_handle, MAP *map_handle, UCHAR *input) { /************************************** * @@ -327,13 +278,8 @@ PYXIS_INSERT(status, db_handle, tra_handle, map_handle, input) } -PYXIS_LOAD_FORM(status_vector, dbb, transaction, - form_handle, form_name_length, form_name) - STATUS *status_vector; - SLONG *dbb, *transaction; - OBJ *form_handle; - ULONG *form_name_length; - TEXT *form_name; +int PYXIS_LOAD_FORM(STATUS *status_vector, SLONG *dbb, SLONG *transaction, + OBJ *form_handle, ULONG *form_name_length, TEXT *form_name) { /************************************** * @@ -354,11 +300,7 @@ PYXIS_LOAD_FORM(status_vector, dbb, transaction, } -OBJ PYXIS_MENU(window_handle, menu_handle, length, source) - WIN *window_handle; - MENU *menu_handle; - USHORT *length; - TEXT *source; +OBJ PYXIS_MENU(WIN *window_handle, MENU *menu_handle, USHORT *length, TEXT *source) { /************************************** * @@ -374,8 +316,7 @@ OBJ PYXIS_MENU(window_handle, menu_handle, length, source) } -PYXIS_POP_WINDOW(window_handle) - WIN *window_handle; +int PYXIS_POP_WINDOW(WIN *window_handle) { /************************************** * @@ -391,11 +332,7 @@ PYXIS_POP_WINDOW(window_handle) } -PYXIS_PUT_ENTREE(menu_handle, entree_length, entree_text, entree_value) - MENU *menu_handle; - USHORT *entree_length; - TEXT *entree_text; - SLONG *entree_value; +int PYXIS_PUT_ENTREE(MENU *menu_handle, USHORT *entree_length, TEXT *entree_text, SLONG *entree_value) { /************************************** * @@ -411,9 +348,7 @@ PYXIS_PUT_ENTREE(menu_handle, entree_length, entree_text, entree_value) } -PYXIS_RESET_FORM(status, map_handle) - STATUS *status; - MAP *map_handle; +int PYXIS_RESET_FORM(STATUS *status, MAP *map_handle) { /************************************** * @@ -429,8 +364,7 @@ PYXIS_RESET_FORM(status, map_handle) } -PYXIS_SUSPEND_WINDOW(window_handle) - SLONG *window_handle; +int PYXIS_SUSPEND_WINDOW(SLONG *window_handle) { /************************************** * diff --git a/src/pyxis/vt100.cpp b/src/pyxis/vt100.cpp index 7c98e12d12..1884febd73 100644 --- a/src/pyxis/vt100.cpp +++ b/src/pyxis/vt100.cpp @@ -44,9 +44,30 @@ #include #endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_UIO_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + static USHORT width, height, graphics_mode; -static int clear_window(), disable(), fini(), get_char(), text(), -update_window(); + +static int text(WIN , UCHAR*, SSHORT , SSHORT , SSHORT , USHORT); +static int clear_window(WIN ); +static int disable(WIN ); +static int disable_forms(WIN); +static int enable_forms(WIN ); +static int get_char(WIN , int , int ); +static int get_input(WIN , UCHAR *); +static int get_size(WIN , int *, int *); +static int position(WIN , SSHORT , SSHORT ); +static int read_char(WIN ); +static int update_window(WIN , int , int ); +static int fini(WIN ); typedef struct seq { UCHAR seq_key; @@ -118,8 +139,7 @@ static UCHAR keypad[256], keypad_equiv[] = { }; -VT100_create_window(window) - WIN window; +int VT100_create_window(WIN window) { /************************************** * @@ -138,12 +158,12 @@ VT100_create_window(window) /* Populate window with action routines */ - window->win_clear = clear_window; - window->win_disable = disable; - window->win_fini = fini; - window->win_getchar = get_char; + window->win_clear = (int (*)()) clear_window; + window->win_disable = (int (*)()) disable; + window->win_fini = (int (*)()) fini; + window->win_getchar = (int (*)()) get_char; window->win_text = text; - window->win_update = update_window; + window->win_update = (int (*)()) update_window; if ((int) (window->win_input = (int *) open("/dev/tty", O_RDWR, 0660)) < 0) @@ -181,8 +201,7 @@ VT100_create_window(window) } -static clear_window(window) - WIN window; +static int clear_window(WIN window) { /************************************** * @@ -205,8 +224,7 @@ static clear_window(window) } -static disable(window) - WIN window; +static int disable(WIN window) { /************************************** * @@ -225,8 +243,7 @@ static disable(window) #ifndef LINUX -static disable_forms(window) - WIN window; +static int disable_forms(WIN window) { /************************************** * @@ -243,7 +260,7 @@ static disable_forms(window) #ifndef VMS struct sgttyb cruft; - n = ioctl(window->win_input, TIOCGETP, &cruft); + n = ioctl((int) window->win_input, TIOCGETP, &cruft); /* If CBREAK is not supported by ioctl, use RAW. (for HP) */ @@ -254,7 +271,7 @@ static disable_forms(window) #endif cruft.sg_flags |= ECHO; /* ECHO on */ - n = ioctl(window->win_input, TIOCSETP, &cruft); + n = ioctl((int) window->win_input, TIOCSETP, &cruft); #endif /* Set normal characters, numeric keypad, non-graphics */ @@ -265,8 +282,7 @@ static disable_forms(window) window->win_current_mode = 0; } #else /** Linux Stub **/ -static disable_forms(window) - WIN window; +static int disable_forms(WIN window) { /************************************** * @@ -284,8 +300,7 @@ static disable_forms(window) #ifndef LINUX -static enable_forms(window) - WIN window; +static int enable_forms(WIN window) { /************************************** * @@ -302,7 +317,7 @@ static enable_forms(window) #ifndef VMS struct sgttyb cruft; - n = ioctl(window->win_input, TIOCGETP, &cruft); + n = ioctl((int) window->win_input, TIOCGETP, &cruft); /* If CBREAK is not supported by ioctl, use RAW. (for HP) */ @@ -313,7 +328,7 @@ static enable_forms(window) #endif cruft.sg_flags &= ~ECHO; /* ECHO off */ - n = ioctl(window->win_input, TIOCSETP, &cruft); + n = ioctl((int) window->win_input, TIOCSETP, &cruft); #endif window->win_current_mode = 0; @@ -321,8 +336,7 @@ static enable_forms(window) clear_window(window); } #else /** stub function for LINUX **/ -static enable_forms(window) - WIN window; +static int enable_forms(WIN window) { /************************************** * @@ -338,8 +352,7 @@ static enable_forms(window) #endif -static fini(window) - WIN window; +static int fini(WIN window) { /************************************** * @@ -360,8 +373,7 @@ static fini(window) } -static get_char(window, x, y) - WIN window; +static int get_char(WIN window, int x, int y) { /************************************** * @@ -423,9 +435,7 @@ static get_char(window, x, y) } -static get_input(window, buffer) - WIN window; - UCHAR *buffer; +static int get_input(WIN window, UCHAR *buffer) { /************************************** * @@ -480,9 +490,7 @@ static get_input(window, buffer) } -static get_size(window, width, height) - WIN window; - int *width, *height; +static int get_size(WIN window, int *width, int *height) { /************************************** * @@ -502,7 +510,7 @@ static get_size(window, width, height) position(window, 999, 999); fputs("\33[6n", (FILE *) window->win_output); fflush((FILE *) window->win_output); - n = get_input(window, buffer); + n = get_input(window, (UCHAR*) buffer); buffer[n] = 0; n = sscanf(buffer, "\33[%d;%dR", height, width); @@ -510,9 +518,7 @@ static get_size(window, width, height) } -static position(window, x, y) - WIN window; - SSHORT x, y; +static int position(WIN window, SSHORT x, SSHORT y) { /************************************** * @@ -536,8 +542,7 @@ static position(window, x, y) } -static read_char(window) - WIN window; +static int read_char(WIN window) { /************************************** * @@ -551,7 +556,7 @@ static read_char(window) **************************************/ SCHAR c; - if (read(window->win_input, &c, 1) <= 0) + if (read((int) window->win_input, &c, 1) <= 0) return 0; return c; @@ -560,11 +565,7 @@ static read_char(window) -static text(window, string, length, x, y, mode) - WIN window; - UCHAR *string; - SSHORT length, x, y; - USHORT mode; +static int text(WIN window, UCHAR*string, SSHORT length, SSHORT x, SSHORT y, USHORT mode) { /************************************** * @@ -636,9 +637,7 @@ static text(window, string, length, x, y, mode) } -static update_window(window, x, y) - WIN window; - int x, y; +static int update_window(WIN window, int x, int y) { /************************************** * diff --git a/src/qli/all.cpp b/src/qli/all.cpp index 136b3165b9..7c0471cd94 100644 --- a/src/qli/all.cpp +++ b/src/qli/all.cpp @@ -21,7 +21,7 @@ * Contributor(s): ______________________________________. */ /* -$Id: all.cpp,v 1.1.1.1 2001-05-23 13:26:34 tamlin Exp $ +$Id: all.cpp,v 1.2 2001-07-12 05:46:05 bellardo Exp $ */ /*************************************************** @@ -167,25 +167,25 @@ BLK ALLQ_extend(BLK * pointer, int size) * Extend a repeating block, copying the constant part. * **************************************/ - BLK block, new; + BLK block, new_blk; register int length; block = *pointer; - new = (BLK) ALLQ_alloc(pools->vec_object[block->blk_pool_id], + new_blk = (BLK) ALLQ_alloc((PLB) pools->vec_object[block->blk_pool_id], block->blk_type, size); - length = MIN(block->blk_length, new->blk_length) - sizeof(struct blk); - MOVQ_fast((UCHAR *) block + sizeof(struct blk), - (UCHAR *) new + sizeof(struct blk), length); - ALLQ_release(block); + length = MIN(block->blk_length, new_blk->blk_length) - sizeof(struct blk); + MOVQ_fast((SCHAR *) block + sizeof(struct blk), + (SCHAR *) new_blk + sizeof(struct blk), length); + ALLQ_release((FRB) block); - if (new->blk_type == (SCHAR) type_vec) - ((VEC) new)->vec_count = size; - else if (new->blk_type == (SCHAR) type_vcl) - ((VCL) new)->vcl_count = size; + if (new_blk->blk_type == (SCHAR) type_vec) + ((VEC) new_blk)->vec_count = size; + else if (new_blk->blk_type == (SCHAR) type_vcl) + ((VCL) new_blk)->vcl_count = size; - *pointer = new; + *pointer = new_blk; - return new; + return new_blk; } @@ -307,7 +307,7 @@ PLB ALLQ_pool(void) break; if (pool_id >= pools->vec_count) - ALLQ_extend(&pools, pool_id + 10); + ALLQ_extend((BLK*) &pools, pool_id + 10); pools->vec_object[pool_id] = (BLK) & temp_pool; temp_pool.plb_free = NULL; @@ -503,7 +503,7 @@ static void extend_pool( PLB pool, USHORT count) block->blk_length = size; block->blk_type = (SCHAR) type_frb; block->blk_pool_id = pool->plb_pool_id; - ALLQ_release(block); + ALLQ_release((FRB) block); hunk = (HNK) ALLQ_alloc(pool, type_hnk, 0); hunk->hnk_address = (SCHAR *) block; diff --git a/src/qli/command.cpp b/src/qli/command.cpp index e0c0612243..4ca508b499 100644 --- a/src/qli/command.cpp +++ b/src/qli/command.cpp @@ -46,7 +46,7 @@ static void extract_procedure(IB_FILE *, TEXT *, USHORT, DBB, SLONG *); extern USHORT QLI_lines, QLI_columns, QLI_form_mode, QLI_name_columns; static SCHAR db_items[] = - { gds__info_page_size, gds__info_allocation, gds__info_end }; + { gds_info_page_size, gds_info_allocation, gds_info_end }; int CMD_check_ready(void) @@ -191,7 +191,7 @@ void CMD_extract( SYN node) IB_FILE *file; int *blob; - file = EXEC_open_output(node->syn_arg[1]); + file = (IB_FILE*) EXEC_open_output((NOD) node->syn_arg[1]); if (list = node->syn_arg[0]) for (ptr = list->syn_arg, end = ptr + list->syn_count; ptr < end; @@ -200,7 +200,7 @@ void CMD_extract( SYN node) if (!(database = proc->qpr_database)) database = QLI_databases; name = proc->qpr_name; - if (!(blob = PRO_fetch_procedure(database, name->nam_string))) { + if (!(blob = (int*) PRO_fetch_procedure(database, name->nam_string))) { ERRQ_msg_put(89, /* Msg89 Procedure %s not found in database %s */ name->nam_string, database->dbb_symbol->sym_string, NULL, NULL, @@ -214,7 +214,7 @@ void CMD_extract( SYN node) CMD_check_ready(); for (database = QLI_databases; database; database = - database->dbb_next) PRO_scan(database, extract_procedure, file); + database->dbb_next) PRO_scan(database, (void (*)()) extract_procedure, file); } #ifdef WIN_NT @@ -247,7 +247,7 @@ void CMD_finish( SYN node) } for (i = 0; i < node->syn_count; i++) - MET_finish(node->syn_arg[i]); + MET_finish((DBB) node->syn_arg[i]); } @@ -350,7 +350,7 @@ void CMD_set( SYN node) length = MIN(string->con_desc.dsc_length, sizeof(QLI_default_password)); - strncpy(QLI_default_password, string->con_data, length); + strncpy(QLI_default_password, (char*) string->con_data, length); QLI_default_password[length] = 0; break; @@ -358,7 +358,7 @@ void CMD_set( SYN node) string = (CON) value; if (string->con_desc.dsc_length > sizeof(QLI_prompt_string)) ERRQ_error(86, NULL, NULL, NULL, NULL, NULL); /* Msg86 substitute prompt string too long */ - strncpy(QLI_prompt_string, string->con_data, + strncpy(QLI_prompt_string, (char*) string->con_data, string->con_desc.dsc_length); QLI_prompt_string[string->con_desc.dsc_length] = 0; break; @@ -367,21 +367,21 @@ void CMD_set( SYN node) string = (CON) value; if (string->con_desc.dsc_length > sizeof(QLI_cont_string)) ERRQ_error(87, NULL, NULL, NULL, NULL, NULL); /* Msg87 substitute prompt string too long */ - strncpy(QLI_cont_string, string->con_data, + strncpy(QLI_cont_string, (char*) string->con_data, string->con_desc.dsc_length); QLI_cont_string[string->con_desc.dsc_length] = 0; break; case set_matching_language: if (QLI_matching_language) - ALLQ_release(QLI_matching_language); + ALLQ_release((FRB) QLI_matching_language); if (!(string = (CON) value)) { QLI_matching_language = NULL; break; } QLI_matching_language = (CON) ALLOCPV(type_con, string->con_desc.dsc_length); - strncpy(QLI_matching_language->con_data, string->con_data, + strncpy((char*)QLI_matching_language->con_data, (char*)string->con_data, string->con_desc.dsc_length); QLI_matching_language->con_desc.dsc_dtype = dtype_text; QLI_matching_language->con_desc.dsc_address = @@ -400,7 +400,7 @@ void CMD_set( SYN node) string = (CON) value; length = MIN(string->con_desc.dsc_length, sizeof(QLI_default_user)); - strncpy(QLI_default_user, string->con_data, length); + strncpy(QLI_default_user, (char*)string->con_data, length); QLI_default_user[length] = 0; break; diff --git a/src/qli/compile.cpp b/src/qli/compile.cpp index 0f1aa37950..8a681f0a38 100644 --- a/src/qli/compile.cpp +++ b/src/qli/compile.cpp @@ -389,13 +389,13 @@ static void compile_control_break( BRK control, REQ request) { temp = (NOD) control->brk_field;; temp->nod_flags |= NOD_parameter2; - temp = compile_expression(control->brk_field, request, FALSE); + temp = compile_expression((NOD) control->brk_field, request, FALSE); if (temp->nod_type == nod_field) temp = temp->nod_arg[e_fld_reference]; control->brk_field = (SYN) temp; } if (control->brk_line) - compile_print_list(control->brk_line, request, 0); + compile_print_list((NOD) control->brk_line, request, 0); report_control_break = NULL; } } @@ -2086,7 +2086,7 @@ static void release_message( MSG message) BUGCHECK(364); /* Msg 364 lost message */ *ptr = message->msg_next; - ALL_release(message); + ALL_release((FRB) message); } diff --git a/src/qli/dtr.cpp b/src/qli/dtr.cpp index 5d7d831c47..d612e53e5c 100644 --- a/src/qli/dtr.cpp +++ b/src/qli/dtr.cpp @@ -89,7 +89,7 @@ typedef struct answer_t { BOOLEAN value; } *ANS; -static yes_no_loaded = 0; +static int yes_no_loaded = 0; static struct answer_t answer_table[] = { "", FALSE, /* NO */ "", TRUE, /* YES */ @@ -342,10 +342,10 @@ static void enable_signals(void) SLONG mask; void (*prev_handler) (); - signal(SIGQUIT, signal_quit); - signal(SIGINT, signal_quit); - signal(SIGPIPE, signal_quit); - signal(SIGFPE, signal_arith_excp); + signal(SIGQUIT, (void(*)(int)) signal_quit); + signal(SIGINT, (void(*)(int)) signal_quit); + signal(SIGPIPE, (void(*)(int)) signal_quit); + signal(SIGFPE, (void(*)(int)) signal_arith_excp); } @@ -463,17 +463,17 @@ static USHORT process_statement( USHORT flush_flag) /* Expand the statement. It will return NULL is the statement was a command. An error will be unwound */ - if (!(expanded_tree = EXP_expand(syntax_tree))) + if (!(expanded_tree = (BLK) EXP_expand(syntax_tree))) return FALSE; /* Compile the statement */ - if (!(execution_tree = CMPQ_compile(expanded_tree))) + if (!(execution_tree = (BLK) CMPQ_compile((nod*) expanded_tree))) return FALSE; /* Generate any BLR needed to support the request */ - if (!GEN_generate(execution_tree)) + if (!GEN_generate(( (nod*) execution_tree))) return FALSE; if (QLI_statistics) @@ -488,13 +488,13 @@ static USHORT process_statement( USHORT flush_flag) #endif } #ifndef PC_PLATFORM - perf_get_info(&dbb->dbb_handle, dbb->dbb_statistics); + perf_get_info((int**)&dbb->dbb_handle, (perf*) dbb->dbb_statistics); #endif } /* Execute the request, for better or worse */ - EXEC_top(execution_tree); + EXEC_top((nod*) execution_tree); if (QLI_statistics) for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) @@ -504,8 +504,8 @@ static USHORT process_statement( USHORT flush_flag) /* Msg505 " reads = !r writes = !w fetches = !f marks = !m\n" */ ERRQ_msg_get(506, report + strlen(report)); /* Msg506 " elapsed = !e cpu = !u system = !s mem = !x, buffers = !b" */ - perf_get_info(&dbb->dbb_handle, &statistics); - perf_format(dbb->dbb_statistics, &statistics, + perf_get_info((int**)&dbb->dbb_handle, &statistics); + perf_format((perf*) dbb->dbb_statistics, &statistics, report, buffer, 0); #endif ERRQ_msg_put(26, dbb->dbb_filename, buffer, NULL, NULL, NULL); /* Msg26 Statistics for database %s %s */ @@ -581,7 +581,7 @@ static void CLIB_ROUTINE signal_arith_excp(USHORT sig, USHORT code, USHORT scp) msg_number = 21; /* Msg21 arithmetic exception */ } - signal(SIGFPE, signal_arith_excp); + signal(SIGFPE, (void(*)(int)) signal_arith_excp); IBERROR(msg_number); } diff --git a/src/qli/err.cpp b/src/qli/err.cpp index be132bc3a6..78e004577d 100644 --- a/src/qli/err.cpp +++ b/src/qli/err.cpp @@ -94,7 +94,7 @@ void ERRQ_database_error( DBB dbb, STATUS * status_vector) ERRQ_msg_put(458, dbb->dbb_filename, NULL, NULL, NULL, NULL); /* Msg458 ** connection to database %s lost ** */ if (QLI_env) - longjmp(QLI_env, -1); + longjmp((jmp_buf) QLI_env, -1); } @@ -120,7 +120,7 @@ void ERRQ_error( ERRQ_error_format(number, arg1, arg2, arg3, arg4, arg5); if (QLI_env) - longjmp(QLI_env, -1); + longjmp((jmp_buf) QLI_env, -1); else { ERRQ_pending(); ERRQ_exit(FINI_ERROR); @@ -150,7 +150,7 @@ void ERRQ_error_format( arg1, arg2, arg3, arg4, arg5); gds__msg_format(0, QLI_MSG_FAC, 12, sizeof(ERRQ_message), ERRQ_message, s, NULL, NULL, NULL, NULL); /* Msg12 ** QLI error: %s ** */ - QLI_error = ERRQ_message; + QLI_error = (UCHAR*) ERRQ_message; QLI_skip_line = TRUE; } diff --git a/src/qli/eval.cpp b/src/qli/eval.cpp index 831f0925ee..cde9f634d7 100644 --- a/src/qli/eval.cpp +++ b/src/qli/eval.cpp @@ -425,7 +425,7 @@ DSC *EVAL_value(NOD node) desc->dsc_missing = FALSE; if (node->nod_flags & nod_date) { d1 = MOVQ_date_to_double(values[0]) + MOVQ_get_double(values[1]); - MOVQ_double_to_date(d1, desc->dsc_address); + MOVQ_double_to_date(d1, (long*) desc->dsc_address); } else if (desc->dsc_dtype == dtype_long) *((SLONG *) desc->dsc_address) = @@ -553,7 +553,7 @@ DSC *EVAL_value(NOD node) case nod_format: p = desc->dsc_address; - PIC_edit(values[0], node->nod_arg[e_fmt_picture], &p, + PIC_edit(values[0], (pic*) node->nod_arg[e_fmt_picture], (TEXT**) &p, desc->dsc_length); desc->dsc_length = p - desc->dsc_address; return desc; @@ -600,7 +600,7 @@ static SLONG execute_any( NOD node) send a message along with it. */ if (request = (REQ) node->nod_arg[e_any_request]) - EXEC_start_request(request, node->nod_arg[e_any_send]); + EXEC_start_request(request, (MSG) node->nod_arg[e_any_send]); else if (message = (MSG) node->nod_arg[e_any_send]) EXEC_send(message); @@ -628,8 +628,8 @@ static DSC *execute_concatenate( NOD node, DSC * value1, DSC * value2) TEXT *p, temp1[32], temp2[32], *address1, *address2; USHORT length1, length2; - length1 = MOVQ_get_string(value1, &address1, temp1, sizeof(temp1)); - length2 = MOVQ_get_string(value2, &address2, temp2, sizeof(temp2)); + length1 = MOVQ_get_string(value1, &address1, (VARY*)temp1, sizeof(temp1)); + length2 = MOVQ_get_string(value2, &address2, (VARY*)temp2, sizeof(temp2)); desc = &node->nod_desc; vary = (VARY *) desc->dsc_address; p = vary->vary_string; @@ -689,10 +689,10 @@ static DSC *execute_edit( NOD node) field_name = (TEXT *) node->nod_arg[e_edt_name]; #if (defined JPN_EUC || defined JPN_SJIS) - BLOB_edit2(id, dbb->dbb_handle, dbb->dbb_transaction, field_name, + BLOB_edit2((GDS_QUAD_t*)id, dbb->dbb_handle, dbb->dbb_transaction, field_name, node->nod_desc.dsc_sub_type); #else - BLOB_edit(id, dbb->dbb_handle, dbb->dbb_transaction, field_name); + BLOB_edit((GDS_QUAD_t*)id, dbb->dbb_handle, dbb->dbb_transaction, field_name); #endif /* (defined JPN_EUC || defined JPN_SJIS) */ node->nod_desc.dsc_missing = (id[0] || id[1]) ? 0 : DSC_missing; @@ -721,11 +721,11 @@ static DSC *execute_function( NOD node) send a message along with it. */ if (request = (REQ) node->nod_arg[e_fun_request]) - EXEC_start_request(request, node->nod_arg[e_fun_send]); + EXEC_start_request(request, (MSG) node->nod_arg[e_fun_send]); else if (message = (MSG) node->nod_arg[e_fun_send]) EXEC_send(message); - return EXEC_receive(node->nod_arg[e_fun_receive], node->nod_import); + return EXEC_receive((MSG) node->nod_arg[e_fun_receive], node->nod_import); } @@ -833,11 +833,11 @@ static DSC *execute_statistical( NOD node) send a message along with it. */ if (request = (REQ) node->nod_arg[e_stt_request]) - EXEC_start_request(request, node->nod_arg[e_stt_send]); + EXEC_start_request(request, (MSG) node->nod_arg[e_stt_send]); else if (message = (MSG) node->nod_arg[e_stt_send]) EXEC_send(message); - return EXEC_receive(node->nod_arg[e_stt_receive], node->nod_import); + return EXEC_receive((MSG) node->nod_arg[e_stt_receive], node->nod_import); } @@ -956,7 +956,7 @@ static TEXT *make_blob_buffer( SLONG * blob, USHORT * length) **************************************/ SLONG size, segment_count, max_segment; - gds__blob_size(&blob, &size, &segment_count, &max_segment); + gds__blob_size((SLONG*) &blob, &size, &segment_count, &max_segment); #ifdef JPN_EUC max_segment = MIN(max_segment * 2, 32768); /* prepare for SJIS->EUC expansion */ @@ -1085,24 +1085,24 @@ static int sleuth( NOD node, DSC * desc1, DSC * desc2, DSC * desc3) /* Get operator definition string (control string) */ - l1 = MOVQ_get_string(desc3, &p1, temp1, TEMP_LENGTH); + l1 = MOVQ_get_string(desc3, &p1, (VARY*) temp1, TEMP_LENGTH); /* Get address and length of search string */ - l2 = MOVQ_get_string(desc2, &p2, temp2, TEMP_LENGTH); + l2 = MOVQ_get_string(desc2, &p2, (VARY*) temp2, TEMP_LENGTH); /* Merge search and control strings */ - l2 = sleuth_merge(p2, p2 + l2, p1, p1 + l1, control); + l2 = sleuth_merge((UCHAR*) p2, (UCHAR*) (p2 + l2), (UCHAR*) p1, (UCHAR*) (p1 + l1), (UCHAR*) control); /* If source is not a blob, do a simple search */ if (desc1->dsc_dtype != dtype_blob) { - l1 = MOVQ_get_string(desc1, &p1, temp1, TEMP_LENGTH); + l1 = MOVQ_get_string(desc1, &p1, (VARY*) temp1, TEMP_LENGTH); #if (defined JPN_EUC || defined JPN_SJIS) - return sleuth_check2(0, p1, p1 + l1, control, control + l2); + return sleuth_check2(0, (UCHAR*) p1, (UCHAR*) (p1 + l1), (UCHAR*) control, (UCHAR*) (control + l2)); #else - return sleuth_check(0, p1, p1 + l1, control, control + l2); + return sleuth_check(0, (UCHAR*) p1, (UCHAR*) (p1 + l1), (UCHAR*) control, (UCHAR*) (control + l2)); #endif /* (defined JPN_EUC || defined JPN_SJIS) */ } @@ -1110,20 +1110,20 @@ static int sleuth( NOD node, DSC * desc1, DSC * desc2, DSC * desc3) result = FALSE; - blob = EXEC_open_blob(node->nod_arg[0]); + blob = (int*) EXEC_open_blob(node->nod_arg[0]); buffer_length = sizeof(fixed_buffer); - if (!(buffer = make_blob_buffer(blob, &buffer_length))) + if (!(buffer = make_blob_buffer((SLONG*) blob, &buffer_length))) buffer = fixed_buffer; while (!gds__get_segment(status_vector, - GDS_REF(blob), - GDS_REF(l1), buffer_length, GDS_VAL(buffer))) + (void**) GDS_REF(blob), + (USHORT*) GDS_REF(l1), buffer_length, GDS_VAL(buffer))) #if (defined JPN_EUC || defined JPN_SJIS) - if (sleuth_check2(0, buffer, buffer + l1, control, control + l2)) + if (sleuth_check2(0, (UCHAR*) buffer, (UCHAR*) (buffer + l1), (UCHAR*) control, (UCHAR*) (control + l2))) #else - if (sleuth_check(0, buffer, buffer + l1, control, control + l2)) + if (sleuth_check(0, (UCHAR*) buffer, (UCHAR*) (buffer + l1), (UCHAR*) control, (UCHAR*) (control + l2))) #endif /* (defined JPN_EUC || defined JPN_SJIS) */ { result = TRUE; @@ -1133,7 +1133,7 @@ static int sleuth( NOD node, DSC * desc1, DSC * desc2, DSC * desc3) if (buffer != fixed_buffer) gds__free(buffer); - if (gds__close_blob(status_vector, GDS_REF(blob))) { + if (gds__close_blob(status_vector, (void**) GDS_REF(blob))) { context = (CTX) node->nod_arg[e_fld_context]; request = context->ctx_request; dbb = request->req_database; @@ -1509,28 +1509,28 @@ static int string_boolean( NOD node) /* Get address and length of strings */ - l2 = MOVQ_get_string(desc2, &p2, temp2, TEMP_LENGTH); + l2 = MOVQ_get_string(desc2, &p2, (VARY*) temp2, TEMP_LENGTH); /* If source is not a blob, do a simple search */ if (desc1->dsc_dtype != dtype_blob) { - l1 = MOVQ_get_string(desc1, &p1, temp1, TEMP_LENGTH); + l1 = MOVQ_get_string(desc1, &p1, (VARY*) temp1, TEMP_LENGTH); return string_function(node, l1, p1, l2, p2); } /* Source string is a blob, things get interesting */ result = FALSE; - blob = EXEC_open_blob(node->nod_arg[0]); + blob = (int*) EXEC_open_blob(node->nod_arg[0]); buffer_length = sizeof(fixed_buffer); - if (!(buffer = make_blob_buffer(blob, &buffer_length))) + if (!(buffer = make_blob_buffer((SLONG*) blob, &buffer_length))) buffer = fixed_buffer; while (!gds__get_segment(status_vector, - GDS_REF(blob), - GDS_REF(l1), + (void**) GDS_REF(blob), + (USHORT*) GDS_REF(l1), buffer_length, GDS_VAL(buffer))) if (string_function(node, l1, buffer, l2, p2)) { @@ -1541,7 +1541,7 @@ static int string_boolean( NOD node) if (buffer != fixed_buffer) gds__free(buffer); - if (gds__close_blob(status_vector, GDS_REF(blob))) { + if (gds__close_blob(status_vector, (void**) GDS_REF(blob))) { context = (CTX) node->nod_arg[e_fld_context]; request = context->ctx_request; dbb = request->req_database; @@ -1637,12 +1637,12 @@ static int string_function( if (node->nod_type == nod_like) { c1 = 0; if (node->nod_count > 2 && - MOVQ_get_string(EVAL_value(node->nod_arg[2]), &q1, temp, + MOVQ_get_string(EVAL_value(node->nod_arg[2]), &q1, (VARY*) temp, sizeof(temp))) c1 = *q1; #if (defined JPN_EUC || defined JPN_SJIS) - if (like2(p1, l1, p2, l2, c1)) + if (like2((UCHAR*) p1, l1, (UCHAR*) p2, l2, c1)) #else - if (like(p1, l1, p2, l2, c1)) + if (like((UCHAR*) p1, l1, (UCHAR*) p2, l2, c1)) #endif /* (defined JPN_EUC || defined JPN_SJIS) */ return TRUE; return FALSE; diff --git a/src/qli/exe.cpp b/src/qli/exe.cpp index 1775d8763b..6b3963c9a0 100644 --- a/src/qli/exe.cpp +++ b/src/qli/exe.cpp @@ -39,6 +39,10 @@ #include "../jrd/gds_proto.h" #include "../jrd/utl_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef sparc #ifndef SOLARIS #include @@ -79,10 +83,10 @@ static void transaction_state(NOD, DBB); #define COUNT_ITEMS 4 static SCHAR count_info[] = { - gds__info_req_select_count, - gds__info_req_insert_count, - gds__info_req_update_count, - gds__info_req_delete_count + gds_info_req_select_count, + gds_info_req_insert_count, + gds_info_req_update_count, + gds_info_req_delete_count }; @@ -105,7 +109,7 @@ void EXEC_abort(void) for (request = QLI_requests; request; request = request->req_next) if (request->req_handle) gds__unwind_request(status_vector, - GDS_REF(request->req_handle), 0); + (void**) GDS_REF(request->req_handle), 0); QLI_abort = TRUE; } @@ -249,18 +253,18 @@ void *EXEC_open_blob( NOD node) /* Format blob parameter block */ p = bpb; - *p++ = gds__bpb_version1; - *p++ = gds__bpb_source_type; + *p++ = gds_bpb_version1; + *p++ = gds_bpb_source_type; *p++ = 2; *p++ = desc->dsc_sub_type; *p++ = desc->dsc_sub_type >> 8; - *p++ = gds__bpb_target_type; + *p++ = gds_bpb_target_type; *p++ = 1; *p++ = 1; #if (defined JPN_EUC || defined JPN_SJIS) if (desc->dsc_sub_type == 1) { - *p++ = gds__bpb_target_interp; + *p++ = gds_bpb_target_interp; *p++ = 2; *p++ = QLI_interp; *p++ = QLI_interp >> 8; @@ -273,9 +277,9 @@ void *EXEC_open_blob( NOD node) GDS_REF(dbb->dbb_handle), GDS_REF(dbb->dbb_transaction), GDS_REF(blob), - GDS_VAL(desc->dsc_address), + (GDS_QUAD*)GDS_VAL(desc->dsc_address), bpb_length, - bpb)) ERRQ_database_error(dbb, status_vector); + (char*) bpb)) ERRQ_database_error(dbb, status_vector); return blob; } @@ -302,7 +306,7 @@ struct file *EXEC_open_output(NOD node) /* Evaluate filename and copy to a null terminated string */ desc = EVAL_value(node->nod_arg[e_out_file]); - l = MOVQ_get_string(desc, &p, temp, sizeof(temp)); + l = MOVQ_get_string(desc, &p, (VARY*) temp, sizeof(temp)); q = filename; if (l) do @@ -406,7 +410,7 @@ DSC *EXEC_receive(MSG message, PAR parameter) request = message->msg_request; if (gds__receive(status_vector, - GDS_REF(request->req_handle), + (void**) GDS_REF(request->req_handle), message->msg_number, message->msg_length, GDS_VAL(message->msg_buffer), @@ -439,7 +443,7 @@ void EXEC_send( MSG message) map_data(message); if (gds__send(status_vector, - GDS_REF(request->req_handle), + (void**) GDS_REF(request->req_handle), message->msg_number, message->msg_length, GDS_VAL(message->msg_buffer), @@ -465,7 +469,7 @@ void EXEC_start_request( REQ request, MSG message) if (message) { map_data(message); if (!gds__start_and_send(status_vector, - GDS_REF(request->req_handle), + (void**) GDS_REF(request->req_handle), GDS_REF(request->req_database-> dbb_transaction), message->msg_number, message->msg_length, @@ -473,7 +477,7 @@ void EXEC_start_request( REQ request, MSG message) } else if (!gds__start_request(status_vector, - GDS_REF(request->req_handle), + (void**) GDS_REF(request->req_handle), GDS_REF(request->req_database-> dbb_transaction), 0)) return; @@ -716,12 +720,12 @@ static int copy_blob( NOD value, PAR parameter) /* Format blob parameter block for the existing blob */ p = bpb; - *p++ = gds__bpb_version1; - *p++ = gds__bpb_source_type; + *p++ = gds_bpb_version1; + *p++ = gds_bpb_source_type; *p++ = 2; *p++ = from_desc->dsc_sub_type; *p++ = from_desc->dsc_sub_type >> 8; - *p++ = gds__bpb_target_type; + *p++ = gds_bpb_target_type; *p++ = 2; *p++ = to_desc->dsc_sub_type; *p++ = to_desc->dsc_sub_type >> 8; @@ -731,8 +735,8 @@ static int copy_blob( NOD value, PAR parameter) if ((to_desc->dsc_sub_type == 1) && (to_desc->dsc_scale != from_desc->dsc_scale)) { p2 = bpb2x; - *p2++ = gds__bpb_version1; - *p2++ = gds__bpb_source_interp; + *p2++ = gds_bpb_version1; + *p2++ = gds_bpb_source_interp; *p2++ = 2; *p2++ = from_desc->dsc_scale; *p2++ = from_desc->dsc_scale >> 8; @@ -753,19 +757,19 @@ static int copy_blob( NOD value, PAR parameter) if (gds__create_blob(status_vector, GDS_REF(to_dbb->dbb_handle), GDS_REF(to_dbb->dbb_transaction), - GDS_REF(to_blob), GDS_VAL(to_desc->dsc_address))) + (void**) GDS_REF(to_blob), (GDS__QUAD*) GDS_VAL(to_desc->dsc_address))) #endif ERRQ_database_error(to_dbb, status_vector); if (gds__open_blob2(status_vector, GDS_REF(from_dbb->dbb_handle), GDS_REF(from_dbb->dbb_transaction), - GDS_REF(from_blob), - GDS_VAL(from_desc->dsc_address), + (void**) GDS_REF(from_blob), + (GDS__QUAD*) GDS_VAL(from_desc->dsc_address), bpb_length, - bpb)) ERRQ_database_error(from_dbb, status_vector); + (char*) bpb)) ERRQ_database_error(from_dbb, status_vector); - gds__blob_size(&from_blob, &size, &segment_count, &max_segment); + gds__blob_size((SLONG*) &from_blob, &size, &segment_count, &max_segment); if (max_segment < sizeof(fixed_buffer)) { buffer_length = sizeof(fixed_buffer); @@ -773,7 +777,7 @@ static int copy_blob( NOD value, PAR parameter) } else { buffer_length = max_segment; - buffer = gds__alloc(buffer_length); + buffer = (UCHAR*) gds__alloc(buffer_length); #ifdef DEBUG_GDS_ALLOC /* We don't care about QLI specific memory leaks for V4.0 */ gds_alloc_flag_unfreed((void *) buffer); /* QLI: don't care */ @@ -782,23 +786,23 @@ static int copy_blob( NOD value, PAR parameter) } while (!gds__get_segment(status_vector, - GDS_REF(from_blob), + (void**) GDS_REF(from_blob), GDS_REF(length), buffer_length, - GDS_VAL(buffer))) + (char*) GDS_VAL(buffer))) if (gds__put_segment(status_vector, - GDS_REF(to_blob), + (void**) GDS_REF(to_blob), length, - GDS_VAL(buffer))) + (char*) GDS_VAL(buffer))) ERRQ_database_error(to_dbb, status_vector); if (buffer != fixed_buffer) gds__free(buffer); - if (gds__close_blob(status_vector, GDS_REF(from_blob))) + if (gds__close_blob(status_vector, (void**) GDS_REF(from_blob))) ERRQ_database_error(from_dbb, status_vector); - if (gds__close_blob(status_vector, GDS_REF(to_blob))) + if (gds__close_blob(status_vector, (void**) GDS_REF(to_blob))) ERRQ_database_error(to_dbb, status_vector); return TRUE; @@ -841,10 +845,10 @@ static void execute_abort( NOD node) if (node->nod_count) { l = - MOVQ_get_string(EVAL_value(node->nod_arg[0]), &ptr, temp, + MOVQ_get_string(EVAL_value(node->nod_arg[0]), (TEXT**) &ptr, (VARY*) temp, sizeof(temp)); - MOVQ_terminate(ptr, msg, l, sizeof(msg)); - ERRQ_error(40, msg, NULL, NULL, NULL, NULL); /* Msg40 Request terminated by statement: %s */ + MOVQ_terminate((SCHAR*) ptr, (SCHAR*) msg, l, sizeof(msg)); + ERRQ_error(40, (TEXT*) msg, NULL, NULL, NULL, NULL); /* Msg40 Request terminated by statement: %s */ } IBERROR(41); /* Msg41 Request terminated by statement */ @@ -928,7 +932,7 @@ static void execute_for( NOD node) send a message along with it. */ if (request = (REQ) node->nod_arg[e_for_request]) - EXEC_start_request(request, node->nod_arg[e_for_send]); + EXEC_start_request(request, (MSG) node->nod_arg[e_for_send]); else if (message = (MSG) node->nod_arg[e_for_send]) EXEC_send(message); @@ -942,7 +946,7 @@ static void execute_for( NOD node) true. */ while (TRUE) { - desc = EXEC_receive(message, node->nod_arg[e_for_eof]); + desc = EXEC_receive(message, (PAR) node->nod_arg[e_for_eof]); if (*(USHORT *) desc->dsc_address) break; EXEC_execute(node->nod_arg[e_for_statement]); @@ -1041,11 +1045,11 @@ static void execute_print( NOD node) **************************************/ if (node->nod_arg[e_prt_header]) { - FMT_put(node->nod_arg[e_prt_header], node->nod_arg[e_prt_output]); + FMT_put((TEXT*) node->nod_arg[e_prt_header], (PRT) node->nod_arg[e_prt_output]); node->nod_arg[e_prt_header] = NULL; } - FMT_print(node->nod_arg[e_prt_list], node->nod_arg[e_prt_output]); + FMT_print(node->nod_arg[e_prt_list], (PRT) node->nod_arg[e_prt_output]); } @@ -1099,7 +1103,7 @@ static void execute_store( NOD node) send a message along with it. */ if (request = (REQ) node->nod_arg[e_sto_request]) - EXEC_start_request(request, node->nod_arg[e_sto_send]); + EXEC_start_request(request, (MSG) node->nod_arg[e_sto_send]); else if (message) EXEC_send(message); @@ -1165,7 +1169,7 @@ static void print_counts( REQ request) SCHAR count_buffer[COUNT_ITEMS * 7 + 1], *c; if (gds__request_info(status_vector, - GDS_REF(request->req_handle), + (void**) GDS_REF(request->req_handle), 0, sizeof(count_info), count_info, @@ -1173,27 +1177,27 @@ static void print_counts( REQ request) /* print out the counts of any records affected */ - for (c = count_buffer; *c != gds__info_end; c += length) { + for (c = count_buffer; *c != gds_info_end; c += length) { item = *c++; - length = gds__vax_integer(c, 2); + length = gds__vax_integer((UCHAR*) c, 2); c += 2; - number = gds__vax_integer(c, length); + number = gds__vax_integer((UCHAR*) c, length); if (number) switch (item) { - case gds__info_req_select_count: + case gds_info_req_select_count: ib_printf("\nrecords selected: %ld\n", number); break; - case gds__info_req_insert_count: + case gds_info_req_insert_count: ib_printf("records inserted: %ld\n", number); break; - case gds__info_req_update_count: + case gds_info_req_update_count: ib_printf("records updated: %ld\n", number); break; - case gds__info_req_delete_count: + case gds_info_req_delete_count: ib_printf("records deleted: %ld\n", number); break; diff --git a/src/qli/expand.cpp b/src/qli/expand.cpp index dbf7a631b6..328a5618c1 100644 --- a/src/qli/expand.cpp +++ b/src/qli/expand.cpp @@ -132,7 +132,7 @@ NOD EXP_expand( SYN node) return NULL; case nod_declare: - declare_global(node->syn_arg[0], node->syn_arg[1]); + declare_global((FLD) node->syn_arg[0], node->syn_arg[1]); return NULL; case nod_define: @@ -149,7 +149,7 @@ NOD EXP_expand( SYN node) return NULL; case nod_def_field: - MET_define_field(node->syn_arg[0], node->syn_arg[1]); + MET_define_field((DBB) node->syn_arg[0], (FLD) node->syn_arg[1]); return NULL; case nod_def_index: @@ -157,23 +157,23 @@ NOD EXP_expand( SYN node) return NULL; case nod_def_relation: - MET_define_relation(node->syn_arg[0], node->syn_arg[1]); + MET_define_relation((REL)node->syn_arg[0], (REL) node->syn_arg[1]); return NULL; case nod_del_relation: - MET_delete_relation(node->syn_arg[0]); + MET_delete_relation((REL)node->syn_arg[0]); return NULL; case nod_del_field: - MET_delete_field(node->syn_arg[0], node->syn_arg[1]); + MET_delete_field((DBB)node->syn_arg[0], (NAM) node->syn_arg[1]); return NULL; case nod_del_index: - MET_delete_index(node->syn_arg[0], node->syn_arg[1]); + MET_delete_index((DBB)node->syn_arg[0], (NAM) node->syn_arg[1]); return NULL; case nod_del_database: - MET_delete_database(node->syn_arg[0]); + MET_delete_database((DBB)node->syn_arg[0]); return NULL; case nod_edit_proc: @@ -182,7 +182,7 @@ NOD EXP_expand( SYN node) case nod_edit_form: name = (NAM) node->syn_arg[1]; - FORM_edit(node->syn_arg[0], name->nam_string); + FORM_edit((DBB)node->syn_arg[0], name->nam_string); return NULL; case nod_extract: @@ -199,11 +199,11 @@ NOD EXP_expand( SYN node) return NULL; case nod_mod_field: - MET_modify_field(node->syn_arg[0], node->syn_arg[1]); + MET_modify_field((DBB)node->syn_arg[0], (FLD) node->syn_arg[1]); return NULL; case nod_mod_relation: - MET_modify_relation(node->syn_arg[0], node->syn_arg[1]); + MET_modify_relation((REL) node->syn_arg[0], (FLD) node->syn_arg[1]); return NULL; case nod_mod_index: @@ -239,7 +239,7 @@ NOD EXP_expand( SYN node) return NULL; case nod_sql_cr_table: - MET_define_sql_relation(node->syn_arg[0]); + MET_define_sql_relation((REL) node->syn_arg[0]); return NULL; /**** @@ -250,7 +250,7 @@ NOD EXP_expand( SYN node) ****/ case nod_sql_al_table: - MET_sql_alter_table(node->syn_arg[0], node->syn_arg[1]); + MET_sql_alter_table((REL) node->syn_arg[0], (FLD) node->syn_arg[1]); return NULL; } @@ -356,15 +356,15 @@ static SYM copy_symbol( SYM old) * Copy a symbol into the permanent pool. * **************************************/ - SYM new; + SYM new_sym; - new = (SYM) ALLOCPV(type_sym, old->sym_length); - new->sym_length = old->sym_length; - new->sym_type = old->sym_type; - new->sym_string = new->sym_name; - strcpy(new->sym_name, old->sym_name); + new_sym = (SYM) ALLOCPV(type_sym, old->sym_length); + new_sym->sym_length = old->sym_length; + new_sym->sym_type = old->sym_type; + new_sym->sym_string = new_sym->sym_name; + strcpy(new_sym->sym_name, old->sym_name); - return new; + return new_sym; } @@ -384,7 +384,7 @@ static void declare_global( FLD variable, SYN field_node) **************************************/ TEXT *p, *q; USHORT l; - FLD new, field, *ptr; + FLD new_fld, field, *ptr; /* If it's based_on, flesh it out & check datatype. */ @@ -402,10 +402,10 @@ static void declare_global( FLD variable, SYN field_node) if (!strcmp (field->fld_name->sym_string, variable->fld_name->sym_string)) { *ptr = field->fld_next; - ALLQ_release(field->fld_name); + ALLQ_release((FRB) field->fld_name); if (field->fld_query_name) - ALLQ_release(field->fld_query_name); - ALLQ_release(field); + ALLQ_release((FRB) field->fld_query_name); + ALLQ_release((FRB) field); break; } @@ -418,33 +418,33 @@ static void declare_global( FLD variable, SYN field_node) if (q = variable->fld_query_header) l += strlen(q); - new = (FLD) ALLOCPV(type_fld, l); - new->fld_name = copy_symbol(variable->fld_name); - new->fld_dtype = variable->fld_dtype; - new->fld_length = variable->fld_length; - new->fld_scale = variable->fld_scale; - new->fld_sub_type = variable->fld_sub_type; - new->fld_sub_type_missing = variable->fld_sub_type_missing; - new->fld_flags = variable->fld_flags | FLD_missing; + new_fld = (FLD) ALLOCPV(type_fld, l); + new_fld->fld_name = copy_symbol(variable->fld_name); + new_fld->fld_dtype = variable->fld_dtype; + new_fld->fld_length = variable->fld_length; + new_fld->fld_scale = variable->fld_scale; + new_fld->fld_sub_type = variable->fld_sub_type; + new_fld->fld_sub_type_missing = variable->fld_sub_type_missing; + new_fld->fld_flags = variable->fld_flags | FLD_missing; /* Copy query_name, edit string, query header */ - p = (TEXT *) new->fld_data + new->fld_length; + p = (TEXT *) new_fld->fld_data + new_fld->fld_length; if (q = variable->fld_edit_string) { - new->fld_edit_string = p; + new_fld->fld_edit_string = p; while (*p++ = *q++); } if (variable->fld_query_name) - new->fld_query_name = copy_symbol(variable->fld_query_name); + new_fld->fld_query_name = copy_symbol(variable->fld_query_name); if (q = variable->fld_query_header) { - new->fld_query_header = p; + new_fld->fld_query_header = p; while (*p++ = *q++); } /* Link new variable into variable chain */ - new->fld_next = QLI_variables; - QLI_variables = new; + new_fld->fld_next = QLI_variables; + QLI_variables = new_fld; } @@ -1083,7 +1083,7 @@ static NOD expand_field( SYN input, LLS stack, SYN subs) } if (context->ctx_type == CTX_FORM) - return make_form_field(context->ctx_form, field); + return make_form_field(context->ctx_form, (FFL) field); node = make_field(field, context); if (subs) @@ -1107,7 +1107,7 @@ static NOD expand_field( SYN input, LLS stack, SYN subs) stream_context->ctx_stream->nod_type != nod_rse) continue; - ptr = stream_context->ctx_stream->nod_arg + e_rse_count; + ptr = (CTX*) stream_context->ctx_stream->nod_arg + e_rse_count; end = ptr + stream_context->ctx_stream->nod_count; for (; ptr < end; ptr++) if (*ptr == context) @@ -1521,7 +1521,7 @@ static NOD expand_modify( SYN input, LLS right, LLS left) syn_ptr = syn_list->syn_arg; for (i = 0; i < syn_list->syn_count; i++, syn_ptr++) *ptr++ = - make_assignment(expand_expression(*syn_ptr, left), *syn_ptr, + make_assignment(expand_expression((SYN) *syn_ptr, left), (NOD) *syn_ptr, right); } else @@ -1635,7 +1635,7 @@ static NOD expand_print( SYN input, LLS right, LLS left) if (((*sub)->syn_type == nod_print_item) && (syn_item = (*sub)->syn_arg[s_itm_value]) && (syn_item->syn_type == nod_star)) - count += generate_items(syn_item, new_right, &items, rse); + count += generate_items(syn_item, new_right, (LLS) &items, rse); else { LLS_PUSH(expand_print_item(*sub, new_right), &items); count++; @@ -2133,7 +2133,7 @@ static NOD expand_rse( SYN input, LLS * stack) /* Handle implicit boolean from SQL xxx IN (yyy FROM relation) */ if (input->syn_arg[s_rse_outer]) { - eql_node = MAKE_NODE((NOD_T) input->syn_arg[s_rse_op], 2); + eql_node = MAKE_NODE((enum nod_t)(int)input->syn_arg[s_rse_op], 2); eql_node->nod_arg[0] = expand_expression(input->syn_arg[s_rse_outer], old_stack); eql_node->nod_arg[1] = @@ -2251,7 +2251,7 @@ static NOD expand_statement( SYN input, LLS right, LLS left) **************************************/ SYN *syn_ptr, syn_node, field_node; CTX context; - NOD node, (*routine) (); + NOD node, (*routine) (SYN, LLS, LLS); LLS stack; USHORT i; @@ -2345,7 +2345,7 @@ static NOD expand_statement( SYN input, LLS right, LLS left) if (field_node = syn_node->syn_arg[1]) { if (field_node->syn_type == nod_index) field_node = field_node->syn_arg[s_idx_field]; - resolve_really(syn_node->syn_arg[0], field_node); + resolve_really((FLD) syn_node->syn_arg[0], field_node); } context->ctx_variable = (FLD) syn_node->syn_arg[0]; LLS_PUSH(context, &right); @@ -2518,7 +2518,7 @@ static void expand_values( SYN input, LLS right) while (temp) { context = (CTX) LLS_POP(&temp); value_count += - generate_fields(context, &values, + generate_fields(context, (LLS) &values, input->syn_arg[s_sto_rse]); } } @@ -2526,10 +2526,10 @@ static void expand_values( SYN input, LLS right) IBERROR(542); /* this was a prompting expression. won't do at all */ } else if (input->syn_arg[s_sto_rse] && (value->syn_type == nod_star)) { - if (!(context = find_context(value->syn_arg[0], right))) + if (!(context = find_context((NAM) value->syn_arg[0], right))) IBERROR(154); /* Msg154 unrecognized context */ value_count += - generate_fields(context, &values, input->syn_arg[s_sto_rse]); + generate_fields(context, (LLS) &values, input->syn_arg[s_sto_rse]); } else { LLS_PUSH(value, &values); @@ -2622,7 +2622,7 @@ static int generate_fields( CTX context, LLS values, SYN rse) value = decompile_field(field, context); if (group_list && invalid_syn_field(value, group_list)) continue; - LLS_PUSH(value, values); + LLS_PUSH(value, (LLS*) values); count++; } @@ -2683,7 +2683,7 @@ static int generate_items( SYN symbol, LLS right, LLS items, NOD rse) item->itm_type = item_value; item->itm_value = make_field(field, context); expand_edit_string(item->itm_value, item); - LLS_PUSH(item, items); + LLS_PUSH(item, (LLS*) items); count++; } @@ -2953,7 +2953,7 @@ static NOD make_assignment( NOD target, NOD initial, LLS right) prompt->nod_arg[e_edt_name] = (NOD) field->fld_name->sym_string; if (initial) { prompt->nod_count = 1; - prompt->nod_arg[e_edt_input] = expand_expression(initial, right); + prompt->nod_arg[e_edt_input] = expand_expression((SYN) initial, right); } } else { @@ -3378,7 +3378,7 @@ static FLD resolve( SYN node, LLS stack, CTX * out_context) case CTX_RELATION: if (context->ctx_primary) { *out_context = context = context->ctx_primary; - if (!compare_names(node->syn_arg[0], context->ctx_symbol)) + if (!compare_names((NAM) node->syn_arg[0], context->ctx_symbol)) break; } relation = context->ctx_relation; diff --git a/src/qli/form.cpp b/src/qli/form.cpp index 47b4c82a62..030f9961e4 100644 --- a/src/qli/form.cpp +++ b/src/qli/form.cpp @@ -26,7 +26,10 @@ #include "../qli/form.h" #include "../include/jrd/gds.h" #include "../pyxis/phase1.h" +#include "../pyxis/pyxis_proto.h" #include "../pyxis/phase2.h" +#include "../pyxis/phase3.h" +#include "../pyxis/save_proto.h" #include "../qli/all_proto.h" #include "../qli/err_proto.h" #include "../qli/eval_proto.h" @@ -34,12 +37,11 @@ #include "../qli/form_proto.h" #include "../qli/hsh_proto.h" #include "../qli/proc_proto.h" +#include "../qli/mov_proto.h" -extern int *PYXIS_relation_fields(), *PYXIS_relation_form(), - *PYXIS_create_object(), *PYXIS_find_index(), *PYXIS_find_object(), - *PYXIS_get_value(); -extern TEXT *PYXIS_get_attribute_value(), *PYXIS_get_string(); -extern SCHAR *PYXIS_get_keyname(); +#include + +extern "C" int PYXIS_edit(WIN , OBJ , int *, int *); extern TEXT *QLI_error; extern USHORT QLI_prompt_count, QLI_reprompt; @@ -47,7 +49,7 @@ extern USHORT sw_forms; static void clear_fields(FRM); static FRM register_form(DBB, int *, TEXT *); -static void set_form(int *); +static void set_form(OBJ); static void update_form(FRM, TEXT *); static int *pyxis_window; @@ -69,15 +71,15 @@ FRM FORM_default_form( DBB database, TEXT * string) int *handle, *fields, *transaction; FRM form; - transaction = PRO_transaction(database, FALSE); + transaction = (int*) PRO_transaction(database, FALSE); if (! - (fields = - PYXIS_relation_fields(&database->dbb_handle, &transaction, + (fields = (int*) + PYXIS_relation_fields((SLONG**) &database->dbb_handle, (SLONG**) &transaction, string))) return NULL; - handle = PYXIS_relation_form(pyxis_window, fields); - pyxis__delete(&fields); + handle = (int*) PYXIS_relation_form((WIN) pyxis_window, (OBJ) fields); + pyxis__delete((OBJ*) &fields); if (!handle) return NULL; @@ -107,7 +109,7 @@ void FORM_display( NOD node) form = (FRM) node->nod_arg[e_ffr_form]; for (field = form->frm_fields; field; field = field->ffl_next) - PYXIS_set_field_options(field->ffl_handle, 0, PYXIS_reset, + PYXIS_set_field_options((OBJ) field->ffl_handle, 0, PYXIS_reset, PYXIS_clear); EXEC_execute(node->nod_arg[e_ffr_statement]); @@ -127,23 +129,23 @@ void FORM_edit( DBB database, TEXT * name) * **************************************/ FRM form; - int *transaction, *handle, *fields, *label; + OBJ transaction, handle, fields, label; sw_forms = TRUE; - transaction = PRO_transaction(database, FALSE); + transaction = (OBJ) PRO_transaction(database, FALSE); /* Get an existing form, make a form out of a relation name, or build one from scratch */ if (form = FORM_lookup_form(database, name)) - handle = form->frm_handle; + handle = (OBJ) form->frm_handle; else if (fields = - PYXIS_relation_fields(&database->dbb_handle, &transaction, name)) { - handle = PYXIS_relation_form(pyxis_window, fields); - pyxis__delete(&fields); + PYXIS_relation_fields((SLONG**) &database->dbb_handle, (SLONG**) &transaction, name)) { + handle = PYXIS_relation_form((WIN) pyxis_window, (OBJ) fields); + pyxis__delete((OBJ*) &fields); } else { - handle = PYXIS_create_object(0, 0); + handle = PYXIS_create_object(0, (enum att_n)0); label = PYXIS_create_object(name, att_literal_string); PYXIS_put_attribute(handle, att_label, attype_object, label); } @@ -151,8 +153,8 @@ void FORM_edit( DBB database, TEXT * name) PYXIS_set_field_options(handle, "all", PYXIS_reset, PYXIS_clear); set_form(handle); - if (PYXIS_edit(pyxis_window, handle, &database->dbb_handle, &transaction)) { - PYXIS_store_form(&database->dbb_handle, &transaction, name, handle); + if (PYXIS_edit((WIN) pyxis_window, handle, (int*) &database->dbb_handle, (int*) &transaction)) { + PYXIS_store_form((SLONG**) &database->dbb_handle, (SLONG**) &transaction, name, handle); PRO_commit(database); } } @@ -172,7 +174,7 @@ void FORM_fini(void) **************************************/ if (pyxis_window) - pyxis__delete_window(&pyxis_window); + pyxis__delete_window((SLONG*) &pyxis_window); } @@ -194,18 +196,18 @@ void FORM_finish( DBB database) while (form = database->dbb_forms) { database->dbb_forms = form->frm_next; - pyxis__delete(&form->frm_handle); + pyxis__delete((OBJ*)&form->frm_handle); if (symbol = form->frm_symbol) { HSH_remove(symbol); - ALLQ_release(symbol); + ALLQ_release((FRB)symbol); } while (field = form->frm_fields) { form->frm_fields = field->ffl_next; if (symbol = field->ffl_symbol) - ALLQ_release(symbol); - ALLQ_release(field); + ALLQ_release((FRB)symbol); + ALLQ_release((FRB)field); } - ALLQ_release(form); + ALLQ_release((FRB)form); } } @@ -227,7 +229,7 @@ int FORM_get_blob( NOD value, PAR parameter) DBB dbb; DSC *desc; FFL field; - int *blob, *item; + OBJ blob, item; TEXT bpb[20], buffer[4096], *p, *data; STATUS status_vector[20]; USHORT length, n, bpb_length; @@ -249,11 +251,11 @@ int FORM_get_blob( NOD value, PAR parameter) /* Format blob parameter block */ p = bpb; - *p++ = gds__bpb_version1; - *p++ = gds__bpb_source_type; + *p++ = gds_bpb_version1; + *p++ = gds_bpb_source_type; *p++ = 1; *p++ = 1; - *p++ = gds__bpb_target_type; + *p++ = gds_bpb_target_type; *p++ = 2; *p++ = desc->dsc_sub_type; *p++ = desc->dsc_sub_type >> 8; @@ -262,16 +264,16 @@ int FORM_get_blob( NOD value, PAR parameter) if (gds__create_blob2(status_vector, GDS_REF(dbb->dbb_handle), GDS_REF(dbb->dbb_transaction), - GDS_REF(blob), - GDS_VAL(desc->dsc_address), + (void**)GDS_REF(blob), + (GDS__QUAD*)GDS_VAL(desc->dsc_address), bpb_length, bpb)) ERRQ_database_error(dbb, status_vector); for (n = 1;; n++) { - if (!(item = PYXIS_find_index(field->ffl_handle, n))) + if (!(item = PYXIS_find_index((OBJ)field->ffl_handle, n))) break; - if (!(data = PYXIS_get_attribute_value(item, att_update_data)) && - !(data = PYXIS_get_attribute_value(item, att_data))) + if (!(data = (TEXT*)PYXIS_get_attribute_value(item, att_update_data)) && + !(data = (TEXT*)PYXIS_get_attribute_value(item, att_data))) data = ""; do { for (p = buffer; *data && p < &buffer[sizeof(buffer) - 2];) @@ -281,13 +283,13 @@ int FORM_get_blob( NOD value, PAR parameter) *p = 0; length = p - buffer; if (gds__put_segment(status_vector, - GDS_REF(blob), length, buffer)) break; + (void**)GDS_REF(blob), length, buffer)) break; } while (*data); if (status_vector[1]) break; } - if (gds__close_blob(status_vector, GDS_REF(blob))) + if (gds__close_blob(status_vector, (void**)GDS_REF(blob))) ERRQ_database_error(dbb, status_vector); return TRUE; @@ -320,7 +322,7 @@ DSC *FORM_get_field(NOD node) if (QLI_reprompt) { clear_fields(form); field = (FFL) node->nod_arg[e_ffl_field]; - PYXIS_set_field_options(field->ffl_handle, 0, PYXIS_updatable, + PYXIS_set_field_options((OBJ)field->ffl_handle, 0, PYXIS_updatable, PYXIS_updatable); p = QLI_error; QLI_error = NULL; @@ -331,7 +333,7 @@ DSC *FORM_get_field(NOD node) /* Determine if there is data and where it came from */ - switch (PYXIS_get_updated(field->ffl_handle, NULL, &p)) { + switch (PYXIS_get_updated((OBJ) field->ffl_handle, NULL, &p)) { case PYXIS_user_data: break; case PYXIS_prog_data: @@ -362,7 +364,7 @@ DSC *FORM_get_field(NOD node) if ((string = (STR) node->nod_arg[e_ffl_string]) && l >= string->str_length) { - ALLQ_release(string); + ALLQ_release((FRB)string); string = NULL; } @@ -417,7 +419,7 @@ FRM FORM_lookup_form(DBB database, TEXT * string) if (!pyxis_window) { width = 0; height = 40; - pyxis__create_window(&pyxis_window, 0, 0, &width, &height); + pyxis__create_window((WIN*)&pyxis_window, 0, 0, &width, &height); if (!pyxis_window) { ERRQ_print_error(459, NULL, NULL, NULL, NULL, NULL); /* Msg459 Unable to create form window */ return NULL; @@ -428,13 +430,13 @@ FRM FORM_lookup_form(DBB database, TEXT * string) /* Make sure PYXIS$FORMS exists in the database */ if (!(database->dbb_flags & DBB_form_init)) { - PYXIS_define_forms_relation(&database->dbb_handle); + PYXIS_define_forms_relation((SLONG**) &database->dbb_handle); database->dbb_flags |= DBB_form_init; } - transaction = PRO_transaction(database, FALSE); - pyxis__load_form(status, &database->dbb_handle, &transaction, - &handle, 0, string); + transaction = (int*) PRO_transaction(database, FALSE); + pyxis__load_form(status, (SLONG*) &database->dbb_handle, (SLONG*) &transaction, + (SLONG*) &handle, 0, string); if (!handle) return NULL; @@ -488,27 +490,27 @@ int FORM_put_field( NOD from, NOD node) field = (FFL) node->nod_arg[e_ffl_field]; if (desc->dsc_missing & DSC_missing) - PYXIS_set_field_options(field->ffl_handle, 0, + PYXIS_set_field_options((OBJ) field->ffl_handle, 0, PYXIS_data_present | PYXIS_update_present, PYXIS_clear); else if (desc->dsc_dtype != dtype_blob) - PYXIS_put_desc(field->ffl_handle, desc); + PYXIS_put_desc((OBJ) field->ffl_handle, desc); else { - blob = EXEC_open_blob(from); + blob = (int*) EXEC_open_blob(from); for (index = 1;; index++) { if ((status = gds__get_segment(status_vector, - GDS_REF(blob), + (void**) GDS_REF(blob), GDS_REF(length), sizeof(buffer), - buffer)) && status != gds__segment) + buffer)) && status != gds_segment) break; p = buffer + length; *p = 0; if (length && *--p == '\n') *p = 0; - PYXIS_put_segment(field->ffl_handle, buffer, index); + PYXIS_put_segment((OBJ) field->ffl_handle, buffer, index); } - gds__close_blob(status_vector, GDS_REF(blob)); + gds__close_blob(status_vector, (void**) GDS_REF(blob)); } return TRUE; @@ -529,7 +531,7 @@ void FORM_reset(void) **************************************/ sw_forms = FALSE; - pyxis__suspend_window(&pyxis_window); + pyxis__suspend_window((SLONG*) &pyxis_window); } @@ -565,25 +567,25 @@ void FORM_update( NOD node) if (list = node->nod_arg[e_fup_fields]) for (ptr = (FFL *) list->nod_arg, end = ptr + list->nod_count; ptr < end; ptr++) { - PYXIS_set_field_options((*ptr)->ffl_handle, 0, PYXIS_updatable, + PYXIS_set_field_options((OBJ) (*ptr)->ffl_handle, 0, PYXIS_updatable, PYXIS_updatable); /* Make sure that the current form field is reset (bug 3148) */ - PYXIS_delete_named_attribute((*ptr)->ffl_handle, + PYXIS_delete_named_attribute((OBJ) (*ptr)->ffl_handle, att_current_index); } sprintf(temp, "%s to continue, %s to stop", - PYXIS_get_keyname(pyxis_window, PYXIS__KEY_ENTER), - PYXIS_get_keyname(pyxis_window, PYXIS__KEY_PF1)); + PYXIS_get_keyname((WIN) pyxis_window, PYXIS_KEY_ENTER), + PYXIS_get_keyname((WIN) pyxis_window, PYXIS_KEY_PF1)); prompt = temp; if (node->nod_arg[2]) { desc = EVAL_value(node->nod_arg[e_fup_tag]); if (!(desc->dsc_missing & DSC_missing)) { p = temp; - if (l = MOVQ_get_string(desc, &q, temp, sizeof(temp))) + if (l = MOVQ_get_string(desc, &q, (vary*) temp, sizeof(temp))) do *p++ = *q++; while (--l); @@ -611,7 +613,7 @@ static void clear_fields( FRM form) FFL field; for (field = form->frm_fields; field; field = field->ffl_next) - PYXIS_set_field_options(field->ffl_handle, 0, + PYXIS_set_field_options((OBJ) field->ffl_handle, 0, PYXIS_updatable, PYXIS_clear); } @@ -658,10 +660,10 @@ static FRM register_form( DBB database, int *handle, TEXT * string) /* Pick up field names */ for (attribute = NULL; - attribute = - PYXIS_find_object(form->frm_handle, attribute, att_field, TRUE);) { - object = PYXIS_get_value(attribute); - if (p = PYXIS_get_attribute_value(object, att_field_name)) { + attribute = (int*) + PYXIS_find_object((OBJ) form->frm_handle, (ATT) attribute, att_field, TRUE);) { + object = (int*) PYXIS_get_value((ATT) attribute); + if (p = (TEXT*) PYXIS_get_attribute_value((OBJ) object, att_field_name)) { l = strlen(p); field = (FFL) ALLOCPV(type_ffl, l); field->ffl_handle = object; @@ -674,11 +676,11 @@ static FRM register_form( DBB database, int *handle, TEXT * string) symbol->sym_length = l; symbol->sym_object = (BLK) field; field->ffl_dtype = - (int) PYXIS_get_attribute_value(field->ffl_handle, att_dtype); + (int) PYXIS_get_attribute_value((OBJ) field->ffl_handle, att_dtype); field->ffl_scale = - (int) PYXIS_get_attribute_value(field->ffl_handle, att_scale); + (int) PYXIS_get_attribute_value((OBJ) field->ffl_handle, att_scale); field->ffl_length = - (int) PYXIS_get_attribute_value(field->ffl_handle, + (int) PYXIS_get_attribute_value((OBJ) field->ffl_handle, att_length); } } @@ -687,7 +689,7 @@ static FRM register_form( DBB database, int *handle, TEXT * string) } -static void set_form( int *form) +static void set_form( OBJ form) { /************************************** * @@ -700,14 +702,14 @@ static void set_form( int *form) * **************************************/ - if (form == current_form) + if (form == (OBJ) current_form) return; - pyxis__pop_window(&pyxis_window); - current_form = form; + pyxis__pop_window((WIN*) &pyxis_window); + current_form = (int*) form; if (form) - PYXIS_push_form(pyxis_window, form, TRUE); + PYXIS_push_form((WIN) pyxis_window, form, TRUE); } @@ -726,37 +728,37 @@ static void update_form( FRM form, TEXT * string) USHORT c; int *tag; - set_form(form->frm_handle); + set_form((OBJ) form->frm_handle); /* Set up tag, if given */ if (string) { - tag = PYXIS_create_object(string, att_literal_string); - PYXIS_push_tag(pyxis_window, tag); + tag = (int*) PYXIS_create_object(string, att_literal_string); + PYXIS_push_tag((WIN) pyxis_window, (OBJ) tag); } /* Make sure that the current form field is reset (bug 3148) */ - PYXIS_delete_named_attribute(form->frm_handle, att_current_index); + PYXIS_delete_named_attribute((OBJ) form->frm_handle, att_current_index); /* Drive form until abort */ for (;;) { - PYXIS_update(pyxis_window, form->frm_handle, 0, &c); - if (!c || c == PYXIS__KEY_ENTER || c == PYXIS__KEY_PF1) + PYXIS_update((WIN) pyxis_window, (OBJ) form->frm_handle, 0, &c); + if (!c || c == PYXIS_KEY_ENTER || c == PYXIS_KEY_PF1) break; } /* Cleanup tag, if appropriate */ if (string) { - pyxis__pop_window(&pyxis_window); - pyxis__delete(&tag); + pyxis__pop_window((WIN*) &pyxis_window); + pyxis__delete((OBJ*) &tag); } /* Clean exit on ENTER, otherwise abort */ - if (c == PYXIS__KEY_ENTER) + if (c == PYXIS_KEY_ENTER) return; FORM_reset(); diff --git a/src/qli/format.cpp b/src/qli/format.cpp index 4aa56c438c..c33212d447 100644 --- a/src/qli/format.cpp +++ b/src/qli/format.cpp @@ -106,7 +106,7 @@ int FMT_expression( NOD node) FLD field; sub = node->nod_arg[e_fmt_value]; - picture = PIC_analyze(node->nod_arg[e_fmt_edit], &sub->nod_desc); + picture = PIC_analyze((TEXT*) node->nod_arg[e_fmt_edit], &sub->nod_desc); node->nod_arg[e_fmt_picture] = (NOD) picture; if (node->nod_type == nod_reference) @@ -155,7 +155,7 @@ TEXT *FMT_format(LLS stack) stack = NULL; if (fmt_buffer) { - ALL_release(fmt_buffer); + ALL_release((FRB) fmt_buffer); fmt_buffer = NULL; } @@ -203,7 +203,7 @@ TEXT *FMT_format(LLS stack) else { n = decompose_header(item->itm_query_header, segments, - lengths); + (SSHORT*) lengths); number_segments = MAX(n, number_segments); #ifdef JPN_EUC for (j = 0, ptr = lengths, p2 = segments; j < n; @@ -326,7 +326,7 @@ TEXT *FMT_format(LLS stack) item = (ITM) temp->lls_object; if (item->itm_type != item_value) continue; - n = decompose_header(item->itm_query_header, segments, lengths); + n = decompose_header(item->itm_query_header, segments, (SSHORT*) lengths); segment = j - (number_segments - n); if (segment < 0) continue; @@ -389,15 +389,15 @@ NOD FMT_list(NOD list) SYM name; FLD field; CON constant; - NOD value, new; + NOD value, new_nod; USHORT column, expression; DSC *desc; STR header; TEXT *p, *q, c; - new = (NOD) ALLOCDV(type_nod, list->nod_count * 2 + 1); - new->nod_type = nod_list; - new_ptr = (ITM *) new->nod_arg; + new_nod = (NOD) ALLOCDV(type_nod, list->nod_count * 2 + 1); + new_nod->nod_type = nod_list; + new_ptr = (ITM *) new_nod->nod_arg; column = 0; for (item = (ITM *) list->nod_arg, end = item + list->nod_count; @@ -445,7 +445,7 @@ NOD FMT_list(NOD list) p[-1] = 0; } value->nod_desc.dsc_length = - strlen(value->nod_desc.dsc_address); + strlen((char*) value->nod_desc.dsc_address); } else { value->nod_desc.dsc_length = name->sym_length; @@ -480,9 +480,9 @@ NOD FMT_list(NOD list) (*item)->itm_print_offset = column; } - new->nod_count = new_ptr - (ITM *) new->nod_arg; + new_nod->nod_count = new_ptr - (ITM *) new_nod->nod_arg; - return new; + return new_nod; } @@ -532,7 +532,7 @@ void FMT_print( NOD list, PRT print) case item_new_page: if (print->prt_new_page) { put_line(print, &p, buffer, '\n'); - (*print->prt_new_page) (print, FALSE); + (*(void(*)(PRT, int))print->prt_new_page) (print, FALSE); } else { put_line(print, &p, buffer, '\f'); @@ -542,7 +542,7 @@ void FMT_print( NOD list, PRT print) case item_skip: put_line(print, &p, buffer, '\n'); - print_blobs(print, list->nod_arg, ptr); + print_blobs(print, (ITM*) list->nod_arg, (ITM*) ptr); for (l = item->itm_count - 1; l > 0; --l) put_line(print, &p, buffer, '\n'); QLI_skip_line = FALSE; @@ -577,7 +577,7 @@ void FMT_print( NOD list, PRT print) #endif /* JPN_EUC */ if (p > q) { put_line(print, &p, buffer, '\n'); - print_blobs(print, list->nod_arg, ptr); + print_blobs(print, (ITM*) list->nod_arg, (ITM*) ptr); #ifdef JPN_EUC if (QLI_euc_justify) { q -= n_half_kanas; /* undo the previous addition of blanks */ @@ -618,7 +618,7 @@ void FMT_print( NOD list, PRT print) /* Finally, handle blobs */ - if (!(item->itm_stream = EXEC_open_blob(item->itm_value))) + if (!(item->itm_stream = (int*) EXEC_open_blob(item->itm_value))) continue; #ifdef JPN_EUC @@ -645,14 +645,14 @@ void FMT_print( NOD list, PRT print) /* Now go back until all blobs have been fetched */ - print_blobs(print, list->nod_arg, end); + print_blobs(print, (ITM*) list->nod_arg, (ITM*) end); /* Finish by closing all blobs */ for (ptr = list->nod_arg; ptr < end; ptr++) { item = (ITM) * ptr; if (item->itm_dtype == dtype_blob && item->itm_stream) - gds__close_blob(status_vector, GDS_REF(item->itm_stream)); + gds__close_blob(status_vector, (void**) GDS_REF(item->itm_stream)); } } @@ -733,7 +733,7 @@ void FMT_report( RPT report) VEC columns_vec; if (fmt_buffer) { - ALL_release(fmt_buffer); + ALL_release((FRB) fmt_buffer); fmt_buffer = NULL; } @@ -758,7 +758,7 @@ void FMT_report( RPT report) /* Handle report name, if any */ if (report->rpt_name) { - n = decompose_header(report->rpt_name, segments, lengths); + n = decompose_header(report->rpt_name, segments, (SSHORT*) lengths); for (i = 0; i < n; i++) width = MAX(width, lengths[i] + 15); string = (STR) ALLOCDV(type_str, width * n); @@ -895,7 +895,7 @@ static void format_index( ITM item, NOD field, USHORT print_flag) default: /* Punt on anything but constants, fields, and variables */ - ALL_release(str); + ALL_release((FRB) str); return; } @@ -987,7 +987,7 @@ static TEXT *format_report( VEC columns_vec, USHORT width, USHORT * max_width) if (item->itm_query_header) { n = decompose_header(item->itm_query_header, segments, - lengths); + (SSHORT*) lengths); number_segments = MAX(n, number_segments); #ifdef JPN_EUC for (j = 0, ptr = lengths, p2 = segments; j < n; @@ -1091,7 +1091,7 @@ static TEXT *format_report( VEC columns_vec, USHORT width, USHORT * max_width) continue; n = decompose_header(item->itm_query_header, segments, - lengths); + (SSHORT*) lengths); segment = j - (number_segments - n); if (segment < 0) continue; @@ -1217,7 +1217,7 @@ static TEXT *get_buffer( STR * str, TEXT * ptr, USHORT length) *p++ = *q++; while (--l); - ALL_release(*str); + ALL_release((FRB) *str); *str = temp_str; return p; @@ -1539,12 +1539,12 @@ static int print_line( ITM item, TEXT ** ptr) #else if ((status = gds__get_segment(status_vector, - GDS_REF(item->itm_stream), + (void**) GDS_REF(item->itm_stream), GDS_REF(length), - l, GDS_VAL(p))) && status != gds__segment) { + l, GDS_VAL(p))) && status != gds_segment) { long *null_status = 0; - gds__close_blob(null_status, GDS_REF(item->itm_stream)); - if (status != gds__segstr_eof) + gds__close_blob(null_status, (void**) GDS_REF(item->itm_stream)); + if (status != gds_segstr_eof) ERRQ_database_error(0, status_vector); return EOF; } @@ -1611,13 +1611,13 @@ static void report_break( BRK control, VEC * columns_vec, int bottom_flag) if (control->brk_next) report_break(control->brk_next, columns_vec, bottom_flag); if (control->brk_line) - report_line(control->brk_line, columns_vec); + report_line((NOD) control->brk_line, columns_vec); return; } for (; control; control = control->brk_next) if (control->brk_line) - report_line(control->brk_line, columns_vec); + report_line((NOD) control->brk_line, columns_vec); } @@ -1648,7 +1648,7 @@ static void report_item( ITM item, VEC * columns_vec, USHORT * col_ndx) columns = *columns_vec; if (columns->vec_object[*col_ndx] && (node = item->itm_value) && node->nod_type == nod_constant) { - LLS_PUSH(item, columns->vec_object + *col_ndx); + LLS_PUSH(item, (LLS*) (columns->vec_object + *col_ndx)); return; } @@ -1672,11 +1672,11 @@ static void report_item( ITM item, VEC * columns_vec, USHORT * col_ndx) *col_ndx = new_index = col - (LLS *) columns->vec_object; if (new_index >= columns->vec_count) { - ALLQ_extend(columns_vec, new_index + 16); + ALLQ_extend((BLK*) columns_vec, new_index + 16); (*columns_vec)->vec_count = new_index + 16; } - LLS_PUSH(item, (*columns_vec)->vec_object + new_index); + LLS_PUSH(item, (LLS*) ((*columns_vec)->vec_object + new_index)); } diff --git a/src/qli/gener.cpp b/src/qli/gener.cpp index 9926af1f90..b2a790edf5 100644 --- a/src/qli/gener.cpp +++ b/src/qli/gener.cpp @@ -21,7 +21,7 @@ * Contributor(s): ______________________________________. */ /* -$Id: gener.cpp,v 1.1.1.1 2001-05-23 13:26:35 tamlin Exp $ +$Id: gener.cpp,v 1.2 2001-07-12 05:46:06 bellardo Exp $ */ #include "../jrd/ib_stdio.h" @@ -69,7 +69,7 @@ static void gen_statistical(NOD, REQ); static void gen_store(NOD, REQ); #ifdef DEV_BUILD -static SCHAR explain_info[] = { gds__info_access_path }; +static SCHAR explain_info[] = { gds_info_access_path }; #endif @@ -111,7 +111,7 @@ void GEN_release(void) for (; QLI_requests; QLI_requests = QLI_requests->req_next) { if (QLI_requests->req_handle) gds__release_request(status_vector, - GDS_REF(QLI_requests->req_handle)); + (void**) GDS_REF(QLI_requests->req_handle)); rlb = QLI_requests->req_blr; RELEASE_RLB; @@ -142,10 +142,10 @@ RLB GEN_rlb_extend(RLB rlb) old_string = rlb->rlb_base; l = (UCHAR *) rlb->rlb_data - (UCHAR *) rlb->rlb_base; rlb->rlb_length += RLB_BUFFER_SIZE; - new_string = ALLQ_malloc((SLONG) rlb->rlb_length); + new_string = (UCHAR*) ALLQ_malloc((SLONG) rlb->rlb_length); if (old_string) { - MOVQ_fast(old_string, new_string, l); - ALLQ_free(old_string); + MOVQ_fast((SCHAR*) old_string, (SCHAR*) new_string, l); + ALLQ_free((SCHAR*) old_string); } rlb->rlb_base = new_string; rlb->rlb_data = new_string + l; @@ -175,7 +175,7 @@ void GEN_rlb_release( RLB rlb) return; if (rlb->rlb_base) { - ALLQ_free(rlb->rlb_base); + ALLQ_free((SCHAR*) rlb->rlb_base); rlb->rlb_base = NULL; rlb->rlb_length = 0; rlb->rlb_data = NULL; @@ -201,7 +201,7 @@ static void explain( UCHAR * explain_buffer) SSHORT buffer_length, length, level = 0; SCHAR relation_name[32], *r; - if (*explain_buffer++ != gds__info_access_path) + if (*explain_buffer++ != gds_info_access_path) return; buffer_length = *explain_buffer++; @@ -210,18 +210,18 @@ static void explain( UCHAR * explain_buffer) while (buffer_length > 0) { buffer_length--; switch (*explain_buffer++) { - case gds__info_rsb_begin: - explain_printf(level, "gds__info_rsb_begin,\n", 0); + case gds_info_rsb_begin: + explain_printf(level, "gds_info_rsb_begin,\n", 0); level++; break; - case gds__info_rsb_end: - explain_printf(level, "gds__info_rsb_end,\n", 0); + case gds_info_rsb_end: + explain_printf(level, "gds_info_rsb_end,\n", 0); level--; break; - case gds__info_rsb_relation: - explain_printf(level, "gds__info_rsb_relation, ", 0); + case gds_info_rsb_relation: + explain_printf(level, "gds_info_rsb_relation, ", 0); buffer_length--; buffer_length -= (length = *explain_buffer++); @@ -235,18 +235,18 @@ static void explain( UCHAR * explain_buffer) *r++ = 0; break; - case gds__info_rsb_type: + case gds_info_rsb_type: buffer_length--; - explain_printf(level, "gds__info_rsb_type, ", 0); + explain_printf(level, "gds_info_rsb_type, ", 0); switch (*explain_buffer++) { - case gds__info_rsb_unknown: + case gds_info_rsb_unknown: ib_printf("unknown type\n"); break; - case gds__info_rsb_indexed: - ib_printf("gds__info_rsb_indexed,\n"); + case gds_info_rsb_indexed: + ib_printf("gds_info_rsb_indexed,\n"); level++; - explain_index_tree(level, relation_name, &explain_buffer, + explain_index_tree(level, relation_name, (SCHAR**) &explain_buffer, &buffer_length); level--; break; @@ -254,86 +254,86 @@ static void explain( UCHAR * explain_buffer) /* for join types, advance past the count byte of substreams; we don't need it */ - case gds__info_rsb_merge: + case gds_info_rsb_merge: buffer_length--; - ib_printf("gds__info_rsb_merge, %d,\n", *explain_buffer++); + ib_printf("gds_info_rsb_merge, %d,\n", *explain_buffer++); break; - case gds__info_rsb_cross: + case gds_info_rsb_cross: buffer_length--; - ib_printf("gds__info_rsb_cross, %d,\n", *explain_buffer++); + ib_printf("gds_info_rsb_cross, %d,\n", *explain_buffer++); break; - case gds__info_rsb_navigate: - ib_printf("gds__info_rsb_navigate,\n"); + case gds_info_rsb_navigate: + ib_printf("gds_info_rsb_navigate,\n"); level++; - explain_index_tree(level, relation_name, &explain_buffer, + explain_index_tree(level, relation_name, (SCHAR**) &explain_buffer, &buffer_length); level--; break; - case gds__info_rsb_sequential: - ib_printf("gds__info_rsb_sequential,\n"); + case gds_info_rsb_sequential: + ib_printf("gds_info_rsb_sequential,\n"); break; - case gds__info_rsb_sort: - ib_printf("gds__info_rsb_sort,\n"); + case gds_info_rsb_sort: + ib_printf("gds_info_rsb_sort,\n"); break; - case gds__info_rsb_first: - ib_printf("gds__info_rsb_first,\n"); + case gds_info_rsb_first: + ib_printf("gds_info_rsb_first,\n"); break; - case gds__info_rsb_boolean: - ib_printf("gds__info_rsb_boolean,\n"); + case gds_info_rsb_boolean: + ib_printf("gds_info_rsb_boolean,\n"); break; - case gds__info_rsb_union: - ib_printf("gds__info_rsb_union,\n"); + case gds_info_rsb_union: + ib_printf("gds_info_rsb_union,\n"); break; - case gds__info_rsb_aggregate: - ib_printf("gds__info_rsb_aggregate,\n"); + case gds_info_rsb_aggregate: + ib_printf("gds_info_rsb_aggregate,\n"); break; - case gds__info_rsb_ext_sequential: - ib_printf("gds__info_rsb_ext_sequential,\n"); + case gds_info_rsb_ext_sequential: + ib_printf("gds_info_rsb_ext_sequential,\n"); break; - case gds__info_rsb_ext_indexed: - ib_printf("gds__info_rsb_ext_indexed,\n"); + case gds_info_rsb_ext_indexed: + ib_printf("gds_info_rsb_ext_indexed,\n"); break; - case gds__info_rsb_ext_dbkey: - ib_printf("gds__info_rsb_ext_dbkey,\n"); + case gds_info_rsb_ext_dbkey: + ib_printf("gds_info_rsb_ext_dbkey,\n"); break; - case gds__info_rsb_left_cross: - ib_printf("gds__info_rsb_left_cross,\n"); + case gds_info_rsb_left_cross: + ib_printf("gds_info_rsb_left_cross,\n"); break; - case gds__info_rsb_select: - ib_printf("gds__info_rsb_select,\n"); + case gds_info_rsb_select: + ib_printf("gds_info_rsb_select,\n"); break; - case gds__info_rsb_sql_join: - ib_printf("gds__info_rsb_sql_join,\n"); + case gds_info_rsb_sql_join: + ib_printf("gds_info_rsb_sql_join,\n"); break; - case gds__info_rsb_simulate: - ib_printf("gds__info_rsb_simulate,\n"); + case gds_info_rsb_simulate: + ib_printf("gds_info_rsb_simulate,\n"); break; - case gds__info_rsb_sim_cross: - ib_printf("gds__info_rsb_sim_cross,\n"); + case gds_info_rsb_sim_cross: + ib_printf("gds_info_rsb_sim_cross,\n"); break; - case gds__info_rsb_once: - ib_printf("gds__info_rsb_once,\n"); + case gds_info_rsb_once: + ib_printf("gds_info_rsb_once,\n"); break; - case gds__info_rsb_procedure: - ib_printf("gds__info_rsb_procedure,\n"); + case gds_info_rsb_procedure: + ib_printf("gds_info_rsb_procedure,\n"); break; } @@ -376,8 +376,8 @@ static void explain_index_tree( (*buffer_length)--; switch (*explain_buffer++) { - case gds__info_rsb_and: - explain_printf(level, "gds__info_rsb_and,\n", 0); + case gds_info_rsb_and: + explain_printf(level, "gds_info_rsb_and,\n", 0); level++; explain_index_tree(level, relation_name, &explain_buffer, buffer_length); @@ -386,8 +386,8 @@ static void explain_index_tree( level--; break; - case gds__info_rsb_or: - explain_printf(level, "gds__info_rsb_or,\n", 0); + case gds_info_rsb_or: + explain_printf(level, "gds_info_rsb_or,\n", 0); level++; explain_index_tree(level, relation_name, &explain_buffer, buffer_length); @@ -396,12 +396,12 @@ static void explain_index_tree( level--; break; - case gds__info_rsb_dbkey: - explain_printf(level, "gds__info_rsb_dbkey,\n", 0); + case gds_info_rsb_dbkey: + explain_printf(level, "gds_info_rsb_dbkey,\n", 0); break; - case gds__info_rsb_index: - explain_printf(level, "gds__info_rsb_index, ", 0); + case gds_info_rsb_index: + explain_printf(level, "gds_info_rsb_index, ", 0); (*buffer_length)--; length = (SSHORT) * explain_buffer++; @@ -416,7 +416,7 @@ static void explain_index_tree( break; } - if (*explain_buffer == gds__info_rsb_end) { + if (*explain_buffer == gds_info_rsb_end) { explain_buffer++; (*buffer_length)--; } @@ -576,9 +576,9 @@ static void gen_control_break( BRK control, REQ request) for (; control; control = control->brk_next) { if (control->brk_field) - gen_expression(control->brk_field, request); + gen_expression((NOD) control->brk_field, request); if (control->brk_line) - gen_print_list(control->brk_line, request); + gen_print_list((NOD) control->brk_line, request); } } @@ -616,8 +616,8 @@ static void gen_compile( REQ request) if (gds__compile_request(status_vector, GDS_REF(dbb->dbb_handle), - GDS_REF(request->req_handle), - length, GDS_VAL(rlb->rlb_base))) { + (void**) GDS_REF(request->req_handle), + length, (char*) GDS_VAL(rlb->rlb_base))) { RELEASE_RLB; ERRQ_database_error(dbb, status_vector); } @@ -625,12 +625,12 @@ static void gen_compile( REQ request) #ifdef DEV_BUILD if (QLI_explain && !gds__request_info(status_vector, - GDS_REF(request->req_handle), + (void**) GDS_REF(request->req_handle), 0, sizeof(explain_info), explain_info, sizeof(explain_buffer), - explain_buffer)) explain(explain_buffer); + explain_buffer)) explain((UCHAR*) explain_buffer); #endif RELEASE_RLB; @@ -780,7 +780,7 @@ static void gen_expression( NOD node, REQ request) FLD field; CTX context; MAP map; - USHORT operator; + USHORT operatr; RLB rlb; if (node->nod_flags & NOD_local) @@ -828,95 +828,95 @@ static void gen_expression( NOD node, REQ request) return; case nod_eql: - operator = blr_eql; + operatr = blr_eql; break; case nod_neq: - operator = blr_neq; + operatr = blr_neq; break; case nod_gtr: - operator = blr_gtr; + operatr = blr_gtr; break; case nod_geq: - operator = blr_geq; + operatr = blr_geq; break; case nod_leq: - operator = blr_leq; + operatr = blr_leq; break; case nod_lss: - operator = blr_lss; + operatr = blr_lss; break; case nod_containing: - operator = blr_containing; + operatr = blr_containing; break; case nod_matches: - operator = blr_matching; + operatr = blr_matching; break; case nod_sleuth: - operator = blr_matching2; + operatr = blr_matching2; break; case nod_like: - operator = (node->nod_count == 2) ? blr_like : blr_ansi_like; + operatr = (node->nod_count == 2) ? blr_like : blr_ansi_like; break; case nod_starts: - operator = blr_starting; + operatr = blr_starting; break; case nod_missing: - operator = blr_missing; + operatr = blr_missing; break; case nod_between: - operator = blr_between; + operatr = blr_between; break; case nod_and: - operator = blr_and; + operatr = blr_and; break; case nod_or: - operator = blr_or; + operatr = blr_or; break; case nod_not: - operator = blr_not; + operatr = blr_not; break; case nod_add: - operator = blr_add; + operatr = blr_add; break; case nod_subtract: - operator = blr_subtract; + operatr = blr_subtract; break; case nod_multiply: - operator = blr_multiply; + operatr = blr_multiply; break; case nod_divide: - operator = blr_divide; + operatr = blr_divide; break; case nod_negate: - operator = blr_negate; + operatr = blr_negate; break; case nod_concatenate: - operator = blr_concatenate; + operatr = blr_concatenate; break; case nod_substr: - operator = blr_substring; + operatr = blr_substring; break; case nod_function: @@ -965,15 +965,15 @@ static void gen_expression( NOD node, REQ request) return; case nod_null: - operator = blr_null; + operatr = blr_null; break; case nod_user_name: - operator = blr_user_name; + operatr = blr_user_name; break; case nod_upcase: - operator = blr_upcase; + operatr = blr_upcase; break; default: @@ -986,7 +986,7 @@ static void gen_expression( NOD node, REQ request) if (request) { rlb = CHECK_RLB(request->req_blr); - STUFF(operator); + STUFF(operatr); } for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++) @@ -1091,7 +1091,7 @@ static void gen_for( NOD node, REQ request) /* If there is a message to be sent, build a receive for it */ if (node->nod_arg[e_for_send]) - gen_send_receive(node->nod_arg[e_for_send], blr_receive); + gen_send_receive((MSG) node->nod_arg[e_for_send], blr_receive); /* Generate the FOR loop proper. */ @@ -1393,7 +1393,7 @@ static void gen_modify( NOD node, REQ org_request) rlb = CHECK_RLB(request->req_blr); if (node->nod_arg[e_mod_send]) - gen_send_receive(node->nod_arg[e_mod_send], blr_receive); + gen_send_receive((MSG) node->nod_arg[e_mod_send], blr_receive); for (ptr = &node->nod_arg[e_mod_count], end = ptr + node->nod_count; ptr < end; ptr++) { @@ -1580,7 +1580,7 @@ static void gen_rse( NOD node, REQ request) rlb = CHECK_RLB(request->req_blr); - if ((NOD_T) node->nod_arg[e_rse_join_type] == (NOD_T) 0) + if ((NOD_T) (int) node->nod_arg[e_rse_join_type] == (NOD_T) 0) STUFF(blr_rse); else STUFF(blr_rs_stream); @@ -1649,7 +1649,7 @@ static void gen_rse( NOD node, REQ request) if (list = node->nod_arg[e_rse_reduced]) gen_sort(list, request, blr_project); - join_type = (NOD_T) node->nod_arg[e_rse_join_type]; + join_type = (NOD_T) (int) node->nod_arg[e_rse_join_type]; if (join_type != (NOD_T) 0 && join_type != nod_join_inner) { STUFF(blr_join_type); if (join_type == nod_join_left) @@ -1664,7 +1664,7 @@ static void gen_rse( NOD node, REQ request) } -static void gen_send_receive( MSG message, USHORT operator) +static void gen_send_receive( MSG message, USHORT operatr) { /************************************** * @@ -1681,12 +1681,12 @@ static void gen_send_receive( MSG message, USHORT operator) request = message->msg_request; rlb = CHECK_RLB(request->req_blr); - STUFF(operator); + STUFF(operatr); STUFF(message->msg_number); } -static void gen_sort( NOD node, REQ request, UCHAR operator) +static void gen_sort( NOD node, REQ request, UCHAR operatr) { /************************************** * @@ -1703,13 +1703,13 @@ static void gen_sort( NOD node, REQ request, UCHAR operator) rlb = CHECK_RLB(request->req_blr); - STUFF(operator); + STUFF(operatr); STUFF(node->nod_count); request->req_flags |= REQ_project; for (ptr = node->nod_arg, end = ptr + node->nod_count * 2; ptr < end; ptr += 2) { - if (operator == blr_sort) + if (operatr == blr_sort) STUFF((ptr[1]) ? blr_descending : blr_ascending); gen_expression(ptr[0], request); } @@ -1822,58 +1822,58 @@ static void gen_statistical( NOD node, REQ request) FLD field; CTX context; MSG send, receive; - USHORT operator, i; + USHORT operatr, i; RLB rlb; switch (node->nod_type) { case nod_average: - operator = blr_average; + operatr = blr_average; break; case nod_count: /* count2 - operator = node->nod_arg [e_stt_value] ? blr_count2 : blr_count; + operatr = node->nod_arg [e_stt_value] ? blr_count2 : blr_count; */ - operator = blr_count; + operatr = blr_count; break; case nod_max: - operator = blr_maximum; + operatr = blr_maximum; break; case nod_min: - operator = blr_minimum; + operatr = blr_minimum; break; case nod_total: - operator = blr_total; + operatr = blr_total; break; case nod_agg_average: - operator = blr_agg_average; + operatr = blr_agg_average; break; case nod_agg_count: /* count2 - operator = node->nod_arg [e_stt_value] ? blr_agg_count2 : blr_agg_count; + operatr = node->nod_arg [e_stt_value] ? blr_agg_count2 : blr_agg_count; */ - operator = blr_agg_count; + operatr = blr_agg_count; break; case nod_agg_max: - operator = blr_agg_max; + operatr = blr_agg_max; break; case nod_agg_min: - operator = blr_agg_min; + operatr = blr_agg_min; break; case nod_agg_total: - operator = blr_agg_total; + operatr = blr_agg_total; break; case nod_from: - operator = (node->nod_arg[e_stt_default]) ? blr_via : blr_from; + operatr = (node->nod_arg[e_stt_default]) ? blr_via : blr_from; break; default: @@ -1896,7 +1896,7 @@ static void gen_statistical( NOD node, REQ request) else rlb = CHECK_RLB(request->req_blr); - STUFF(operator); + STUFF(operatr); if (node->nod_arg[e_stt_rse]) gen_rse(node->nod_arg[e_stt_rse], request); @@ -1947,7 +1947,7 @@ static void gen_store( NOD node, REQ request) /* If there is a message to be sent, build a receive for it */ if (node->nod_arg[e_sto_send]) - gen_send_receive(node->nod_arg[e_sto_send], blr_receive); + gen_send_receive((MSG) node->nod_arg[e_sto_send], blr_receive); /* Generate the STORE statement proper. */ diff --git a/src/qli/hsh.cpp b/src/qli/hsh.cpp index 22b03a754d..b0fd2d8589 100644 --- a/src/qli/hsh.cpp +++ b/src/qli/hsh.cpp @@ -67,7 +67,7 @@ void HSH_fini(void) symbol = key_symbols; key_symbols = (SYM) key_symbols->sym_object; HSH_remove(symbol); - ALL_release(symbol); + ALL_release((FRB) symbol); } } diff --git a/src/qli/lex.cpp b/src/qli/lex.cpp index 9af50e08e0..00e4fcf202 100644 --- a/src/qli/lex.cpp +++ b/src/qli/lex.cpp @@ -39,6 +39,14 @@ #include "../jrd/gds_proto.h" #include "../jrd/utl_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_CTYPES_H +#include +#endif + #ifdef VMS #include #define SCRATCH "gds_query" @@ -379,7 +387,7 @@ void LEX_fini(void) if (trace_file && (trace_file != (IB_FILE *) - 1)) { ib_fclose(trace_file); - unlink(trace_file_name); + unlink((char*) trace_file_name); } } @@ -572,7 +580,7 @@ void LEX_init(void) TEXT *p; #ifndef __BORLANDC__ - trace_file = gds__temp_file(TRUE, SCRATCH, trace_file_name); + trace_file = (IB_FILE*) gds__temp_file(TRUE, SCRATCH, (TEXT*) trace_file_name); if (trace_file == (IB_FILE *) - 1) IBERROR(61); /* Msg 61 couldn't open scratch file */ #else @@ -654,7 +662,7 @@ void LEX_pop_line(void) else if (temp->line_type == line_file) ib_fclose((IB_FILE *) temp->line_source); - ALL_release(temp); + ALL_release((FRB) temp); } @@ -1148,7 +1156,7 @@ static void next_line( BOOLEAN eof_ok) flag = LEX_get_line(QLI_prompt, p, (int) QLI_line->line_size); else if (QLI_line->line_type == line_file) { flag = - get_line(QLI_line->line_source, p, QLI_line->line_size); + get_line((FILE*) QLI_line->line_source, p, QLI_line->line_size); if (QLI_echo) ib_printf("%s", QLI_line->line_data); } diff --git a/src/qli/mov.cpp b/src/qli/mov.cpp index 9283094f9c..f898629dcb 100644 --- a/src/qli/mov.cpp +++ b/src/qli/mov.cpp @@ -236,8 +236,8 @@ int MOVQ_compare( DSC * arg1, DSC * arg2) /* Handle mixed string comparisons */ if (arg1->dsc_dtype <= dtype_varying && arg2->dsc_dtype <= dtype_varying) { - length = MOVQ_get_string(arg1, &p1, 0, 0); - length2 = MOVQ_get_string(arg2, &p2, 0, 0); + length = MOVQ_get_string(arg1, (TEXT**) &p1, 0, 0); + length2 = MOVQ_get_string(arg2, (TEXT**) &p2, 0, 0); fill = length - length2; if (length >= length2) { if (length2) @@ -830,7 +830,7 @@ int MOVQ_get_string( DSC * desc, TEXT ** address, VARY * temp, USHORT length) if (desc->dsc_dtype == dtype_cstring) { *address = (TEXT *) desc->dsc_address; - return MIN(strlen(desc->dsc_address), desc->dsc_length - 1); + return MIN(strlen((char*)desc->dsc_address), desc->dsc_length - 1); } /* No luck -- convert value to varying string. */ @@ -900,8 +900,8 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type) case dtype_varying: case dtype_cstring: case dtype_text: - length = MOVQ_get_string(from, &ptr, 0, 0); - string_to_date(ptr, length, to->dsc_address); + length = MOVQ_get_string(from, (TEXT**) &ptr, 0, 0); + string_to_date((TEXT*) ptr, length, (long int*)to->dsc_address); return; case dtype_sql_date: ((SLONG *) to->dsc_address)[0] = *(SLONG *) from->dsc_address; @@ -921,8 +921,8 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type) case dtype_text: { SLONG date[2]; - length = MOVQ_get_string(from, &ptr, 0, 0); - string_to_date(ptr, length, date); + length = MOVQ_get_string(from, (TEXT**)&ptr, 0, 0); + string_to_date((TEXT*) ptr, length, (long int*)date); ((SLONG *) to->dsc_address)[0] = date[0]; } return; @@ -942,8 +942,8 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type) case dtype_text: { SLONG date[2]; - length = MOVQ_get_string(from, &ptr, 0, 0); - string_to_time(ptr, length, date); + length = MOVQ_get_string(from, (TEXT**)&ptr, 0, 0); + string_to_time((TEXT*) ptr, length, (long int*) date); ((SLONG *) to->dsc_address)[0] = date[1]; } return; @@ -963,7 +963,7 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type) case dtype_varying: case dtype_cstring: case dtype_text: - length = MOVQ_get_string(from, &ptr, 0, 0); + length = MOVQ_get_string(from, (TEXT**)&ptr, 0, 0); q = ptr; switch (to->dsc_dtype) { case dtype_text: @@ -1028,13 +1028,13 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type) return; case dtype_sql_date: - sql_date_to_text(from->dsc_address, to); + sql_date_to_text((long int*) from->dsc_address, to); return; case dtype_sql_time: - sql_time_to_text(from->dsc_address, to); + sql_time_to_text((ULONG*) from->dsc_address, to); return; case dtype_timestamp: - timestamp_to_text(from->dsc_address, to); + timestamp_to_text((long int*) from->dsc_address, to); return; } break; @@ -1173,9 +1173,9 @@ static void sql_date_to_text( SLONG date[1], DSC * to) struct tm times; SLONG date2[2]; - date2[0] = date; + date2[0] = (SLONG) date; date2[1] = 0; - isc_decode_date(date2, ×); + isc_decode_date((GDS_QUAD*) date2, ×); sprintf(temp, "%2d-%.3s-%04d", times.tm_mday, months[times.tm_mon], times.tm_year + 1900); @@ -1209,9 +1209,9 @@ static void sql_time_to_text( ULONG date[1], DSC * to) SLONG date2[2]; date2[0] = 0; - date2[1] = date; + date2[1] = (SLONG) date; - isc_decode_date(date2, ×); + isc_decode_date((GDS_QUAD*) date2, ×); sprintf(temp, " %2d:%.2d:%.2d.%.4d", times.tm_hour, times.tm_min, times.tm_sec, date2[1] % PRECISION); @@ -1244,7 +1244,7 @@ static void timestamp_to_text( SLONG date[2], DSC * to) TEXT *p, temp[35], time[15]; struct tm times; - isc_decode_date(date, ×); + isc_decode_date((GDS_QUAD*)date, ×); #if ((defined JPN_SJIS || defined JPN_EUC) && defined JPN_DATE) /* By default the Japanese date format is yyyy.mm.dd */ @@ -1327,29 +1327,7 @@ static void now_to_date( struct tm *time, SLONG date[2]) * **************************************/ - isc_encode_date(time, date); - - time_$clock_t clock, clock1, clock2; - cal_$timedate_rec_t d_clock; - - cal_$get_local_time(&clock1); - cal_$decode_time(clock1, &d_clock); - cal_$encode_time(d_clock, &clock2); - cal_$sub_clock(&clock1, clock2); - - time->tm_year = d_clock.year - 1900; - time->tm_mon = d_clock.month - 1; - time->tm_mday = d_clock.day; - time->tm_hour = d_clock.hour; - time->tm_min = d_clock.minute; - time->tm_sec = d_clock.second; - time->tm_wday = 0; - time->tm_yday = 0; - - isc_encode_date(time, date); - date[1] += (clock1.c2.low32 * 4) / 100; - -#endif + isc_encode_date(time, (GDS_QUAD*)date); } @@ -1574,7 +1552,7 @@ static void string_to_date( TEXT * string, USHORT length, SLONG date[2]) return; } today->tm_hour = today->tm_min = today->tm_sec = 0; - isc_encode_date(today, date); + isc_encode_date(today, (GDS_QUAD*)date); if (strcmp(temp, TODAY) == 0) return; if (strcmp(temp, TOMORROW) == 0) { @@ -1669,8 +1647,8 @@ static void string_to_date( TEXT * string, USHORT length, SLONG date[2]) /* convert day/month/year to Julian and validate result */ - isc_encode_date(×, date); - isc_decode_date(date, ×2); + isc_encode_date(×, (GDS_QUAD*)date); + isc_decode_date((GDS_QUAD*)date, ×2); if (times.tm_year != times2.tm_year || times.tm_mon != times2.tm_mon || times.tm_mday != times2.tm_mday) @@ -1779,7 +1757,7 @@ static void string_to_time( TEXT * string, USHORT length, SLONG date[2]) /* convert day/month/year to Julian and validate result */ - isc_encode_date(×, date); + isc_encode_date(×, (GDS_QUAD*)date); while (precision++ < 4) components[6] *= 10; diff --git a/src/qli/parse.cpp b/src/qli/parse.cpp index 04ac83345b..eeb2d6d58c 100644 --- a/src/qli/parse.cpp +++ b/src/qli/parse.cpp @@ -590,7 +590,7 @@ static CON make_numeric_constant( TEXT * string, USHORT length) constant->con_desc.dsc_length = sizeof(SLONG); constant->con_desc.dsc_address = constant->con_data; constant->con_desc.dsc_scale = - MOVQ_decompose(string, length, constant->con_data); + MOVQ_decompose(string, length, (SLONG*) constant->con_data); } else { ++length; @@ -755,23 +755,23 @@ static SYN parse_add( USHORT * paren_count, USHORT * bool_flag) ************************************** * * Functional description - * Parse the lowest precedence operators, ADD and SUBTRACT. + * Parse the lowest precedence operatrs, ADD and SUBTRACT. * **************************************/ SYN node, arg; - NOD_T operator; + NOD_T operatr; node = parse_multiply(paren_count, bool_flag); while (TRUE) { if (MATCH(KW_PLUS)) - operator = nod_add; + operatr = nod_add; else if (MATCH(KW_MINUS)) - operator = nod_subtract; + operatr = nod_subtract; else return node; arg = node; - node = SYNTAX_NODE(operator, 2); + node = SYNTAX_NODE(operatr, 2); node->syn_arg[0] = arg; node->syn_arg[1] = parse_multiply(paren_count, bool_flag); } @@ -825,7 +825,7 @@ static SYN parse_assignment(void) * Parse an assignment statement (or give an error). The * assignment statement can be either a simple assignment * (field = value) or a restructure (relation = rse). - * If the assignment operator is missing, + * If the assignment operatr is missing, * generate an "expected statement" error. * **************************************/ @@ -856,7 +856,7 @@ static SYN parse_assignment(void) relation = NULL; if (relation) { - ALL_release(field); + ALL_release((FRB) field); node->syn_type = nod_restructure; node->syn_arg[s_asn_to] = field = SYNTAX_NODE(nod_relation, s_rel_count); @@ -2087,7 +2087,7 @@ static SYN parse_if(void) } -static SYN parse_in( SYN value, NOD_T operator, USHORT all_flag) +static SYN parse_in( SYN value, NOD_T operatr, USHORT all_flag) { /************************************** * @@ -2113,7 +2113,7 @@ static SYN parse_in( SYN value, NOD_T operator, USHORT all_flag) /* Time to chose between two forms of the expression */ if (!MATCH(KW_SELECT)) { - node = SYNTAX_NODE(operator, 2); + node = SYNTAX_NODE(operatr, 2); node->syn_arg[0] = value; node->syn_arg[1] = parse_primitive_value(0, 0); while (MATCH(KW_COMMA)) { @@ -2137,7 +2137,7 @@ static SYN parse_in( SYN value, NOD_T operator, USHORT all_flag) rse->syn_arg[s_rse_outer] = value; rse->syn_arg[s_rse_inner] = value2; - rse->syn_arg[s_rse_op] = INT_CAST operator; + rse->syn_arg[s_rse_op] = INT_CAST operatr; rse->syn_arg[s_rse_all_flag] = INT_CAST all_flag; /* Finally, construct an ANY node */ @@ -2245,28 +2245,28 @@ static NOD_T parse_join_type(void) * Parse a join type. * **************************************/ - NOD_T operator; + NOD_T operatr; if (MATCH(KW_INNER)) - operator = nod_join_inner; + operatr = nod_join_inner; else if (MATCH(KW_LEFT)) - operator = nod_join_left; + operatr = nod_join_left; else if (MATCH(KW_RIGHT)) - operator = nod_join_right; + operatr = nod_join_right; else if (MATCH(KW_FULL)) - operator = nod_join_full; + operatr = nod_join_full; else if (MATCH(KW_JOIN)) return nod_join_inner; else return (NOD_T) 0; - if (operator != nod_join_inner) + if (operatr != nod_join_inner) MATCH(KW_OUTER); if (!MATCH(KW_JOIN)) SYNTAX_ERROR(489); /* Msg489 JOIN */ - return operator; + return operatr; } @@ -2659,23 +2659,23 @@ static SYN parse_multiply( USHORT * paren_count, USHORT * bool_flag) ************************************** * * Functional description - * Parse the operators * and /. + * Parse the operatrs * and /. * **************************************/ SYN node, arg; - NOD_T operator; + NOD_T operatr; node = parse_from(paren_count, bool_flag); while (TRUE) { if (MATCH(KW_ASTERISK)) - operator = nod_multiply; + operatr = nod_multiply; else if (MATCH(KW_SLASH)) - operator = nod_divide; + operatr = nod_divide; else return node; arg = node; - node = SYNTAX_NODE(operator, 2); + node = SYNTAX_NODE(operatr, 2); node->syn_arg[0] = arg; node->syn_arg[1] = parse_from(paren_count, bool_flag); } @@ -3339,7 +3339,7 @@ static SYN parse_relational( USHORT * paren_count) **************************************/ SYN node, expr1, or_node; USHORT negation; - NOD_T operator, *rel_ops; + NOD_T operatr, *rel_ops; USHORT local_flag; local_flag = TRUE; @@ -3350,19 +3350,19 @@ static SYN parse_relational( USHORT * paren_count) return node; } - operator = (NOD_T) 0; + operatr = (NOD_T) 0; if (MATCH(KW_EXISTS)) - operator = nod_any; + operatr = nod_any; else if (MATCH(KW_SINGULAR)) - operator = nod_unique; + operatr = nod_unique; - if (operator != (NOD_T) 0) { + if (operatr != (NOD_T) 0) { PAR_real(); if (MATCH(KW_LEFT_PAREN)) { PAR_real(); if (MATCH(KW_SELECT)) { PAR_real(); - node = SYNTAX_NODE(operator, 2); + node = SYNTAX_NODE(operatr, 2); if (!MATCH(KW_ASTERISK)) node->syn_arg[1] = parse_value(0, 0); node->syn_arg[0] = parse_sql_rse(); @@ -3370,7 +3370,7 @@ static SYN parse_relational( USHORT * paren_count) return node; } } - if (operator == nod_any) + if (operatr == nod_any) SYNTAX_ERROR(205); /* Msg205 EXISTS (SELECT * ) */ else SYNTAX_ERROR(488); /* Msg488 SINGULAR (SELECT * ) */ @@ -3408,43 +3408,43 @@ static SYN parse_relational( USHORT * paren_count) case KW_EQUALS: case KW_EQ: - operator = (negation) ? nod_neq : nod_eql; + operatr = (negation) ? nod_neq : nod_eql; negation = FALSE; break; case KW_NE: - operator = (negation) ? nod_eql : nod_neq; + operatr = (negation) ? nod_eql : nod_neq; negation = FALSE; break; case KW_GT: - operator = (negation) ? nod_leq : nod_gtr; + operatr = (negation) ? nod_leq : nod_gtr; negation = FALSE; break; case KW_GE: - operator = (negation) ? nod_lss : nod_geq; + operatr = (negation) ? nod_lss : nod_geq; negation = FALSE; break; case KW_LE: - operator = (negation) ? nod_gtr : nod_leq; + operatr = (negation) ? nod_gtr : nod_leq; negation = FALSE; break; case KW_LT: - operator = (negation) ? nod_geq : nod_lss; + operatr = (negation) ? nod_geq : nod_lss; negation = FALSE; break; case KW_CONTAINING: - operator = nod_containing; + operatr = nod_containing; break; case KW_MATCHES: node = parse_matches(); node->syn_arg[0] = expr1; - operator = node->syn_type; + operatr = node->syn_type; break; case KW_LIKE: @@ -3487,19 +3487,19 @@ static SYN parse_relational( USHORT * paren_count) for (rel_ops = relationals; *rel_ops != (NOD_T) 0; rel_ops++) if (expr1->syn_type == *rel_ops) return expr1; - SYNTAX_ERROR(206); /* Msg206 relational operator */ + SYNTAX_ERROR(206); /* Msg206 relational operatr */ } -/* If we haven't already built a node, it must be an ordinary binary operator. +/* If we haven't already built a node, it must be an ordinary binary operatr. Build it. */ if (!node) { PAR_token(); if (MATCH(KW_ANY)) - return parse_in(expr1, operator, FALSE); + return parse_in(expr1, operatr, FALSE); if (MATCH(KW_ALL)) - return parse_in(expr1, operator, TRUE); - node = SYNTAX_NODE(operator, 2); + return parse_in(expr1, operatr, TRUE); + node = SYNTAX_NODE(operatr, 2); node->syn_arg[0] = expr1; node->syn_arg[1] = parse_value(paren_count, &local_flag); } @@ -3512,7 +3512,7 @@ static SYN parse_relational( USHORT * paren_count) /* If the node isn't an equality, we've done. Since equalities can be structured as implicit ORs, build them here. */ - if (operator != nod_eql) + if (operatr != nod_eql) return node; /* We have an equality operation, which can take a number of values. Generate @@ -4722,7 +4722,7 @@ static SYN parse_sql_grant_revoke( USHORT type) USHORT privileges; PAR_real_token(); - node = SYNTAX_NODE(type, s_grant_count); + node = SYNTAX_NODE((NOD_T) type, s_grant_count); stack = NULL; privileges = 0; @@ -5507,7 +5507,7 @@ static SYM parse_symbol(void) } -static parse_terminating_parens( USHORT * paren_count, USHORT * local_count) +static int parse_terminating_parens( USHORT * paren_count, USHORT * local_count) { /************************************** * @@ -5647,7 +5647,7 @@ static SYN parse_value( USHORT * paren_count, USHORT * bool_flag) * * Functional description * Parse a general value expression. In practice, this means parse the - * lowest precedence operator CONCATENATE. + * lowest precedence operatr CONCATENATE. * **************************************/ SYN node, arg; diff --git a/src/qli/picstr.cpp b/src/qli/picstr.cpp index dfa7251eab..4df2137948 100644 --- a/src/qli/picstr.cpp +++ b/src/qli/picstr.cpp @@ -32,6 +32,7 @@ #include "../qli/mov_proto.h" #else #include "../pyxis/pyxis.h" +#include "../pyxis/all.h" #endif #include "../jrd/time.h" #if (defined JPN_SJIS || defined JPN_EUC) @@ -59,11 +60,13 @@ static void literal(PIC, TEXT, TEXT **); #define MOVQ_get_string MOVP_get_string #define MOVQ_move MOVP_move -extern double PASCAL_ROUTINE MOVQ_get_double(); +#include "../qli/mov_proto.h" + +extern BLK PYXIS_alloc(PLB , UCHAR , int ); #endif #ifdef PYXIS -TEXT *PICSTR_default_edit_string(); +TEXT *PICSTR_default_edit_string(DSC *, TEXT*); #endif static TEXT *alpha_weekdays[] = { @@ -344,16 +347,16 @@ int PIC_edit( DSC * desc, PIC picture, TEXT ** output, USHORT max_length) switch (picture->pic_type) { case pic_alpha: edit_alpha(desc, picture, output, max_length); - return; + return 0; case pic_numeric: edit_numeric(desc, picture, output); - return; + return 0; case pic_date: edit_date(desc, picture, output); - return; + return 0; case pic_float: edit_float(desc, picture, output); - return; + return 0; default: #ifndef PYXIS BUGCHECK(68); /* Msg 68 PIC_edit: class not yet implemented */ @@ -551,7 +554,7 @@ static void edit_alpha( TEXT c, d, *p, *out, *end, temp[512], *q, date[32]; USHORT l, i; - l = MOVQ_get_string(desc, &p, temp, sizeof(temp)); + l = MOVQ_get_string(desc, &p, (vary*) temp, sizeof(temp)); end = p + l; picture->pic_pointer = picture->pic_string; picture->pic_count = 0; @@ -685,7 +688,7 @@ static void edit_date( DSC * desc, PIC picture, TEXT ** output) return; #endif - isc_decode_date(date, ×); + isc_decode_date((GDS_QUAD*) date, ×); p = temp; nmonth = p; diff --git a/src/qli/procddl4.h b/src/qli/procddl4.h index aeb02548e2..3792d99888 100644 --- a/src/qli/procddl4.h +++ b/src/qli/procddl4.h @@ -16,13 +16,13 @@ * All Rights Reserved. * Contributor(s): ______________________________________. */ - gds__dyn_version_1, - gds__dyn_begin, - gds__dyn_def_idx, 19,0, 'Q','L','I','$','P','R','O','C','E','D','U','R','E','S','_','I','D','X','1', - gds__dyn_rel_name, 14,0, 'Q','L','I','$','P','R','O','C','E','D','U','R','E','S', - gds__dyn_idx_unique, 2,0, 1,0, - gds__dyn_idx_inactive, 2,0, 0,0, - gds__dyn_fld_name, 18,0, 'Q','L','I','$','P','R','O','C','E','D','U','R','E','_','N','A','M','E', - gds__dyn_end, - gds__dyn_end, - gds__dyn_eoc + gds_dyn_version_1, + gds_dyn_begin, + gds_dyn_def_idx, 19,0, 'Q','L','I','$','P','R','O','C','E','D','U','R','E','S','_','I','D','X','1', + gds_dyn_rel_name, 14,0, 'Q','L','I','$','P','R','O','C','E','D','U','R','E','S', + gds_dyn_idx_unique, 2,0, 1,0, + gds_dyn_idx_inactive, 2,0, 0,0, + gds_dyn_fld_name, 18,0, 'Q','L','I','$','P','R','O','C','E','D','U','R','E','_','N','A','M','E', + gds_dyn_end, + gds_dyn_end, + gds_dyn_eoc diff --git a/src/qli/report.cpp b/src/qli/report.cpp index bb5f9ca59d..986c2b2db3 100644 --- a/src/qli/report.cpp +++ b/src/qli/report.cpp @@ -73,7 +73,7 @@ void RPT_report( NOD loop) node = loop->nod_arg[e_for_statement]; report = (RPT) node->nod_arg[e_prt_list]; print = (PRT) node->nod_arg[e_prt_output]; - print->prt_new_page = top_of_page; + print->prt_new_page = (int(*)()) top_of_page; print->prt_page_number = 0; /* Get to actual report node */ @@ -82,7 +82,7 @@ void RPT_report( NOD loop) send a message slong with it. */ if (request = (REQ) loop->nod_arg[e_for_request]) - EXEC_start_request(request, loop->nod_arg[e_for_send]); + EXEC_start_request(request, (MSG) loop->nod_arg[e_for_send]); else if (message = (MSG) loop->nod_arg[e_for_send]) EXEC_send(message); @@ -94,7 +94,7 @@ void RPT_report( NOD loop) /* Get the first record of the record. If there isn't anything, don't worry about anything. */ - desc = EXEC_receive(message, loop->nod_arg[e_for_eof]); + desc = EXEC_receive(message, (PAR) loop->nod_arg[e_for_eof]); if (*(USHORT *) desc->dsc_address) return; @@ -103,11 +103,11 @@ void RPT_report( NOD loop) report->rpt_buffer = (UCHAR *) string->str_data; } - MOVQ_fast(message->msg_buffer, report->rpt_buffer, + MOVQ_fast((SCHAR*) message->msg_buffer, (SCHAR*) report->rpt_buffer, (SLONG) message->msg_length); if (control = report->rpt_top_rpt) - FMT_print(control->brk_line, print); + FMT_print((NOD) control->brk_line, print); top_of_page(print, TRUE); @@ -118,7 +118,7 @@ void RPT_report( NOD loop) /* Force TOP breaks for all fields */ for (control = report->rpt_top_breaks; control; - control = control->brk_next) FMT_print(control->brk_line, print); + control = control->brk_next) FMT_print((NOD) control->brk_line, print); for (;;) { /* Check for bottom breaks. If we find one, force all lower breaks. */ @@ -157,7 +157,7 @@ void RPT_report( NOD loop) /* Get the next record. If we're at end, we're almost done. */ SWAP(message->msg_buffer, report->rpt_buffer); - desc = EXEC_receive(message, loop->nod_arg[e_for_eof]); + desc = EXEC_receive(message, (PAR) loop->nod_arg[e_for_eof]); if (*(USHORT *) desc->dsc_address) break; } @@ -169,7 +169,7 @@ void RPT_report( NOD loop) bottom_break(report->rpt_bottom_rpt, print); if (control = report->rpt_bottom_page) - FMT_print(control->brk_line, print); + FMT_print((NOD) control->brk_line, print); } @@ -194,9 +194,9 @@ static void bottom_break( BRK control, PRT print) bottom_break(control->brk_next, print); for (stack = control->brk_statisticals; stack; stack = stack->lls_next) - EVAL_break_compute(stack->lls_object); + EVAL_break_compute((NOD) stack->lls_object); - FMT_print(control->brk_line, print); + FMT_print((NOD) control->brk_line, print); } @@ -216,7 +216,7 @@ static void increment_break( BRK control) for (; control; control = control->brk_next) for (stack = control->brk_statisticals; stack; - stack = stack->lls_next) EVAL_break_increment(stack->lls_object); + stack = stack->lls_next) EVAL_break_increment((NOD) stack->lls_object); } @@ -236,7 +236,7 @@ static void initialize_break( BRK control) for (; control; control = control->brk_next) for (stack = control->brk_statisticals; stack; - stack = stack->lls_next) EVAL_break_init(stack->lls_object); + stack = stack->lls_next) EVAL_break_init((NOD) stack->lls_object); } @@ -258,13 +258,13 @@ static int test_break( BRK control, RPT report, MSG message) /* Evaluate the two versions of the expression */ - if (ptr1 = EVAL_value(control->brk_field)) + if (ptr1 = EVAL_value((NOD) control->brk_field)) desc1 = *ptr1; p1 = message->msg_buffer; message->msg_buffer = report->rpt_buffer; - if (ptr2 = EVAL_value(control->brk_field)) + if (ptr2 = EVAL_value((NOD) control->brk_field)) desc2 = *ptr2; message->msg_buffer = p1; @@ -310,8 +310,8 @@ static void top_break( BRK control, PRT print) for (; control; control = control->brk_next) { for (stack = control->brk_statisticals; stack; - stack = stack->lls_next) EVAL_break_compute(stack->lls_object); - FMT_print(control->brk_line, print); + stack = stack->lls_next) EVAL_break_compute((NOD) stack->lls_object); + FMT_print((NOD) control->brk_line, print); } } @@ -336,14 +336,14 @@ static void top_of_page( PRT print, BOOLEAN first_flag) if (!first_flag) { if (control = report->rpt_bottom_page) - FMT_print(control->brk_line, print); + FMT_print((NOD) control->brk_line, print); FMT_put("\f", print); } print->prt_lines_remaining = print->prt_lines_per_page; if (control = report->rpt_top_page) - FMT_print(control->brk_line, print); + FMT_print((NOD) control->brk_line, print); else if (report->rpt_column_header) { if (report->rpt_header) FMT_put(report->rpt_header, print); diff --git a/src/remote/inet.cpp b/src/remote/inet.cpp index 11a3b69e97..f50e7d81b2 100644 --- a/src/remote/inet.cpp +++ b/src/remote/inet.cpp @@ -23,7 +23,7 @@ * FSG 16.03.2001 */ /* -$Id: inet.cpp,v 1.1.1.1 2001-05-23 13:26:38 tamlin Exp $ +$Id: inet.cpp,v 1.2 2001-07-12 05:46:06 bellardo Exp $ */ #include "../jrd/ib_stdio.h" #include @@ -35,6 +35,18 @@ $Id: inet.cpp,v 1.1.1.1 2001-05-23 13:26:38 tamlin Exp $ #include "../jrd/time.h" +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef SUPERSERVER #ifdef WIN_NT #define FD_SETSIZE 1024 @@ -53,6 +65,10 @@ $Id: inet.cpp,v 1.1.1.1 2001-05-23 13:26:38 tamlin Exp $ #endif #endif +#ifdef DARWIN +extern "C" int innetgr(const char *, const char *, const char *, const char *); +#endif + #ifdef NETWARE_386 NETDB_DEFINE_CONTEXT #include "../remote/faux.h" @@ -1501,11 +1517,12 @@ static int accept_connection(PORT port, P_CNCT* cnct) #else SLONG gids[128]; + int i; initgroups(passwd->pw_name, passwd->pw_gid); if (eff_gid != -1) { - const int gid_count = getgroups(sizeof(gids) / sizeof(SLONG), gids); - for (int i = 0; i < gid_count; ++i) { + const int gid_count = getgroups(sizeof(gids) / sizeof(SLONG), (gid_t*)gids); + for (i = 0; i < gid_count; ++i) { if (gids[i] == eff_gid) { break; } @@ -1775,7 +1792,7 @@ static PORT aux_connect(PORT port, PACKET* packet, XDR_INT (*ast)(void)) } new_port->port_ast = ast; - ISC_signal(SIGURG, inet_handler, new_port); + ISC_signal(SIGURG, (void(*)(void))inet_handler, new_port); } #endif @@ -1943,7 +1960,7 @@ static int check_host( length = sizeof(address); - if (getpeername((int) port->port_handle, &address, &length) == -1) + if (getpeername((int) port->port_handle, (struct sockaddr*)&address, &length) == -1) return 0; @@ -1967,7 +1984,7 @@ static int check_host( if (result == -1) { fp = ib_fopen(GDS_HOSTS_FILE, "r"); - hosts_file = fp ? GDS_HOSTS_FILE : HOSTS_FILE; + hosts_file = fp ? (TEXT*)GDS_HOSTS_FILE : (TEXT*)HOSTS_FILE; if (fp) ib_fclose(fp); @@ -2097,7 +2114,7 @@ static void disconnect( PORT port) #if !(defined VMS || defined NETWARE_386 || defined PC_PLATFORM || \ defined WIN_NT) if (port->port_ast) { - ISC_signal_cancel(SIGURG, inet_handler, port); + ISC_signal_cancel(SIGURG, (void(*)(void))inet_handler, port); } #endif @@ -3346,7 +3363,7 @@ static void inet_handler( PORT port) return; } - (*port->port_ast) (port); + (*((void(*)(PORT))port->port_ast)) (port); } #endif diff --git a/src/remote/inet_server.cpp b/src/remote/inet_server.cpp index ad5fb307ad..ddefbafceb 100644 --- a/src/remote/inet_server.cpp +++ b/src/remote/inet_server.cpp @@ -23,15 +23,33 @@ * FSG 16.03.2001 */ /* -$Id: inet_server.cpp,v 1.1.1.1 2001-05-23 13:26:39 tamlin Exp $ +$Id: inet_server.cpp,v 1.2 2001-07-12 05:46:06 bellardo Exp $ */ #include "../jrd/ib_stdio.h" #include #include "../jrd/common.h" +#include "../jrd/isc_proto.h" +#include "../jrd/divorce.h" #if !(defined VMS || defined sgi || defined PC_PLATFORM) #include #endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + #ifdef WINDOWS_ROUTER #define MAX_ARGS 6 #endif /* WINDOWS_ROUTER */ @@ -91,7 +109,7 @@ $Id: inet_server.cpp,v 1.1.1.1 2001-05-23 13:26:39 tamlin Exp $ #ifndef NFDBITS #define NFDBITS (sizeof(SLONG) * NBBY) -#if !(defined NETWARE_386 || defined DECOSF) +#if !(defined NETWARE_386 || defined DECOSF || defined DARWIN) #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) @@ -115,7 +133,8 @@ extern "C" { static int assign(SCHAR *); #ifndef DECOSF -static int bzero(SCHAR *, int); +extern "C" void *memset(void* , int , size_t); +static int bzero(void *, int); #endif static void name_process(UCHAR *); static void signal_handler(void); @@ -294,7 +313,7 @@ int CLIB_ROUTINE main( int argc, char **argv) } gds__log("INET_SERVER/main: gds_inet_server restarted"); } - set_signal(SIGUSR1, SIG_DFL); + set_signal(SIGUSR1, (void(*)()) SIG_DFL); } #endif @@ -326,7 +345,7 @@ int CLIB_ROUTINE main( int argc, char **argv) if (!debug) { FD_ZERO(&mask); FD_SET(2, &mask); - divorce_terminal(&mask); + divorce_terminal((int) &mask); } { STATUS status_vector[ISC_STATUS_LENGTH]; @@ -500,7 +519,7 @@ static int assign( SCHAR * string) #if !(defined DECOSF) -static int bzero( SCHAR * address, int length) +static int bzero( void * addr, int length) { /************************************** * @@ -512,6 +531,7 @@ static int bzero( SCHAR * address, int length) * Zero a block of memory. * **************************************/ + SCHAR *address = (SCHAR*) addr; if (length) do @@ -551,7 +571,7 @@ static int set_signal( int signal_number, void (*handler) (void)) #else struct sigaction vec, old_vec; - vec.sa_handler = handler; + vec.sa_handler = (void(*)(int)) handler; memset(&vec.sa_mask, 0, sizeof(vec.sa_mask)); vec.sa_flags = 0; sigaction(signal_number, &vec, &old_vec); diff --git a/src/remote/interface.cpp b/src/remote/interface.cpp index f893ddcfd3..9119798697 100644 --- a/src/remote/interface.cpp +++ b/src/remote/interface.cpp @@ -56,6 +56,10 @@ #include "../jrd/thd_proto.h" #include "../jrd/sch_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef WIN_NT #include "../jrd/isc_proto.h" #endif @@ -2871,7 +2875,7 @@ STATUS GDS_QUE_EVENTS(STATUS * user_status, (event_thread), port->port_async, THREAD_high, THREAD_ast, 0); #else - if (!port->connect(packet, event_handler)) + if (!port->connect(packet, (void(*)(void))event_handler)) return error(user_status); #endif port->port_async->port_context = rdb; diff --git a/src/remote/protocol.h b/src/remote/protocol.h index d984201750..be54ccb298 100644 --- a/src/remote/protocol.h +++ b/src/remote/protocol.h @@ -23,7 +23,7 @@ * FSG 16.03.2001 */ /* -$Id: protocol.h,v 1.1.1.1 2001-05-23 13:26:37 tamlin Exp $ +$Id: protocol.h,v 1.2 2001-07-12 05:46:06 bellardo Exp $ */ #ifndef _REMOTE_PROTOCOL_H_ #define _REMOTE_PROTOCOL_H_ @@ -121,8 +121,9 @@ typedef enum arch_linux = 36, arch_freebsd = 37, arch_netbsd = 38, + arch_darwin_ppc = 39, - arch_max = 39 /* Keep this at the end */ + arch_max = 40 /* Keep this at the end */ } P_ARCH; #ifdef DECOSF diff --git a/src/remote/remote.cpp b/src/remote/remote.cpp index 036ebe4237..e1ac522e52 100644 --- a/src/remote/remote.cpp +++ b/src/remote/remote.cpp @@ -822,6 +822,9 @@ static SLONG get_parameter( UCHAR ** ptr) } +} // extern "C" + + // TMN: Beginning of C++ port - ugly but a start int port::accept(p_cnct* cnct) @@ -859,5 +862,3 @@ port* port::request(PACKET* pckt) return (*this->port_request)(this, pckt); } - -} // extern "C" diff --git a/src/remote/remote_def.h b/src/remote/remote_def.h index e2a6a93c02..ad95f1de26 100644 --- a/src/remote/remote_def.h +++ b/src/remote/remote_def.h @@ -134,6 +134,10 @@ #define ARCHITECTURE arch_netbsd #endif +#ifdef DARWIN +#define ARCHITECTURE arch_darwin_ppc +#endif + #define SRVR_server 1 /* 0x0001 server */ #define SRVR_multi_client 2 /* 0x0002 multi-client server */ diff --git a/src/utilities/drop.cpp b/src/utilities/drop.cpp index 48306c6db2..738ad645e7 100644 --- a/src/utilities/drop.cpp +++ b/src/utilities/drop.cpp @@ -21,7 +21,7 @@ * Contributor(s): ______________________________________. */ /* -$Id: drop.cpp,v 1.1.1.1 2001-05-23 13:26:41 tamlin Exp $ +$Id: drop.cpp,v 1.2 2001-07-12 05:46:06 bellardo Exp $ */ #include "../jrd/ib_stdio.h" @@ -159,7 +159,7 @@ int CLIB_ROUTINE main( int argc, char *argv[]) shut_manager("lock manager"); #endif -#if !(defined WIN_NT || defined NETWARE_386 || defined linux || defined FREEBSD || defined NETBSD || defined AIX_PPC ) +#if !(defined WIN_NT || defined NETWARE_386 || defined linux || defined FREEBSD || defined NETBSD || defined AIX_PPC || defined DARWIN) if (!sw_nobridge) { ib_printf("\nBRIDGE RESOURCES\n\n"); V3_drop(orig_argc, orig_argv); @@ -302,6 +302,9 @@ static void remove_resource( SLONG length, key, semid; TEXT expanded_filename[MAXPATHLEN]; int pid; + #ifdef DARWIN + union semun semctlArg; + #endif #ifdef MANAGER_PROCESS /* Shutdown lock manager process so that shared memory @@ -333,7 +336,12 @@ static void remove_resource( return; } + #ifdef DARWIN + semctlArg.val = 0; + if (semctl(semid, sem_count, IPC_RMID, semctlArg) == -1) + #else if (semctl(semid, sem_count, IPC_RMID, 0) == -1) + #endif ib_printf("\n***Error trying to drop %s semaphores. ERRNO = %d.\n", label, errno); else diff --git a/src/utilities/dropv3.cpp b/src/utilities/dropv3.cpp index 70bb89a3b3..ee7d47b4e5 100644 --- a/src/utilities/dropv3.cpp +++ b/src/utilities/dropv3.cpp @@ -28,6 +28,7 @@ #include #endif #include +#include #include "../jrd/common.h" #include "../jrd/isc.h" @@ -45,7 +46,14 @@ #define FTOK_KEY 15 static long get_key(); -static dummy_init(); +static int dummy_init(); +static int get_lock_header(); +static int sem_exclusive(long , int ); +#ifndef MMAP_SUPPORTED +static int remove_resource(int , TEXT *, int, int , TEXT *); +#else +static int remove_resource(int, TEXT *,int ,int ,TEXT *); +#endif static int LOCK_shm_size, LOCK_sem_key, LOCK_blk_signal, LOCK_sem_count; @@ -61,9 +69,7 @@ static struct { "SEMCOUNT", &LOCK_sem_count, NULL, NULL}; -V3_drop(argc, argv) - int argc; - UCHAR *argv[]; +int V3_drop(int argc, UCHAR **argv) { /************************************** * @@ -134,7 +140,7 @@ V3_drop(argc, argv) } -static dummy_init() +static int dummy_init() { /************************************** * @@ -149,8 +155,7 @@ static dummy_init() } -static long get_key(filename) - TEXT *filename; +static long get_key(TEXT *filename) { /************************************* * @@ -177,7 +182,7 @@ static long get_key(filename) } -static get_lock_header() +static int get_lock_header() { /************************************* * @@ -221,11 +226,8 @@ static get_lock_header() #ifndef MMAP_SUPPORTED -static remove_resource(lock_flag, filename, shm_length, sem_count, label) - int lock_flag; - TEXT *filename; - int shm_length, sem_count; - TEXT *label; +static int remove_resource(int lock_flag, TEXT *filename, int shm_length, + int sem_count, TEXT *label) { /************************************** * @@ -291,11 +293,8 @@ static remove_resource(lock_flag, filename, shm_length, sem_count, label) #ifdef MMAP_SUPPORTED -static remove_resource(lock_flag, filename, shm_length, sem_count, label) - int lock_flag; - TEXT *filename; - int shm_length, sem_count; - TEXT *label; +static int remove_resource(int lock_flag, TEXT *filename, int shm_length, + int sem_count, TEXT *label) { /************************************** * @@ -310,6 +309,9 @@ static remove_resource(lock_flag, filename, shm_length, sem_count, label) long length, key, shmid, semid; TEXT expanded_filename[512], hostname[64]; struct stat stat_buf; + #ifdef DARWIN + union semun semctlArg; + #endif #ifdef NOHOSTNAME strcpy(expanded_filename, filename); @@ -319,7 +321,7 @@ static remove_resource(lock_flag, filename, shm_length, sem_count, label) #endif if (stat(expanded_filename, &stat_buf) == -1) { ib_printf("\n***No bridge %s file found.\n", label); - return; + return 0; } #ifdef SUN_V3_LOCK_MANAGER @@ -330,16 +332,21 @@ static remove_resource(lock_flag, filename, shm_length, sem_count, label) if ((key = get_key(filename)) == -1) { ib_printf("\n***Unable to get the key value of the bridge %s file.\n", label); - return; + return 0; } if ((semid = sem_exclusive(key, sem_count)) == -1) { ib_printf("\n***Semaphores for bridge %s are currently in use.\n", label); - return; + return 0; } + #ifdef DARWIN + semctlArg.val = 0; + if (semctl(semid, sem_count, IPC_RMID, semctlArg) == -1) + #else if (semctl(semid, sem_count, IPC_RMID, 0) == -1) + #endif ib_printf ("\n***Error trying to drop bridge %s semaphores. ERRNO = %d.\n", label, errno); @@ -349,9 +356,7 @@ static remove_resource(lock_flag, filename, shm_length, sem_count, label) #endif -static sem_exclusive(key, count) - long key; - int count; +static int sem_exclusive(long key, int count) { /************************************** * @@ -379,9 +384,7 @@ static sem_exclusive(key, count) #ifndef MMAP_SUPPORTED -static shm_exclusive(key, length) - long key; - int length; +static int shm_exclusive(long key, int length) { /************************************** * diff --git a/src/utilities/gsec.cpp b/src/utilities/gsec.cpp index 5622503164..9f3138f48b 100644 --- a/src/utilities/gsec.cpp +++ b/src/utilities/gsec.cpp @@ -44,6 +44,10 @@ #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif + extern "C" { @@ -467,7 +471,7 @@ static void data_print( void *arg, USER_DATA data, BOOLEAN first) } -static get_line( int *argc, SCHAR ** argv, TEXT * stuff, TSEC tdsec) +static int get_line( int *argc, SCHAR ** argv, TEXT * stuff, TSEC tdsec) { /************************************** * @@ -1202,7 +1206,7 @@ static void util_output( CONST SCHAR * format, ...) if (format[0] == '\0') { exit_code = tdsec->tsec_output_proc(tdsec->tsec_output_data, - reinterpret_cast < UCHAR * >("")); + (UCHAR * )("")); } else { VA_START(arglist, format); diff --git a/src/utilities/relay.cpp b/src/utilities/relay.cpp index 1b13ca3c87..2e7e69da34 100644 --- a/src/utilities/relay.cpp +++ b/src/utilities/relay.cpp @@ -28,6 +28,12 @@ #include "../jrd/common.h" #include "../jrd/license.h" +#include + +#ifdef HAVE_UNISTD_H +#include +#endif + #ifndef NOFILE #define NOFILE 20 #endif diff --git a/src/wal/wal.cpp b/src/wal/wal.cpp index 99e535e571..b6859b82b9 100644 --- a/src/wal/wal.cpp +++ b/src/wal/wal.cpp @@ -36,6 +36,18 @@ #include "../jrd/isc_s_proto.h" #include "../jrd/thd_proto.h" +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + #ifndef NETWARE_386 #ifndef WIN_NT #include diff --git a/src/wal/walc.cpp b/src/wal/walc.cpp index a5e471d0dc..5c30c81e7d 100644 --- a/src/wal/walc.cpp +++ b/src/wal/walc.cpp @@ -46,6 +46,10 @@ #include #endif +#ifdef HAVE_UNISTD_H +#include +#endif + #ifdef WIN_NT #include #include @@ -442,7 +446,7 @@ SSHORT WALC_init(STATUS * status_vector, wal->wal_shmem_data.sh_mem_semaphores = MAX_WALSEMS; #endif if ((WAL_segment = (WALS) ISC_map_file(status_vector, wal_mapfile, - wal_init_routine, + (void(*)(void *, sh_mem *, int))wal_init_routine, (void *) &wal_args, length, &wal->wal_shmem_data)) == NULL) { WAL_ERROR_APPEND(status_vector, gds__wal_illegal_attach, dbname); diff --git a/src/wal/walw.cpp b/src/wal/walw.cpp index b16ac95e5d..9df35c862f 100644 --- a/src/wal/walw.cpp +++ b/src/wal/walw.cpp @@ -45,6 +45,11 @@ #include "../jrd/jrn_proto.h" #include "../jrd/llio_proto.h" #include "../jrd/misc_proto.h" +#include "../jrd/divorce.h" + +#ifdef HAVE_UNISTD_H +#include +#endif #include #if !(defined WIN_NT) @@ -171,7 +176,11 @@ static WAL_TERMINATOR(log_terminator_block); int main_walw( char **argv) #else -int CLIB_ROUTINE main( int argc, char **argv) +/* JMB - I didn't like have a "main" symbol is the shared library, so + * I change the function name from main to walw_classic_main and + * added the walw_main.c file. + */ +int CLIB_ROUTINE walw_classic_main( int argc, char **argv) #endif { /**************************************