modified the string-constant printing routines; bts2str() is invoked

This commit is contained in:
erikb 1986-03-27 11:01:12 +00:00
parent f2ff7661e4
commit 5bdb108e47
3 changed files with 19 additions and 4 deletions

View file

@ -185,7 +185,7 @@ sim: cfiles
$(SIM) $(SIMFLAGS) `sources $(COBJ)` $(GSRC) $(LSRC) $(SIM) $(SIMFLAGS) `sources $(COBJ)` $(GSRC) $(LSRC)
#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO #AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO
main.o: LLlex.h Lpars.h alloc.h arith.h debug.h declar.h idf.h input.h inputtype.h level.h maxincl.h myalloc.h nobitfield.h nopp.h spec_arith.h specials.h target_sizes.h tokenname.h type.h use_tmp.h main.o: LLlex.h Lpars.h alloc.h arith.h debug.h declar.h idf.h input.h inputtype.h level.h maxincl.h myalloc.h nobitfield.h nopp.h spec_arith.h specials.h target_sizes.h tokenname.h type.h use_tmp.h ssize.h
idf.o: LLlex.h Lpars.h align.h alloc.h arith.h assert.h botch_free.h debug.h declar.h decspecs.h def.h idf.h idfsize.h label.h level.h nobitfield.h nopp.h sizes.h spec_arith.h specials.h stack.h storage.h struct.h type.h idf.o: LLlex.h Lpars.h align.h alloc.h arith.h assert.h botch_free.h debug.h declar.h decspecs.h def.h idf.h idfsize.h label.h level.h nobitfield.h nopp.h sizes.h spec_arith.h specials.h stack.h storage.h struct.h type.h
declarator.o: Lpars.h alloc.h arith.h botch_free.h declar.h expr.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h type.h declarator.o: Lpars.h alloc.h arith.h botch_free.h declar.h expr.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h type.h
decspecs.o: Lpars.h arith.h decspecs.h def.h level.h nobitfield.h spec_arith.h type.h decspecs.o: Lpars.h arith.h decspecs.h def.h level.h nobitfield.h spec_arith.h type.h

View file

@ -284,7 +284,8 @@ type2str(tp)
} }
char * /* the ultimate transient buffer supplier */ char * /* the ultimate transient buffer supplier */
next_transient() { next_transient()
{
static int bnum; static int bnum;
static char buf[MAXTRANS][300]; static char buf[MAXTRANS][300];
@ -340,8 +341,15 @@ p1_expr(lvl, expr)
v->vl_value); v->vl_value);
break; break;
case String: case String:
printf("%s\n", expr->SG_VALUE); {
char bts2str();
printf(
"%s\n",
bts2str(expr->SG_VALUE, expr->SG_LEN, next_transient())
);
break; break;
}
case Float: case Float:
printf("%s\n", expr->FL_VALUE); printf("%s\n", expr->FL_VALUE);
break; break;

View file

@ -21,6 +21,7 @@
#include "LLlex.h" #include "LLlex.h"
#include "alloc.h" #include "alloc.h"
#include "specials.h" #include "specials.h"
#include "ssize.h"
extern struct tokenname tkidf[], tkother[]; extern struct tokenname tkidf[], tkother[];
extern char *symbol2str(); extern char *symbol2str();
@ -328,8 +329,14 @@ preprocess()
printf(" "); printf(" ");
break; break;
case STRING: case STRING:
printf("\"%s\" ", dot.tk_bts); {
char sbuf[SSIZE];
char *bts2str();
printf("\"%s\" ",
bts2str(dot.tk_bts, dot.tk_len, sbuf));
break; break;
}
case INTEGER: case INTEGER:
printf("%ld ", dot.tk_ival); printf("%ld ", dot.tk_ival);
break; break;