Fixed problem with global names used for statics as well as externs
This commit is contained in:
parent
06e6c8638f
commit
7f8a099a15
|
@ -159,37 +159,11 @@ STATIC getpnames(dumpp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
STATIC bool name_exists(name,endp,endd)
|
|
||||||
char *name;
|
|
||||||
proc_p endp;
|
|
||||||
dblock_p endd;
|
|
||||||
{
|
|
||||||
/* Search the proctable (from fproc to endp)
|
|
||||||
* and the data block table (from fdblock to endd)
|
|
||||||
* to see if the name is already in use.
|
|
||||||
*/
|
|
||||||
|
|
||||||
proc_p p;
|
|
||||||
dblock_p d;
|
|
||||||
|
|
||||||
if (! name) return FALSE; /* HOL blocks don't have names */
|
|
||||||
for (p = fproc; p != endp; p = p->p_next) {
|
|
||||||
if (strcmp(name,pnames[p->p_id]) == 0) return TRUE;
|
|
||||||
}
|
|
||||||
for (d = fdblock; d != endd; d = d->d_next) {
|
|
||||||
if (dnames[d->d_id] != 0 && /* HOL blocks excluded */
|
|
||||||
strcmp(name,dnames[d->d_id]) == 0) return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int nn = 0;
|
|
||||||
|
|
||||||
STATIC new_name(s)
|
STATIC new_name(s)
|
||||||
char **s;
|
char **s;
|
||||||
{
|
{
|
||||||
|
static int nn = 0;
|
||||||
char buf[20];
|
char buf[20];
|
||||||
int len = strlen(*s);
|
int len = strlen(*s);
|
||||||
|
|
||||||
|
@ -204,7 +178,7 @@ STATIC new_name(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
STATIC uniq_names()
|
STATIC uniq_names()
|
||||||
{
|
{
|
||||||
/* The names of all internal procedures and data blocks
|
/* The names of all internal procedures and data blocks
|
||||||
|
@ -218,18 +192,18 @@ STATIC uniq_names()
|
||||||
dblock_p d;
|
dblock_p d;
|
||||||
|
|
||||||
for (p = fproc; p != (proc_p) 0; p = p->p_next) {
|
for (p = fproc; p != (proc_p) 0; p = p->p_next) {
|
||||||
if (!(p->p_flags1 & PF_EXTERNAL) &&
|
if (!(p->p_flags1 & PF_EXTERNAL)) {
|
||||||
name_exists(pnames[p->p_id],p,fdblock)) {
|
|
||||||
new_name(&(pnames[p->p_id]));
|
new_name(&(pnames[p->p_id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (d = fdblock; d != (dblock_p) 0; d = d->d_next) {
|
for (d = fdblock; d != (dblock_p) 0; d = d->d_next) {
|
||||||
if (!(d->d_flags1 & DF_EXTERNAL) &&
|
if (!(d->d_flags1 & DF_EXTERNAL) && dnames[d->d_id]) {
|
||||||
name_exists(dnames[d->d_id],(proc_p) 0,d) ) {
|
|
||||||
new_name(&(dnames[d->d_id]));
|
new_name(&(dnames[d->d_id]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main(argc,argv)
|
main(argc,argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
|
|
|
@ -118,9 +118,13 @@ dblock_p symlookup(name, status)
|
||||||
* list.
|
* list.
|
||||||
*/
|
*/
|
||||||
if (strcmp((*spp)->sy_name, name) == 0) {
|
if (strcmp((*spp)->sy_name, name) == 0) {
|
||||||
/* found */
|
if (status != DEFINING ||
|
||||||
lastname = (*spp)->sy_name;
|
(*spp)->sy_dblock->d_pseudo == DUNKNOWN) {
|
||||||
return ((*spp)->sy_dblock);
|
/* found */
|
||||||
|
lastname = (*spp)->sy_name;
|
||||||
|
return ((*spp)->sy_dblock);
|
||||||
|
}
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
spp = &(*spp)->sy_next;
|
spp = &(*spp)->sy_next;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +134,9 @@ dblock_p symlookup(name, status)
|
||||||
* indicating that we don't need this name.
|
* indicating that we don't need this name.
|
||||||
*/
|
*/
|
||||||
if (status == IMPORTING) return (dblock_p) 0;
|
if (status == IMPORTING) return (dblock_p) 0;
|
||||||
*spp = sp = newsym();
|
sp = newsym();
|
||||||
|
sp->sy_next = *spp;
|
||||||
|
*spp = sp;
|
||||||
sp->sy_name = (char *) newcore(strlen(name)+1);
|
sp->sy_name = (char *) newcore(strlen(name)+1);
|
||||||
strcpy(sp->sy_name, name);
|
strcpy(sp->sy_name, name);
|
||||||
lastname = sp->sy_name; /* quick hack to get at
|
lastname = sp->sy_name; /* quick hack to get at
|
||||||
|
@ -210,7 +216,11 @@ proc_p proclookup(name, status)
|
||||||
*/
|
*/
|
||||||
if (strcmp((*ppp)->pr_name, name) == 0) {
|
if (strcmp((*ppp)->pr_name, name) == 0) {
|
||||||
/* found */
|
/* found */
|
||||||
return ((*ppp)->pr_proc);
|
if (status != DEFINING ||
|
||||||
|
! ((*ppp)->pr_proc->p_flags1 & PF_BODYSEEN)) {
|
||||||
|
return ((*ppp)->pr_proc);
|
||||||
|
}
|
||||||
|
break;
|
||||||
} else {
|
} else {
|
||||||
ppp = &(*ppp)->pr_next;
|
ppp = &(*ppp)->pr_next;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +230,9 @@ proc_p proclookup(name, status)
|
||||||
* return 0, indicating we don't want this proc.
|
* return 0, indicating we don't want this proc.
|
||||||
*/
|
*/
|
||||||
if (status == IMPORTING) return (proc_p) 0;
|
if (status == IMPORTING) return (proc_p) 0;
|
||||||
*ppp = pp = newprc();
|
pp = newprc();
|
||||||
|
pp->pr_next = *ppp;
|
||||||
|
*ppp = pp;
|
||||||
pp->pr_name = (char *) newcore(strlen(name)+1);
|
pp->pr_name = (char *) newcore(strlen(name)+1);
|
||||||
strcpy(pp->pr_name, name);
|
strcpy(pp->pr_name, name);
|
||||||
dp = pp->pr_proc = newproc();
|
dp = pp->pr_proc = newproc();
|
||||||
|
|
Loading…
Reference in a new issue