/* $Header$ */
/* L E X I C A L A N A L Y Z E R */
+#include "debug.h"
#include "lint.h"
#include <alloc.h>
#include "idfsize.h"
#include "numsize.h"
-#include "debug.h"
#include "strsize.h"
#include "nopp.h"
#include "input.h"
ch3bin.o: Lpars.h
ch3bin.o: arith.h
ch3bin.o: botch_free.h
+ch3bin.o: debug.h
ch3bin.o: expr.h
ch3bin.o: idf.h
ch3bin.o: label.h
domacro.o: idfsize.h
domacro.o: ifdepth.h
domacro.o: input.h
+domacro.o: macbuf.h
domacro.o: macro.h
domacro.o: nopp.h
domacro.o: nparams.h
domacro.o: parbufsize.h
+domacro.o: replace.h
domacro.o: spec_arith.h
domacro.o: textsize.h
replace.o: LLlex.h
type.o: align.h
type.o: arith.h
type.o: botch_free.h
+type.o: debug.h
type.o: decspecs.h
type.o: def.h
type.o: idf.h
ch3mon.o: Lpars.h
ch3mon.o: arith.h
ch3mon.o: botch_free.h
+ch3mon.o: debug.h
ch3mon.o: def.h
ch3mon.o: expr.h
ch3mon.o: idf.h
ch3mon.o: label.h
ch3mon.o: lint.h
ch3mon.o: nobitfield.h
+ch3mon.o: nocross.h
ch3mon.o: nopp.h
+ch3mon.o: sizes.h
ch3mon.o: spec_arith.h
+ch3mon.o: target_sizes.h
ch3mon.o: type.h
label.o: Lpars.h
label.o: arith.h
conversion.o: type.h
util.o: Lpars.h
util.o: align.h
+util.o: debug.h
util.o: def.h
util.o: lint.h
util.o: nocross.h
l_misc.o: Lpars.h
l_misc.o: arith.h
l_misc.o: code.h
+l_misc.o: debug.h
l_misc.o: def.h
l_misc.o: expr.h
l_misc.o: file_info.h
expression.o: Lpars.h
expression.o: arith.h
expression.o: code.h
+expression.o: debug.h
expression.o: expr.h
expression.o: file_info.h
expression.o: idf.h
expression.o: label.h
expression.o: lint.h
expression.o: nobitfield.h
+expression.o: nocross.h
expression.o: nopp.h
+expression.o: sizes.h
expression.o: spec_arith.h
+expression.o: target_sizes.h
expression.o: type.h
program.o: LLlex.h
program.o: Lpars.h
program.o: arith.h
program.o: code.h
+program.o: debug.h
program.o: declar.h
program.o: decspecs.h
program.o: def.h
ival.o: type.h
char.o: class.h
symbol2str.o: Lpars.h
+next.o: debug.h
*/
#include <alloc.h>
+#include "debug.h"
#include "lint.h"
#include "nobitfield.h"
#include "idf.h"
/* $Header$ */
/* S E M A N T I C A N A L Y S I S -- C H A P T E R 3.3 */
-#include "lint.h"
#include "debug.h"
+#include "lint.h"
#include "nobitfield.h"
#include "idf.h"
#include <flt_arith.h>
/* SEMANTIC ANALYSIS (CHAPTER 3.3) -- BINARY OPERATORS */
#include "botch_free.h"
+#include "debug.h"
#include <alloc.h>
#include "lint.h"
#include "idf.h"
/* SEMANTIC ANALYSIS (CHAPTER 3.3) -- MONADIC OPERATORS */
#include "botch_free.h"
+#include "debug.h"
#include <alloc.h>
#include "nobitfield.h"
#include "Lpars.h"
/* C O D E - G E N E R A T I N G R O U T I N E S */
#include "lint.h"
+#include "debug.h"
#include <em.h>
#include "botch_free.h"
#include <alloc.h>
- indication of the use of floating points
- indication of the number of bytes used for
formal parameters
- - use of special identifiers such as "setjmp"
+ - use of special identifiers such as "__setjmp"
- "end" + number of bytes used for local variables
*/
arith nbytes;
func_name, (long) max_int);
}
C_ms_par(fbytes); /* # bytes for formals */
- if (sp_occurred[SP_SETJMP]) { /* indicate use of "setjmp" */
+ if (sp_occurred[SP_SETJMP]) { /* indicate use of "__setjmp" */
options['n'] = 1;
C_ms_gto();
sp_occurred[SP_SETJMP] = 0;
struct formal *dc_formal; /* params for function */
};
-/* ALLOCDEF "declarator" 50 */
-
-
struct formal { /* list of formals */
struct formal *next;
struct idf *fm_idf;
/* $Header$ */
/* D E C L A R A T O R M A N I P U L A T I O N */
+#include "debug.h"
#include "botch_free.h"
#include <alloc.h>
#include <flt_arith.h>
#include "label.h"
#include "expr.h"
#include "sizes.h"
-#include "debug.h"
#include "level.h"
extern char options[];
dtp->tp_align = tp->tp_align;
dtp->tp_typequal = typequal;
dtp->tp_size = tp->tp_size;
+ dtp->tp_pointer = tp->tp_pointer;
+ dtp->tp_array = tp->tp_array;
+ dtp->tp_function = tp->tp_function;
switch (fund) {
case ARRAY:
if (typequal) {
tp->tp_up = qualifier_type(tp->tp_up, typequal);
dtp->tp_typequal = typequal = 0;
}
+ goto nottagged;
+ case FIELD:
+ dtp->tp_field = tp->tp_field;
/* fallthrough */
case POINTER:
- case FUNCTION:
+ case FUNCTION: /* dont't assign tp_proto */
+ nottagged:
+ dtp->tp_up = tp->tp_up;
+ break;
case STRUCT:
case UNION:
case ENUM:
dtp->tp_idf = tp->tp_idf;
dtp->tp_sdef = tp->tp_sdef;
- dtp->tp_up = tp->tp_up;
- dtp->tp_field = tp->tp_field;
- dtp->tp_pointer = tp->tp_pointer;
- dtp->tp_array = tp->tp_array;
- dtp->tp_function = tp->tp_function;
break;
default:
break;
/* $Header$ */
/* PREPROCESSOR: CONTROLLINE INTERPRETER */
+#include "debug.h"
#include "arith.h"
#include "LLlex.h"
#include "Lpars.h"
-#include "debug.h"
#include "idf.h"
#include "input.h"
#include "nopp.h"
#include <system.h>
#include <em.h>
+#include "debug.h"
#include "lint.h"
#include "nopp.h"
#include "errout.h"
-#include "debug.h"
#include "tokenname.h"
#include <flt_arith.h>
/* EXPRESSION TREE HANDLING */
#include "lint.h"
+#include "debug.h"
#include "assert.h"
#include "botch_free.h"
#include <alloc.h>
#define Type 4 /* only its type is relevant */
struct expr {
- struct expr *next;
char *ex_file; /* the file it (probably) comes from */
unsigned int ex_line; /* the line it (probably) comes from */
struct type *ex_type;
{
#include <alloc.h>
#include "lint.h"
+#include "debug.h"
#include <flt_arith.h>
#include "arith.h"
#include "LLlex.h"
/* FIELD DESCRIPTOR */
struct field { /* for field specifiers */
- struct field *next;
arith fd_mask;
int fd_shift;
int fd_width;
struct sdef *fd_sdef; /* upward pointer */
};
-/* ALLOCDEF "field" 50 */
+/* ALLOCDEF "field" 10 */
break;
if (cmp == 0) {
/* suppose that special identifiers, as
- "setjmp", are already inserted
+ "__setjmp", are already inserted
*/
sp_occurred[notch->id_special] = 1;
return notch;
#ifdef LINT
#include <alloc.h> /* for st_free */
+#include "debug.h"
#include "interface.h"
#include <flt_arith.h>
#include "arith.h" /* definition arith */
#ifdef LINT
#include <alloc.h>
+#include "debug.h"
#include "interface.h"
#include <flt_arith.h>
#include "arith.h"
#ifdef LINT
#include <alloc.h> /* for st_free */
+#include "debug.h"
#include "interface.h"
#include "assert.h"
-#include "debug.h"
#include <flt_arith.h>
#include "arith.h" /* definition arith */
#include "label.h" /* definition label */
/* ALLOCDEF "macro" 20 */
-struct mlist {
- struct mlist *next;
- struct macro *m_mac;
- char *m_repl;
- char m_unstack;
-};
-
-/* ALLOCDEF "mlist" 20 */
-
/* `token' numbers of keywords of command-line processor
*/
#define K_UNKNOWN 0
#include "lint.h"
#include <system.h>
+#include "debug.h"
#include "nopp.h"
#include "target_sizes.h"
-#include "debug.h"
#include "use_tmp.h"
#include "inputtype.h"
#include "input.h"
#endif NOPP
struct sp_id special_ids[] = {
- {"setjmp", SP_SETJMP}, /* non-local goto's are registered */
+ {"__setjmp", SP_SETJMP}, /* non-local goto's are registered */
{0, 0}
};
#ifdef DEBUG
hash_stat();
+ if (options['m']) Info();
#endif DEBUG
sys_stop(err_occurred ? S_EXIT : S_END);
}
}
#endif NOPP
+
+Info()
+{
+ extern int cnt_string_cst, cnt_formal,
+ cnt_decl_unary, cnt_def, cnt_expr, cnt_field,
+ cnt_e_stack, cnt_localvar, cnt_proto, cnt_repl,
+ cnt_args, cnt_idf, cnt_macro, cnt_stack_level,
+ cnt_stack_entry, cnt_stmt_block, cnt_sdef, cnt_tag,
+ cnt_switch_hdr, cnt_case_entry, cnt_type, cnt_brace,
+ cnt_lint_stack_entry, cnt_state, cnt_auto_def,
+ cnt_expr_state, cnt_argument;
+ print("\
+%6d string_cst\n%6d formal\n\
+%6d decl_unary\n%6d def\n%6d expr\n%6d field\n\
+%6d e_stack\n%6d localvar\n%6d proto\n%6d repl\n\
+%6d args\n%6d idf\n%6d macro\n%6d stack_level\n\
+%6d stack_entry\n%6d stmt_block\n%6d sdef\n%6d tag\n\
+%6d switch_hdr\n%6d case_entry\n%6d type\n%6d brace\n\
+%6d lint_stack_entry\n%6d state\n%6d auto_def\n\
+%6d expr_state\n%6d argument\n",
+ cnt_string_cst, cnt_formal,
+ cnt_decl_unary, cnt_def, cnt_expr, cnt_field,
+ cnt_e_stack, cnt_localvar, cnt_proto, cnt_repl,
+ cnt_args, cnt_idf, cnt_macro, cnt_stack_level,
+ cnt_stack_entry, cnt_stmt_block, cnt_sdef, cnt_tag,
+ cnt_switch_hdr, cnt_case_entry, cnt_type, cnt_brace,
+ cnt_lint_stack_entry, cnt_state, cnt_auto_def,
+ cnt_expr_state, cnt_argument);
+
+
+}
#endif DEBUG
No_Mem() /* called by alloc package */
/* allocation definitions of struct \1 */\
extern char *st_alloc();\
extern struct \1 *h_\1;\
+#ifdef DEBUG\
+extern int cnt_\1;\
+extern char *std_alloc();\
+#define new_\1() ((struct \1 *) std_alloc((char **)\&h_\1, sizeof(struct \1), \2, \&cnt_\1))\
+#else\
#define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\
+#endif\
#define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\
:'
+echo '#include "debug.h"'
sed -n '
-s:^.*ALLOCDEF.*"\(.*\)".*$:struct \1 *h_\1 = 0;:p
+s:^.*ALLOCDEF.*"\(.*\)".*$:struct \1 *h_\1 = 0;\
+#ifdef DEBUG\
+int cnt_\1 = 0;\
+#endif:p
' $*
/* $Header$ */
/* PREPROCESSOR: PRAGMA INTERPRETER */
+#include "debug.h"
#include "arith.h"
#include "LLlex.h"
#include "Lpars.h"
-#include "debug.h"
#include "idf.h"
#include "input.h"
#include "ifdepth.h"
{
#include "lint.h"
#include "nopp.h"
+#include "debug.h"
#include <flt_arith.h>
#include "arith.h"
#include "LLlex.h"
return;
}
- while (tp && tp->tp_fund != FUNCTION) {
+ while (tp->tp_fund != FUNCTION) {
tp = tp->tp_up;
otp = otp->tp_up;
if (!tp) return;
any2parameter(estack[ecnt]);
}
if (pcnt >= 0 && !(pstack[0]->pl_flag & PL_ELLIPSIS))
- expr_error(*expp, "less parameters than specified in prototype");
+ expr_error(*expp, "fewer parameters than specified in prototype");
} else {
if (pl && !(pl->pl_flag & PL_VOID))
- expr_error(*expp, "less parameters than specified in prototype");
+ expr_error(*expp, "fewer parameters than specified in prototype");
}
}
#define PL_ELLIPSIS 0x04
#define PL_ERRGIVEN 0x08
-/* ALLOCDEF "proto" 10 */
+/* ALLOCDEF "proto" 20 */
+/*
+ * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
+ * See the copyright notice in the ACK home directory, in the file "Copyright".
+ */
+/* $Header$ */
+/* DEFINITIONS FOR THE MACRO REPLACEMENT ROUTINES */
+
struct repl {
struct repl *next;
struct idf *r_idf; /* name of the macro */
#define ABCD 2
#define g(x, y) x ## y + h(x)
- g(ABC, D);
+ g(ABC, D); // gives: 2 + h(f())
In this case we need two copies: one raw copy for the pasting
operator, and an expanded one as argument for h().
struct idf *se_idf;
};
-/* ALLOCDEF "stack_entry" 5 */
+/* ALLOCDEF "stack_entry" 50 */
extern struct stack_level *local_level;
extern struct stack_level *stack_level_of();
};
-/* ALLOCDEF "tag" 50 */
+/* ALLOCDEF "tag" 10 */
struct sdef *idf2sdef();
/* T Y P E D E F I N I T I O N M E C H A N I S M */
#include "nobitfield.h"
+#include "debug.h"
#include "botch_free.h"
#include <alloc.h>
#include "Lpars.h"
#include "nobitfield.h"
struct type {
- struct type *next; /* used only with ARRAY */
+ struct type *next; /* used for ARRAY and for qualifiers */
short tp_fund; /* fundamental type */
short tp_unsigned;
int tp_align;
int tp_typequal; /* type qualifier */
arith tp_size; /* -1 if declared but not defined */
- struct idf *tp_idf; /* name of STRUCT, UNION or ENUM */
- struct sdef *tp_sdef; /* to first selector */
- struct type *tp_up; /* from FIELD, POINTER, ARRAY
- or FUNCTION to fund. */
- struct field *tp_field; /* field descriptor if fund == FIELD */
- struct type *tp_pointer;/* to POINTER */
- struct type *tp_array; /* to ARRAY */
- struct proto *tp_proto; /* prototype list */
- struct proto *tp_pseudoproto; /* pseudo prototype list */
- struct type *tp_function;/* to FUNCTION */
+ struct type *tp_pointer; /* to POINTER */
+ struct type *tp_array; /* to ARRAY */
+ struct type *tp_function; /* to FUNCTION */
+ union {
+ struct {
+ struct idf *tp__idf; /* name of STRUCT, UNION or ENUM */
+ struct sdef *tp__sdef; /* to first selector */
+ } tp_istagged; /* used with STRUCT, UNION & ENUM */
+ struct {
+ /* tp__up: from FIELD, POINTER, ARRAY or FUNCTION to fund. */
+ struct type *tp__up;
+ union {
+ /* tp__field: field descriptor if fund == FIELD */
+ struct field *tp__field;
+ struct {
+ /* prototype list (pseudoproto for old_style def) */
+ struct proto *tp__proto;
+ struct proto *tp__pseudoproto;
+ } tp_isfunc;
+ } tp_f; /* FIELD or FUNCTION */
+ } tp_nottagged; /* used with POINTER, FIELD, ARRAY & FUNCTION */
+ } tp_union;
};
+#define tp_idf tp_union.tp_istagged.tp__idf
+#define tp_sdef tp_union.tp_istagged.tp__sdef
+#define tp_up tp_union.tp_nottagged.tp__up
+#define tp_field tp_union.tp_nottagged.tp_f.tp__field
+#define tp_proto tp_union.tp_nottagged.tp_f.tp_isfunc.tp__proto
+#define tp_pseudoproto tp_union.tp_nottagged.tp_f.tp_isfunc.tp__pseudoproto
/* Type qualifiers. Note: TQ_VOLATILE and TQ_CONST can be
'ored' to specify: extern const volatile int a;
extern arith size_of_type(), align();
-/* ALLOCDEF "type" 20 */
+/* ALLOCDEF "type" 50 */
#include <em_mes.h>
#include "lint.h"
+#include "debug.h"
#include "util.h"
#include "use_tmp.h"
#include "regcount.h"