unsigned char *best_location ;
size_t best_length ;
int best_attr ;
- bool best_move_all ;
- bool best_address_of ;
+ int best_flags ;
bool first_time = true;
assert(ncount);
best_location = __gg__treeplet_1f[i]->data + __gg__treeplet_1o[i];
best_length = __gg__treeplet_1s[i];
best_attr = __gg__treeplet_1f[i]->attr;
- best_move_all = !!(__gg__fourplet_flags[i] & REFER_T_MOVE_ALL);
- best_address_of = !!(__gg__fourplet_flags[i] & REFER_T_ADDRESS_OF);
+ best_flags = __gg__fourplet_flags[i];
}
else
{
unsigned char *candidate_location = __gg__treeplet_1f[i]->data + __gg__treeplet_1o[i];
size_t candidate_length = __gg__treeplet_1s[i];
int candidate_attr = __gg__treeplet_1f[i]->attr;
- bool candidate_move_all = !!(__gg__fourplet_flags[i] & REFER_T_MOVE_ALL);
- bool candidate_address_of = !!(__gg__fourplet_flags[i] & REFER_T_ADDRESS_OF);
+ int candidate_flags = __gg__fourplet_flags[i];
int compare_result = __gg__compare_2(
candidate_field,
candidate_location,
candidate_length,
candidate_attr,
- candidate_move_all,
- candidate_address_of,
+ candidate_flags,
best_field,
best_location,
best_length,
best_attr,
- best_move_all,
- best_address_of,
+ best_flags,
0);
if( compare_result >= 0 )
{
- best_field = candidate_field ;
- best_location = candidate_location ;
- best_length = candidate_length ;
- best_attr = candidate_attr ;
- best_move_all = candidate_move_all ;
- best_address_of = candidate_address_of ;
+ best_field = candidate_field ;
+ best_location = candidate_location ;
+ best_length = candidate_length ;
+ best_attr = candidate_attr ;
+ best_flags = candidate_flags ;
}
}
if( !update_refer_state_for_all(state, __gg__treeplet_1f[i]) )
unsigned char *best_location ;
size_t best_length ;
int best_attr ;
- bool best_move_all ;
- bool best_address_of ;
+ int best_flags ;
bool first_time = true;
assert(ncount);
best_location = __gg__treeplet_1f[i]->data + __gg__treeplet_1o[i];
best_length = __gg__treeplet_1s[i];
best_attr = __gg__treeplet_1f[i]->attr;
- best_move_all = !!(__gg__fourplet_flags[i] & REFER_T_MOVE_ALL);
- best_address_of = !!(__gg__fourplet_flags[i] & REFER_T_ADDRESS_OF);
+ best_flags = __gg__fourplet_flags[i];
}
else
{
unsigned char *candidate_location = __gg__treeplet_1f[i]->data + __gg__treeplet_1o[i];
size_t candidate_length = __gg__treeplet_1s[i];
int candidate_attr = __gg__treeplet_1f[i]->attr;
- bool candidate_move_all = !!(__gg__fourplet_flags[i] & REFER_T_MOVE_ALL);
- bool candidate_address_of = !!(__gg__fourplet_flags[i] & REFER_T_ADDRESS_OF);
+ int candidate_flags = __gg__fourplet_flags[i];
int compare_result = __gg__compare_2(
candidate_field,
candidate_location,
candidate_length,
candidate_attr,
- candidate_move_all,
- candidate_address_of,
+ candidate_flags,
best_field,
best_location,
best_length,
best_attr,
- best_move_all,
- best_address_of,
+ best_flags,
0);
if( compare_result < 0 )
{
- best_field = candidate_field ;
- best_location = candidate_location ;
- best_length = candidate_length ;
- best_attr = candidate_attr ;
- best_move_all = candidate_move_all ;
- best_address_of = candidate_address_of ;
+ best_field = candidate_field ;
+ best_location = candidate_location ;
+ best_length = candidate_length ;
+ best_attr = candidate_attr ;
+ best_flags = candidate_flags ;
}
}
if( !update_refer_state_for_all(state, __gg__treeplet_1f[i]) )
unsigned char *best_location;
size_t best_length;
int best_attr;
- bool best_move_all;
- bool best_address_of ;
+ int best_flags;
unsigned char *candidate_location;
size_t candidate_length;
int candidate_attr;
- bool candidate_move_all;
- bool candidate_address_of;
+ int candidate_flags;
for( size_t i=0; i<ninputs; i++ )
{
best_location = __gg__treeplet_1f[i]->data + __gg__treeplet_1o[i];
best_length = __gg__treeplet_1s[i];
best_attr = __gg__treeplet_1f[i]->attr;
- best_move_all = !!(__gg__fourplet_flags[i] & REFER_T_MOVE_ALL);
- best_address_of = !!(__gg__fourplet_flags[i] & REFER_T_ADDRESS_OF);
+ best_flags = __gg__fourplet_flags[i];
}
else
{
candidate_location = __gg__treeplet_1f[i]->data + __gg__treeplet_1o[i];
candidate_length = __gg__treeplet_1s[i];
candidate_attr = __gg__treeplet_1f[i]->attr;
- candidate_move_all = !!(__gg__fourplet_flags[i] & REFER_T_MOVE_ALL);
- candidate_address_of = !!(__gg__fourplet_flags[i] & REFER_T_ADDRESS_OF);
+ candidate_flags = __gg__fourplet_flags[i];
int compare_result =
__gg__compare_2(
candidate_location,
candidate_length,
candidate_attr,
- candidate_move_all,
- candidate_address_of,
+ candidate_flags,
best,
best_location,
best_length,
best_attr,
- best_move_all,
- best_address_of,
+ best_flags,
0);
if( compare_result < 0 )
{
best_location = candidate_location;
best_length = candidate_length;
best_attr = candidate_attr;
- best_move_all = candidate_move_all;
- best_address_of = candidate_address_of;
+ best_flags = candidate_flags;
}
}
if( !update_refer_state_for_all(state, __gg__treeplet_1f[i]) )
unsigned char *best_location;
size_t best_length;
int best_attr;
- bool best_move_all;
- bool best_address_of ;
+ int best_flags;
unsigned char *candidate_location;
size_t candidate_length;
int candidate_attr;
- bool candidate_move_all;
- bool candidate_address_of;
+ int candidate_flags;
for( size_t i=0; i<ninputs; i++ )
{
best_location = __gg__treeplet_1f[i]->data + __gg__treeplet_1o[i];
best_length = __gg__treeplet_1s[i];
best_attr = __gg__treeplet_1f[i]->attr;
- best_move_all = !!(__gg__fourplet_flags[i] & REFER_T_MOVE_ALL);
- best_address_of = !!(__gg__fourplet_flags[i] & REFER_T_ADDRESS_OF);
+ best_flags = __gg__fourplet_flags[i];
}
else
{
candidate_location = __gg__treeplet_1f[i]->data + __gg__treeplet_1o[i];
candidate_length = __gg__treeplet_1s[i];
candidate_attr = __gg__treeplet_1f[i]->attr;
- candidate_move_all = !!(__gg__fourplet_flags[i] & REFER_T_MOVE_ALL);
- candidate_address_of = !!(__gg__fourplet_flags[i] & REFER_T_ADDRESS_OF);
+ candidate_flags = __gg__fourplet_flags[i];
int compare_result =
__gg__compare_2(
candidate_location,
candidate_length,
candidate_attr,
- candidate_move_all,
- candidate_address_of,
+ candidate_flags,
best,
best_location,
best_length,
best_attr,
- best_move_all,
- best_address_of,
+ best_flags,
0);
if( compare_result > 0 )
{
best_location = candidate_location;
best_length = candidate_length;
best_attr = candidate_attr;
- best_move_all = candidate_move_all;
- best_address_of = candidate_address_of;
+ best_flags = candidate_flags;
}
}
if( !update_refer_state_for_all(state, __gg__treeplet_1f[i]) )
unsigned char *left_location,
size_t left_length,
int left_attr,
- bool left_all,
- bool left_address_of,
+ int left_flags,
cblc_field_t *right_side,
unsigned char *right_location,
size_t right_length,
int right_attr,
- bool right_all,
- bool right_address_of,
+ int right_flags,
int second_time_through)
{
// First order of business: If right_side is a FldClass, pass that off
// to the speciality squad:
- // static size_t converted_initial_size = MINIMUM_ALLOCATION_SIZE;
- // static unsigned char *converted_initial =
- // (unsigned char *)malloc(converted_initial_size);
-
if( right_side->type == FldClass )
{
return compare_field_class( left_side,
}
// Serene in our conviction that the left_side isn't a FldClass, we
- // move on:
+ // move on.
+
+ // Extract the individual flags from the flag words:
+ bool left_all = !!(left_flags & REFER_T_MOVE_ALL );
+ bool left_address_of = !!(left_flags & REFER_T_ADDRESS_OF);
+ bool right_all = !!(right_flags & REFER_T_MOVE_ALL );
+ bool right_address_of = !!(right_flags & REFER_T_ADDRESS_OF);
+//bool left_refmod = !!(left_flags & REFER_T_REFMOD );
+ bool right_refmod = !!(right_flags & REFER_T_REFMOD );
+ // Figure out if we have any figurative constants
cbl_figconst_t left_figconst = (cbl_figconst_t)(left_attr & FIGCONST_MASK);
cbl_figconst_t right_figconst = (cbl_figconst_t)(right_attr & FIGCONST_MASK);
{
// We are comparing an alphanumeric to a numeric.
+ // The right side is numeric. Sometimes people write code where they
+ // take the refmod of a numeric displays. If somebody did that here,
+ // just do a complete straight-up character by character comparison:
+
+ if( right_refmod )
+ {
+ retval = compare_strings( (char *)left_location,
+ left_length,
+ left_all,
+ (char *)right_location,
+ right_length,
+ right_all);
+ compare = true;
+ goto fixup_retval;
+ }
+
+
// The trick here is to convert the numeric to its display form,
// and compare that to the alphanumeric. For example, when comparing
// a VAL5 PIC X(3) VALUE 5 to literals,
// VAL5 EQUAL 005 is TRUE
// VAL5 EQUAL "5" is FALSE
// VAL5 EQUAL "005" is TRUE
-
if( left_side->type == FldLiteralA )
{
left_location = (unsigned char *)left_side->data;
right_location,
right_length,
right_attr,
- right_all,
- right_address_of,
+ right_flags,
left_side,
left_location,
left_length,
left_attr,
- left_all,
- left_address_of,
+ left_flags,
1);
// And reverse the sense of the return value:
compare = true;
left->data + left_offset,
left_length,
left->attr,
- !!(left_flags & REFER_T_MOVE_ALL),
- !!(left_flags & REFER_T_ADDRESS_OF),
+ left_flags,
right,
right->data + right_offset,
right_length,
right->attr,
- !!(right_flags & REFER_T_MOVE_ALL),
- !!(right_flags & REFER_T_ADDRESS_OF),
+ right_flags,
second_time_through);
return retval;
}