Skip to content

allow negative numbers in #emit & changes to public variable behaviour #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/compiler/sc1.c
Original file line number Diff line number Diff line change
Expand Up @@ -4690,7 +4690,7 @@ static int testsymbols(symbol *root,int level,int testlabs,int testconst)
/* a variable */
if (sym->parent!=NULL)
break; /* hierarchical data type */
if ((sym->usage & (uWRITTEN | uREAD | uSTOCK))==0) {
if ((sym->usage & (uWRITTEN | uREAD | uSTOCK | uPUBLIC))==0) {
if (testconst)
errorset(sSETPOS,sym->lnumber);
error(203,sym->name,sym->lnumber); /* symbol isn't used (and not stock) */
Expand Down
13 changes: 12 additions & 1 deletion source/compiler/sc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,19 @@ static int command(void)
} /* if */
break;
default: {
char s2[20];
extern char *sc_tokens[];/* forward declaration */
char s2[33] = "-";
if ((char)tok == '-') {
if (lex(&val, &str) == tNUMBER) {
outval(-val, FALSE);
code_idx += opargs(1);
break;
} else {
strcpy((s2 + 1), str);
error(1, sc_tokens[tSYMBOL - tFIRST], s2);
break;
}/* if */
}/* if */
if (tok<256)
sprintf(s2,"%c",(char)tok);
else
Expand Down
10 changes: 8 additions & 2 deletions source/compiler/sc6.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,13 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
mainaddr=sym->addr;
} /* if */
} else if (sym->ident==iVARIABLE) {
if ((sym->usage & uPUBLIC)!=0)
match=++numpubvars;
if ((sym->usage & uPUBLIC) != 0) {
if ((sym->usage & uSTOCK) != 0) {
if ((sym->usage & (uREAD | uWRITTEN)) != 0)
match = ++numpubvars;
} /* if */
else match = ++numpubvars;
} /* if */
} /* if */
if (match) {
char alias[sNAMEMAX+1];
Expand Down Expand Up @@ -925,6 +930,7 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
count=0;
for (sym=glbtab.next; sym!=NULL; sym=sym->next) {
if (sym->ident==iVARIABLE && (sym->usage & uPUBLIC)!=0) {
if (((sym->usage & uSTOCK) != 0) && ((sym->usage & (uREAD | uWRITTEN)) == 0)) continue;
assert((sym->usage & uDEFINE)!=0);
assert(sym->vclass==sGLOBAL);
func.address=sym->addr;
Expand Down