String support and more run-time routines

This is a work in progress.
This commit is contained in:
rswier
2016-03-29 01:49:21 -04:00
parent a36ea820b6
commit 6a40af2f97
4 changed files with 153 additions and 3 deletions
+36
View File
@@ -204,6 +204,27 @@ getcc() {
error('cc');
}
getstr() {
auto i, c, d;
i = 1;
loop:
if ((c = mapch('"')) < 0) {
number(2048);
write('*n');
return(i);
}
if ((d = mapch('"')) < 0) {
number(c*512+4);
write('*n');
return(i);
}
number(c*512+d);
write('*n');
i = i+1;
goto loop;
}
mapch(c) {
extrn peekc;
auto a;
@@ -262,6 +283,21 @@ case21:
goto loop;
}
if (o==122) { /* string */
write('x ');
write('.+');
write('2*n');
write('t ');
write('2f');
write('*n');
write('.+');
write('1*n');
getstr();
write('2:');
write('*n');
goto loop;
}
if (o==20) { /* name */
if (*csym==0) { /* not seen */
if ((peeksym=symbol())==6) { /* ( */