mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 06:03:02 +01:00
-Replace BOOLEAN, TRUE and FALSE
This commit is contained in:
parent
1ee6d86019
commit
a4416db52a
@ -125,12 +125,12 @@ static ISC_STATUS error();
|
||||
static void execute_blob(DSQL_REQ, USHORT, UCHAR*, USHORT, UCHAR*,
|
||||
USHORT, UCHAR*, USHORT, UCHAR*);
|
||||
static ISC_STATUS execute_request(DSQL_REQ, FRBRD**, USHORT, UCHAR*, USHORT, UCHAR*,
|
||||
USHORT, UCHAR*, USHORT, UCHAR*, USHORT);
|
||||
USHORT, UCHAR*, USHORT, UCHAR*, bool);
|
||||
static SSHORT filter_sub_type(DSQL_REQ, DSQL_NOD);
|
||||
static BOOLEAN get_indices(SSHORT*, SCHAR**, SSHORT*, SCHAR**);
|
||||
static bool get_indices(SSHORT*, SCHAR**, SSHORT*, SCHAR**);
|
||||
static USHORT get_plan_info(DSQL_REQ, SSHORT, SCHAR**);
|
||||
static USHORT get_request_info(DSQL_REQ, SSHORT, SCHAR*);
|
||||
static BOOLEAN get_rsb_item(SSHORT*, SCHAR**, SSHORT*, SCHAR**, USHORT*,
|
||||
static bool get_rsb_item(SSHORT*, SCHAR**, SSHORT*, SCHAR**, USHORT*,
|
||||
USHORT*);
|
||||
static DBB init(FRBRD**);
|
||||
static void map_in_out(DSQL_REQ, DSQL_MSG, USHORT, UCHAR*, USHORT, UCHAR*);
|
||||
@ -139,7 +139,7 @@ static USHORT parse_blr(USHORT, UCHAR*, USHORT, PAR);
|
||||
static DSQL_REQ prepare(DSQL_REQ, USHORT, TEXT*, USHORT, USHORT);
|
||||
static void punt(void);
|
||||
static UCHAR* put_item(UCHAR, USHORT, UCHAR*, UCHAR*, UCHAR*);
|
||||
static void release_request(DSQL_REQ, USHORT);
|
||||
static void release_request(DSQL_REQ, bool);
|
||||
static ISC_STATUS return_success(void);
|
||||
static UCHAR* var_info(DSQL_MSG, const UCHAR*, const UCHAR*, UCHAR*, UCHAR*, USHORT);
|
||||
|
||||
@ -170,7 +170,7 @@ static const UCHAR sql_records_info[] = {
|
||||
#ifdef ANY_THREADING
|
||||
static MUTX_T databases_mutex;
|
||||
static MUTX_T cursors_mutex;
|
||||
static USHORT mutex_inited = 0;
|
||||
static bool mutex_inited = false;
|
||||
#endif
|
||||
|
||||
|
||||
@ -537,7 +537,7 @@ ISC_STATUS DLL_EXPORT GDS_DSQL_EXECUTE_CPP(ISC_STATUS* user_status,
|
||||
OPN open_cursor;
|
||||
ISC_STATUS_ARRAY local_status;
|
||||
struct tsql thd_context, *tdsql;
|
||||
USHORT singleton;
|
||||
bool singleton;
|
||||
ISC_STATUS sing_status;
|
||||
|
||||
SET_THREAD_DATA;
|
||||
@ -584,25 +584,17 @@ ISC_STATUS DLL_EXPORT GDS_DSQL_EXECUTE_CPP(ISC_STATUS* user_status,
|
||||
/* A select with a non zero output length is a singleton select */
|
||||
|
||||
if (request->req_type == REQ_SELECT && out_msg_length != 0) {
|
||||
singleton = TRUE;
|
||||
singleton = true;
|
||||
} else {
|
||||
singleton = FALSE;
|
||||
singleton = false;
|
||||
}
|
||||
|
||||
if (request->req_type != REQ_EMBED_SELECT)
|
||||
{
|
||||
sing_status =
|
||||
execute_request(request,
|
||||
trans_handle,
|
||||
in_blr_length,
|
||||
in_blr,
|
||||
in_msg_length,
|
||||
in_msg,
|
||||
out_blr_length,
|
||||
out_blr,
|
||||
out_msg_length,
|
||||
out_msg,
|
||||
singleton);
|
||||
sing_status = execute_request(request, trans_handle, in_blr_length,
|
||||
in_blr, in_msg_length, in_msg,
|
||||
out_blr_length, out_blr,
|
||||
out_msg_length, out_msg, singleton);
|
||||
}
|
||||
|
||||
/* If the output message length is zero on a REQ_SELECT then we must
|
||||
@ -753,23 +745,15 @@ static ISC_STATUS dsql8_execute_immediate_common(ISC_STATUS* user_status,
|
||||
gds_arg_string, string, gds_arg_end);
|
||||
}
|
||||
|
||||
execute_request(request,
|
||||
trans_handle,
|
||||
in_blr_length,
|
||||
in_blr,
|
||||
in_msg_length,
|
||||
in_msg,
|
||||
out_blr_length,
|
||||
out_blr,
|
||||
out_msg_length,
|
||||
out_msg,
|
||||
FALSE);
|
||||
execute_request(request, trans_handle, in_blr_length, in_blr,
|
||||
in_msg_length, in_msg, out_blr_length, out_blr,
|
||||
out_msg_length, out_msg, false);
|
||||
|
||||
release_request(request, TRUE);
|
||||
release_request(request, true);
|
||||
} // try
|
||||
catch (const std::exception&) {
|
||||
status = error();
|
||||
release_request(request, TRUE);
|
||||
release_request(request, true);
|
||||
RESTORE_THREAD_DATA;
|
||||
return status;
|
||||
}
|
||||
@ -1219,7 +1203,7 @@ ISC_STATUS GDS_DSQL_FREE_CPP(ISC_STATUS* user_status,
|
||||
if (option & DSQL_drop) {
|
||||
/* Release everything associate with the request. */
|
||||
|
||||
release_request(request, TRUE);
|
||||
release_request(request, true);
|
||||
*req_handle = NULL;
|
||||
}
|
||||
else if (option & DSQL_close) {
|
||||
@ -1459,7 +1443,7 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
|
||||
/* Now that we know that the new request exists, zap the old one. */
|
||||
|
||||
tdsql->tsql_default = old_request->req_pool;
|
||||
release_request(old_request, TRUE);
|
||||
release_request(old_request, true);
|
||||
tdsql->tsql_default = NULL;
|
||||
|
||||
/* The request was sucessfully prepared, and the old request was
|
||||
@ -1479,7 +1463,7 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
|
||||
} // try
|
||||
catch(const std::exception&) {
|
||||
status = error();
|
||||
release_request(request, TRUE);
|
||||
release_request(request, true);
|
||||
RESTORE_THREAD_DATA;
|
||||
return status;
|
||||
}
|
||||
@ -1722,19 +1706,20 @@ ISC_STATUS GDS_DSQL_SQL_INFO_CPP( ISC_STATUS* user_status,
|
||||
}
|
||||
else if (item == isc_info_sql_batch_fetch) {
|
||||
if (request->req_flags & REQ_no_batch)
|
||||
number = FALSE;
|
||||
number = 0;
|
||||
else
|
||||
number = TRUE;
|
||||
number = 1;
|
||||
length = convert((SLONG) number, buffer);
|
||||
if (!(info = put_item(item, length, buffer, info, end_info))) {
|
||||
return return_success();
|
||||
}
|
||||
}
|
||||
else if (item == gds_info_sql_records) {
|
||||
length =
|
||||
get_request_info(request, (SSHORT) sizeof(buffer), reinterpret_cast<SCHAR*>(buffer));
|
||||
if (length
|
||||
&& !(info = put_item(item, length, buffer, info, end_info))) {
|
||||
length = get_request_info(request, (SSHORT) sizeof(buffer),
|
||||
reinterpret_cast<SCHAR*>(buffer));
|
||||
if (length && !(info = put_item(item, length, buffer, info,
|
||||
end_info)))
|
||||
{
|
||||
return return_success();
|
||||
}
|
||||
}
|
||||
@ -2870,7 +2855,7 @@ static ISC_STATUS execute_request(DSQL_REQ request,
|
||||
UCHAR* out_blr,
|
||||
USHORT out_msg_length,
|
||||
UCHAR* out_msg,
|
||||
USHORT singleton)
|
||||
bool singleton)
|
||||
{
|
||||
DSQL_MSG message;
|
||||
USHORT use_msg_length;
|
||||
@ -3002,7 +2987,7 @@ static ISC_STATUS execute_request(DSQL_REQ request,
|
||||
|
||||
default:
|
||||
/* Catch invalid request types */
|
||||
assert(FALSE);
|
||||
assert(false);
|
||||
/* Fall into ... */
|
||||
|
||||
case REQ_SELECT:
|
||||
@ -3203,7 +3188,7 @@ static SSHORT filter_sub_type( DSQL_REQ request, DSQL_NOD node)
|
||||
|
||||
@brief Retrieve the indices from the index tree in
|
||||
the request info buffer, and print them out
|
||||
in the plan buffer.
|
||||
in the plan buffer. Return false on success and true on failure
|
||||
|
||||
|
||||
@param explain_length_ptr
|
||||
@ -3212,7 +3197,7 @@ static SSHORT filter_sub_type( DSQL_REQ request, DSQL_NOD node)
|
||||
@param plan_ptr
|
||||
|
||||
**/
|
||||
static BOOLEAN get_indices(
|
||||
static bool get_indices(
|
||||
SSHORT * explain_length_ptr,
|
||||
SCHAR ** explain_ptr,
|
||||
SSHORT * plan_length_ptr, SCHAR ** plan_ptr)
|
||||
@ -3234,9 +3219,9 @@ static BOOLEAN get_indices(
|
||||
case gds_info_rsb_and:
|
||||
case gds_info_rsb_or:
|
||||
if (get_indices(&explain_length, &explain, &plan_length, &plan))
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
if (get_indices(&explain_length, &explain, &plan_length, &plan))
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
break;
|
||||
|
||||
case gds_info_rsb_dbkey:
|
||||
@ -3250,21 +3235,21 @@ static BOOLEAN get_indices(
|
||||
|
||||
if (plan[-1] != '(' && plan[-1] != ' ') {
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
*plan++ = ',';
|
||||
}
|
||||
|
||||
/* now put out the index name */
|
||||
|
||||
if ((plan_length -= length) < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
explain_length -= length;
|
||||
while (length--)
|
||||
*plan++ = *explain++;
|
||||
break;
|
||||
|
||||
default:
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
}
|
||||
|
||||
*explain_length_ptr = explain_length;
|
||||
@ -3272,7 +3257,7 @@ static BOOLEAN get_indices(
|
||||
*plan_length_ptr = plan_length;
|
||||
*plan_ptr = plan;
|
||||
|
||||
return FB_SUCCESS;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -3466,7 +3451,8 @@ static USHORT get_request_info(
|
||||
get_rsb_item
|
||||
|
||||
@brief Use recursion to print out a reverse-polish
|
||||
access plan of joins and join types.
|
||||
access plan of joins and join types. Return true on failure
|
||||
and false if succeed
|
||||
|
||||
|
||||
@param explain_length_ptr
|
||||
@ -3477,7 +3463,7 @@ static USHORT get_request_info(
|
||||
@param level_ptr
|
||||
|
||||
**/
|
||||
static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
static bool get_rsb_item(SSHORT* explain_length_ptr,
|
||||
SCHAR ** explain_ptr,
|
||||
SSHORT* plan_length_ptr,
|
||||
SCHAR** plan_ptr,
|
||||
@ -3502,7 +3488,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
|
||||
p = "\nPLAN ";
|
||||
if ((plan_length -= strlen(p)) < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
while (*p)
|
||||
*plan++ = *p++;
|
||||
}
|
||||
@ -3524,7 +3510,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
|
||||
if (!*parent_join_count) {
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
*plan++ = '(';
|
||||
}
|
||||
|
||||
@ -3532,7 +3518,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
|
||||
if (plan[-1] != '(') {
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
*plan++ = ',';
|
||||
}
|
||||
|
||||
@ -3541,7 +3527,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
explain_length--;
|
||||
explain_length -= (length = (UCHAR) * explain++);
|
||||
if ((plan_length -= length) < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
while (length--)
|
||||
*plan++ = *explain++;
|
||||
break;
|
||||
@ -3564,10 +3550,12 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
|
||||
union_level = *level_ptr;
|
||||
union_join_count = 0;
|
||||
while (TRUE) {
|
||||
if (get_rsb_item
|
||||
(&explain_length, &explain, &plan_length, &plan,
|
||||
&union_join_count, &union_level)) return FB_FAILURE;
|
||||
while (true) {
|
||||
if (get_rsb_item(&explain_length, &explain, &plan_length, &plan,
|
||||
&union_join_count, &union_level))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (union_level == *level_ptr)
|
||||
break;
|
||||
}
|
||||
@ -3578,10 +3566,12 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
while (union_count) {
|
||||
union_join_count = 0;
|
||||
union_level = 0;
|
||||
while (TRUE) {
|
||||
if (get_rsb_item
|
||||
(&explain_length, &explain, &plan_length, &plan,
|
||||
&union_join_count, &union_level)) return FB_FAILURE;
|
||||
while (true) {
|
||||
if (get_rsb_item(&explain_length, &explain, &plan_length,
|
||||
&plan, &union_join_count, &union_level))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!union_level)
|
||||
break;
|
||||
}
|
||||
@ -3598,7 +3588,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
|
||||
if (*parent_join_count && plan[-1] != '(') {
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
*plan++ = ',';
|
||||
}
|
||||
|
||||
@ -3613,7 +3603,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
}
|
||||
|
||||
if ((plan_length -= strlen(p)) < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
while (*p)
|
||||
*plan++ = *p++;
|
||||
|
||||
@ -3624,7 +3614,9 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
while (join_count) {
|
||||
if (get_rsb_item(&explain_length, &explain, &plan_length,
|
||||
&plan, &join_count, level_ptr))
|
||||
return FB_FAILURE;
|
||||
{
|
||||
return true;
|
||||
}
|
||||
/* CVC: Here's the additional stop condition. */
|
||||
if (!*level_ptr) {
|
||||
break;
|
||||
@ -3635,7 +3627,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
/* put out the final parenthesis for the join */
|
||||
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
else
|
||||
*plan++ = ')';
|
||||
|
||||
@ -3651,14 +3643,17 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
case gds_info_rsb_ext_sequential:
|
||||
case gds_info_rsb_ext_indexed:
|
||||
if (rsb_type == gds_info_rsb_indexed ||
|
||||
rsb_type == gds_info_rsb_ext_indexed) p = " INDEX (";
|
||||
rsb_type == gds_info_rsb_ext_indexed)
|
||||
{
|
||||
p = " INDEX (";
|
||||
}
|
||||
else if (rsb_type == gds_info_rsb_navigate)
|
||||
p = " ORDER ";
|
||||
else
|
||||
p = " NATURAL";
|
||||
|
||||
if ((plan_length -= strlen(p)) < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
while (*p)
|
||||
*plan++ = *p++;
|
||||
|
||||
@ -3667,15 +3662,14 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
if (rsb_type == gds_info_rsb_indexed ||
|
||||
rsb_type == gds_info_rsb_navigate ||
|
||||
rsb_type == gds_info_rsb_ext_indexed) {
|
||||
if (get_indices
|
||||
(&explain_length, &explain, &plan_length,
|
||||
&plan)) return FB_FAILURE;
|
||||
if (get_indices(&explain_length, &explain, &plan_length, &plan))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rsb_type == gds_info_rsb_indexed ||
|
||||
rsb_type == gds_info_rsb_ext_indexed) {
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
*plan++ = ')';
|
||||
}
|
||||
|
||||
@ -3683,7 +3677,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
|
||||
if (!*parent_join_count)
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
else
|
||||
*plan++ = ')';
|
||||
|
||||
@ -3703,20 +3697,23 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
if (explain_length > 2 &&
|
||||
(explain[0] == gds_info_rsb_begin) &&
|
||||
(explain[1] == gds_info_rsb_type) &&
|
||||
(explain[2] == gds_info_rsb_union)) break;
|
||||
(explain[2] == gds_info_rsb_union))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
/* if this isn't the first item in the list, put out a comma */
|
||||
|
||||
if (*parent_join_count && plan[-1] != '(') {
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
*plan++ = ',';
|
||||
}
|
||||
|
||||
p = "SORT (";
|
||||
|
||||
if ((plan_length -= strlen(p)) < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
while (*p)
|
||||
*plan++ = *p++;
|
||||
|
||||
@ -3727,13 +3724,13 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
while (explain_length > 0 && plan_length > 0) {
|
||||
if (get_rsb_item(&explain_length, &explain, &plan_length,
|
||||
&plan, parent_join_count, level_ptr))
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
if (*level_ptr == save_level)
|
||||
break;
|
||||
}
|
||||
|
||||
if (--plan_length < 0)
|
||||
return FB_FAILURE;
|
||||
return true;
|
||||
*plan++ = ')';
|
||||
break;
|
||||
|
||||
@ -3751,7 +3748,7 @@ static BOOLEAN get_rsb_item(SSHORT* explain_length_ptr,
|
||||
*plan_length_ptr = plan_length;
|
||||
*plan_ptr = plan;
|
||||
|
||||
return FB_SUCCESS;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -3770,7 +3767,7 @@ static DBB init(FRBRD** db_handle)
|
||||
|
||||
#ifdef ANY_THREADING
|
||||
if (!mutex_inited) {
|
||||
mutex_inited = TRUE;
|
||||
mutex_inited = true;
|
||||
THD_MUTEX_INIT(&databases_mutex);
|
||||
THD_MUTEX_INIT(&cursors_mutex);
|
||||
}
|
||||
@ -3822,10 +3819,7 @@ static DBB init(FRBRD** db_handle)
|
||||
ISC_STATUS_ARRAY user_status;
|
||||
|
||||
THREAD_EXIT;
|
||||
gds__database_cleanup(user_status,
|
||||
db_handle,
|
||||
cleanup_database,
|
||||
(SLONG) FALSE);
|
||||
gds__database_cleanup(user_status, db_handle, cleanup_database, (SLONG) 0);
|
||||
THREAD_ENTER;
|
||||
|
||||
/* Determine if the database is V3 or V4 */
|
||||
@ -4540,7 +4534,7 @@ static UCHAR* put_item( UCHAR item,
|
||||
@param top_level
|
||||
|
||||
**/
|
||||
static void release_request(DSQL_REQ request, USHORT top_level)
|
||||
static void release_request(DSQL_REQ request, bool top_level)
|
||||
{
|
||||
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
@ -4555,7 +4549,7 @@ static void release_request(DSQL_REQ request, USHORT top_level)
|
||||
child->req_parent = NULL;
|
||||
DsqlMemoryPool *save_default = tdsql->tsql_default;
|
||||
tdsql->tsql_default = child->req_pool;
|
||||
release_request(child, FALSE);
|
||||
release_request(child, false);
|
||||
tdsql->tsql_default = save_default;
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,8 @@ extern "C" {
|
||||
ASSERT_FILENAME
|
||||
#define HASH_SIZE 211
|
||||
static SSHORT hash(SCHAR *, USHORT);
|
||||
static BOOLEAN remove_symbol(struct sym **, struct sym *);
|
||||
static BOOLEAN scompare(TEXT *, USHORT, TEXT *, USHORT);
|
||||
static bool remove_symbol(struct sym **, struct sym *);
|
||||
static bool scompare(TEXT *, USHORT, TEXT *, USHORT);
|
||||
|
||||
static SYM *hash_table;
|
||||
|
||||
@ -240,7 +240,8 @@ void HSHD_insert(SYM symbol)
|
||||
for (old = hash_table[h]; old; old = old->sym_collision)
|
||||
if ((!database || (database == old->sym_dbb)) &&
|
||||
scompare(symbol->sym_string, symbol->sym_length, old->sym_string,
|
||||
old->sym_length)) {
|
||||
old->sym_length))
|
||||
{
|
||||
symbol->sym_homonym = old->sym_homonym;
|
||||
old->sym_homonym = symbol;
|
||||
UNLOCK_HASH;
|
||||
@ -327,11 +328,13 @@ void HSHD_remove( SYM symbol)
|
||||
h = hash(symbol->sym_string, symbol->sym_length);
|
||||
|
||||
for (collision = &hash_table[h]; *collision;
|
||||
collision =
|
||||
&(*collision)->sym_collision) if (remove_symbol(collision, symbol)) {
|
||||
collision = &(*collision)->sym_collision)
|
||||
{
|
||||
if (remove_symbol(collision, symbol)) {
|
||||
UNLOCK_HASH;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
UNLOCK_HASH;
|
||||
IBERROR(-1, "HSHD_remove failed");
|
||||
@ -462,7 +465,7 @@ static SSHORT hash(SCHAR * string, USHORT length)
|
||||
@param symbol
|
||||
|
||||
**/
|
||||
static BOOLEAN remove_symbol( SYM * collision, SYM symbol)
|
||||
static bool remove_symbol( SYM * collision, SYM symbol)
|
||||
{
|
||||
SYM *ptr, homonym;
|
||||
|
||||
@ -474,16 +477,16 @@ static BOOLEAN remove_symbol( SYM * collision, SYM symbol)
|
||||
else
|
||||
*collision = symbol->sym_collision;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
for (ptr = &(*collision)->sym_homonym; *ptr; ptr = &(*ptr)->sym_homonym)
|
||||
if (symbol == *ptr) {
|
||||
*ptr = symbol->sym_homonym;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -504,20 +507,20 @@ static BOOLEAN remove_symbol( SYM * collision, SYM symbol)
|
||||
@param length2
|
||||
|
||||
**/
|
||||
static BOOLEAN scompare(TEXT * string1,
|
||||
static bool scompare(TEXT * string1,
|
||||
USHORT length1,
|
||||
TEXT * string2, USHORT length2)
|
||||
{
|
||||
|
||||
if (length1 != length2)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
while (length1--) {
|
||||
if ((*string1++) != (*string2++))
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -175,7 +175,7 @@ static void yyerror (TEXT *);
|
||||
|
||||
static TEXT *lex_position (void);
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static BOOLEAN long_int (DSQL_NOD, SLONG *);
|
||||
static bool long_int(DSQL_NOD, SLONG *);
|
||||
#endif
|
||||
static DSQL_FLD make_field (DSQL_NOD);
|
||||
static FIL make_file (void);
|
||||
@ -185,7 +185,7 @@ static DSQL_NOD make_parameter (void);
|
||||
static DSQL_NOD make_flag_node (NOD_TYPE, SSHORT, int, ...);
|
||||
static void prepare_console_debug (int, int *);
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static BOOLEAN short_int (DSQL_NOD, SLONG *, SSHORT);
|
||||
static bool short_int(DSQL_NOD, SLONG *, SSHORT);
|
||||
#endif
|
||||
static void stack_nodes (DSQL_NOD, DLLS *);
|
||||
inline static int yylex (USHORT, USHORT, USHORT, BOOLEAN *);
|
||||
@ -5245,13 +5245,12 @@ static TEXT *lex_position (void)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
return lex.ptr;
|
||||
return lex.ptr;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static BOOLEAN long_int (
|
||||
DSQL_NOD string,
|
||||
static bool long_int(DSQL_NOD string,
|
||||
SLONG *long_value)
|
||||
{
|
||||
/*************************************
|
||||
@ -5269,18 +5268,17 @@ static BOOLEAN long_int (
|
||||
for (const char* p = ((STR) string)->str_data; classes [*p] & CHR_DIGIT; p++)
|
||||
{
|
||||
if (!(classes [*p] & CHR_DIGIT)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*long_value = atol ((char *)((STR) string)->str_data);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static DSQL_FLD make_field (
|
||||
DSQL_NOD field_name)
|
||||
static DSQL_FLD make_field (DSQL_NOD field_name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -5292,23 +5290,23 @@ static DSQL_FLD make_field (
|
||||
* Make a field block of given name.
|
||||
*
|
||||
**************************************/
|
||||
DSQL_FLD field;
|
||||
STR string;
|
||||
TSQL tdsql;
|
||||
DSQL_FLD field;
|
||||
STR string;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
if (field_name == NULL)
|
||||
if (field_name == NULL)
|
||||
{
|
||||
field = FB_NEW_RPT(*tdsql->tsql_default, sizeof (INTERNAL_FIELD_NAME)) dsql_fld;
|
||||
strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME);
|
||||
return field;
|
||||
}
|
||||
string = (STR) field_name->nod_arg [1];
|
||||
field = FB_NEW_RPT(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) dsql_fld;
|
||||
strcpy (field->fld_name, (TEXT*) string->str_data);
|
||||
string = (STR) field_name->nod_arg [1];
|
||||
field = FB_NEW_RPT(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) dsql_fld;
|
||||
strcpy (field->fld_name, (TEXT*) string->str_data);
|
||||
|
||||
return field;
|
||||
return field;
|
||||
}
|
||||
|
||||
|
||||
@ -5324,19 +5322,18 @@ static FIL make_file (void)
|
||||
* Make a file block
|
||||
*
|
||||
**************************************/
|
||||
FIL temp_file;
|
||||
TSQL tdsql;
|
||||
FIL temp_file;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
temp_file = FB_NEW(*tdsql->tsql_default) fil;
|
||||
temp_file = FB_NEW(*tdsql->tsql_default) fil;
|
||||
|
||||
return temp_file;
|
||||
return temp_file;
|
||||
}
|
||||
|
||||
|
||||
static DSQL_NOD make_list (
|
||||
DSQL_NOD node)
|
||||
static DSQL_NOD make_list (DSQL_NOD node)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -5348,33 +5345,33 @@ static DSQL_NOD make_list (
|
||||
* Collapse nested list nodes into single list.
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD *ptr;
|
||||
DLLS stack, temp;
|
||||
USHORT l;
|
||||
DSQL_NOD old;
|
||||
TSQL tdsql;
|
||||
DSQL_NOD *ptr;
|
||||
DLLS stack, temp;
|
||||
USHORT l;
|
||||
DSQL_NOD old;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
if (!node)
|
||||
if (!node)
|
||||
return node;
|
||||
|
||||
stack = 0;
|
||||
stack_nodes (node, &stack);
|
||||
for (l = 0, temp = stack; temp; temp = temp->lls_next)
|
||||
stack = 0;
|
||||
stack_nodes (node, &stack);
|
||||
for (l = 0, temp = stack; temp; temp = temp->lls_next)
|
||||
l++;
|
||||
|
||||
old = node;
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, l) dsql_nod;
|
||||
node->nod_count = l;
|
||||
node->nod_type = nod_list;
|
||||
node->nod_flags = old->nod_flags;
|
||||
ptr = node->nod_arg + node->nod_count;
|
||||
old = node;
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, l) dsql_nod;
|
||||
node->nod_count = l;
|
||||
node->nod_type = nod_list;
|
||||
node->nod_flags = old->nod_flags;
|
||||
ptr = node->nod_arg + node->nod_count;
|
||||
|
||||
while (stack)
|
||||
while (stack)
|
||||
*--ptr = (DSQL_NOD) LLS_POP (&stack);
|
||||
|
||||
return node;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@ -5391,24 +5388,23 @@ static DSQL_NOD make_parameter (void)
|
||||
* Any change should also be made to function below
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD node;
|
||||
TSQL tdsql;
|
||||
DSQL_NOD node;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
|
||||
node->nod_type = nod_parameter;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = 1;
|
||||
node->nod_arg[0] = (DSQL_NOD)(ULONG) lex.param_number++;
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
|
||||
node->nod_type = nod_parameter;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = 1;
|
||||
node->nod_arg[0] = (DSQL_NOD)(ULONG) lex.param_number++;
|
||||
|
||||
return node;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
static DSQL_NOD make_node (
|
||||
NOD_TYPE type,
|
||||
static DSQL_NOD make_node (NOD_TYPE type,
|
||||
int count,
|
||||
...)
|
||||
{
|
||||
@ -5423,29 +5419,28 @@ static DSQL_NOD make_node (
|
||||
* Any change should also be made to function below
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD node, *p;
|
||||
va_list ptr;
|
||||
TSQL tdsql;
|
||||
DSQL_NOD node, *p;
|
||||
va_list ptr;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
|
||||
node->nod_type = type;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = count;
|
||||
p = node->nod_arg;
|
||||
VA_START (ptr, count);
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
|
||||
node->nod_type = type;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = count;
|
||||
p = node->nod_arg;
|
||||
VA_START (ptr, count);
|
||||
|
||||
while (--count >= 0)
|
||||
while (--count >= 0)
|
||||
*p++ = va_arg (ptr, DSQL_NOD);
|
||||
|
||||
return node;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
static DSQL_NOD make_flag_node (
|
||||
NOD_TYPE type,
|
||||
static DSQL_NOD make_flag_node (NOD_TYPE type,
|
||||
SSHORT flag,
|
||||
int count,
|
||||
...)
|
||||
@ -5460,25 +5455,25 @@ static DSQL_NOD make_flag_node (
|
||||
* Make a node of given type. Set flag field
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD node, *p;
|
||||
va_list ptr;
|
||||
TSQL tdsql;
|
||||
DSQL_NOD node, *p;
|
||||
va_list ptr;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
|
||||
node->nod_type = type;
|
||||
node->nod_flags = flag;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = count;
|
||||
p = node->nod_arg;
|
||||
VA_START (ptr, count);
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
|
||||
node->nod_type = type;
|
||||
node->nod_flags = flag;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = count;
|
||||
p = node->nod_arg;
|
||||
VA_START (ptr, count);
|
||||
|
||||
while (--count >= 0)
|
||||
while (--count >= 0)
|
||||
*p++ = va_arg (ptr, DSQL_NOD);
|
||||
|
||||
return node;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@ -5505,7 +5500,7 @@ static void prepare_console_debug (int level, int *yydeb)
|
||||
operations that's generated in DEV build when DEBUG <n> is typed into isql.exe.
|
||||
When n>0, the output console is activated; otherwise it's closed. */
|
||||
#if defined(DEV_BUILD) && defined(WIN_NT) && defined(SUPERSERVER)
|
||||
static FILE* redirected_output;
|
||||
static FILE* redirected_output;
|
||||
if (level > 0) {
|
||||
/* Console debug code inside this scope */
|
||||
if (AllocConsole()) {
|
||||
@ -5522,8 +5517,7 @@ static FILE* redirected_output;
|
||||
}
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static BOOLEAN short_int (
|
||||
DSQL_NOD string,
|
||||
static bool short_int(DSQL_NOD string,
|
||||
SLONG *long_value,
|
||||
SSHORT range)
|
||||
{
|
||||
@ -5540,13 +5534,13 @@ static BOOLEAN short_int (
|
||||
*************************************/
|
||||
|
||||
if (((STR) string)->str_length > 5) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (char* p = ((STR) string)->str_data; classes [*p] & CHR_DIGIT; p++)
|
||||
{
|
||||
if (!(classes [*p] & CHR_DIGIT)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5563,7 +5557,7 @@ static BOOLEAN short_int (
|
||||
|
||||
*long_value = atoi (buf);
|
||||
|
||||
BOOLEAN return_value;
|
||||
bool return_value;
|
||||
|
||||
switch (range)
|
||||
{
|
||||
@ -5581,8 +5575,7 @@ static BOOLEAN short_int (
|
||||
}
|
||||
#endif
|
||||
|
||||
static void stack_nodes (
|
||||
DSQL_NOD node,
|
||||
static void stack_nodes (DSQL_NOD node,
|
||||
DLLS *stack)
|
||||
{
|
||||
/**************************************
|
||||
@ -5595,16 +5588,16 @@ static void stack_nodes (
|
||||
* Assist in turning a tree of misc nodes into a clean list.
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD *ptr, *end;
|
||||
DSQL_NOD curr_node, next_node, start_chain, end_chain, save_link;
|
||||
DSQL_NOD *ptr, *end;
|
||||
DSQL_NOD curr_node, next_node, start_chain, end_chain, save_link;
|
||||
|
||||
if (node->nod_type != nod_list)
|
||||
if (node->nod_type != nod_list)
|
||||
{
|
||||
LLS_PUSH (node, stack);
|
||||
return;
|
||||
}
|
||||
|
||||
/* To take care of cases where long lists of nodes are in a chain
|
||||
/* To take care of cases where long lists of nodes are in a chain
|
||||
of list nodes with exactly one entry, this algorithm will look
|
||||
for a pattern of repeated list nodes with two entries, the first
|
||||
being a list node and the second being a non-list node. Such
|
||||
@ -5612,11 +5605,11 @@ if (node->nod_type != nod_list)
|
||||
non-list nodes in the process. The purpose of this is to avoid
|
||||
massive recursion of this function. */
|
||||
|
||||
start_chain = node;
|
||||
end_chain = NULL;
|
||||
curr_node = node;
|
||||
next_node = node->nod_arg[0];
|
||||
while ( curr_node->nod_count == 2 &&
|
||||
start_chain = node;
|
||||
end_chain = NULL;
|
||||
curr_node = node;
|
||||
next_node = node->nod_arg[0];
|
||||
while ( curr_node->nod_count == 2 &&
|
||||
curr_node->nod_arg[0]->nod_type == nod_list &&
|
||||
curr_node->nod_arg[1]->nod_type != nod_list &&
|
||||
next_node->nod_arg[0]->nod_type == nod_list &&
|
||||
@ -5632,9 +5625,9 @@ while ( curr_node->nod_count == 2 &&
|
||||
end_chain = curr_node;
|
||||
}
|
||||
|
||||
/* see if any chain was found */
|
||||
/* see if any chain was found */
|
||||
|
||||
if ( end_chain)
|
||||
if ( end_chain)
|
||||
{
|
||||
|
||||
/* first, handle the rest of the nodes */
|
||||
@ -5645,7 +5638,7 @@ if ( end_chain)
|
||||
/* stack the non-list nodes and reverse the chain on the way back */
|
||||
|
||||
curr_node = end_chain;
|
||||
while ( TRUE)
|
||||
while (true)
|
||||
{
|
||||
LLS_PUSH( curr_node->nod_arg[1], stack);
|
||||
if ( curr_node == start_chain)
|
||||
@ -5658,7 +5651,7 @@ if ( end_chain)
|
||||
return;
|
||||
}
|
||||
|
||||
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
|
||||
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
|
||||
stack_nodes (*ptr, stack);
|
||||
}
|
||||
|
||||
@ -5689,21 +5682,21 @@ int LexerState::yylex (
|
||||
* Functional description: lexer.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR tok_class;
|
||||
char string[MAX_TOKEN_LEN];
|
||||
char* p;
|
||||
char* buffer;
|
||||
char* buffer_end;
|
||||
char* new_buffer;
|
||||
SYM sym;
|
||||
SSHORT c;
|
||||
USHORT buffer_len;
|
||||
UCHAR tok_class;
|
||||
char string[MAX_TOKEN_LEN];
|
||||
char* p;
|
||||
char* buffer;
|
||||
char* buffer_end;
|
||||
char* new_buffer;
|
||||
SYM sym;
|
||||
SSHORT c;
|
||||
USHORT buffer_len;
|
||||
|
||||
STR delimited_id_str;
|
||||
STR delimited_id_str;
|
||||
|
||||
/* Find end of white space and skip comments */
|
||||
/* Find end of white space and skip comments */
|
||||
|
||||
for (;;)
|
||||
for (;;)
|
||||
{
|
||||
if (ptr >= end)
|
||||
return -1;
|
||||
@ -5762,11 +5755,11 @@ for (;;)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Depending on tok_class of token, parse token */
|
||||
/* Depending on tok_class of token, parse token */
|
||||
|
||||
last_token = ptr - 1;
|
||||
last_token = ptr - 1;
|
||||
|
||||
if (tok_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
|
||||
@ -5790,9 +5783,9 @@ if (tok_class & CHR_INTRODUCER)
|
||||
return INTRODUCER;
|
||||
}
|
||||
|
||||
/* parse a quoted string, being sure to look for double quotes */
|
||||
/* parse a quoted string, being sure to look for double quotes */
|
||||
|
||||
if (tok_class & CHR_QUOTE)
|
||||
if (tok_class & CHR_QUOTE)
|
||||
{
|
||||
buffer = string;
|
||||
buffer_len = sizeof (string);
|
||||
@ -5888,19 +5881,19 @@ if (tok_class & CHR_QUOTE)
|
||||
* ptr points to the next character.
|
||||
*/
|
||||
|
||||
assert(ptr <= end);
|
||||
assert(ptr <= end);
|
||||
|
||||
if ((tok_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. */
|
||||
|
||||
BOOLEAN have_error = FALSE; /* syntax error or value too large */
|
||||
BOOLEAN have_digit = FALSE; /* we've seen a digit */
|
||||
BOOLEAN have_decimal = FALSE; /* we've seen a '.' */
|
||||
BOOLEAN have_exp = FALSE; /* digit ... [eE] */
|
||||
BOOLEAN have_exp_sign = FALSE; /* digit ... [eE] {+-] */
|
||||
BOOLEAN have_exp_digit = FALSE; /* digit ... [eE] ... digit */
|
||||
bool have_error = false; /* syntax error or value too large */
|
||||
bool have_digit = false; /* we've seen a digit */
|
||||
bool have_decimal = false; /* we've seen a '.' */
|
||||
bool have_exp = false; /* digit ... [eE] */
|
||||
bool have_exp_sign = false; /* digit ... [eE] {+-] */
|
||||
bool have_exp_digit = false; /* digit ... [eE] ... digit */
|
||||
UINT64 number = 0;
|
||||
UINT64 limit_by_10 = MAX_SINT64 / 10;
|
||||
|
||||
@ -5914,32 +5907,32 @@ if ((tok_class & CHR_DIGIT) ||
|
||||
else if (have_exp_sign && (! (classes [c] & CHR_DIGIT)))
|
||||
{
|
||||
/* only digits can be accepted after "1E-" */
|
||||
have_error = TRUE;
|
||||
have_error = true;
|
||||
break;
|
||||
}
|
||||
else if (have_exp)
|
||||
{
|
||||
/* We've seen e or E, but nothing beyond that. */
|
||||
if ( ('-' == c) || ('+' == c) )
|
||||
have_exp_sign = TRUE;
|
||||
have_exp_sign = true;
|
||||
else if ( classes [c] & CHR_DIGIT )
|
||||
/* We have a digit: we haven't seen a sign yet,
|
||||
but it's too late now. */
|
||||
have_exp_digit = have_exp_sign = TRUE;
|
||||
have_exp_digit = have_exp_sign = true;
|
||||
else
|
||||
{
|
||||
/* end of the token */
|
||||
have_error = TRUE;
|
||||
have_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ('.' == c)
|
||||
{
|
||||
if (!have_decimal)
|
||||
have_decimal = TRUE;
|
||||
have_decimal = true;
|
||||
else
|
||||
{
|
||||
have_error = TRUE;
|
||||
have_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -5948,19 +5941,19 @@ if ((tok_class & CHR_DIGIT) ||
|
||||
/* Before computing the next value, make sure there will be
|
||||
no overflow. */
|
||||
|
||||
have_digit = TRUE;
|
||||
have_digit = true;
|
||||
|
||||
if (number >= limit_by_10)
|
||||
/* possibility of an overflow */
|
||||
if ((number > limit_by_10) || (c > '8'))
|
||||
{
|
||||
have_error = TRUE;
|
||||
have_error = true;
|
||||
break;
|
||||
}
|
||||
number = number * 10 + (c - '0');
|
||||
}
|
||||
else if ( (('E' == c) || ('e' == c)) && have_digit )
|
||||
have_exp = TRUE;
|
||||
have_exp = true;
|
||||
else
|
||||
/* Unexpected character: this is the end of the number. */
|
||||
break;
|
||||
@ -6039,17 +6032,17 @@ if ((tok_class & CHR_DIGIT) ||
|
||||
*/
|
||||
}
|
||||
|
||||
/* Restore the status quo ante, before we started our unsuccessful
|
||||
/* Restore the status quo ante, before we started our unsuccessful
|
||||
attempt to recognize a number. */
|
||||
ptr = last_token;
|
||||
c = *ptr++;
|
||||
/* We never touched tok_class, so it doesn't need to be restored. */
|
||||
ptr = last_token;
|
||||
c = *ptr++;
|
||||
/* We never touched tok_class, so it doesn't need to be restored. */
|
||||
|
||||
/* end of number-recognition code */
|
||||
/* end of number-recognition code */
|
||||
|
||||
|
||||
if (tok_class & CHR_LETTER)
|
||||
{
|
||||
if (tok_class & CHR_LETTER)
|
||||
{
|
||||
p = string;
|
||||
CHECK_COPY_INCR(p, UPPER (c));
|
||||
for (; ptr < end && classes [*ptr] & CHR_IDENT; ptr++)
|
||||
@ -6136,11 +6129,11 @@ if (tok_class & CHR_LETTER)
|
||||
line_start_bk = line_start;
|
||||
lines_bk = lines;
|
||||
return SYMBOL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Must be punctuation -- test for double character punctuation */
|
||||
/* Must be punctuation -- test for double character punctuation */
|
||||
|
||||
if (last_token + 1 < end)
|
||||
if (last_token + 1 < end)
|
||||
{
|
||||
sym = HSHD_lookup (NULL, last_token, (SSHORT) 2, SYM_keyword, (USHORT) parser_version);
|
||||
if (sym)
|
||||
@ -6150,10 +6143,10 @@ if (last_token + 1 < end)
|
||||
}
|
||||
}
|
||||
|
||||
/* We need to swallow braces around INSERTING/UPDATING/DELETING keywords */
|
||||
/* This algorithm is not perfect, but it is ok for now.
|
||||
/* We need to swallow braces around INSERTING/UPDATING/DELETING keywords */
|
||||
/* This algorithm is not perfect, but it is ok for now.
|
||||
It should be dropped when BOOLEAN datatype is introduced in Firebird */
|
||||
if ( c == '(' && !brace_analysis &&
|
||||
if ( c == '(' && !brace_analysis &&
|
||||
/* 1) We need to swallow braces in all boolean expressions
|
||||
2) We may swallow braces in ordinary expressions
|
||||
3) We should not swallow braces after special tokens
|
||||
@ -6161,7 +6154,7 @@ if ( c == '(' && !brace_analysis &&
|
||||
*/
|
||||
(prev_keyword=='(' || prev_keyword==NOT || prev_keyword==AND || prev_keyword==OR ||
|
||||
prev_keyword==ON || prev_keyword==HAVING || prev_keyword==WHERE || prev_keyword==WHEN) )
|
||||
{
|
||||
{
|
||||
LexerState savedState = lex;
|
||||
brace_analysis = true;
|
||||
int openCount = 0;
|
||||
@ -6216,11 +6209,11 @@ if ( c == '(' && !brace_analysis &&
|
||||
/* Restore status quo. */
|
||||
lex = savedState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Single character punctuation are simply passed on */
|
||||
/* Single character punctuation are simply passed on */
|
||||
|
||||
return c;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@ -6238,11 +6231,11 @@ static void yyerror (
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (DSQL_yychar < 1)
|
||||
if (DSQL_yychar < 1)
|
||||
ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
|
||||
gds_arg_gds, gds_command_end_err, /* Unexpected end of command */
|
||||
0);
|
||||
else
|
||||
else
|
||||
{
|
||||
ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
|
||||
gds_arg_gds, gds_dsql_token_unk_err,
|
||||
@ -6250,14 +6243,12 @@ else
|
||||
gds_arg_number, (SLONG) (lex.last_token - lex.line_start + 1), /*CVC: +1*/
|
||||
/* Token unknown - line %d, char %d */
|
||||
gds_arg_gds, gds_random,
|
||||
gds_arg_cstring, (int) (lex.ptr - lex.last_token), lex.last_token,
|
||||
0);
|
||||
gds_arg_cstring, (int) (lex.ptr - lex.last_token), lex.last_token, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void yyabandon (
|
||||
SSHORT sql_code,
|
||||
static void yyabandon (SSHORT sql_code,
|
||||
ISC_STATUS error_symbol)
|
||||
{
|
||||
/**************************************
|
||||
@ -6271,7 +6262,7 @@ 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);
|
||||
}
|
||||
#define YYABORT goto yyabort
|
||||
|
317
src/dsql/parse.y
317
src/dsql/parse.y
@ -166,7 +166,7 @@ static void yyerror (TEXT *);
|
||||
|
||||
static TEXT *lex_position (void);
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static BOOLEAN long_int (DSQL_NOD, SLONG *);
|
||||
static bool long_int(DSQL_NOD, SLONG *);
|
||||
#endif
|
||||
static DSQL_FLD make_field (DSQL_NOD);
|
||||
static FIL make_file (void);
|
||||
@ -176,7 +176,7 @@ static DSQL_NOD make_parameter (void);
|
||||
static DSQL_NOD make_flag_node (NOD_TYPE, SSHORT, int, ...);
|
||||
static void prepare_console_debug (int, int *);
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static BOOLEAN short_int (DSQL_NOD, SLONG *, SSHORT);
|
||||
static bool short_int(DSQL_NOD, SLONG *, SSHORT);
|
||||
#endif
|
||||
static void stack_nodes (DSQL_NOD, DLLS *);
|
||||
inline static int yylex (USHORT, USHORT, USHORT, BOOLEAN *);
|
||||
@ -4173,13 +4173,12 @@ static TEXT *lex_position (void)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
return lex.ptr;
|
||||
return lex.ptr;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static BOOLEAN long_int (
|
||||
DSQL_NOD string,
|
||||
static bool long_int(DSQL_NOD string,
|
||||
SLONG *long_value)
|
||||
{
|
||||
/*************************************
|
||||
@ -4197,18 +4196,17 @@ static BOOLEAN long_int (
|
||||
for (const char* p = ((STR) string)->str_data; classes [*p] & CHR_DIGIT; p++)
|
||||
{
|
||||
if (!(classes [*p] & CHR_DIGIT)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
*long_value = atol ((char *)((STR) string)->str_data);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static DSQL_FLD make_field (
|
||||
DSQL_NOD field_name)
|
||||
static DSQL_FLD make_field (DSQL_NOD field_name)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4220,23 +4218,23 @@ static DSQL_FLD make_field (
|
||||
* Make a field block of given name.
|
||||
*
|
||||
**************************************/
|
||||
DSQL_FLD field;
|
||||
STR string;
|
||||
TSQL tdsql;
|
||||
DSQL_FLD field;
|
||||
STR string;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
if (field_name == NULL)
|
||||
if (field_name == NULL)
|
||||
{
|
||||
field = FB_NEW_RPT(*tdsql->tsql_default, sizeof (INTERNAL_FIELD_NAME)) dsql_fld;
|
||||
strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME);
|
||||
return field;
|
||||
}
|
||||
string = (STR) field_name->nod_arg [1];
|
||||
field = FB_NEW_RPT(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) dsql_fld;
|
||||
strcpy (field->fld_name, (TEXT*) string->str_data);
|
||||
string = (STR) field_name->nod_arg [1];
|
||||
field = FB_NEW_RPT(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) dsql_fld;
|
||||
strcpy (field->fld_name, (TEXT*) string->str_data);
|
||||
|
||||
return field;
|
||||
return field;
|
||||
}
|
||||
|
||||
|
||||
@ -4252,19 +4250,18 @@ static FIL make_file (void)
|
||||
* Make a file block
|
||||
*
|
||||
**************************************/
|
||||
FIL temp_file;
|
||||
TSQL tdsql;
|
||||
FIL temp_file;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
temp_file = FB_NEW(*tdsql->tsql_default) fil;
|
||||
temp_file = FB_NEW(*tdsql->tsql_default) fil;
|
||||
|
||||
return temp_file;
|
||||
return temp_file;
|
||||
}
|
||||
|
||||
|
||||
static DSQL_NOD make_list (
|
||||
DSQL_NOD node)
|
||||
static DSQL_NOD make_list (DSQL_NOD node)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -4276,33 +4273,33 @@ static DSQL_NOD make_list (
|
||||
* Collapse nested list nodes into single list.
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD *ptr;
|
||||
DLLS stack, temp;
|
||||
USHORT l;
|
||||
DSQL_NOD old;
|
||||
TSQL tdsql;
|
||||
DSQL_NOD *ptr;
|
||||
DLLS stack, temp;
|
||||
USHORT l;
|
||||
DSQL_NOD old;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
if (!node)
|
||||
if (!node)
|
||||
return node;
|
||||
|
||||
stack = 0;
|
||||
stack_nodes (node, &stack);
|
||||
for (l = 0, temp = stack; temp; temp = temp->lls_next)
|
||||
stack = 0;
|
||||
stack_nodes (node, &stack);
|
||||
for (l = 0, temp = stack; temp; temp = temp->lls_next)
|
||||
l++;
|
||||
|
||||
old = node;
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, l) dsql_nod;
|
||||
node->nod_count = l;
|
||||
node->nod_type = nod_list;
|
||||
node->nod_flags = old->nod_flags;
|
||||
ptr = node->nod_arg + node->nod_count;
|
||||
old = node;
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, l) dsql_nod;
|
||||
node->nod_count = l;
|
||||
node->nod_type = nod_list;
|
||||
node->nod_flags = old->nod_flags;
|
||||
ptr = node->nod_arg + node->nod_count;
|
||||
|
||||
while (stack)
|
||||
while (stack)
|
||||
*--ptr = (DSQL_NOD) LLS_POP (&stack);
|
||||
|
||||
return node;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@ -4319,24 +4316,23 @@ static DSQL_NOD make_parameter (void)
|
||||
* Any change should also be made to function below
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD node;
|
||||
TSQL tdsql;
|
||||
DSQL_NOD node;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
|
||||
node->nod_type = nod_parameter;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = 1;
|
||||
node->nod_arg[0] = (DSQL_NOD)(ULONG) lex.param_number++;
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
|
||||
node->nod_type = nod_parameter;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = 1;
|
||||
node->nod_arg[0] = (DSQL_NOD)(ULONG) lex.param_number++;
|
||||
|
||||
return node;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
static DSQL_NOD make_node (
|
||||
NOD_TYPE type,
|
||||
static DSQL_NOD make_node (NOD_TYPE type,
|
||||
int count,
|
||||
...)
|
||||
{
|
||||
@ -4351,29 +4347,28 @@ static DSQL_NOD make_node (
|
||||
* Any change should also be made to function below
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD node, *p;
|
||||
va_list ptr;
|
||||
TSQL tdsql;
|
||||
DSQL_NOD node, *p;
|
||||
va_list ptr;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
|
||||
node->nod_type = type;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = count;
|
||||
p = node->nod_arg;
|
||||
VA_START (ptr, count);
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
|
||||
node->nod_type = type;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = count;
|
||||
p = node->nod_arg;
|
||||
VA_START (ptr, count);
|
||||
|
||||
while (--count >= 0)
|
||||
while (--count >= 0)
|
||||
*p++ = va_arg (ptr, DSQL_NOD);
|
||||
|
||||
return node;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
static DSQL_NOD make_flag_node (
|
||||
NOD_TYPE type,
|
||||
static DSQL_NOD make_flag_node (NOD_TYPE type,
|
||||
SSHORT flag,
|
||||
int count,
|
||||
...)
|
||||
@ -4388,25 +4383,25 @@ static DSQL_NOD make_flag_node (
|
||||
* Make a node of given type. Set flag field
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD node, *p;
|
||||
va_list ptr;
|
||||
TSQL tdsql;
|
||||
DSQL_NOD node, *p;
|
||||
va_list ptr;
|
||||
TSQL tdsql;
|
||||
|
||||
tdsql = GET_THREAD_DATA;
|
||||
tdsql = GET_THREAD_DATA;
|
||||
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
|
||||
node->nod_type = type;
|
||||
node->nod_flags = flag;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = count;
|
||||
p = node->nod_arg;
|
||||
VA_START (ptr, count);
|
||||
node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
|
||||
node->nod_type = type;
|
||||
node->nod_flags = flag;
|
||||
node->nod_line = (USHORT) lex.lines_bk;
|
||||
node->nod_column = (USHORT) (lex.last_token_bk - lex.line_start_bk + 1);
|
||||
node->nod_count = count;
|
||||
p = node->nod_arg;
|
||||
VA_START (ptr, count);
|
||||
|
||||
while (--count >= 0)
|
||||
while (--count >= 0)
|
||||
*p++ = va_arg (ptr, DSQL_NOD);
|
||||
|
||||
return node;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
@ -4433,7 +4428,7 @@ static void prepare_console_debug (int level, int *yydeb)
|
||||
operations that's generated in DEV build when DEBUG <n> is typed into isql.exe.
|
||||
When n>0, the output console is activated; otherwise it's closed. */
|
||||
#if defined(DEV_BUILD) && defined(WIN_NT) && defined(SUPERSERVER)
|
||||
static FILE* redirected_output;
|
||||
static FILE* redirected_output;
|
||||
if (level > 0) {
|
||||
/* Console debug code inside this scope */
|
||||
if (AllocConsole()) {
|
||||
@ -4450,8 +4445,7 @@ static FILE* redirected_output;
|
||||
}
|
||||
|
||||
#ifdef NOT_USED_OR_REPLACED
|
||||
static BOOLEAN short_int (
|
||||
DSQL_NOD string,
|
||||
static bool short_int(DSQL_NOD string,
|
||||
SLONG *long_value,
|
||||
SSHORT range)
|
||||
{
|
||||
@ -4468,13 +4462,13 @@ static BOOLEAN short_int (
|
||||
*************************************/
|
||||
|
||||
if (((STR) string)->str_length > 5) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (char* p = ((STR) string)->str_data; classes [*p] & CHR_DIGIT; p++)
|
||||
{
|
||||
if (!(classes [*p] & CHR_DIGIT)) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4491,7 +4485,7 @@ static BOOLEAN short_int (
|
||||
|
||||
*long_value = atoi (buf);
|
||||
|
||||
BOOLEAN return_value;
|
||||
bool return_value;
|
||||
|
||||
switch (range)
|
||||
{
|
||||
@ -4509,8 +4503,7 @@ static BOOLEAN short_int (
|
||||
}
|
||||
#endif
|
||||
|
||||
static void stack_nodes (
|
||||
DSQL_NOD node,
|
||||
static void stack_nodes (DSQL_NOD node,
|
||||
DLLS *stack)
|
||||
{
|
||||
/**************************************
|
||||
@ -4523,16 +4516,16 @@ static void stack_nodes (
|
||||
* Assist in turning a tree of misc nodes into a clean list.
|
||||
*
|
||||
**************************************/
|
||||
DSQL_NOD *ptr, *end;
|
||||
DSQL_NOD curr_node, next_node, start_chain, end_chain, save_link;
|
||||
DSQL_NOD *ptr, *end;
|
||||
DSQL_NOD curr_node, next_node, start_chain, end_chain, save_link;
|
||||
|
||||
if (node->nod_type != nod_list)
|
||||
if (node->nod_type != nod_list)
|
||||
{
|
||||
LLS_PUSH (node, stack);
|
||||
return;
|
||||
}
|
||||
|
||||
/* To take care of cases where long lists of nodes are in a chain
|
||||
/* To take care of cases where long lists of nodes are in a chain
|
||||
of list nodes with exactly one entry, this algorithm will look
|
||||
for a pattern of repeated list nodes with two entries, the first
|
||||
being a list node and the second being a non-list node. Such
|
||||
@ -4540,11 +4533,11 @@ if (node->nod_type != nod_list)
|
||||
non-list nodes in the process. The purpose of this is to avoid
|
||||
massive recursion of this function. */
|
||||
|
||||
start_chain = node;
|
||||
end_chain = NULL;
|
||||
curr_node = node;
|
||||
next_node = node->nod_arg[0];
|
||||
while ( curr_node->nod_count == 2 &&
|
||||
start_chain = node;
|
||||
end_chain = NULL;
|
||||
curr_node = node;
|
||||
next_node = node->nod_arg[0];
|
||||
while ( curr_node->nod_count == 2 &&
|
||||
curr_node->nod_arg[0]->nod_type == nod_list &&
|
||||
curr_node->nod_arg[1]->nod_type != nod_list &&
|
||||
next_node->nod_arg[0]->nod_type == nod_list &&
|
||||
@ -4560,9 +4553,9 @@ while ( curr_node->nod_count == 2 &&
|
||||
end_chain = curr_node;
|
||||
}
|
||||
|
||||
/* see if any chain was found */
|
||||
/* see if any chain was found */
|
||||
|
||||
if ( end_chain)
|
||||
if ( end_chain)
|
||||
{
|
||||
|
||||
/* first, handle the rest of the nodes */
|
||||
@ -4573,7 +4566,7 @@ if ( end_chain)
|
||||
/* stack the non-list nodes and reverse the chain on the way back */
|
||||
|
||||
curr_node = end_chain;
|
||||
while ( TRUE)
|
||||
while (true)
|
||||
{
|
||||
LLS_PUSH( curr_node->nod_arg[1], stack);
|
||||
if ( curr_node == start_chain)
|
||||
@ -4586,7 +4579,7 @@ if ( end_chain)
|
||||
return;
|
||||
}
|
||||
|
||||
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
|
||||
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
|
||||
stack_nodes (*ptr, stack);
|
||||
}
|
||||
|
||||
@ -4617,21 +4610,21 @@ int LexerState::yylex (
|
||||
* Functional description: lexer.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR tok_class;
|
||||
char string[MAX_TOKEN_LEN];
|
||||
char* p;
|
||||
char* buffer;
|
||||
char* buffer_end;
|
||||
char* new_buffer;
|
||||
SYM sym;
|
||||
SSHORT c;
|
||||
USHORT buffer_len;
|
||||
UCHAR tok_class;
|
||||
char string[MAX_TOKEN_LEN];
|
||||
char* p;
|
||||
char* buffer;
|
||||
char* buffer_end;
|
||||
char* new_buffer;
|
||||
SYM sym;
|
||||
SSHORT c;
|
||||
USHORT buffer_len;
|
||||
|
||||
STR delimited_id_str;
|
||||
STR delimited_id_str;
|
||||
|
||||
/* Find end of white space and skip comments */
|
||||
/* Find end of white space and skip comments */
|
||||
|
||||
for (;;)
|
||||
for (;;)
|
||||
{
|
||||
if (ptr >= end)
|
||||
return -1;
|
||||
@ -4690,11 +4683,11 @@ for (;;)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Depending on tok_class of token, parse token */
|
||||
/* Depending on tok_class of token, parse token */
|
||||
|
||||
last_token = ptr - 1;
|
||||
last_token = ptr - 1;
|
||||
|
||||
if (tok_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
|
||||
@ -4718,9 +4711,9 @@ if (tok_class & CHR_INTRODUCER)
|
||||
return INTRODUCER;
|
||||
}
|
||||
|
||||
/* parse a quoted string, being sure to look for double quotes */
|
||||
/* parse a quoted string, being sure to look for double quotes */
|
||||
|
||||
if (tok_class & CHR_QUOTE)
|
||||
if (tok_class & CHR_QUOTE)
|
||||
{
|
||||
buffer = string;
|
||||
buffer_len = sizeof (string);
|
||||
@ -4816,19 +4809,19 @@ if (tok_class & CHR_QUOTE)
|
||||
* ptr points to the next character.
|
||||
*/
|
||||
|
||||
assert(ptr <= end);
|
||||
assert(ptr <= end);
|
||||
|
||||
if ((tok_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. */
|
||||
|
||||
BOOLEAN have_error = FALSE; /* syntax error or value too large */
|
||||
BOOLEAN have_digit = FALSE; /* we've seen a digit */
|
||||
BOOLEAN have_decimal = FALSE; /* we've seen a '.' */
|
||||
BOOLEAN have_exp = FALSE; /* digit ... [eE] */
|
||||
BOOLEAN have_exp_sign = FALSE; /* digit ... [eE] {+-] */
|
||||
BOOLEAN have_exp_digit = FALSE; /* digit ... [eE] ... digit */
|
||||
bool have_error = false; /* syntax error or value too large */
|
||||
bool have_digit = false; /* we've seen a digit */
|
||||
bool have_decimal = false; /* we've seen a '.' */
|
||||
bool have_exp = false; /* digit ... [eE] */
|
||||
bool have_exp_sign = false; /* digit ... [eE] {+-] */
|
||||
bool have_exp_digit = false; /* digit ... [eE] ... digit */
|
||||
UINT64 number = 0;
|
||||
UINT64 limit_by_10 = MAX_SINT64 / 10;
|
||||
|
||||
@ -4842,32 +4835,32 @@ if ((tok_class & CHR_DIGIT) ||
|
||||
else if (have_exp_sign && (! (classes [c] & CHR_DIGIT)))
|
||||
{
|
||||
/* only digits can be accepted after "1E-" */
|
||||
have_error = TRUE;
|
||||
have_error = true;
|
||||
break;
|
||||
}
|
||||
else if (have_exp)
|
||||
{
|
||||
/* We've seen e or E, but nothing beyond that. */
|
||||
if ( ('-' == c) || ('+' == c) )
|
||||
have_exp_sign = TRUE;
|
||||
have_exp_sign = true;
|
||||
else if ( classes [c] & CHR_DIGIT )
|
||||
/* We have a digit: we haven't seen a sign yet,
|
||||
but it's too late now. */
|
||||
have_exp_digit = have_exp_sign = TRUE;
|
||||
have_exp_digit = have_exp_sign = true;
|
||||
else
|
||||
{
|
||||
/* end of the token */
|
||||
have_error = TRUE;
|
||||
have_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ('.' == c)
|
||||
{
|
||||
if (!have_decimal)
|
||||
have_decimal = TRUE;
|
||||
have_decimal = true;
|
||||
else
|
||||
{
|
||||
have_error = TRUE;
|
||||
have_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4876,19 +4869,19 @@ if ((tok_class & CHR_DIGIT) ||
|
||||
/* Before computing the next value, make sure there will be
|
||||
no overflow. */
|
||||
|
||||
have_digit = TRUE;
|
||||
have_digit = true;
|
||||
|
||||
if (number >= limit_by_10)
|
||||
/* possibility of an overflow */
|
||||
if ((number > limit_by_10) || (c > '8'))
|
||||
{
|
||||
have_error = TRUE;
|
||||
have_error = true;
|
||||
break;
|
||||
}
|
||||
number = number * 10 + (c - '0');
|
||||
}
|
||||
else if ( (('E' == c) || ('e' == c)) && have_digit )
|
||||
have_exp = TRUE;
|
||||
have_exp = true;
|
||||
else
|
||||
/* Unexpected character: this is the end of the number. */
|
||||
break;
|
||||
@ -4967,17 +4960,17 @@ if ((tok_class & CHR_DIGIT) ||
|
||||
*/
|
||||
}
|
||||
|
||||
/* Restore the status quo ante, before we started our unsuccessful
|
||||
/* Restore the status quo ante, before we started our unsuccessful
|
||||
attempt to recognize a number. */
|
||||
ptr = last_token;
|
||||
c = *ptr++;
|
||||
/* We never touched tok_class, so it doesn't need to be restored. */
|
||||
ptr = last_token;
|
||||
c = *ptr++;
|
||||
/* We never touched tok_class, so it doesn't need to be restored. */
|
||||
|
||||
/* end of number-recognition code */
|
||||
/* end of number-recognition code */
|
||||
|
||||
|
||||
if (tok_class & CHR_LETTER)
|
||||
{
|
||||
if (tok_class & CHR_LETTER)
|
||||
{
|
||||
p = string;
|
||||
CHECK_COPY_INCR(p, UPPER (c));
|
||||
for (; ptr < end && classes [*ptr] & CHR_IDENT; ptr++)
|
||||
@ -5064,11 +5057,11 @@ if (tok_class & CHR_LETTER)
|
||||
line_start_bk = line_start;
|
||||
lines_bk = lines;
|
||||
return SYMBOL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Must be punctuation -- test for double character punctuation */
|
||||
/* Must be punctuation -- test for double character punctuation */
|
||||
|
||||
if (last_token + 1 < end)
|
||||
if (last_token + 1 < end)
|
||||
{
|
||||
sym = HSHD_lookup (NULL, last_token, (SSHORT) 2, SYM_keyword, (USHORT) parser_version);
|
||||
if (sym)
|
||||
@ -5078,10 +5071,10 @@ if (last_token + 1 < end)
|
||||
}
|
||||
}
|
||||
|
||||
/* We need to swallow braces around INSERTING/UPDATING/DELETING keywords */
|
||||
/* This algorithm is not perfect, but it is ok for now.
|
||||
/* We need to swallow braces around INSERTING/UPDATING/DELETING keywords */
|
||||
/* This algorithm is not perfect, but it is ok for now.
|
||||
It should be dropped when BOOLEAN datatype is introduced in Firebird */
|
||||
if ( c == '(' && !brace_analysis &&
|
||||
if ( c == '(' && !brace_analysis &&
|
||||
/* 1) We need to swallow braces in all boolean expressions
|
||||
2) We may swallow braces in ordinary expressions
|
||||
3) We should not swallow braces after special tokens
|
||||
@ -5089,7 +5082,7 @@ if ( c == '(' && !brace_analysis &&
|
||||
*/
|
||||
(prev_keyword=='(' || prev_keyword==NOT || prev_keyword==AND || prev_keyword==OR ||
|
||||
prev_keyword==ON || prev_keyword==HAVING || prev_keyword==WHERE || prev_keyword==WHEN) )
|
||||
{
|
||||
{
|
||||
LexerState savedState = lex;
|
||||
brace_analysis = true;
|
||||
int openCount = 0;
|
||||
@ -5144,11 +5137,11 @@ if ( c == '(' && !brace_analysis &&
|
||||
/* Restore status quo. */
|
||||
lex = savedState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Single character punctuation are simply passed on */
|
||||
/* Single character punctuation are simply passed on */
|
||||
|
||||
return c;
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@ -5166,11 +5159,11 @@ static void yyerror (
|
||||
*
|
||||
**************************************/
|
||||
|
||||
if (yychar < 1)
|
||||
if (yychar < 1)
|
||||
ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
|
||||
gds_arg_gds, gds_command_end_err, /* Unexpected end of command */
|
||||
0);
|
||||
else
|
||||
else
|
||||
{
|
||||
ERRD_post (gds_sqlerr, gds_arg_number, (SLONG) -104,
|
||||
gds_arg_gds, gds_dsql_token_unk_err,
|
||||
@ -5178,14 +5171,12 @@ else
|
||||
gds_arg_number, (SLONG) (lex.last_token - lex.line_start + 1), /*CVC: +1*/
|
||||
/* Token unknown - line %d, char %d */
|
||||
gds_arg_gds, gds_random,
|
||||
gds_arg_cstring, (int) (lex.ptr - lex.last_token), lex.last_token,
|
||||
0);
|
||||
gds_arg_cstring, (int) (lex.ptr - lex.last_token), lex.last_token, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void yyabandon (
|
||||
SSHORT sql_code,
|
||||
static void yyabandon (SSHORT sql_code,
|
||||
ISC_STATUS error_symbol)
|
||||
{
|
||||
/**************************************
|
||||
@ -5199,6 +5190,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);
|
||||
}
|
||||
|
@ -1958,7 +1958,7 @@ static void explode_asterisk(DSQL_REQ request, DSQL_NOD node, DSQL_NOD aggregate
|
||||
DSQL_NOD derived_field = MAKE_node(nod_derived_field, e_derived_field_count);
|
||||
derived_field->nod_arg[e_derived_field_value] = select_item->nod_arg[e_derived_field_value];
|
||||
derived_field->nod_arg[e_derived_field_name] = select_item->nod_arg[e_derived_field_name];
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD) request->req_scope_level;
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD)(ULONG) request->req_scope_level;
|
||||
derived_field->nod_desc = select_item->nod_desc;
|
||||
LLS_PUSH(derived_field, stack);
|
||||
}
|
||||
@ -3424,7 +3424,7 @@ static DSQL_NOD pass1_derived_table(DSQL_REQ request, DSQL_NOD input)
|
||||
derived_field = MAKE_node(nod_derived_field, e_derived_field_count);
|
||||
derived_field->nod_arg[e_derived_field_value] = select_item;
|
||||
derived_field->nod_arg[e_derived_field_name] = list->nod_arg[count];
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD) request->req_scope_level;
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD)(ULONG) request->req_scope_level;
|
||||
derived_field->nod_desc = select_item->nod_desc;
|
||||
|
||||
rse->nod_arg[e_rse_items]->nod_arg[count] = derived_field;
|
||||
@ -4537,7 +4537,7 @@ static DSQL_NOD pass1_make_derived_field(DSQL_REQ request, TSQL tdsql, DSQL_NOD
|
||||
DSQL_NOD derived_field = MAKE_node(nod_derived_field, e_derived_field_count);
|
||||
derived_field->nod_arg[e_derived_field_value] = select_item;
|
||||
derived_field->nod_arg[e_derived_field_name] = (DSQL_NOD) alias;
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD) request->req_scope_level;
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD)(ULONG) request->req_scope_level;
|
||||
derived_field->nod_desc = select_item->nod_desc;
|
||||
return derived_field;
|
||||
}
|
||||
@ -4555,7 +4555,7 @@ static DSQL_NOD pass1_make_derived_field(DSQL_REQ request, TSQL tdsql, DSQL_NOD
|
||||
DSQL_NOD derived_field = MAKE_node(nod_derived_field, e_derived_field_count);
|
||||
derived_field->nod_arg[e_derived_field_value] = select_item->nod_arg[e_alias_value];
|
||||
derived_field->nod_arg[e_derived_field_name] = (DSQL_NOD) alias;
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD) request->req_scope_level;
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD)(ULONG) request->req_scope_level;
|
||||
derived_field->nod_desc = select_item->nod_desc;
|
||||
return derived_field;
|
||||
}
|
||||
@ -4570,7 +4570,7 @@ static DSQL_NOD pass1_make_derived_field(DSQL_REQ request, TSQL tdsql, DSQL_NOD
|
||||
// with orginal map.
|
||||
if (derived_field->nod_type == nod_derived_field) {
|
||||
derived_field->nod_arg[e_derived_field_value] = select_item;
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD) request->req_scope_level;
|
||||
derived_field->nod_arg[e_derived_field_scope] = (DSQL_NOD)(ULONG) request->req_scope_level;
|
||||
derived_field->nod_desc = select_item->nod_desc;
|
||||
return derived_field;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ extern "C" {
|
||||
|
||||
static void generate_error(ISC_STATUS *, SCHAR *, SSHORT, SSHORT);
|
||||
static SSHORT get_next_token(SCHAR **, SCHAR *, SCHAR *, USHORT *);
|
||||
static SSHORT get_token(ISC_STATUS *, SSHORT, BOOLEAN, SCHAR **, SCHAR *,
|
||||
static SSHORT get_token(ISC_STATUS *, SSHORT, bool, SCHAR **, SCHAR *,
|
||||
SCHAR *, USHORT *);
|
||||
|
||||
typedef struct pp_table {
|
||||
@ -111,18 +111,21 @@ static const PP_TABLE pp_symbols[] = {
|
||||
@param dialect
|
||||
|
||||
**/
|
||||
int DLL_EXPORT PREPARSE_execute(
|
||||
ISC_STATUS * user_status,
|
||||
int DLL_EXPORT PREPARSE_execute(ISC_STATUS * user_status,
|
||||
FRBRD ** db_handle,
|
||||
FRBRD ** trans_handle,
|
||||
USHORT stmt_length, SCHAR * stmt, BOOLEAN * stmt_eaten, USHORT dialect)
|
||||
USHORT stmt_length,
|
||||
SCHAR * stmt,
|
||||
BOOLEAN * stmt_eaten,
|
||||
USHORT dialect)
|
||||
{
|
||||
TEXT file_name[MAX_TOKEN_SIZE + 1];
|
||||
SCHAR *token, *dpb_array, *dpb, *ch, *stmt_end;
|
||||
SLONG page_size = 0;
|
||||
USHORT dpb_len = 0, token_length;
|
||||
SSHORT i, l, result;
|
||||
BOOLEAN matched, get_out;
|
||||
bool matched;
|
||||
bool get_out;
|
||||
ISC_STATUS_ARRAY temp_status;
|
||||
FRBRD *temp_db_handle = NULL;
|
||||
|
||||
@ -139,26 +142,29 @@ USHORT stmt_length, SCHAR * stmt, BOOLEAN * stmt_eaten, USHORT dialect)
|
||||
stmt_length = strlen(stmt);
|
||||
stmt_end = stmt + stmt_length;
|
||||
|
||||
if (get_token(user_status, SYMBOL, FALSE, &stmt, stmt_end, token,
|
||||
if (get_token(user_status, SYMBOL, false, &stmt, stmt_end, token,
|
||||
&token_length) ||
|
||||
token_length != pp_symbols[PP_CREATE].length ||
|
||||
strcmp(token, pp_symbols[PP_CREATE].symbol)) {
|
||||
strcmp(token, pp_symbols[PP_CREATE].symbol))
|
||||
{
|
||||
gds__free((SLONG *) token);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (get_token(user_status, SYMBOL, FALSE, &stmt, stmt_end, token,
|
||||
if (get_token(user_status, SYMBOL, false, &stmt, stmt_end, token,
|
||||
&token_length) ||
|
||||
(token_length != pp_symbols[PP_DATABASE].length &&
|
||||
token_length != pp_symbols[PP_SCHEMA].length) ||
|
||||
(strcmp(token, pp_symbols[PP_DATABASE].symbol) &&
|
||||
strcmp(token, pp_symbols[PP_SCHEMA].symbol))) {
|
||||
strcmp(token, pp_symbols[PP_SCHEMA].symbol)))
|
||||
{
|
||||
gds__free((SLONG *) token);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (get_token(user_status, STRING, FALSE, &stmt, stmt_end, token,
|
||||
&token_length)) {
|
||||
if (get_token(user_status, STRING, false, &stmt, stmt_end, token,
|
||||
&token_length))
|
||||
{
|
||||
gds__free((SLONG *) token);
|
||||
return TRUE;
|
||||
}
|
||||
@ -191,33 +197,35 @@ USHORT stmt_length, SCHAR * stmt, BOOLEAN * stmt_eaten, USHORT dialect)
|
||||
else if (result < 0)
|
||||
break;
|
||||
|
||||
matched = FALSE;
|
||||
matched = false;
|
||||
for (i = 3; pp_symbols[i].length && !matched; i++) {
|
||||
if (token_length == pp_symbols[i].length &&
|
||||
!strcmp(token, pp_symbols[i].symbol)) {
|
||||
|
||||
get_out = FALSE;
|
||||
get_out = false;
|
||||
switch (pp_symbols[i].code) {
|
||||
case PP_PAGE_SIZE:
|
||||
case PP_PAGESIZE:
|
||||
if (get_token(user_status, '=', TRUE, &stmt, stmt_end,
|
||||
if (get_token(user_status, '=', true, &stmt, stmt_end,
|
||||
token, &token_length) ||
|
||||
get_token(user_status, NUMERIC, FALSE, &stmt,
|
||||
stmt_end, token, &token_length)) {
|
||||
get_out = TRUE;
|
||||
get_token(user_status, NUMERIC, false, &stmt,
|
||||
stmt_end, token, &token_length))
|
||||
{
|
||||
get_out = true;
|
||||
break;
|
||||
}
|
||||
page_size = atol(token);
|
||||
STUFF_DPB(gds_dpb_page_size);
|
||||
STUFF_DPB(4);
|
||||
STUFF_DPB_INT(page_size);
|
||||
matched = TRUE;
|
||||
matched = true;
|
||||
break;
|
||||
|
||||
case PP_USER:
|
||||
if (get_token(user_status, STRING, FALSE, &stmt, stmt_end,
|
||||
token, &token_length)) {
|
||||
get_out = TRUE;
|
||||
if (get_token(user_status, STRING, false, &stmt, stmt_end,
|
||||
token, &token_length))
|
||||
{
|
||||
get_out = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -227,13 +235,14 @@ USHORT stmt_length, SCHAR * stmt, BOOLEAN * stmt_eaten, USHORT dialect)
|
||||
ch = token;
|
||||
while (*ch)
|
||||
STUFF_DPB(*ch++);
|
||||
matched = TRUE;
|
||||
matched = true;
|
||||
break;
|
||||
|
||||
case PP_PASSWORD:
|
||||
if (get_token(user_status, STRING, FALSE, &stmt, stmt_end,
|
||||
token, &token_length)) {
|
||||
get_out = TRUE;
|
||||
if (get_token(user_status, STRING, false, &stmt, stmt_end,
|
||||
token, &token_length))
|
||||
{
|
||||
get_out = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -243,17 +252,18 @@ USHORT stmt_length, SCHAR * stmt, BOOLEAN * stmt_eaten, USHORT dialect)
|
||||
ch = token;
|
||||
while (*ch)
|
||||
STUFF_DPB(*ch++);
|
||||
matched = TRUE;
|
||||
matched = true;
|
||||
break;
|
||||
|
||||
case PP_SET:
|
||||
if (get_token(user_status, SYMBOL, FALSE, &stmt, stmt_end,
|
||||
if (get_token(user_status, SYMBOL, false, &stmt, stmt_end,
|
||||
token, &token_length) ||
|
||||
token_length != pp_symbols[PP_NAMES].length ||
|
||||
strcmp(token, pp_symbols[PP_NAMES].symbol) ||
|
||||
get_token(user_status, STRING, FALSE, &stmt, stmt_end,
|
||||
token, &token_length)) {
|
||||
get_out = TRUE;
|
||||
get_token(user_status, STRING, false, &stmt, stmt_end,
|
||||
token, &token_length))
|
||||
{
|
||||
get_out = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -263,26 +273,27 @@ USHORT stmt_length, SCHAR * stmt, BOOLEAN * stmt_eaten, USHORT dialect)
|
||||
ch = token;
|
||||
while (*ch)
|
||||
STUFF_DPB(*ch++);
|
||||
matched = TRUE;
|
||||
matched = true;
|
||||
break;
|
||||
|
||||
case PP_LENGTH:
|
||||
/* Skip a token for value */
|
||||
|
||||
if (get_token(user_status, '=', TRUE, &stmt, stmt_end,
|
||||
if (get_token(user_status, '=', true, &stmt, stmt_end,
|
||||
token, &token_length) ||
|
||||
get_token(user_status, NUMERIC, FALSE, &stmt,
|
||||
stmt_end, token, &token_length)) {
|
||||
get_out = TRUE;
|
||||
get_token(user_status, NUMERIC, false, &stmt,
|
||||
stmt_end, token, &token_length))
|
||||
{
|
||||
get_out = true;
|
||||
break;
|
||||
}
|
||||
|
||||
matched = TRUE;
|
||||
matched = true;
|
||||
break;
|
||||
|
||||
case PP_PAGE:
|
||||
case PP_PAGES:
|
||||
matched = TRUE;
|
||||
matched = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -531,12 +542,13 @@ static SSHORT get_next_token(
|
||||
@param token_length
|
||||
|
||||
**/
|
||||
static SSHORT get_token(
|
||||
ISC_STATUS * status,
|
||||
static SSHORT get_token(ISC_STATUS * status,
|
||||
SSHORT token_type,
|
||||
BOOLEAN optional,
|
||||
bool optional,
|
||||
SCHAR ** stmt,
|
||||
SCHAR * stmt_end, SCHAR * token, USHORT * token_length)
|
||||
SCHAR * stmt_end,
|
||||
SCHAR * token,
|
||||
USHORT * token_length)
|
||||
{
|
||||
SSHORT result;
|
||||
SCHAR *temp_stmt;
|
||||
|
@ -101,13 +101,13 @@ static void init(FRBRD**);
|
||||
static NAME insert_name(SCHAR*, NAME *, STMT);
|
||||
static USHORT name_length(SCHAR *);
|
||||
static void remove_name(NAME, NAME *);
|
||||
static BOOLEAN scompare(SCHAR*, USHORT, SCHAR*, USHORT);
|
||||
static bool scompare(SCHAR*, USHORT, SCHAR*, USHORT);
|
||||
|
||||
/* declare the private data */
|
||||
|
||||
#pragma FB_COMPILER_MESSAGE("Dragons ahead. Static data. Not thread safe!")
|
||||
|
||||
static BOOLEAN init_flag = FALSE; /* whether we've been initialized */
|
||||
static bool init_flag = false; /* whether we've been initialized */
|
||||
static ERR UDSQL_error = NULL;
|
||||
static STMT statements = NULL;
|
||||
static NAME statement_names = NULL;
|
||||
@ -1339,7 +1339,7 @@ static void cleanup(void* arg)
|
||||
return;
|
||||
}
|
||||
|
||||
init_flag = FALSE;
|
||||
init_flag = false;
|
||||
|
||||
gds__free(UDSQL_error);
|
||||
UDSQL_error = NULL;
|
||||
@ -1500,7 +1500,7 @@ static void init(FRBRD** db_handle)
|
||||
if (!UDSQL_error) { // NOMEM:
|
||||
return; // Don't set the init_flag
|
||||
}
|
||||
init_flag = TRUE;
|
||||
init_flag = true;
|
||||
gds__register_cleanup(cleanup, 0);
|
||||
}
|
||||
|
||||
@ -1527,10 +1527,7 @@ static void init(FRBRD** db_handle)
|
||||
dbb->dbb_database_handle = *db_handle;
|
||||
|
||||
ISC_STATUS_ARRAY local_status;
|
||||
gds__database_cleanup(local_status,
|
||||
db_handle,
|
||||
cleanup_database,
|
||||
(SLONG) FALSE);
|
||||
gds__database_cleanup(local_status, db_handle, cleanup_database, (SLONG) 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1671,7 +1668,7 @@ static void remove_name(NAME name, NAME* list_ptr)
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN scompare(SCHAR* string1,
|
||||
static bool scompare(SCHAR* string1,
|
||||
USHORT length1,
|
||||
SCHAR* string2,
|
||||
USHORT length2)
|
||||
@ -1688,7 +1685,7 @@ static BOOLEAN scompare(SCHAR* string1,
|
||||
**************************************/
|
||||
|
||||
if (length1 != length2) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
SCHAR c1, c2;
|
||||
@ -1698,11 +1695,11 @@ static BOOLEAN scompare(SCHAR* string1,
|
||||
c2 = *string2++;
|
||||
if (c1 != c2 && UPPER7(c1) != UPPER7(c2))
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,9 +51,9 @@ private:
|
||||
static MemoryPool * pool; // where we should place our thps
|
||||
static ThreadPriorityScheduler * chain; // where starts thps chain
|
||||
static ThreadPriorityScheduler * news; // where starts new thps chain
|
||||
static BOOLEAN initialized;
|
||||
static bool initialized;
|
||||
static DWORD specific_key; // for thread LS access
|
||||
static BOOLEAN shutdown; // server shutting down
|
||||
static bool shutdown; // server shutting down
|
||||
|
||||
ThreadPriorityScheduler * next; // next thread in list
|
||||
union {
|
||||
@ -77,7 +77,7 @@ public:
|
||||
static void Exit(void);
|
||||
static thdd *Get(void);
|
||||
static void Set(thdd *val);
|
||||
static BOOLEAN Boosted(void);
|
||||
static bool Boosted(void);
|
||||
static void Cleanup(void);
|
||||
static void Init(void);
|
||||
static void Attach(HANDLE tHandle, DWORD thread_id, int &p);
|
||||
@ -109,7 +109,7 @@ public:
|
||||
#define THPS_INIT()
|
||||
#define THPS_FINI()
|
||||
#define THPS_ATTACH(handle, thread_id, priority)
|
||||
#define THPS_BOOSTDONE() FALSE
|
||||
#define THPS_BOOSTDONE() false
|
||||
|
||||
#endif // THREAD_PSCHED
|
||||
|
||||
|
@ -48,18 +48,18 @@
|
||||
static struct FAB fab;
|
||||
static struct RAB rab;
|
||||
|
||||
static BOOLEAN check_sort(NOD, IDX *, USHORT);
|
||||
static BOOLEAN compare(UCHAR *, UCHAR *, USHORT);
|
||||
static bool check_sort(NOD, IDX *, USHORT);
|
||||
static bool compare(UCHAR *, UCHAR *, USHORT);
|
||||
static int compare_segment(NOD, UCHAR *, DSC *);
|
||||
static int connect(EXT, USHORT);
|
||||
static void disconnect(EXT);
|
||||
static void expand_format(FMT, FMT);
|
||||
static SLONG find_field(FMT, USHORT, USHORT, USHORT);
|
||||
static int get_dbkey(RSB);
|
||||
static int get_indexed(RSB);
|
||||
static bool get_dbkey(RSB);
|
||||
static bool get_indexed(RSB);
|
||||
static USHORT get_key_segment(NOD, UCHAR *, DSC *);
|
||||
static BOOLEAN get_sequential(RSB);
|
||||
static BOOLEAN match_index(FMT, struct XABKEY *, IDX *);
|
||||
static bool get_sequential(RSB);
|
||||
static bool match_index(FMT, struct XABKEY *, IDX *);
|
||||
static int open_indexed(RSB);
|
||||
static int open_sequential(RSB);
|
||||
static void position_by_rfa(EXT, USHORT *);
|
||||
@ -314,13 +314,22 @@ int EXT_get(RSB rsb)
|
||||
|
||||
switch (rsb->rsb_type) {
|
||||
case rsb_ext_sequential:
|
||||
return get_sequential(rsb);
|
||||
if (get_sequential(rsb))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
case rsb_ext_indexed:
|
||||
return get_indexed(rsb);
|
||||
if (get_indexed(rsb))
|
||||
return TRUE
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
case rsb_ext_dbkey:
|
||||
return get_dbkey(rsb);
|
||||
if (get_dbkey(rsb))
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
default:
|
||||
IBERROR(181); /* msg 181 external access type not implemented */
|
||||
@ -641,7 +650,7 @@ void EXT_trans_start(TRA transaction)
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN check_sort(NOD sort, IDX * index, USHORT stream)
|
||||
static bool check_sort(NOD sort, IDX * index, USHORT stream)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -661,7 +670,7 @@ static BOOLEAN check_sort(NOD sort, IDX * index, USHORT stream)
|
||||
index segments, we obviously can optimize anything */
|
||||
|
||||
if (!sort || sort->nod_count > index->idx_count)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
/* For each sort key, make sure the key matches the index segment,
|
||||
and that the sort is ascending */
|
||||
@ -672,14 +681,17 @@ static BOOLEAN check_sort(NOD sort, IDX * index, USHORT stream)
|
||||
if (field->nod_type != nod_field ||
|
||||
(USHORT) field->nod_arg[e_fld_stream] != stream ||
|
||||
(USHORT) field->nod_arg[e_fld_id] != tail->idx_field ||
|
||||
ptr[sort->nod_count]) return FALSE;
|
||||
ptr[sort->nod_count])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN compare(UCHAR * string1, UCHAR * string2, USHORT length)
|
||||
static bool compare(UCHAR * string1, UCHAR * string2, USHORT length)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -694,10 +706,10 @@ static BOOLEAN compare(UCHAR * string1, UCHAR * string2, USHORT length)
|
||||
|
||||
do
|
||||
if (*string1++ != *string2++)
|
||||
return 1;
|
||||
return true;
|
||||
while (--length);
|
||||
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -862,7 +874,7 @@ static SLONG find_field(
|
||||
}
|
||||
|
||||
|
||||
static get_dbkey(RSB rsb)
|
||||
static bool get_dbkey(RSB rsb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -903,7 +915,7 @@ static get_dbkey(RSB rsb)
|
||||
/* If this isn't the first time thru its the last time thru */
|
||||
|
||||
if (!(impure->irsb_flags & irsb_first))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
/* Evaluate expression */
|
||||
|
||||
@ -922,18 +934,18 @@ static get_dbkey(RSB rsb)
|
||||
file->ext_flags &= ~EXT_eof;
|
||||
|
||||
if (status == RMS$_EOF)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
sys$free(&rab);
|
||||
set_flags(relation, record);
|
||||
MOVE_FAST(rab.rab$w_rfa, &rpb->rpb_ext_dbkey, sizeof(rab.rab$w_rfa));
|
||||
MOVE_FAST(rab.rab$w_rfa, file->ext_dbkey, sizeof(rab.rab$w_rfa));
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static get_indexed(RSB rsb)
|
||||
static bool get_indexed(RSB rsb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -999,7 +1011,7 @@ static get_indexed(RSB rsb)
|
||||
status = sys$find(&rab);
|
||||
file->ext_flags &= ~EXT_eof;
|
||||
if (status == RMS$_EOF || status == RMS$_RNF)
|
||||
return FALSE;
|
||||
return false;
|
||||
if (!(status & 1))
|
||||
ERR_post(isc_io_error,
|
||||
gds_arg_string, "sys$find",
|
||||
@ -1012,7 +1024,7 @@ static get_indexed(RSB rsb)
|
||||
EOF, we're done */
|
||||
|
||||
if (!get_sequential(rsb))
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
/* Check record against upper bound. If we pass it, we're done.
|
||||
Note: this code ignores issues of inclusive/exclusive upper
|
||||
@ -1029,10 +1041,10 @@ static get_indexed(RSB rsb)
|
||||
if (result < 0)
|
||||
break;
|
||||
if (result > 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1062,7 +1074,7 @@ static USHORT get_key_segment(NOD node, UCHAR * buffer, DSC * target)
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN get_sequential(RSB rsb)
|
||||
static bool get_sequential(RSB rsb)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1106,7 +1118,9 @@ static BOOLEAN get_sequential(RSB rsb)
|
||||
if (rpb->rpb_ext_isi == file->ext_isi &&
|
||||
!(impure->irsb_flags & irsb_first) &&
|
||||
compare(file->ext_dbkey, &rpb->rpb_ext_dbkey, sizeof(rab.rab$w_rfa)))
|
||||
{
|
||||
position_by_rfa(file, &rpb->rpb_ext_dbkey);
|
||||
}
|
||||
|
||||
rab.rab$b_rac = RAB$C_SEQ;
|
||||
status = sys$get(&rab);
|
||||
@ -1114,7 +1128,7 @@ static BOOLEAN get_sequential(RSB rsb)
|
||||
file->ext_flags &= ~EXT_eof;
|
||||
|
||||
if (status == RMS$_EOF)
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
if (!(status & 1))
|
||||
ERR_post(isc_io_error,
|
||||
@ -1133,11 +1147,11 @@ static BOOLEAN get_sequential(RSB rsb)
|
||||
if (rpb->rpb_ext_isi == file->ext_isi)
|
||||
MOVE_FAST(rab.rab$w_rfa, file->ext_dbkey, sizeof(rab.rab$w_rfa));
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN match_index(FMT format, struct XABKEY *xab, IDX * idx)
|
||||
static bool match_index(FMT format, struct XABKEY *xab, IDX * idx)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1147,8 +1161,8 @@ static BOOLEAN match_index(FMT format, struct XABKEY *xab, IDX * idx)
|
||||
*
|
||||
* Functional description
|
||||
* Try to match RMS key against fields. If success, build
|
||||
* internal index description and return TRUE. Otherwise
|
||||
* return FALSE.
|
||||
* internal index description and return true. Otherwise
|
||||
* return false.
|
||||
*
|
||||
**************************************/
|
||||
int n, dtype;
|
||||
@ -1163,7 +1177,7 @@ static BOOLEAN match_index(FMT format, struct XABKEY *xab, IDX * idx)
|
||||
|
||||
for (; size < end; size++, position++, tail++) {
|
||||
if ((n = find_field(format, xab->xab$b_dtp, *position, *size)) < 0)
|
||||
return FALSE;
|
||||
return false;
|
||||
tail->idx_field = n;
|
||||
tail->idx_itype = xab->xab$b_dtp;
|
||||
}
|
||||
@ -1173,7 +1187,7 @@ static BOOLEAN match_index(FMT format, struct XABKEY *xab, IDX * idx)
|
||||
idx->idx_flags = 0;
|
||||
idx->idx_id = xab->xab$b_ref;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,7 +55,7 @@ typedef struct map_msg {
|
||||
extern double MTH$CVT_D_G(), MTH$CVT_G_D();
|
||||
|
||||
static void bugcheck(int);
|
||||
static BOOLEAN check_message(UCHAR **);
|
||||
static bool check_message(UCHAR **);
|
||||
static MAP_MSG rebuild_message(UCHAR **, UCHAR **);
|
||||
static int translate_status(ISC_STATUS *, ISC_STATUS *, SCHAR **);
|
||||
|
||||
@ -394,7 +394,8 @@ int MAP_status_to_gds(ISC_STATUS * vms_status, ISC_STATUS * gds_status)
|
||||
**************************************/
|
||||
ISC_STATUS code, number, length, gds_index, *tmp;
|
||||
ISC_STATUS_ARRAY temp;
|
||||
USHORT shift, flag;
|
||||
USHORT shift;
|
||||
bool flag;
|
||||
SCHAR msgbuff[WRKBUF_SIZ], *p, *q, *pw1, *pw2, flags[4], part;
|
||||
struct dsc$descriptor_s desc, *dsc_ptr;
|
||||
// static const SCHAR * const messages[] = {
|
||||
@ -432,7 +433,7 @@ int MAP_status_to_gds(ISC_STATUS * vms_status, ISC_STATUS * gds_status)
|
||||
return gds__random;
|
||||
}
|
||||
|
||||
flag = FALSE;
|
||||
flag = false;
|
||||
vms_status = vms_status + 3;
|
||||
|
||||
if (*p == '%')
|
||||
@ -455,7 +456,7 @@ int MAP_status_to_gds(ISC_STATUS * vms_status, ISC_STATUS * gds_status)
|
||||
BUGCHECK(235); /* msg 235 Unimplemented conversion, FAO directive X,U */
|
||||
*tmp++ = gds_arg_number;
|
||||
number = *tmp++ = *vms_status++;
|
||||
flag = (number == 1) ? FALSE : TRUE;
|
||||
flag = (number == 1) ? false : true;
|
||||
sprintf(pw2, "%%x%x", number);
|
||||
while (*pw2)
|
||||
++pw2;
|
||||
@ -524,7 +525,7 @@ int MAP_status_to_gds(ISC_STATUS * vms_status, ISC_STATUS * gds_status)
|
||||
p = messages[gds_index];
|
||||
tmp = temp;
|
||||
gds_status = gds_status + 2;
|
||||
flag = FALSE;
|
||||
flag = false;
|
||||
|
||||
while (*p) {
|
||||
if (*p++ != '%')
|
||||
@ -533,7 +534,7 @@ int MAP_status_to_gds(ISC_STATUS * vms_status, ISC_STATUS * gds_status)
|
||||
case 's':
|
||||
*gds_status++ = gds_arg_cstring;
|
||||
if (*tmp++ != gds_arg_cstring || flag) {
|
||||
flag = TRUE;
|
||||
flag = true;
|
||||
*gds_status++ = 3;
|
||||
*gds_status++ = pw2;
|
||||
sprintf(pw2, "<?>");
|
||||
@ -548,7 +549,7 @@ int MAP_status_to_gds(ISC_STATUS * vms_status, ISC_STATUS * gds_status)
|
||||
case 'd':
|
||||
*gds_status++ = gds_arg_number;
|
||||
if (*tmp++ != gds_arg_number || flag) {
|
||||
flag = TRUE;
|
||||
flag = true;
|
||||
*gds_status++ = -1;
|
||||
break;
|
||||
}
|
||||
@ -632,7 +633,7 @@ static void bugcheck(int number)
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN check_message(UCHAR ** org_ptr)
|
||||
static bool check_message(UCHAR ** org_ptr)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -642,7 +643,7 @@ static BOOLEAN check_message(UCHAR ** org_ptr)
|
||||
*
|
||||
* Functional description
|
||||
* Parse a blr message. If the message contains a non-Rdb data type,
|
||||
* return TRUE. Otherwise update the blr pointer and return FALSE.
|
||||
* return true. Otherwise update the blr pointer and return false.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR *org, dtype;
|
||||
@ -659,7 +660,7 @@ static BOOLEAN check_message(UCHAR ** org_ptr)
|
||||
case blr_timestamp:
|
||||
case blr_cstring:
|
||||
case blr_d_float:
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
case blr_text:
|
||||
case blr_varying:
|
||||
@ -673,7 +674,7 @@ static BOOLEAN check_message(UCHAR ** org_ptr)
|
||||
|
||||
*org_ptr = org;
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,12 +58,12 @@ extern "C" {
|
||||
|
||||
extern gds__completion_ast();
|
||||
|
||||
static BOOLEAN extend_file(FIL, ISC_STATUS *);
|
||||
static bool extend_file(FIL, ISC_STATUS *);
|
||||
static FIL seek_file(FIL, BDB, int *);
|
||||
static FIL setup_file(DBB, TEXT *, USHORT, USHORT, struct NAM *);
|
||||
static void setup_trace(FIL, SSHORT);
|
||||
static void trace_event(FIL, SSHORT, SCHAR *, SSHORT);
|
||||
static BOOLEAN vms_io_error(ISC_STATUS *, TEXT *, ISC_STATUS, int, FIL);
|
||||
static bool vms_io_error(ISC_STATUS *, TEXT *, ISC_STATUS, int, FIL);
|
||||
|
||||
#define DVI$_DEVLOCKNAM 240
|
||||
|
||||
@ -671,7 +671,7 @@ int PIO_write(FIL file, BDB bdb, PAG page, ISC_STATUS * status_vector)
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN extend_file(FIL file, ISC_STATUS * status_vector)
|
||||
static bool extend_file(FIL file, ISC_STATUS * status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -757,7 +757,7 @@ static BOOLEAN extend_file(FIL file, ISC_STATUS * status_vector)
|
||||
return vms_io_error(status_vector, "QIO IO$_MODIFY",
|
||||
isc_io_access_err, status, file);
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -930,7 +930,7 @@ static void trace_event(FIL file, SSHORT type, SCHAR * ptr, SSHORT length)
|
||||
#endif
|
||||
|
||||
|
||||
static BOOLEAN vms_io_error(
|
||||
static bool vms_io_error(
|
||||
ISC_STATUS * status_vector,
|
||||
TEXT * string,
|
||||
ISC_STATUS operation, int code, FIL file)
|
||||
@ -959,7 +959,7 @@ static BOOLEAN vms_io_error(
|
||||
*status_vector++ = code;
|
||||
*status_vector++ = gds_arg_end;
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,7 +91,8 @@ static SES sessions;
|
||||
static EVNT parent_events;
|
||||
static SLONG request_id;
|
||||
static POKE pokes;
|
||||
static USHORT thread_started, delivery_flag;
|
||||
static bool thread_started;
|
||||
static bool delivery_flag;
|
||||
|
||||
static UCHAR *alloc(USHORT);
|
||||
static void blocking_ast(EVNT);
|
||||
@ -100,14 +101,13 @@ static void delete_request(VMS_REQ);
|
||||
static void deliver(EVNT);
|
||||
static void deliver_request(VMS_REQ);
|
||||
static void delivery_thread(void);
|
||||
static int delivery_wait(void);
|
||||
static ISC_STATUS error(ISC_STATUS *, TEXT *, ISC_STATUS);
|
||||
static EVNT find_event(USHORT, TEXT *, EVNT);
|
||||
static void free(SCHAR *);
|
||||
static RINT historical_interest(SES, EVNT);
|
||||
static EVNT make_event(USHORT, TEXT *, EVNT);
|
||||
static void poke_ast(POKE);
|
||||
static BOOLEAN request_completed(VMS_REQ);
|
||||
static bool request_completed(VMS_REQ);
|
||||
static int return_ok(ISC_STATUS *);
|
||||
|
||||
|
||||
@ -153,7 +153,7 @@ SLONG EVENT_create_session(ISC_STATUS status_vector)
|
||||
|
||||
session = (SES) alloc(sizeof(struct ses));
|
||||
if (!session) {
|
||||
assert(FALSE); /* No error handling */
|
||||
assert(false); /* No error handling */
|
||||
return 0L;
|
||||
}
|
||||
session->ses_next = sessions;
|
||||
@ -325,7 +325,9 @@ SLONG EVENT_que(ISC_STATUS * status_vector,
|
||||
USHORT string_length,
|
||||
TEXT * string,
|
||||
USHORT events_length,
|
||||
UCHAR * events, void (*ast_routine) (), void *ast_arg)
|
||||
UCHAR * events,
|
||||
void (*ast_routine) (),
|
||||
void *ast_arg)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -339,7 +341,9 @@ SLONG EVENT_que(ISC_STATUS * status_vector,
|
||||
**************************************/
|
||||
SES session;
|
||||
UCHAR *p, *end, *find_end;
|
||||
USHORT count, flag, len;
|
||||
USHORT count;
|
||||
bool flag;
|
||||
USHORT len;
|
||||
VMS_REQ request, next;
|
||||
EVNT event, parent;
|
||||
RINT interest, *ptr, *ptr2;
|
||||
@ -348,7 +352,7 @@ SLONG EVENT_que(ISC_STATUS * status_vector,
|
||||
session = (SES) session_id;
|
||||
|
||||
if (!thread_started) {
|
||||
thread_started = TRUE;
|
||||
thread_started = true;
|
||||
gds__thread_start(delivery_thread, 0, THREAD_high, THREAD_ast);
|
||||
}
|
||||
|
||||
@ -388,7 +392,7 @@ SLONG EVENT_que(ISC_STATUS * status_vector,
|
||||
ptr = &request->req_interests;
|
||||
p = events + 1;
|
||||
end = events + events_length;
|
||||
flag = FALSE;
|
||||
flag = false;
|
||||
|
||||
while (p < end) {
|
||||
count = *p++;
|
||||
@ -422,7 +426,7 @@ SLONG EVENT_que(ISC_STATUS * status_vector,
|
||||
interest->rint_count = gds__vax_integer(p, 4);
|
||||
p += 4;
|
||||
if (interest->rint_count <= event->evnt_count)
|
||||
flag = TRUE;
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
@ -613,10 +617,12 @@ static void deliver(EVNT event)
|
||||
event->evnt_count = event->evnt_lksb.lksb_value[0];
|
||||
|
||||
for (interest = event->evnt_interests; interest;
|
||||
interest = interest->rint_evnt_interests) if (request =
|
||||
interest->rint_request)
|
||||
interest = interest->rint_evnt_interests)
|
||||
{
|
||||
if (request = interest->rint_request)
|
||||
if (request->req_ast && request_completed(request))
|
||||
delivery_flag = TRUE;
|
||||
delivery_flag = true;
|
||||
}
|
||||
|
||||
gds__completion_ast();
|
||||
}
|
||||
@ -701,39 +707,28 @@ static void delivery_thread(void)
|
||||
SES session;
|
||||
|
||||
for (;;) {
|
||||
delivery_flag = FALSE;
|
||||
delivery_flag = false;
|
||||
for (session = sessions; session; session = session->ses_next)
|
||||
for (request = session->ses_requests; request;
|
||||
request = request->req_next)
|
||||
if (request->req_ast && request_completed(request)) {
|
||||
{
|
||||
if (request->req_ast && request_completed(request))
|
||||
{
|
||||
deliver_request(request);
|
||||
request->req_ast = NULL;
|
||||
}
|
||||
gds__thread_wait(delivery_wait, 0);
|
||||
}
|
||||
if (delivery_flag)
|
||||
gds__thread_wait(TRUE, 0);
|
||||
else
|
||||
gds__thread_wait(FALSE, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int delivery_wait(void)
|
||||
static ISC_STATUS error(ISC_STATUS * status_vector,
|
||||
TEXT * string,
|
||||
ISC_STATUS status)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* d e l i v e r y _ w a i t
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* See if the deliver thread should wake up.
|
||||
*
|
||||
**************************************/
|
||||
|
||||
return delivery_flag;
|
||||
}
|
||||
|
||||
|
||||
static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
TEXT * string;
|
||||
ISC_STATUS status; {
|
||||
/**************************************
|
||||
*
|
||||
* e r r o r
|
||||
@ -752,11 +747,13 @@ static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
*status_vector++ = gds_arg_vms;
|
||||
*status_vector++ = status; *status_vector++ = gds_arg_end;
|
||||
return gds__sys_request;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static EVNT find_event(USHORT length,
|
||||
TEXT * string, EVNT parent) {
|
||||
static EVNT find_event(USHORT length,
|
||||
TEXT * string,
|
||||
EVNT parent)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* f i n d _ e v e n t
|
||||
@ -772,10 +769,14 @@ static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
for (; event; event = event->evnt_next)
|
||||
if (event->evnt_length == length &&
|
||||
!strncmp(string, event->evnt_name, length))
|
||||
return event; return NULL;}
|
||||
{
|
||||
return event;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static void free(SCHAR * block) {
|
||||
static void free(SCHAR * block) {
|
||||
/**************************************
|
||||
*
|
||||
* f r e e
|
||||
@ -787,10 +788,13 @@ static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
*
|
||||
**************************************/
|
||||
|
||||
gds__free(block);}
|
||||
gds__free(block);
|
||||
}
|
||||
|
||||
|
||||
static RINT historical_interest(SES session, EVNT event) {
|
||||
static RINT historical_interest(SES session,
|
||||
EVNT event)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* h i s t o r i c a l _ i n t e r e s t
|
||||
@ -804,12 +808,18 @@ static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
RINT interest, *ptr;
|
||||
for (ptr = &session->ses_interests; interest = *ptr;
|
||||
ptr = &(*ptr)->rint_req_interests)
|
||||
{
|
||||
if (interest->rint_event == event)
|
||||
return interest; return NULL;}
|
||||
return interest;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static EVNT make_event(USHORT length,
|
||||
TEXT * string, EVNT parent) {
|
||||
static EVNT make_event(USHORT length,
|
||||
TEXT * string,
|
||||
EVNT parent)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* m a k e _ e v e n t
|
||||
@ -879,10 +889,12 @@ static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
0, /* access mode */
|
||||
0);}
|
||||
|
||||
return event;}
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
static void poke_ast(POKE poke) {
|
||||
static void poke_ast(POKE poke)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* p o k e _ a s t
|
||||
@ -898,13 +910,14 @@ static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
LKSB * lksb;
|
||||
lksb = &poke->poke_lksb;
|
||||
lksb->lksb_value[0] += poke->poke_value;
|
||||
status =
|
||||
sys$deq(lksb->lksb_lock_id, lksb->lksb_value, 0, 0);
|
||||
status = sys$deq(lksb->lksb_lock_id, lksb->lksb_value, 0, 0);
|
||||
status = sys$deq(poke->poke_parent_id, 0, 0, 0);
|
||||
--poke->poke_use_count;}
|
||||
--poke->poke_use_count;
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN request_completed(VMS_REQ request) {
|
||||
static bool request_completed(VMS_REQ request)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* r e q u e s t _ c o m p l e t e d
|
||||
@ -918,15 +931,19 @@ static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
RINT interest;
|
||||
EVNT event;
|
||||
for (interest = request->req_interests; interest;
|
||||
interest = interest->rint_req_interests) {
|
||||
interest = interest->rint_req_interests)
|
||||
{
|
||||
event = interest->rint_event;
|
||||
if (interest->rint_count <=
|
||||
event->evnt_count) return TRUE;}
|
||||
if (interest->rint_count <= event->evnt_count)
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static int return_ok(ISC_STATUS * status_vector) {
|
||||
static int return_ok(ISC_STATUS * status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* r e t u r n _ o k
|
||||
@ -940,4 +957,6 @@ static ISC_STATUS error(ISC_STATUS * status_vector;
|
||||
|
||||
*status_vector++ = gds_arg_gds;
|
||||
*status_vector++ = 0;
|
||||
*status_vector = gds_arg_end; return 0;}
|
||||
*status_vector = gds_arg_end;
|
||||
return 0;
|
||||
}
|
||||
|
@ -49,9 +49,9 @@ MUTX_T ThreadPriorityScheduler::mutex;
|
||||
MemoryPool * ThreadPriorityScheduler::pool = 0;
|
||||
ThreadPriorityScheduler * ThreadPriorityScheduler::chain = 0;
|
||||
ThreadPriorityScheduler * ThreadPriorityScheduler::news = 0;
|
||||
BOOLEAN ThreadPriorityScheduler::initialized = FALSE;
|
||||
bool ThreadPriorityScheduler::initialized = false;
|
||||
DWORD ThreadPriorityScheduler::specific_key = (DWORD) -1;
|
||||
BOOLEAN ThreadPriorityScheduler::shutdown = FALSE;
|
||||
bool ThreadPriorityScheduler::shutdown = false;
|
||||
|
||||
//____________________________________________________________
|
||||
//
|
||||
@ -60,8 +60,8 @@ BOOLEAN ThreadPriorityScheduler::shutdown = FALSE;
|
||||
void ThreadPriorityScheduler::Cleanup(void) {
|
||||
if (initialized)
|
||||
{
|
||||
initialized = FALSE;
|
||||
shutdown = TRUE;
|
||||
initialized = false;
|
||||
shutdown = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ void ThreadPriorityScheduler::Init(void)
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
initialized = TRUE;
|
||||
initialized = true;
|
||||
specific_key = TlsAlloc();
|
||||
|
||||
// memory pool for thps allocation
|
||||
@ -224,8 +224,8 @@ void ThreadPriorityScheduler::Exit(void) {
|
||||
//
|
||||
// Check whether current thread has high priority
|
||||
//
|
||||
BOOLEAN ThreadPriorityScheduler::Boosted(void) {
|
||||
return InternalGet()->flags & THPS_BOOSTED ? TRUE : FALSE;
|
||||
bool ThreadPriorityScheduler::Boosted(void) {
|
||||
return InternalGet()->flags & THPS_BOOSTED ? true : false;
|
||||
}
|
||||
|
||||
//____________________________________________________________
|
||||
|
@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
$Id: lock.cpp,v 1.67 2003-09-01 07:51:50 brodsom Exp $
|
||||
$Id: lock.cpp,v 1.68 2003-09-04 21:22:22 brodsom Exp $
|
||||
*/
|
||||
|
||||
#include "firebird.h"
|
||||
@ -108,12 +108,12 @@ $Id: lock.cpp,v 1.67 2003-09-01 07:51:50 brodsom Exp $
|
||||
#include <sys/stat.h>
|
||||
#include <sys/file.h>
|
||||
#define statistics stat
|
||||
static BOOLEAN LOCK_post_manager;
|
||||
static bool LOCK_post_manager;
|
||||
#endif
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
#define ASSERT_ACQUIRED current_is_active_owner (TRUE, __LINE__)
|
||||
#define ASSERT_RELEASED current_is_active_owner (FALSE, __LINE__)
|
||||
#define ASSERT_ACQUIRED current_is_active_owner (true, __LINE__)
|
||||
#define ASSERT_RELEASED current_is_active_owner (false, __LINE__)
|
||||
#define VALIDATE_LOCK_TABLE
|
||||
#if ((defined HAVE_MMAP) && !(defined SUPERSERVER))
|
||||
#define LOCK_DEBUG_ACQUIRE
|
||||
@ -212,14 +212,14 @@ static void bug(ISC_STATUS *, const TEXT *);
|
||||
#ifdef DEV_BUILD
|
||||
static void bug_assert(const TEXT *, ULONG);
|
||||
#endif
|
||||
static BOOLEAN convert(PTR, UCHAR, SSHORT, lock_ast_t, void *, ISC_STATUS *);
|
||||
static bool convert(PTR, UCHAR, SSHORT, lock_ast_t, void *, ISC_STATUS *);
|
||||
static USHORT create_owner(ISC_STATUS *, SLONG, UCHAR, SLONG *);
|
||||
#ifdef DEV_BUILD
|
||||
static void current_is_active_owner(BOOLEAN, ULONG);
|
||||
static void current_is_active_owner(bool, ULONG);
|
||||
#endif
|
||||
static void deadlock_clear(void);
|
||||
static LRQ deadlock_scan(OWN, LRQ);
|
||||
static LRQ deadlock_walk(LRQ, BOOLEAN *);
|
||||
static LRQ deadlock_walk(LRQ, bool *);
|
||||
static void dequeue(PTR);
|
||||
#ifdef DEBUG
|
||||
static void debug_delay(ULONG);
|
||||
@ -227,8 +227,8 @@ static void debug_delay(ULONG);
|
||||
static void exit_handler(void *);
|
||||
static LBL find_lock(PTR, USHORT, UCHAR *, USHORT, USHORT *);
|
||||
#ifdef MANAGER_PROCESS
|
||||
static USHORT fork_lock_manager(ISC_STATUS *);
|
||||
static OWN get_manager(BOOLEAN);
|
||||
static bool fork_lock_manager(ISC_STATUS *);
|
||||
static OWN get_manager(bool);
|
||||
#endif
|
||||
static LRQ get_request(PTR);
|
||||
static void grant(LRQ, LBL);
|
||||
@ -243,12 +243,12 @@ static void insert_data_que(LBL);
|
||||
static void insert_tail(SRQ, SRQ);
|
||||
static USHORT lock_state(LBL);
|
||||
//static void port_waker(PTR *);
|
||||
static void post_blockage(LRQ, LBL, BOOLEAN);
|
||||
static void post_history(USHORT, PTR, PTR, PTR, BOOLEAN);
|
||||
static void post_blockage(LRQ, LBL, bool);
|
||||
static void post_history(USHORT, PTR, PTR, PTR, bool);
|
||||
static void post_pending(LBL);
|
||||
static void post_wakeup(OWN);
|
||||
#ifndef SUPERSERVER
|
||||
static BOOLEAN probe_owners(PTR);
|
||||
static bool probe_owners(PTR);
|
||||
#endif
|
||||
static void purge_owner(PTR, OWN);
|
||||
static void remove_que(SRQ);
|
||||
@ -300,7 +300,7 @@ static SLONG LOCK_hash_slots;
|
||||
static SLONG LOCK_scan_interval;
|
||||
static SLONG LOCK_acquire_spins;
|
||||
static SH_MEM_T LOCK_data;
|
||||
static BOOLEAN start_manager = FALSE;
|
||||
static bool start_manager = false;
|
||||
static TEXT LOCK_bug_buffer[128];
|
||||
|
||||
|
||||
@ -410,12 +410,11 @@ int LOCK_convert(PTR request_offset,
|
||||
else
|
||||
++LOCK_header->lhb_operations[0];
|
||||
|
||||
return convert(request_offset,
|
||||
type,
|
||||
lck_wait,
|
||||
ast_routine,
|
||||
ast_argument,
|
||||
status_vector);
|
||||
if (convert(request_offset, type, lck_wait, ast_routine, ast_argument,
|
||||
status_vector))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -604,7 +603,7 @@ SLONG LOCK_enq( PTR prior_request,
|
||||
}
|
||||
|
||||
owner = (OWN) ABS_PTR(owner_offset); /* Re-init after a potential remap */
|
||||
post_history(his_enq, owner_offset, (PTR)0, REL_PTR(request), TRUE);
|
||||
post_history(his_enq, owner_offset, (PTR)0, REL_PTR(request), true);
|
||||
|
||||
request->lrq_type = type_lrq;
|
||||
request->lrq_flags = 0;
|
||||
@ -798,7 +797,7 @@ int LOCK_init(
|
||||
if (!LOCK_header) {
|
||||
/* We haven't yet mapped the shared region. Do so now. */
|
||||
|
||||
start_manager = FALSE;
|
||||
start_manager = false;
|
||||
if (init_lock_table(status_vector) != FB_SUCCESS) {
|
||||
return FB_FAILURE;
|
||||
}
|
||||
@ -828,8 +827,7 @@ int LOCK_init(
|
||||
#if !defined SUPERSERVER && defined WIN_NT
|
||||
owner = (OWN) ABS_PTR(*owner_handle);
|
||||
wakeup_event[0] = owner->own_wakeup_hndl;
|
||||
blocking_event[0] =
|
||||
ISC_make_signal(TRUE, FALSE, LOCK_pid, LOCK_block_signal);
|
||||
blocking_event[0] = ISC_make_signal(TRUE, FALSE, LOCK_pid, LOCK_block_signal);
|
||||
owner->own_blocking_hndl = blocking_event[0];
|
||||
AST_ALLOC;
|
||||
if (gds__thread_start
|
||||
@ -881,7 +879,7 @@ int LOCK_init(
|
||||
|
||||
#ifdef MANAGER_PROCESS
|
||||
if (start_manager) {
|
||||
start_manager = FALSE;
|
||||
start_manager = false;
|
||||
if (!fork_lock_manager(status_vector))
|
||||
return FB_FAILURE;
|
||||
}
|
||||
@ -934,7 +932,7 @@ void LOCK_manager( PTR manager_owner_offset)
|
||||
|
||||
/* If there already is a lock manager running, quietly return */
|
||||
|
||||
while (owner = get_manager(FALSE))
|
||||
while (owner = get_manager(false))
|
||||
if (signal_owner(owner, (PTR) NULL))
|
||||
purge_owner(manager_owner_offset, owner);
|
||||
else {
|
||||
@ -1070,7 +1068,7 @@ SLONG LOCK_query_data(PTR parent_request, USHORT series, USHORT aggregate)
|
||||
if (parent_request && series < LCK_MAX_SERIES)
|
||||
parent = get_request(parent_request);
|
||||
else {
|
||||
CHECK(FALSE);
|
||||
CHECK(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1139,7 +1137,7 @@ SLONG LOCK_query_data(PTR parent_request, USHORT series, USHORT aggregate)
|
||||
break;
|
||||
|
||||
default:
|
||||
CHECK(FALSE);
|
||||
CHECK(false);
|
||||
}
|
||||
|
||||
release(parent->lrq_owner);
|
||||
@ -1301,7 +1299,7 @@ void LOCK_re_post( lock_ast_t ast, void *arg, PTR owner_offset)
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN LOCK_shut_manager(void)
|
||||
bool LOCK_shut_manager(void)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1318,20 +1316,20 @@ BOOLEAN LOCK_shut_manager(void)
|
||||
OWN manager;
|
||||
|
||||
acquire(DUMMY_OWNER_SHUTDOWN);
|
||||
if (manager = get_manager(FALSE)) {
|
||||
if (manager = get_manager(false)) {
|
||||
LOCK_header->lhb_flags |= LHB_shut_manager;
|
||||
post_wakeup(manager);
|
||||
release_mutex();
|
||||
sleep(5);
|
||||
acquire(DUMMY_OWNER_SHUTDOWN);
|
||||
LOCK_header->lhb_flags &= ~LHB_shut_manager;
|
||||
manager = get_manager(FALSE);
|
||||
manager = get_manager(false);
|
||||
}
|
||||
|
||||
release_mutex();
|
||||
return (manager ? FALSE : TRUE);
|
||||
return (manager ? false : true);
|
||||
#else
|
||||
return TRUE;
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1462,7 +1460,7 @@ static void acquire( PTR owner_offset)
|
||||
LOCK_header->lhb_active_owner = owner_offset;
|
||||
|
||||
#ifdef MANAGER_PROCESS
|
||||
LOCK_post_manager = FALSE;
|
||||
LOCK_post_manager = false;
|
||||
#endif
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
@ -1510,7 +1508,7 @@ static void acquire( PTR owner_offset)
|
||||
SHB recover;
|
||||
SRQ que;
|
||||
|
||||
post_history(his_active, owner_offset, prior_active, (PTR) 0, FALSE);
|
||||
post_history(his_active, owner_offset, prior_active, (PTR) 0, false);
|
||||
recover = (SHB) ABS_PTR(LOCK_header->lhb_secondary);
|
||||
if (recover->shb_remove_node) {
|
||||
/* There was a remove_que operation in progress when the prior_owner died */
|
||||
@ -1616,8 +1614,7 @@ static UCHAR *alloc( SSHORT size, ISC_STATUS * status_vector)
|
||||
*/
|
||||
#if (defined WIN_NT && defined SUPERSERVER) || (!defined SUPERSERVER && defined HAVE_MMAP)
|
||||
ULONG length = LOCK_data.sh_mem_length_mapped + EXTEND_SIZE;
|
||||
LHB header =
|
||||
(LHB) ISC_remap_file(status_vector, &LOCK_data, length, TRUE);
|
||||
LHB header = (LHB) ISC_remap_file(status_vector, &LOCK_data, length, TRUE);
|
||||
if (header) {
|
||||
LOCK_header = header;
|
||||
#ifdef WIN_NT
|
||||
@ -1865,7 +1862,7 @@ static void blocking_action2(
|
||||
* signaled" flag and start winding out of here
|
||||
*/
|
||||
owner->own_ast_flags &= ~OWN_signaled;
|
||||
/*post_history (his_leave_ast, blocking_owner_offset, 0, 0, TRUE); */
|
||||
/*post_history (his_leave_ast, blocking_owner_offset, 0, 0, true); */
|
||||
break;
|
||||
}
|
||||
request = (LRQ) ((UCHAR *) que - OFFSET(LRQ, lrq_own_blocks));
|
||||
@ -1877,7 +1874,7 @@ static void blocking_action2(
|
||||
request->lrq_flags |= LRQ_blocking_seen;
|
||||
++LOCK_header->lhb_blocks;
|
||||
post_history(his_post_ast, blocking_owner_offset,
|
||||
request->lrq_lock, REL_PTR(request), TRUE);
|
||||
request->lrq_lock, REL_PTR(request), true);
|
||||
}
|
||||
else if (request->lrq_flags & LRQ_repost) {
|
||||
request->lrq_type = type_null;
|
||||
@ -1914,7 +1911,7 @@ static void THREAD_ROUTINE blocking_action_thread( PTR * owner_offset_ptr)
|
||||
|
||||
AST_INIT; /* Check into scheduler as AST thread */
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
ret = WaitForSingleObject(blocking_event[0], INFINITE);
|
||||
AST_ENTER;
|
||||
owner = (OWN) ABS_PTR(*owner_offset_ptr);
|
||||
@ -1949,7 +1946,7 @@ static void THREAD_ROUTINE blocking_action_thread( PTR * owner_offset_ptr)
|
||||
|
||||
AST_INIT; /* Check into scheduler as AST thread */
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
AST_ENTER;
|
||||
|
||||
/* See if main thread has requested us to go away */
|
||||
@ -2086,7 +2083,7 @@ static void bug( ISC_STATUS * status_vector, const TEXT * string)
|
||||
}
|
||||
|
||||
|
||||
static BOOLEAN convert(PTR request_offset,
|
||||
static bool convert(PTR request_offset,
|
||||
UCHAR type,
|
||||
SSHORT lck_wait,
|
||||
lock_ast_t ast_routine,
|
||||
@ -2102,15 +2099,15 @@ static BOOLEAN convert(PTR request_offset,
|
||||
* Functional description
|
||||
* Perform a lock conversion, if possible. If the lock cannot be
|
||||
* granted immediately, either return immediately or wait depending
|
||||
* on a wait flag. If the lock is granted return TRUE, otherwise
|
||||
* return FALSE. Note: if the conversion would cause a deadlock,
|
||||
* on a wait flag. If the lock is granted return true, otherwise
|
||||
* return false. Note: if the conversion would cause a deadlock,
|
||||
* FALSE is returned even if wait was requested.
|
||||
*
|
||||
**************************************/
|
||||
LBL lock;
|
||||
LRQ request;
|
||||
UCHAR temp;
|
||||
BOOLEAN new_ast;
|
||||
bool new_ast;
|
||||
PTR owner_offset;
|
||||
|
||||
ASSERT_ACQUIRED;
|
||||
@ -2118,7 +2115,7 @@ static BOOLEAN convert(PTR request_offset,
|
||||
lock = (LBL) ABS_PTR(request->lrq_lock);
|
||||
owner_offset = request->lrq_owner;
|
||||
post_history(his_convert, owner_offset, request->lrq_lock, request_offset,
|
||||
TRUE);
|
||||
true);
|
||||
request->lrq_requested = type;
|
||||
request->lrq_flags &= ~LRQ_blocking_seen;
|
||||
|
||||
@ -2137,7 +2134,7 @@ static BOOLEAN convert(PTR request_offset,
|
||||
grant(request, lock);
|
||||
post_pending(lock);
|
||||
release(owner_offset);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
++lock->lbl_counts[request->lrq_state];
|
||||
@ -2148,13 +2145,13 @@ static BOOLEAN convert(PTR request_offset,
|
||||
if (lck_wait) {
|
||||
if (request->lrq_ast_routine != ast_routine ||
|
||||
request->lrq_ast_argument != ast_argument)
|
||||
new_ast = TRUE;
|
||||
new_ast = true;
|
||||
else
|
||||
new_ast = FALSE;
|
||||
new_ast = false;
|
||||
|
||||
if (wait_for_request(request, lck_wait, status_vector)) {
|
||||
ASSERT_RELEASED;
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
request = (LRQ) ABS_PTR(request_offset);
|
||||
if (!(request->lrq_flags & LRQ_rejected)) {
|
||||
@ -2166,7 +2163,7 @@ static BOOLEAN convert(PTR request_offset,
|
||||
release(owner_offset);
|
||||
}
|
||||
ASSERT_RELEASED;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
acquire(owner_offset);
|
||||
request = get_request(request_offset);
|
||||
@ -2186,7 +2183,7 @@ static BOOLEAN convert(PTR request_offset,
|
||||
((lck_wait < 0) ? gds_lock_timeout : gds_lock_conflict);
|
||||
*status_vector++ = gds_arg_end;
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -2277,7 +2274,7 @@ static USHORT create_owner(ISC_STATUS* status_vector,
|
||||
|
||||
|
||||
#ifdef DEV_BUILD
|
||||
static void current_is_active_owner( BOOLEAN expect_acquired, ULONG line)
|
||||
static void current_is_active_owner(bool expect_acquired, ULONG line)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2300,7 +2297,7 @@ static void current_is_active_owner( BOOLEAN expect_acquired, ULONG line)
|
||||
return;
|
||||
|
||||
/* Use a local copy of lhb_active_owner. We're viewing the lock table
|
||||
without being acquired in the "expect_acquired FALSE" case, so it
|
||||
without being acquired in the "expect_acquired false" case, so it
|
||||
can change out from under us. We don't care that it changes, but
|
||||
if it gets set to DUMMY_OWNER_SHUTDOWN, DUMMY_OWNER_CREATE or
|
||||
DUMMY_OWNER_DELETE it can lead to a core drop when we try to map
|
||||
@ -2394,7 +2391,8 @@ static void deadlock_clear(void)
|
||||
}
|
||||
|
||||
|
||||
static LRQ deadlock_scan( OWN owner, LRQ request)
|
||||
static LRQ deadlock_scan(OWN owner,
|
||||
LRQ request)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2410,7 +2408,7 @@ static LRQ deadlock_scan( OWN owner, LRQ request)
|
||||
*
|
||||
**************************************/
|
||||
LRQ victim;
|
||||
BOOLEAN maybe_deadlock = FALSE;
|
||||
bool maybe_deadlock = false;
|
||||
|
||||
LOCK_TRACE(
|
||||
("deadlock_scan: owner %ld request %ld\n", REL_PTR(owner),
|
||||
@ -2419,7 +2417,7 @@ static LRQ deadlock_scan( OWN owner, LRQ request)
|
||||
ASSERT_ACQUIRED;
|
||||
++LOCK_header->lhb_scans;
|
||||
post_history(his_scan, request->lrq_owner, request->lrq_lock,
|
||||
REL_PTR(request), TRUE);
|
||||
REL_PTR(request), true);
|
||||
deadlock_clear();
|
||||
|
||||
#ifdef VALIDATE_LOCK_TABLE
|
||||
@ -2443,7 +2441,8 @@ static LRQ deadlock_scan( OWN owner, LRQ request)
|
||||
}
|
||||
|
||||
|
||||
static LRQ deadlock_walk( LRQ request, BOOLEAN * maybe_deadlock)
|
||||
static LRQ deadlock_walk(LRQ request,
|
||||
bool * maybe_deadlock)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2461,7 +2460,7 @@ static LRQ deadlock_walk( LRQ request, BOOLEAN * maybe_deadlock)
|
||||
LBL lock;
|
||||
OWN owner;
|
||||
PTR pending_offset;
|
||||
BOOLEAN conversion;
|
||||
bool conversion;
|
||||
|
||||
/* If this request was scanned for deadlock earlier than don't
|
||||
visit it again. */
|
||||
@ -2481,7 +2480,7 @@ static LRQ deadlock_walk( LRQ request, BOOLEAN * maybe_deadlock)
|
||||
|
||||
/* Check if this is a conversion request. */
|
||||
|
||||
conversion = (request->lrq_state > LCK_null) ? TRUE : FALSE;
|
||||
conversion = (request->lrq_state > LCK_null) ? true : false;
|
||||
|
||||
/* Find the parent lock of the request */
|
||||
|
||||
@ -2538,7 +2537,7 @@ static LRQ deadlock_walk( LRQ request, BOOLEAN * maybe_deadlock)
|
||||
|
||||
if (owner->own_ast_flags & OWN_signaled ||
|
||||
!QUE_EMPTY((owner->own_blocks))) {
|
||||
*maybe_deadlock = TRUE;
|
||||
*maybe_deadlock = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2597,7 +2596,7 @@ static void dequeue( PTR request_offset)
|
||||
|
||||
request = get_request(request_offset);
|
||||
post_history(his_deq, request->lrq_owner, request->lrq_lock,
|
||||
request_offset, TRUE);
|
||||
request_offset, true);
|
||||
request->lrq_ast_routine = NULL;
|
||||
release_request(request);
|
||||
}
|
||||
@ -2785,7 +2784,7 @@ static LBL find_lock(
|
||||
|
||||
|
||||
#ifdef MANAGER_PROCESS
|
||||
static USHORT fork_lock_manager( ISC_STATUS * status_vector)
|
||||
static bool fork_lock_manager( ISC_STATUS * status_vector)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2812,7 +2811,7 @@ static USHORT fork_lock_manager( ISC_STATUS * status_vector)
|
||||
if (statistics(string, &stat_buf) == -1) {
|
||||
sprintf (errorstring, "can't start lock manager: %s", string);
|
||||
bug(status_vector, errorstring);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(pid = vfork())) {
|
||||
@ -2825,19 +2824,19 @@ static USHORT fork_lock_manager( ISC_STATUS * status_vector)
|
||||
|
||||
if (pid == -1) {
|
||||
bug(status_vector, "can't start lock manager");
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
while (waitpid(pid, NULL, 0) == -1 && SYSCALL_INTERRUPTED(errno))
|
||||
/* do nothing */ ;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef MANAGER_PROCESS
|
||||
static OWN get_manager( BOOLEAN flag)
|
||||
static OWN get_manager(bool flag)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -2934,7 +2933,7 @@ static void grant( LRQ request, LBL lock)
|
||||
CHECK(REL_PTR(lock) == request->lrq_lock);
|
||||
|
||||
post_history(his_grant, request->lrq_owner, request->lrq_lock,
|
||||
REL_PTR(request), TRUE);
|
||||
REL_PTR(request), true);
|
||||
|
||||
++lock->lbl_counts[request->lrq_requested];
|
||||
request->lrq_state = request->lrq_requested;
|
||||
@ -3015,7 +3014,7 @@ static PTR grant_or_que( LRQ request, LBL lock, SSHORT lck_wait)
|
||||
|
||||
request = (LRQ) ABS_PTR(request_offset);
|
||||
post_history(his_deny, request->lrq_owner, request->lrq_lock,
|
||||
REL_PTR(request), TRUE);
|
||||
REL_PTR(request), true);
|
||||
ASSERT_ACQUIRED;
|
||||
++LOCK_header->lhb_denies;
|
||||
if (lck_wait < 0)
|
||||
@ -3101,8 +3100,7 @@ static ISC_STATUS init_lock_table( ISC_STATUS * status_vector)
|
||||
/* Now get the globally consistent value of LOCK_ordering from the
|
||||
shared lock table. */
|
||||
|
||||
LOCK_ordering =
|
||||
(LOCK_header->lhb_flags & LHB_lock_ordering) ? TRUE : FALSE;
|
||||
LOCK_ordering = (LOCK_header->lhb_flags & LHB_lock_ordering) ? TRUE : FALSE;
|
||||
|
||||
gds__register_cleanup(exit_handler, 0);
|
||||
|
||||
@ -3158,16 +3156,15 @@ static void init_owner_block(
|
||||
#if defined(WIN_NT) && !defined(SUPERSERVER)
|
||||
// Skidder: This Win32 EVENT is deleted when our process is closing
|
||||
if (new_block != OWN_BLOCK_dummy)
|
||||
owner->own_wakeup_hndl =
|
||||
ISC_make_signal(TRUE, TRUE, LOCK_pid, LOCK_wakeup_signal);
|
||||
owner->own_wakeup_hndl = ISC_make_signal(TRUE, TRUE, LOCK_pid,
|
||||
LOCK_wakeup_signal);
|
||||
#endif
|
||||
if (new_block == OWN_BLOCK_new)
|
||||
{
|
||||
#if defined WIN_NT && defined SUPERSERVER
|
||||
// TMN: This Win32 EVENT is never deleted!
|
||||
// Skidder: But it may be reused along with the owner block
|
||||
owner->own_wakeup_hndl =
|
||||
ISC_make_signal(TRUE, TRUE, LOCK_pid, 0);
|
||||
owner->own_wakeup_hndl = ISC_make_signal(TRUE, TRUE, LOCK_pid, 0);
|
||||
#endif
|
||||
#ifdef USE_WAKEUP_EVENTS
|
||||
#if (defined WIN_NT && defined SUPERSERVER)
|
||||
@ -3259,7 +3256,7 @@ static void lock_initialize( void *arg, SH_MEM shmem_data, int initialize)
|
||||
return;
|
||||
}
|
||||
|
||||
start_manager = TRUE;
|
||||
start_manager = true;
|
||||
|
||||
memset(LOCK_header, 0, sizeof(struct lhb));
|
||||
LOCK_header->lhb_type = type_lhb;
|
||||
@ -3495,7 +3492,9 @@ static USHORT lock_state( LBL lock)
|
||||
}
|
||||
|
||||
|
||||
static void post_blockage( LRQ request, LBL lock, BOOLEAN force)
|
||||
static void post_blockage(LRQ request,
|
||||
LBL lock,
|
||||
bool force)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3566,10 +3565,11 @@ static void post_blockage( LRQ request, LBL lock, BOOLEAN force)
|
||||
}
|
||||
|
||||
|
||||
static void post_history(
|
||||
USHORT operation,
|
||||
static void post_history(USHORT operation,
|
||||
PTR process,
|
||||
PTR lock, PTR request, BOOLEAN old_version)
|
||||
PTR lock,
|
||||
PTR request,
|
||||
bool old_version)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3736,7 +3736,7 @@ static void post_wakeup( OWN owner)
|
||||
|
||||
|
||||
#ifndef SUPERSERVER
|
||||
static BOOLEAN probe_owners( PTR probing_owner_offset)
|
||||
static bool probe_owners( PTR probing_owner_offset)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -3751,9 +3751,9 @@ static BOOLEAN probe_owners( PTR probing_owner_offset)
|
||||
**************************************/
|
||||
SRQ que;
|
||||
OWN owner;
|
||||
BOOLEAN purged;
|
||||
bool purged;
|
||||
|
||||
purged = FALSE;
|
||||
purged = false;
|
||||
|
||||
ASSERT_ACQUIRED;
|
||||
QUE_LOOP(LOCK_header->lhb_owners, que) {
|
||||
@ -3765,7 +3765,7 @@ static BOOLEAN probe_owners( PTR probing_owner_offset)
|
||||
owner->own_process_uid, FALSE)) {
|
||||
que = (SRQ) ABS_PTR(que->srq_backward);
|
||||
purge_owner(probing_owner_offset, owner);
|
||||
purged = TRUE;
|
||||
purged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3792,7 +3792,7 @@ static void purge_owner(PTR purging_owner_offset, OWN owner)
|
||||
LOCK_TRACE(("purge_owner (%ld)\n", purging_owner_offset));
|
||||
|
||||
post_history(his_del_owner, purging_owner_offset, REL_PTR(owner), 0,
|
||||
FALSE);
|
||||
false);
|
||||
|
||||
#ifdef USE_STATIC_SEMAPHORES
|
||||
release_semaphore(owner);
|
||||
@ -3935,7 +3935,7 @@ static void release( PTR owner_offset)
|
||||
bug(NULL, "release when not owner");
|
||||
|
||||
#ifdef MANAGER_PROCESS
|
||||
if (LOCK_post_manager && (owner = get_manager(TRUE)))
|
||||
if (LOCK_post_manager && (owner = get_manager(true)))
|
||||
post_wakeup(owner);
|
||||
#endif
|
||||
|
||||
@ -4212,7 +4212,7 @@ static int signal_owner( OWN blocking_owner, PTR blocked_owner_offset)
|
||||
*
|
||||
**************************************/
|
||||
|
||||
/*post_history (his_signal, LOCK_header->lhb_iactive_owner, REL_PTR (blocking_owner), 0, TRUE);*/
|
||||
/*post_history (his_signal, LOCK_header->lhb_iactive_owner, REL_PTR (blocking_owner), 0, true);*/
|
||||
|
||||
ASSERT_ACQUIRED;
|
||||
|
||||
@ -4298,7 +4298,7 @@ static int signal_owner( OWN blocking_owner, PTR blocked_owner_offset)
|
||||
process for delivery. */
|
||||
|
||||
if (!(LOCK_process_owner.own_flags & OWN_manager)) {
|
||||
LOCK_post_manager = TRUE;
|
||||
LOCK_post_manager = true;
|
||||
return FB_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
@ -4334,7 +4334,7 @@ static void validate_history( PTR history_header)
|
||||
|
||||
LOCK_TRACE(("validate_history: %ld\n", history_header));
|
||||
|
||||
for (history = (HIS) ABS_PTR(history_header); TRUE;
|
||||
for (history = (HIS) ABS_PTR(history_header); true;
|
||||
history = (HIS) ABS_PTR(history->his_next)) {
|
||||
count++;
|
||||
CHECK(history->his_type == type_his);
|
||||
@ -4710,7 +4710,7 @@ static void validate_owner( PTR own_ptr, USHORT freed)
|
||||
* exists in the queue for the lock.
|
||||
*/
|
||||
if (owner_own_pending_request && (freed == EXPECT_inuse)) {
|
||||
BOOLEAN found_pending;
|
||||
bool found_pending;
|
||||
LRQ request;
|
||||
LBL lock;
|
||||
LRQ pending;
|
||||
@ -4727,13 +4727,13 @@ static void validate_owner( PTR own_ptr, USHORT freed)
|
||||
|
||||
/* Make sure the pending request is on the list of requests for the lock */
|
||||
|
||||
found_pending = FALSE;
|
||||
found_pending = false;
|
||||
QUE_LOOP(lock->lbl_requests, que_of_lbl_requests) {
|
||||
pending =
|
||||
(LRQ) ((UCHAR *) que_of_lbl_requests -
|
||||
OFFSET(LRQ, lrq_lbl_requests));
|
||||
if (REL_PTR(pending) == owner_own_pending_request) {
|
||||
found_pending = TRUE;
|
||||
found_pending = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -4947,8 +4947,8 @@ static USHORT wait_for_request(
|
||||
/* Post blockage. If the blocking owner has disappeared, the blockage
|
||||
may clear spontaneously. */
|
||||
|
||||
post_blockage(request, lock, FALSE);
|
||||
post_history(his_wait, owner_offset, lock_offset, REL_PTR(request), TRUE);
|
||||
post_blockage(request, lock, false);
|
||||
post_history(his_wait, owner_offset, lock_offset, REL_PTR(request), true);
|
||||
release(owner_offset);
|
||||
|
||||
current_time = GET_TIME;
|
||||
@ -4962,7 +4962,7 @@ static USHORT wait_for_request(
|
||||
|
||||
/* Wait in a loop until the lock becomes available */
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
/* NOTE: Many operations in this loop are done without having
|
||||
* the lock table acquired - for performance reasons
|
||||
*/
|
||||
@ -5176,7 +5176,7 @@ static USHORT wait_for_request(
|
||||
This could happen if the lock was granted to a different request,
|
||||
we have to tell the new owner of the lock that they are blocking us. */
|
||||
|
||||
post_blockage(request, lock, FALSE);
|
||||
post_blockage(request, lock, false);
|
||||
release(owner_offset);
|
||||
continue;
|
||||
}
|
||||
@ -5237,7 +5237,7 @@ static USHORT wait_for_request(
|
||||
We need to inform the new owner. */
|
||||
|
||||
DEBUG_MSG(0, ("wait_for_request: forcing a resignal of blockers\n"));
|
||||
post_blockage(request, lock, FALSE);
|
||||
post_blockage(request, lock, false);
|
||||
#ifdef DEV_BUILD
|
||||
repost_counter++;
|
||||
if (repost_counter % 50 == 0) {
|
||||
|
@ -38,7 +38,7 @@ SLONG LOCK_query_data(SLONG, USHORT, USHORT);
|
||||
SLONG LOCK_read_data(SLONG);
|
||||
SLONG LOCK_read_data2(SLONG, USHORT, UCHAR *, USHORT, SLONG);
|
||||
void LOCK_re_post(int (*)(void *), void *, SLONG);
|
||||
BOOLEAN LOCK_shut_manager(void);
|
||||
bool LOCK_shut_manager(void);
|
||||
SLONG LOCK_write_data(SLONG, SLONG);
|
||||
|
||||
#endif /* _LOCK_LOCK_PROTO_H_ */
|
||||
|
@ -80,7 +80,7 @@ static void prt_lock_activity(OUTFILE, LHB, USHORT, USHORT, USHORT);
|
||||
static void prt_lock_init(void);
|
||||
static void prt_history(OUTFILE, LHB, PTR, SCHAR *);
|
||||
static void prt_lock(OUTFILE, LHB, LBL, USHORT);
|
||||
static void prt_owner(OUTFILE, LHB, OWN, BOOLEAN, BOOLEAN);
|
||||
static void prt_owner(OUTFILE, LHB, OWN, bool, bool);
|
||||
static void prt_owner_wait_cycle(OUTFILE, LHB, OWN, USHORT, struct waitque *);
|
||||
static void prt_request(OUTFILE, LHB, LRQ);
|
||||
static void prt_que(OUTFILE, LHB, SCHAR *, SRQ, USHORT);
|
||||
@ -123,11 +123,15 @@ void CLIB_ROUTINE main( int argc, char *argv[])
|
||||
* to ib_stdout.
|
||||
*
|
||||
**************************************/
|
||||
BOOLEAN sw_requests, sw_owners, sw_locks, sw_history, sw_nobridge;
|
||||
bool sw_requests;
|
||||
bool sw_owners;
|
||||
bool sw_locks;
|
||||
bool sw_history;
|
||||
bool sw_nobridge;
|
||||
USHORT sw_series, sw_interactive, sw_intervals, sw_seconds;
|
||||
BOOLEAN sw_consistency;
|
||||
BOOLEAN sw_waitlist;
|
||||
BOOLEAN sw_file;
|
||||
bool sw_consistency;
|
||||
bool sw_waitlist;
|
||||
bool sw_file;
|
||||
LHB LOCK_header, header = NULL;
|
||||
SLONG LOCK_size_mapped = DEFAULT_SIZE;
|
||||
int orig_argc;
|
||||
@ -188,11 +192,11 @@ void CLIB_ROUTINE main( int argc, char *argv[])
|
||||
/* Handle switches, etc. */
|
||||
|
||||
argv++;
|
||||
sw_consistency = FALSE;
|
||||
sw_waitlist = FALSE;
|
||||
sw_file = FALSE;
|
||||
sw_requests = sw_locks = sw_history = sw_nobridge = FALSE;
|
||||
sw_owners = TRUE;
|
||||
sw_consistency = false;
|
||||
sw_waitlist = false;
|
||||
sw_file = false;
|
||||
sw_requests = sw_locks = sw_history = sw_nobridge = false;
|
||||
sw_owners = true;
|
||||
sw_series = sw_interactive = sw_intervals = sw_seconds = 0;
|
||||
|
||||
while (--argc) {
|
||||
@ -206,31 +210,31 @@ void CLIB_ROUTINE main( int argc, char *argv[])
|
||||
switch (c) {
|
||||
case 'o':
|
||||
case 'p':
|
||||
sw_owners = TRUE;
|
||||
sw_owners = true;
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
sw_nobridge = TRUE;
|
||||
sw_consistency = TRUE;
|
||||
sw_nobridge = true;
|
||||
sw_consistency = true;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
sw_locks = TRUE;
|
||||
sw_locks = true;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
sw_requests = TRUE;
|
||||
sw_requests = true;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
sw_locks = TRUE;
|
||||
sw_owners = TRUE;
|
||||
sw_requests = TRUE;
|
||||
sw_history = TRUE;
|
||||
sw_locks = true;
|
||||
sw_owners = true;
|
||||
sw_requests = true;
|
||||
sw_history = true;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
sw_history = TRUE;
|
||||
sw_history = true;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
@ -245,7 +249,7 @@ void CLIB_ROUTINE main( int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
sw_nobridge = TRUE;
|
||||
sw_nobridge = true;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
@ -277,7 +281,7 @@ void CLIB_ROUTINE main( int argc, char *argv[])
|
||||
sw_interactive =
|
||||
(SW_I_ACQUIRE | SW_I_OPERATION | SW_I_TYPE |
|
||||
SW_I_WAIT);
|
||||
sw_nobridge = TRUE;
|
||||
sw_nobridge = true;
|
||||
sw_seconds = sw_intervals = 1;
|
||||
if (argc > 1) {
|
||||
sw_seconds = atoi(*argv++);
|
||||
@ -296,13 +300,13 @@ void CLIB_ROUTINE main( int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
sw_nobridge = TRUE;
|
||||
sw_waitlist = TRUE;
|
||||
sw_nobridge = true;
|
||||
sw_waitlist = true;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
sw_nobridge = TRUE;
|
||||
sw_file = TRUE;
|
||||
sw_nobridge = true;
|
||||
sw_file = true;
|
||||
if (argc > 1) {
|
||||
lock_file = *argv++;
|
||||
--argc;
|
||||
@ -358,8 +362,8 @@ void CLIB_ROUTINE main( int argc, char *argv[])
|
||||
&& LOCK_header->lhb_length > shmem_data.sh_mem_length_mapped) {
|
||||
length = LOCK_header->lhb_length;
|
||||
#if (!(defined UNIX) || (defined HAVE_MMAP))
|
||||
LOCK_header =
|
||||
(LHB) ISC_remap_file(status_vector, &shmem_data, length, FALSE);
|
||||
LOCK_header = (LHB) ISC_remap_file(status_vector, &shmem_data, length,
|
||||
FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -832,7 +836,7 @@ static void prt_history(
|
||||
|
||||
FPRINTF(outfile, "%s:\n", title);
|
||||
|
||||
for (history = (HIS) ABS_PTR(history_header); TRUE;
|
||||
for (history = (HIS) ABS_PTR(history_header); true;
|
||||
history = (HIS) ABS_PTR(history->his_next)) {
|
||||
if (history->his_operation)
|
||||
FPRINTF(outfile,
|
||||
@ -920,10 +924,11 @@ static void prt_lock(
|
||||
}
|
||||
|
||||
|
||||
static void prt_owner(
|
||||
OUTFILE outfile,
|
||||
static void prt_owner(OUTFILE outfile,
|
||||
LHB LOCK_header,
|
||||
OWN owner, BOOLEAN sw_requests, BOOLEAN sw_waitlist)
|
||||
OWN owner,
|
||||
bool sw_requests,
|
||||
bool sw_waitlist)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1043,7 +1048,7 @@ static void prt_owner_wait_cycle(
|
||||
LRQ owner_request;
|
||||
LBL lock;
|
||||
USHORT counter;
|
||||
BOOLEAN owner_conversion;
|
||||
bool owner_conversion;
|
||||
|
||||
if (waiters->waitque_depth > FB_NELEM(waiters->waitque_entry)) {
|
||||
FPRINTF(outfile, "Dependency too deep\n");
|
||||
@ -1055,8 +1060,7 @@ static void prt_owner_wait_cycle(
|
||||
FPRINTF(outfile, "\n");
|
||||
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;
|
||||
owner_conversion = (owner_request->lrq_state > LCK_null) ? true : false;
|
||||
|
||||
lock = (LBL) ABS_PTR(owner_request->lrq_lock);
|
||||
assert(lock->lbl_type == type_lbl);
|
||||
@ -1079,8 +1083,7 @@ static void prt_owner_wait_cycle(
|
||||
assert(lock_request->lrq_type == type_lrq);
|
||||
|
||||
|
||||
if (LOCK_header->lhb_flags & LHB_lock_ordering
|
||||
&& !owner_conversion) {
|
||||
if (LOCK_header->lhb_flags & LHB_lock_ordering && !owner_conversion) {
|
||||
|
||||
/* Requests AFTER our request can't block us */
|
||||
if (owner_request == lock_request)
|
||||
|
Loading…
Reference in New Issue
Block a user