commit 61b8750baed6c7da1740de3f3de3005458d871cd
parent 5b4ec0be6b7ca9740fa72d99cfa9d9392dd5d14d
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Wed, 25 Aug 2021 22:56:24 +0100
Allowed long tokens within comments (typically URLs)
Diffstat:
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/projects/examples/demos/prng.tal b/projects/examples/demos/prng.tal
@@ -56,7 +56,7 @@
( returns the next number in a 65,535-long sequence,
which is never zero but every other 16-bit number
appears once before the sequence repeats )
- ( http://www.retroprogramming.com/2017/07/ xorshift-pseudorandom-numbers-in-z80.html )
+ ( http://www.retroprogramming.com/2017/07/xorshift-pseudorandom-numbers-in-z80.html )
,&seed LDR2
DUP2 #70 SFT2 EOR2
DUP2 #09 SFT2 EOR2
@@ -68,7 +68,7 @@
@prng2 ( -- number* )
( returns the next number in a (2^32-1)-long sequence )
- ( http://b2d-f9r.blogspot.com/2010/08/ 16-bit-xorshift-rng-now-with-more.html )
+ ( http://b2d-f9r.blogspot.com/2010/08/16-bit-xorshift-rng-now-with-more.html )
,&x LDR2
DUP2 #50 SFT2 EOR2
DUP2 #03 SFT2 EOR2
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -157,12 +157,12 @@ makemacro(char *name, FILE *f)
return error("Macro name is invalid", name);
m = &p.macros[p.mlen++];
scpy(name, m->name, 64);
- while(fscanf(f, "%s", word)) {
+ while(fscanf(f, "%63s", word)) {
if(word[0] == '{') continue;
if(word[0] == '}') break;
if(m->len > 64)
return error("Macro too large", name);
- if(slen(word) >= 64)
+ if(slen(word) >= 63)
return error("Word too long", name);
scpy(word, m->items[m->len++], 64);
}
@@ -290,8 +290,10 @@ pass1(FILE *f)
int ccmnt = 0;
Uint16 addr = 0;
char w[64], scope[64], subw[64];
- while(fscanf(f, "%s", w) == 1) {
+ while(fscanf(f, "%63s", w) == 1) {
if(skipblock(w, &ccmnt, '(', ')')) continue;
+ if(slen(w) == 63)
+ fprintf(stderr, "Warning: token beginning with \"%s\" is too long\n", w);
if(w[0] == '|') {
if(!sihx(w + 1))
return error("Pass 1 - Invalid padding", w);
@@ -320,7 +322,7 @@ pass2(FILE *f)
{
int ccmnt = 0, cmacr = 0;
char w[64], scope[64], subw[64];
- while(fscanf(f, "%s", w) == 1) {
+ while(fscanf(f, "%63s", w) == 1) {
if(w[0] == '%') continue;
if(w[0] == '&') continue;
if(w[0] == '[') continue;