Merge pull request #220 from davidgiven/dtrg-fixes

Don't rely on COMMON variable linkage.
This commit is contained in:
David Given 2020-09-14 23:13:12 +02:00 committed by GitHub
commit ec47148b85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 33 deletions

View file

@ -42,27 +42,27 @@ struct swtab {
extern int wordsize; extern int wordsize;
extern const char* modulename; extern const char* modulename;
int paramsize; extern int paramsize;
struct hshtab hshtab[HSHSIZ]; extern struct hshtab hshtab[HSHSIZ];
int hshused; extern int hshused;
int eof; extern int eof;
int peekc; extern int peekc;
const char* ctab; extern const char* ctab;
struct hshtab *bsym; extern struct hshtab *bsym;
struct hshtab *paraml, *parame; extern struct hshtab *paraml, *parame;
int cval; extern int cval;
int isn; extern int isn;
char symbuf[NCPS+1]; extern char symbuf[NCPS+1];
FILE *sbufp; extern FILE *sbufp;
int stack; extern int stack;
struct tnode **cp; extern struct tnode **cp;
int *space; extern int *space;
int ospace[OSSIZ]; extern int ospace[OSSIZ];
int retlab; extern int retlab;
int nerror; extern int nerror;
struct swtab swtab[SWSIZ]; extern struct swtab swtab[SWSIZ];
struct swtab *swp; extern struct swtab *swp;
int deflab; extern int deflab;
extern int contlab; extern int contlab;
extern int brklab; extern int brklab;
@ -70,16 +70,16 @@ extern int opdope[];
extern int line; extern int line;
extern int peeksym, peeksym2; extern int peeksym, peeksym2;
void error(char *s, ...); extern void error(char *s, ...);
void printtoken(int tok, FILE *out); extern void printtoken(int tok, FILE *out);
struct tnode * block(int op, int value, struct tnode *tr1, struct tnode *tr2); extern struct tnode * block(int op, int value, struct tnode *tr1, struct tnode *tr2);
void rcexpr(struct tnode *tr); extern void rcexpr(struct tnode *tr);
void cbranch(struct tnode *t, int lab); extern void cbranch(struct tnode *t, int lab);
void jump(int lab); extern void jump(int lab);
void fnlabel(int l); extern void fnlabel(int l);
void tonativeaddr(void); extern void tonativeaddr(void);
void fromnativeaddr(void); extern void fromnativeaddr(void);
char* manglename(char* name, char prefix); extern char* manglename(char* name, char prefix);
#define EOFC 0 #define EOFC 0
#define SEMI 1 #define SEMI 1

View file

@ -19,6 +19,35 @@ int bsymb_part;
int code_part; int code_part;
int string_part; int string_part;
int paramsize;
struct hshtab hshtab[HSHSIZ];
int hshused;
int eof;
int peekc;
const char* ctab;
struct hshtab *bsym;
struct hshtab *paraml, *parame;
int cval;
int isn;
char symbuf[NCPS+1];
FILE *sbufp;
int stack;
struct tnode **cp;
int *space;
int ospace[OSSIZ];
int retlab;
int nerror;
struct swtab swtab[SWSIZ];
struct swtab *swp;
int deflab;
int contlab;
int brklab;
int opdope[];
int line;
int peeksym, peeksym2;
void void
init(char *s, int val) init(char *s, int val)
{ {

View file

@ -35,7 +35,6 @@
#define oldlvbx(x) oldstruct(bext_lv,x) #define oldlvbx(x) oldstruct(bext_lv,x)
short nrglobals;
short nrvars; short nrvars;
STATIC int Slv; STATIC int Slv;

View file

@ -33,7 +33,6 @@
#define newudbx() (bext_p) newstruct(bext_ud) #define newudbx() (bext_p) newstruct(bext_ud)
#define oldudbx(x) oldstruct(bext_ud,x) #define oldudbx(x) oldstruct(bext_ud,x)
short nrglobals;
short nrvars; short nrvars;
int Svalue,Svariable; int Svalue,Svariable;