variable length names
This commit is contained in:
parent
9ff877dce5
commit
5fbe427853
5 changed files with 23 additions and 23 deletions
|
@ -386,7 +386,7 @@ enmd_pro() {
|
|||
|
||||
limit = &mprocs[oursize->n_mproc];
|
||||
for (p=mprocs; p<limit; p++) {
|
||||
if (p->p_name[0] == 0)
|
||||
if (p->p_name == 0)
|
||||
continue;
|
||||
if ((p->p_status&DEF)==0)
|
||||
error("undefined local procedure '%s'",p->p_name);
|
||||
|
@ -421,7 +421,7 @@ enmd_glo() {
|
|||
|
||||
limit = &mglobs[oursize->n_mlab];
|
||||
for ( mg = mglobs; mg < limit; mg++) {
|
||||
if (mg->g_name[0] == 0)
|
||||
if (mg->g_name == 0)
|
||||
continue;
|
||||
if ((mg->g_status&(EXT|DEF))==0)
|
||||
error("undefined local symbol '%s'",glostring(mg));
|
||||
|
@ -511,12 +511,12 @@ check_def() {
|
|||
printf("Unresolved references\n Procedures:\n");
|
||||
count = oursize->n_xproc;
|
||||
for (p = xprocs; count--; p++)
|
||||
if (p->p_name[0] && (p->p_status&DEF)==0)
|
||||
if (p->p_name && (p->p_status&DEF)==0)
|
||||
printf(" %s\n",p->p_name);
|
||||
printf(" Data:\n");
|
||||
count = oursize->n_glab;
|
||||
for (g = xglobs; count--; g++)
|
||||
if (g->g_name[0] && (g->g_status&DEF)==0)
|
||||
if (g->g_name && (g->g_status&DEF)==0)
|
||||
printf(" %s\n",glostring(g));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,6 @@ typedef union {
|
|||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define IDLENGTH 8 /* length of glo's and pro's */
|
||||
#define MAXSTRING 200 /* Maximum string length accepted */
|
||||
#define LOCLABSIZE 128 /* size of local label hash table */
|
||||
/* may not be smaller */
|
||||
|
@ -169,7 +168,7 @@ struct loc_label {
|
|||
#define NOTPRESENT 4 /* Undefined and error message given */
|
||||
|
||||
struct glob_label {
|
||||
char g_name[IDLENGTH+1]; /* name + null-byte */
|
||||
char *g_name;
|
||||
char g_status; /* see below */
|
||||
union {
|
||||
cons_t g_addr; /* value if status&DEF */
|
||||
|
@ -241,7 +240,7 @@ struct sizes {
|
|||
};
|
||||
|
||||
struct procs { /* format of mprocs[] and xprocs[] */
|
||||
char p_name[IDLENGTH+1]; /* name + 1 null-byte */
|
||||
char *p_name;
|
||||
char p_status; /* same bits as g_status except REL */
|
||||
int p_num; /* unique procedure descriptor */
|
||||
};
|
||||
|
|
|
@ -138,7 +138,7 @@ if ( ( (n==0 || n>=100) && d_flag) || (n<=1 && d_flag>=2) ) {
|
|||
printf("\n\t%8.8s %8.8s %8.8s\n",
|
||||
"g_name","g_status","g_addr");
|
||||
for (gb = xglobs,i = 0;gb < &xglobs[oursize->n_glab]; gb++, i++)
|
||||
if (gb->g_name[0] != 0) {
|
||||
if (gb->g_name != 0) {
|
||||
printf("%5d\t%8.6s",i,gb->g_name);
|
||||
printf(" %8o %8ld\n",gb->g_status,gb->g_val.g_addr);
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ if ( ( (n==0 || n>=100) && d_flag) || (n<=1 && d_flag>=2) ) {
|
|||
printf("\n\t%8.8s%8s%8s\t%8s%8s\n",
|
||||
"name","status","num","off","locals");
|
||||
for (pl=mprocs;pl< &mprocs[oursize->n_mproc]; pl++)
|
||||
if (pl->p_name[0]) {
|
||||
if (pl->p_name) {
|
||||
printf("%4d\t%-8s%8o%8d",
|
||||
pl-mprocs,pl->p_name,pl->p_status,pl->p_num);
|
||||
if (pl->p_status&DEF)
|
||||
|
@ -158,7 +158,7 @@ if ( ( (n==0 || n>=100) && d_flag) || (n<=1 && d_flag>=2) ) {
|
|||
printf("\n\t%8s%8s%8s\t%8s%8s\n",
|
||||
"name","status","num","off","locals");
|
||||
for (pl=xprocs;pl< &xprocs[oursize->n_xproc]; pl++)
|
||||
if (pl->p_name[0]) {
|
||||
if (pl->p_name) {
|
||||
printf("%4d\t%-8s%8o%8d",
|
||||
pl-xprocs,pl->p_name,pl->p_status,pl->p_num);
|
||||
if (pl->p_status&DEF)
|
||||
|
|
|
@ -96,20 +96,21 @@ int size; /* size for hash */
|
|||
rem = glohash(name,size);
|
||||
j = 0; new=0;
|
||||
g = &table[rem];
|
||||
while (g->g_name[0] != 0 && strcmp(name,g->g_name) != 0) {
|
||||
while (g->g_name != 0 && strcmp(name,g->g_name) != 0) {
|
||||
j++;
|
||||
if (j>size)
|
||||
fatal("global label table overflow");
|
||||
rem = (rem + globstep) % size;
|
||||
g = &table[rem];
|
||||
}
|
||||
if (g->g_name[0] == 0) {
|
||||
if (g->g_name == 0) {
|
||||
/*
|
||||
* This symbol is shining new.
|
||||
* Enter it in table except for status = SEARCHING
|
||||
*/
|
||||
if (status == SEARCHING)
|
||||
return(0);
|
||||
g->g_name = (char *) getarea((unsigned) (strlen(name) + 1));
|
||||
strcpy(g->g_name,name);
|
||||
g->g_status = 0;
|
||||
g->g_val.g_addr=0;
|
||||
|
@ -211,12 +212,12 @@ proc_t *prolookup(name,status) char *name; {
|
|||
switch(status) {
|
||||
case PRO_OCC:
|
||||
p = searchproc(name,mprocs,oursize->n_mproc);
|
||||
if (p->p_name[0]) {
|
||||
if (p->p_name) {
|
||||
p->p_status |= OCC;
|
||||
return(p);
|
||||
}
|
||||
p = searchproc(name,xprocs,oursize->n_xproc);
|
||||
if (p->p_name[0]) {
|
||||
if (p->p_name) {
|
||||
p->p_status |= OCC;
|
||||
return(p);
|
||||
}
|
||||
|
@ -225,20 +226,20 @@ proc_t *prolookup(name,status) char *name; {
|
|||
break;
|
||||
case PRO_INT:
|
||||
p = searchproc(name,xprocs,oursize->n_xproc);
|
||||
if (p->p_name[0] && (p->p_status&EXT) )
|
||||
if (p->p_name && (p->p_status&EXT) )
|
||||
error("pro '%s' conflicting use",name);
|
||||
|
||||
p = searchproc(name,mprocs,oursize->n_mproc);
|
||||
if (p->p_name[0])
|
||||
if (p->p_name)
|
||||
werror("INP must be first occurrence of '%s'",name);
|
||||
pstat = 0;
|
||||
break;
|
||||
case PRO_EXT:
|
||||
p = searchproc(name,mprocs,oursize->n_mproc);
|
||||
if (p->p_name[0])
|
||||
if (p->p_name)
|
||||
error("pro '%s' exists already localy",name);
|
||||
p = searchproc(name,xprocs,oursize->n_xproc);
|
||||
if (p->p_name[0]) {
|
||||
if (p->p_name) {
|
||||
/*
|
||||
* The If statement is removed to be friendly
|
||||
* to Backend writers having to deal with assemblers
|
||||
|
@ -255,7 +256,7 @@ proc_t *prolookup(name,status) char *name; {
|
|||
break;
|
||||
case PRO_DEF:
|
||||
p = searchproc(name,xprocs,oursize->n_xproc);
|
||||
if (p->p_name[0] && (p->p_status&EXT) ) {
|
||||
if (p->p_name && (p->p_status&EXT) ) {
|
||||
if (p->p_status&DEF)
|
||||
error("global pro '%s' redeclared",name);
|
||||
else
|
||||
|
@ -264,7 +265,7 @@ proc_t *prolookup(name,status) char *name; {
|
|||
return(p);
|
||||
} else {
|
||||
p = searchproc(name,mprocs,oursize->n_mproc);
|
||||
if (p->p_name[0]) {
|
||||
if (p->p_name) {
|
||||
if (p->p_status&DEF)
|
||||
error("local pro '%s' redeclared",
|
||||
name);
|
||||
|
@ -296,7 +297,7 @@ proc_t *searchproc(name,table,size)
|
|||
rem = glohash(name,size);
|
||||
j = 0;
|
||||
p = &table[rem];
|
||||
while (p->p_name[0] != 0 && strcmp(name,p->p_name) != 0) {
|
||||
while (p->p_name != 0 && strcmp(name,p->p_name) != 0) {
|
||||
j++;
|
||||
if (j>size)
|
||||
fatal("procedure table overflow");
|
||||
|
@ -326,6 +327,7 @@ proc_t *place; {
|
|||
*/
|
||||
|
||||
p=place;
|
||||
p->p_name = (char *) getarea((unsigned) (strlen(name) + 1));
|
||||
strcpy(p->p_name,name);
|
||||
p->p_status = status;
|
||||
if (procnum>=oursize->n_proc)
|
||||
|
|
|
@ -198,7 +198,6 @@ getstring() {
|
|||
|
||||
inident() {
|
||||
getstring();
|
||||
string[IDLENGTH] = '\0';
|
||||
}
|
||||
|
||||
char *inproname() {
|
||||
|
@ -220,7 +219,7 @@ int needed() {
|
|||
break ;
|
||||
case sp_pnam :
|
||||
p = searchproc(string,xprocs,oursize->n_xproc);
|
||||
if (p->p_name[0]) {
|
||||
if (p->p_name) {
|
||||
if ((p->p_status & DEF) != 0)
|
||||
continue ;
|
||||
} else continue ;
|
||||
|
|
Loading…
Reference in a new issue