2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2012-03-24 14:06:46 -04:00
|
|
|
* Copyright 2001, 2012 Fidelity Information Services, Inc *
|
2012-02-05 11:35:58 -05:00
|
|
|
* *
|
|
|
|
* This source code contains the intellectual property *
|
|
|
|
* of its copyright holder(s), and is made available *
|
|
|
|
* under a license. If you do not know the terms of *
|
|
|
|
* the license, please stop and do not read further. *
|
|
|
|
* *
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "mdef.h"
|
|
|
|
|
|
|
|
#include "gtm_string.h"
|
|
|
|
|
2012-10-29 18:54:31 -04:00
|
|
|
#include <rtnhdr.h>
|
2012-02-05 11:35:58 -05:00
|
|
|
#include "cmd_qlf.h"
|
|
|
|
#include "gtm_caseconv.h"
|
|
|
|
#include "min_max.h"
|
|
|
|
|
|
|
|
GBLREF command_qualifier cmd_qlf;
|
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
error_def(ERR_LABELONLY);
|
|
|
|
|
|
|
|
int4* find_line_addr(rhdtyp *routine, mstr *label, int4 offset, mident **lent_name)
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
lab_tabent *base, *top, *ptr;
|
|
|
|
rhdtyp *real_routine;
|
|
|
|
mident_fixed target_label;
|
|
|
|
mident lname;
|
|
|
|
lnr_tabent *line_table, *first_line;
|
|
|
|
int stat, n;
|
2012-03-24 14:06:46 -04:00
|
|
|
DCL_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-03-24 14:06:46 -04:00
|
|
|
SETUP_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
if (!routine)
|
|
|
|
return NULL;
|
|
|
|
real_routine = CURRENT_RHEAD_ADR(routine);
|
|
|
|
first_line = LNRTAB_ADR(real_routine);
|
2012-03-24 14:06:46 -04:00
|
|
|
if (!label->len || !*label->addr)
|
|
|
|
{ /* No label specified. Return the first line */
|
2012-02-05 11:35:58 -05:00
|
|
|
base = LABTAB_ADR(real_routine);
|
2012-03-24 14:06:46 -04:00
|
|
|
/* Get the null label entry and note whether it has a formallist. */
|
|
|
|
(TREF(lab_proxy)).has_parms = base->has_parms;
|
2012-02-05 11:35:58 -05:00
|
|
|
assert(0 == base->lab_name.len);
|
|
|
|
if (lent_name)
|
|
|
|
*lent_name = &base->lab_name;
|
|
|
|
line_table = first_line;
|
2012-03-24 14:06:46 -04:00
|
|
|
} else
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
lname.len = (label->len <= MAX_MIDENT_LEN) ? label->len : MAX_MIDENT_LEN;
|
|
|
|
if (cmd_qlf.qlf & CQ_LOWER_LABELS)
|
|
|
|
lname.addr = label->addr;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lower_to_upper((uchar_ptr_t)&target_label.c[0], (uchar_ptr_t)label->addr, lname.len);
|
|
|
|
lname.addr = &target_label.c[0];
|
|
|
|
}
|
|
|
|
ptr = base = LABTAB_ADR(real_routine);
|
|
|
|
top = base + real_routine->labtab_len;
|
2012-03-24 14:06:46 -04:00
|
|
|
for ( ; ; )
|
2012-02-05 11:35:58 -05:00
|
|
|
{
|
|
|
|
n = (int)(top - base) / 2;
|
|
|
|
ptr = base + n;
|
|
|
|
MIDENT_CMP(&lname, &ptr->lab_name, stat);
|
|
|
|
if (0 == stat)
|
2012-03-24 14:06:46 -04:00
|
|
|
{ /* Note whether the label has a formallist. */
|
|
|
|
(TREF(lab_proxy)).has_parms = ptr->has_parms;
|
2012-02-05 11:35:58 -05:00
|
|
|
if (lent_name)
|
|
|
|
*lent_name = &ptr->lab_name;
|
|
|
|
line_table = LABENT_LNR_ENTRY(real_routine, ptr);
|
|
|
|
break;
|
2012-03-24 14:06:46 -04:00
|
|
|
} else if (0 < stat)
|
2012-02-05 11:35:58 -05:00
|
|
|
base = ptr;
|
|
|
|
else
|
|
|
|
top = ptr;
|
|
|
|
if (n < 1)
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
line_table += offset;
|
2012-03-24 14:06:46 -04:00
|
|
|
if ((first_line > line_table) || (first_line + real_routine->lnrtab_len <= line_table))
|
2012-02-05 11:35:58 -05:00
|
|
|
return NULL;
|
|
|
|
return line_table;
|
|
|
|
}
|