2017-04-22 18:39:52 +00:00
|
|
|
/******************************************************
|
|
|
|
* C02 Label Parsing, Generation, and Lookup Routines *
|
|
|
|
******************************************************/
|
|
|
|
|
|
|
|
char curlbl[LABLEN+1]; //Most recently generated label
|
2017-05-16 00:25:11 +00:00
|
|
|
char cndlbl[LABLEN+1]; //Label for Conditional Code
|
2017-05-01 01:17:50 +00:00
|
|
|
char endlbl[LABLEN+1]; //End Label
|
2017-05-16 00:25:11 +00:00
|
|
|
char forlbl[LABLEN+1]; //For Loop Label
|
2017-05-01 01:17:50 +00:00
|
|
|
char loplbl[LABLEN+1]; //Skip Increment Label
|
|
|
|
char skplbl[LABLEN+1]; //Skip Increment Label
|
|
|
|
char tmplbl[LABLEN+1]; //Temporary Label
|
2017-04-22 18:39:52 +00:00
|
|
|
char lblnam[MAXLAB+1][LABLEN+1]; //Label Name Table
|
|
|
|
int lbltyp[MAXLAB+1]; //Label Type
|
2017-05-01 01:17:50 +00:00
|
|
|
int lblblk[MAXLAB+1]; //Label Ends Program Block
|
2017-04-22 18:39:52 +00:00
|
|
|
int lblcnt; //Number of Labels in stack
|
|
|
|
int lblnxt; //Sequence of next label to be generated
|
|
|
|
char lbltmp[LABLEN+1]; //Label Temporary Storage
|
|
|
|
|
2018-02-06 02:51:30 +00:00
|
|
|
enum ltypes {LTNONE, LTIF, LTLOOP, LTEND, LTDO, LTDWHL, LTSLCT, LTCASE, LTFUNC}; //Label Types
|
2018-02-07 04:24:55 +00:00
|
|
|
enum lflags {LFNONE, LFBGN, LFEND}; //Label Flag Types
|
2017-04-22 18:39:52 +00:00
|
|
|
|
2018-02-13 22:25:57 +00:00
|
|
|
void chklbl(char* lbname); //Check Label Contents
|
|
|
|
int lstlbl(int lbflag); //Find Last Label of Specified Types *
|
2017-05-16 00:25:11 +00:00
|
|
|
void newlbl(char* lbname); //Generate New Block Label
|
2018-02-13 22:25:57 +00:00
|
|
|
int poplbl(); //Pop Last Label and Emit on Next Line
|
|
|
|
void prslbl(); //Parse Label From Code
|
|
|
|
void pshlbl(int lbtype, char* lbname); //Push Label onto Stack
|
|
|
|
void reqlbl(char* lbname); //Require Label
|
|
|
|
void setblk(int blkflg); //Set Block Flag for Last Label
|
|
|
|
void setlbl(char *lblset); //Emit word as Label on Next Line
|
2018-02-13 23:16:23 +00:00
|
|
|
int toplbl(char *rtlbl); //Get Top Label and Return Type
|
2017-04-22 18:39:52 +00:00
|
|
|
|