Clean up global declarations

This commit is contained in:
Zeex 2017-10-28 05:05:37 +06:00
parent b962246ad5
commit 4a5e02ef29
4 changed files with 60 additions and 54 deletions

View File

@ -617,6 +617,7 @@ SC_FUNC void setline(int chkbounds);
SC_FUNC void setfiledirect(char *name); SC_FUNC void setfiledirect(char *name);
SC_FUNC void setfileconst(char *name); SC_FUNC void setfileconst(char *name);
SC_FUNC void setlinedirect(int line); SC_FUNC void setlinedirect(int line);
SC_FUNC void setlineconst(int line);
SC_FUNC void setlabel(int index); SC_FUNC void setlabel(int index);
SC_FUNC void markexpr(optmark type,const char *name,cell offset); SC_FUNC void markexpr(optmark type,const char *name,cell offset);
SC_FUNC void startfunc(char *fname); SC_FUNC void startfunc(char *fname);

View File

@ -431,8 +431,7 @@ static void readline(unsigned char *line)
line+=strlen((char*)line); line+=strlen((char*)line);
} /* if */ } /* if */
fline+=1; fline+=1;
assert(line_sym!=NULL); setlineconst(fline);
line_sym->addr=fline;
} while (num>=0 && cont); } while (num>=0 && cont);
} }

View File

@ -287,6 +287,12 @@ SC_FUNC void setlinedirect(int line)
} /* if */ } /* if */
} }
SC_FUNC void setlineconst(int line)
{
assert(line_sym!=NULL);
line_sym->addr=line;
}
/* setlabel /* setlabel
* *
* Post a code label (specified as a number), on a new line. * Post a code label (specified as a number), on a new line.

View File

@ -34,7 +34,6 @@
SC_VDEFINE symbol loctab; /* local symbol table */ SC_VDEFINE symbol loctab; /* local symbol table */
SC_VDEFINE symbol glbtab; /* global symbol table */ SC_VDEFINE symbol glbtab; /* global symbol table */
SC_VDEFINE struct hashmap symbol_cache_map; SC_VDEFINE struct hashmap symbol_cache_map;
SC_VDEFINE symbol *line_sym=NULL;
SC_VDEFINE cell *litq; /* the literal queue */ SC_VDEFINE cell *litq; /* the literal queue */
SC_VDEFINE unsigned char pline[sLINEMAX+1]; /* the line read from the input file */ SC_VDEFINE unsigned char pline[sLINEMAX+1]; /* the line read from the input file */
SC_VDEFINE const unsigned char *lptr; /* points to the current position in "pline" */ SC_VDEFINE const unsigned char *lptr; /* points to the current position in "pline" */
@ -75,6 +74,7 @@ SC_VDEFINE cell pc_amxlimit=0; /* default abstract machine size limit = none
SC_VDEFINE cell pc_amxram=0; /* default abstract machine data size limit = none */ SC_VDEFINE cell pc_amxram=0; /* default abstract machine data size limit = none */
SC_VDEFINE int freading=FALSE; /* Is there an input file ready for reading? */ SC_VDEFINE int freading=FALSE; /* Is there an input file ready for reading? */
SC_VDEFINE int fline=0; /* the line number in the current file */ SC_VDEFINE int fline=0; /* the line number in the current file */
SC_VDEFINE symbol *line_sym=NULL; /* the line number constant (__line) */
SC_VDEFINE short fnumber=0; /* the file number in the file table (debugging) */ SC_VDEFINE short fnumber=0; /* the file number in the file table (debugging) */
SC_VDEFINE short fcurrent=0; /* current file being processed (debugging) */ SC_VDEFINE short fcurrent=0; /* current file being processed (debugging) */
SC_VDEFINE short sc_intest=FALSE; /* true if inside a test */ SC_VDEFINE short sc_intest=FALSE; /* true if inside a test */