decspecs.str
def.str
domacro.c
-doprnt.c
dumpidf.c
error.c
eval.c
EMKLIB = /user1/erikb/em/lib/libemk.a
EMELIB = /user1/erikb/em/lib/libeme.a
STRLIB = /user1/erikb/em/lib/libstr.a
+PRTLIB = /user1/erikb/em/lib/libprint.a
EMMESLIB = /user1/erikb/em/lib/libem_mes.a
-LIBS = $(EMMESLIB) $(EMKLIB) $(STRLIB) $(SYSLIB)
-ELIBS = $(EMMESLIB) $(EMELIB) $(STRLIB) $(SYSLIB)
+LIBS = $(EMMESLIB) $(EMKLIB) $(PRTLIB) $(STRLIB) $(SYSLIB)
+ELIBS = $(EMMESLIB) $(EMELIB) $(PRTLIB) $(STRLIB) $(SYSLIB)
LIB_INCLUDES = /user1/erikb/em/h
# Where to install the compiler and its driver
input.o domacro.o replace.o init.o options.o \
scan.o skip.o stack.o type.o ch7mon.o label.o eval.o \
switch.o storage.o ival.o conversion.o \
- blocks.o dataflow.o doprnt.o
+ blocks.o dataflow.o
# Objects of other generated C files
GOBJ = char.o symbol2str.o next.o
idepth.h idfsize.h ifdepth.h inputtype.h inumlength.h lapbuf.h \
maxincl.h myalloc.h nobitfield.h nopp.h \
nparams.h numsize.h parbufsize.h pathlength.h predefine.h \
- strsize.h target_sizes.h textsize.h use_tmp.h \
- ssize.h spec_arith.h
+ strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h
# Other generated files, for 'make clean' only
GENERATED = tab tokenfile.g Lpars.h LLfiles LL.output lint.out \
$(SIM) $(SIMFLAGS) `sources $(COBJ)` $(GSRC) $(LSRC)
#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 ssize.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
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
decspecs.o: Lpars.h arith.h decspecs.h def.h level.h nobitfield.h spec_arith.h type.h
struct.o: LLlex.h Lpars.h align.h arith.h assert.h botch_free.h debug.h def.h field.h idf.h level.h nobitfield.h nopp.h sizes.h spec_arith.h stack.h storage.h struct.h type.h
-expr.o: LLlex.h Lpars.h alloc.h arith.h botch_free.h declar.h decspecs.h def.h expr.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h type.h level.h
+expr.o: LLlex.h Lpars.h alloc.h arith.h botch_free.h declar.h decspecs.h def.h expr.h idf.h label.h level.h nobitfield.h nopp.h sizes.h spec_arith.h storage.h type.h
ch7.o: Lpars.h arith.h assert.h debug.h def.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h struct.h type.h
ch7bin.o: Lpars.h arith.h botch_free.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h storage.h struct.h type.h
-cstoper.o: Lpars.h arith.h expr.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h target_sizes.h type.h assert.h
+cstoper.o: Lpars.h arith.h assert.h debug.h expr.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h target_sizes.h type.h
arith.o: Lpars.h alloc.h arith.h botch_free.h expr.h field.h idf.h label.h mes.h nobitfield.h nopp.h spec_arith.h storage.h type.h
alloc.o: alloc.h assert.h debug.h myalloc.h
code.o: LLlex.h Lpars.h alloc.h arith.h assert.h atw.h botch_free.h code.h dataflow.h debug.h declar.h decspecs.h def.h expr.h idf.h label.h level.h mes.h nobitfield.h nopp.h sizes.h spec_arith.h specials.h stack.h storage.h type.h use_tmp.h
conversion.o: Lpars.h arith.h nobitfield.h sizes.h spec_arith.h type.h
blocks.o: arith.h atw.h sizes.h spec_arith.h
dataflow.o: dataflow.h
-doprnt.o: ssize.h
tokenfile.o: Lpars.h
declar.o: LLlex.h Lpars.h arith.h debug.h declar.h decspecs.h def.h expr.h field.h idf.h label.h nobitfield.h nopp.h sizes.h spec_arith.h struct.h type.h
statement.o: LLlex.h Lpars.h arith.h botch_free.h code.h debug.h def.h expr.h idf.h label.h nobitfield.h nopp.h spec_arith.h stack.h storage.h type.h
#undef NOBITFIELD 1 /* implement bitfields */
-!File: ssize.h
-#define SSIZE 1024 /* string-buffer size for print routines */
-
-
!File: spec_arith.h
/* describes internal compiler arithmetics */
#undef SPECIAL_ARITHMETICS /* something different from native long */
extern char options[];
if (options['m'])
- printf("Total nr of bytes allocated: %d\n",
+ print("Total nr of bytes allocated: %d\n",
sys_break(0) - firstfreeb);
}
#endif DEBUG
DfaEndFunction()
{
- if (NumberOfCalls == 0) {
- printf("DFA: %s: --none--\n", CurrentFunction);
- }
+ if (NumberOfCalls == 0)
+ print("DFA: %s: --none--\n", CurrentFunction);
}
DfaCallFunction(s)
char *s;
{
- printf("DFA: %s: %s\n", CurrentFunction, s);
+ print("DFA: %s: %s\n", CurrentFunction, s);
++NumberOfCalls;
}
#endif DATAFLOW
extern char options[];
-extern char *sprintf();
+extern char *sprint();
extern struct idf *idf_hashtable[];
extern char *symbol2str(), *type2str(), *next_transient();
newline() {
int dl = dumplevel;
- printf("\n");
+ print("\n");
while (dl >= 2) {
- printf("\t");
+ print("\t");
dl -= 2;
}
if (dl)
- printf(" ");
+ print(" ");
}
dumpidftab(msg, opt)
*/
int i;
- printf(">>> DUMPIDF, %s (start)", msg);
+ print(">>> DUMPIDF, %s (start)", msg);
dumpstack();
for (i = 0; i < HASHSIZE; i++) {
struct idf *notch = idf_hashtable[i];
}
}
newline();
- printf(">>> DUMPIDF, %s (end)\n", msg);
+ print(">>> DUMPIDF, %s (end)\n", msg);
}
dumpstack() {
struct stack_entry *se = stl->sl_entry;
newline();
- printf("%3d: ", stl->sl_level);
+ print("%3d: ", stl->sl_level);
while (se) {
- printf("%s ", se->se_idf->id_text);
+ print("%s ", se->se_idf->id_text);
se = se->next;
}
stl = stl->sl_previous;
}
- printf("\n");
+ print("\n");
}
dumpidf(idf, opt)
if ((opt&1) && idf->id_macro) {
if (!started++) {
newline();
- printf("%s:", idf->id_text);
+ print("%s:", idf->id_text);
}
- printf(" macro");
+ print(" macro");
}
#endif NOPP
if ((opt&2) && idf->id_reserved) {
if (!started++) {
newline();
- printf("%s:", idf->id_text);
+ print("%s:", idf->id_text);
}
- printf(" reserved: %d;", idf->id_reserved);
+ print(" reserved: %d;", idf->id_reserved);
}
if (idf->id_def && ((opt&4) || idf->id_def->df_level)) {
if (!started++) {
newline();
- printf("%s:", idf->id_text);
+ print("%s:", idf->id_text);
}
dumpdefs(idf->id_def, opt);
}
if (idf->id_sdef) {
if (!started++) {
newline();
- printf("%s:", idf->id_text);
+ print("%s:", idf->id_text);
}
dumpsdefs(idf->id_sdef, selector);
}
if (idf->id_struct) {
if (!started++) {
newline();
- printf("%s:", idf->id_text);
+ print("%s:", idf->id_text);
}
dumptags(idf->id_struct);
}
if (idf->id_enum) {
if (!started++) {
newline();
- printf("%s:", idf->id_text);
+ print("%s:", idf->id_text);
}
dumptags(idf->id_enum);
}
dumplevel++;
while (def && ((opt&4) || def->df_level)) {
newline();
- printf("L%d: %s %s%s%s%s%s %lo;",
+ print("L%d: %s %s%s%s%s%s %lo;",
def->df_level,
symbol2str(def->df_sc),
(def->df_register != REG_NONE) ? "reg " : "",
register int fund = tp->tp_fund;
newline();
- printf("L%d: %s %s",
+ print("L%d: %s %s",
tag->tg_level,
fund == STRUCT ? "struct" :
fund == UNION ? "union" :
tp->tp_idf->id_text
);
if (is_struct_or_union(fund)) {
- printf(" {");
+ print(" {");
dumpsdefs(tp->tp_sdef, field);
newline();
- printf("}");
+ print("}");
}
- printf(";");
+ print(";");
tag = tag->next;
}
dumplevel--;
dumplevel++;
while (sdef) {
newline();
- printf("L%d: ", sdef->sd_level);
+ print("L%d: ", sdef->sd_level);
#ifndef NOBITFIELD
if (sdk == selector)
#endif NOBITFIELD
- printf("selector %s at offset %lu in %s;",
+ print("selector %s at offset %lu in %s;",
type2str(sdef->sd_type),
sdef->sd_offset, type2str(sdef->sd_stype)
);
#ifndef NOBITFIELD
- else printf("field %s at offset %lu;",
+ else print("field %s at offset %lu;",
type2str(sdef->sd_type), sdef->sd_offset
);
#endif NOBITFIELD
buf[0] = '\0';
if (!tp) {
- sprintf(buf, "<NILTYPE>");
+ sprint(buf, "<NILTYPE>");
return buf;
}
- sprintf(buf, "(@%lx, #%ld, &%d) ",
+ sprint(buf, "(@%lx, #%ld, &%d) ",
tp, (long)tp->tp_size, tp->tp_align);
while (ops) {
switch (tp->tp_fund) {
case POINTER:
- sprintf(buf, "%spointer to ", buf);
+ sprint(buf, "%spointer to ", buf);
break;
case ARRAY:
- sprintf(buf, "%sarray [%ld] of ", buf, tp->tp_size);
+ sprint(buf, "%sarray [%ld] of ", buf, tp->tp_size);
break;
case FUNCTION:
- sprintf(buf, "%sfunction yielding ", buf);
+ sprint(buf, "%sfunction yielding ", buf);
break;
default:
- sprintf(buf, "%s%s%s", buf,
+ sprint(buf, "%s%s%s", buf,
tp->tp_unsigned ? "unsigned " : "",
symbol2str(tp->tp_fund)
);
if (tp->tp_idf)
- sprintf(buf, "%s %s", buf,
+ sprint(buf, "%s %s", buf,
tp->tp_idf->id_text);
#ifndef NOBITFIELD
if (tp->tp_field) {
struct field *fd = tp->tp_field;
- sprintf(buf, "%s [s=%ld,w=%ld]", buf,
+ sprint(buf, "%s [s=%ld,w=%ld]", buf,
fd->fd_shift, fd->fd_width);
}
#endif NOBITFIELD
message msg.
*/
if (options['x']) {
- printf("\n%s: ", msg);
- printf("(L=line, T=type, r/lV=r/lvalue, F=flags, D=depth)\n");
+ print("\n%s: ", msg);
+ print("(L=line, T=type, r/lV=r/lvalue, F=flags, D=depth)\n");
p1_expr(0, expr);
}
}
p1_indent(lvl);
if (!expr) {
- printf("NILEXPR\n");
+ print("NILEXPR\n");
return;
}
- printf("expr: L=%u, T=%s, %cV, F=%03o, D=%d, %s: ",
+ print("expr: L=%u, T=%s, %cV, F=%03o, D=%d, %s: ",
expr->ex_line,
type2str(expr->ex_type),
expr->ex_lvalue ? 'l' : 'r',
case Value:
switch (expr->VL_CLASS) {
case Const:
- printf("(Const) ");
+ print("(Const) ");
break;
case Name:
- printf("(Name) %s + ", expr->VL_IDF->id_text);
+ print("(Name) %s + ", expr->VL_IDF->id_text);
break;
case Label:
- printf("(Label) .%lu + ", expr->VL_LBL);
+ print("(Label) .%lu + ", expr->VL_LBL);
break;
default:
- printf("(Unknown) ");
+ print("(Unknown) ");
break;
}
- printf(expr->ex_type->tp_unsigned ? "%lu\n" : "%ld\n",
+ print(expr->ex_type->tp_unsigned ? "%lu\n" : "%ld\n",
expr->VL_VALUE);
break;
case String:
{
char bts2str();
- printf(
+ print(
"%s\n",
bts2str(expr->SG_VALUE, expr->SG_LEN, next_transient())
);
break;
}
case Float:
- printf("%s\n", expr->FL_VALUE);
+ print("%s\n", expr->FL_VALUE);
break;
case Oper:
o = &expr->ex_object.ex_oper;
- printf("\n");
+ print("\n");
p1_expr(lvl+1, o->op_left);
- p1_indent(lvl); printf("%s\n", symbol2str(o->op_oper));
+ p1_indent(lvl); print("%s\n", symbol2str(o->op_oper));
p1_expr(lvl+1, o->op_right);
break;
case Type:
- printf("\n");
+ print("\n");
break;
default:
- printf("UNKNOWN CLASS\n");
+ print("UNKNOWN CLASS\n");
break;
}
}
p1_indent(lvl) {
while (lvl--)
- printf(" ");
+ print(" ");
}
#endif DEBUG
}
if (fn)
- fprintf(ERROUT, "\"%s\", line %u: ", fn, ln);
+ fprint(ERROUT, "\"%s\", line %u: ", fn, ln);
if (remark)
- fprintf(ERROUT, "%s ", remark);
+ fprint(ERROUT, "%s ", remark);
doprnt(ERROUT, fmt, argv); /* contents of error */
- fprintf(ERROUT, "\n");
+ fprint(ERROUT, "\n");
}
if (options['h']) {
int i;
- printf("Hash table tally:\n");
+ print("Hash table tally:\n");
for (i = 0; i < HASHSIZE; i++) {
struct idf *notch = idf_hashtable[i];
int cnt = 0;
cnt++;
notch = notch->next;
}
- printf("%d %d\n", i, cnt);
+ print("%d %d\n", i, cnt);
}
- printf("End hash table tally\n");
+ print("End hash table tally\n");
}
}
#endif DEBUG
*/
static int name_cnt;
char buff[100];
- char *sprintf();
+ char *sprint();
- sprintf(buff, "#%d in %s, line %u",
+ sprint(buff, "#%d in %s, line %u",
++name_cnt, dot.tk_file, dot.tk_line);
return str2idf(buff);
}
#include "LLlex.h"
#include "alloc.h"
#include "specials.h"
-#include "ssize.h"
extern struct tokenname tkidf[], tkother[];
extern char *symbol2str();
if (strcmp(lastfilenm, dot.tk_file) == 0) {
if (dot.tk_line - lastlineno <= 1) {
lastlineno++;
- printf("\n");
+ print("\n");
}
else {
lastlineno = dot.tk_line;
if (!options['P'])
- printf("\n#line %ld \"%s\"\n",
+ print("\n#line %ld \"%s\"\n",
lastlineno,
lastfilenm
);
lastfilenm = dot.tk_file;
lastlineno = dot.tk_line;
if (!options['P'])
- printf("\n#line %ld \"%s\"\n",
+ print("\n#line %ld \"%s\"\n",
lastlineno, lastfilenm);
}
}
if (strcmp(lastfilenm, dot.tk_file) != 0) {
lastfilenm = dot.tk_file;
if (!options['P'])
- printf("\n#line %ld \"%s\"\n",
+ print("\n#line %ld \"%s\"\n",
lastlineno, lastfilenm);
}
switch (DOT) {
case IDENTIFIER:
case TYPE_IDENTIFIER:
- printf(dot.tk_idf->id_text);
- printf(" ");
+ print("%s ", dot.tk_idf->id_text);
break;
case STRING:
{
- char sbuf[SSIZE];
+ char sbuf[1024]; /* a transient buffer */
char *bts2str();
- printf("\"%s\" ",
- bts2str(dot.tk_bts, dot.tk_len, sbuf));
+ print("\"%s\" ", bts2str(dot.tk_bts, dot.tk_len, sbuf));
break;
}
case INTEGER:
- printf("%ld ", dot.tk_ival);
+ print("%ld ", dot.tk_ival);
break;
case FLOATING:
- printf("%s ", dot.tk_fval);
+ print("%s ", dot.tk_fval);
break;
case EOI:
case EOF:
return;
default: /* very expensive... */
- printf("%s ", symbol2str(DOT));
+ print("%s ", symbol2str(DOT));
}
}
}
#ifdef DEBUG
if (options['a']) {
- printf("\"%s\", %s, %s, %s\n",
+ print("\"%s\", %s, %s, %s\n",
idf->id_text,
(def->df_alloc == 0) ? "no alloc" :
(def->df_alloc == ALLOC_SEEN) ? "alloc seen" :
register struct sdef *newsdef;
int lvl = tg->tg_level;
-/*
- * char *type2str();
- * printf("add_sel: \n stp = %s\n tp = %s\n name = %s\n *szp = %ld\n",
- * type2str(stp), type2str(tp), idf->id_text, *szp);
- * ASSERT(**sdefpp == 0);
- * ASSERT(tg->tg_type == stp);
- */
-
if (options['R'] && !is_anon_idf(idf)) {
/* a K & R test */
- if (idf->id_struct && idf->id_struct->tg_level == level
- ) {
- warning("%s is also a struct/union tag",
- idf->id_text);
- }
+ if (idf->id_struct && idf->id_struct->tg_level == level)
+ warning("%s is also a struct/union tag", idf->id_text);
}
if (stp->tp_fund == STRUCT) {
#ifndef NOBITFIELD
if (fd == 0) { /* no field width specified */
-#endif NOBITFIELD
offset = align(*szp, tp->tp_align);
field_busy = 0;
-#ifndef NOBITFIELD
}
else {
/* if something is wrong, the type of the
*/
offset = add_field(szp, fd, &tp, idf, stp);
}
+#else NOBITFIELD
+ offset = align(*szp, tp->tp_align);
+ field_busy = 0;
#endif NOBITFIELD
}
else { /* (stp->tp_fund == UNION) */
newsdef->sd_offset = offset;
#ifndef NOBITFIELD
- if (tp->tp_fund == FIELD) {
+ if (tp->tp_fund == FIELD)
tp->tp_field->fd_sdef = newsdef;
- }
#endif NOBITFIELD
stack_idf(idf, stack_level_of(lvl));
if (stp->tp_fund == UNION) {
arith sel_size = size_of_type(tp, "member");
- if (*szp < sel_size) {
+ if (*szp < sel_size)
*szp = sel_size;
- }
stp->tp_align = lcm(stp->tp_align, tp->tp_align);
}
}