summary refs log tree commit diff
path: root/lisc/emit.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-02-28 20:02:36 -0800
committerOri Bernstein <ori@eigenstate.org>2016-02-28 20:16:20 -0800
commit50c5af4290aed32a7733768c1bee2e64c93a7f84 (patch)
treeee2d1b70942006735e3d8af44ab38de43c94818a /lisc/emit.c
parentec7c4e0d60e22c10b6f7817436bd3f4abf2d5356 (diff)
downloadroux-50c5af4290aed32a7733768c1bee2e64c93a7f84.tar.gz
Allow trailing and ',' and references in data.
	This change adds support for two things:

		data $foo {l 123,}

	Which allows easier machine generation of data
	statements. It also adds the ability to parse
	and emit references in data declarations.
Diffstat (limited to 'lisc/emit.c')
-rw-r--r--lisc/emit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisc/emit.c b/lisc/emit.c
index 876d9ef..d0599a4 100644
--- a/lisc/emit.c
+++ b/lisc/emit.c
@@ -553,7 +553,10 @@ emitdat(Dat *d, FILE *f)
 		fprintf(f, "\t.asciz \"%s\"\n", d->u.str);
 		break;
 	default:
-		fprintf(f, "%s %"PRId64"\n", dtoa[d->type], d->u.num);
+		if (d->isref)
+			fprintf(f, "%s %s+%"PRId64"\n", dtoa[d->type], d->u.ref.nam, d->u.ref.off);
+		else
+			fprintf(f, "%s %"PRId64"\n", dtoa[d->type], d->u.num);
 		break;
 	}
 }