#line 812 "book/intro.nw"
/* $Id: c.h,v 1.1.1.2 2002/04/21 13:25:22 peter Exp $ */
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>

/* These definitions are taken from the lcc book, p. 18.  They
   were not used in lcc 4.x, but are retained here to facilitate
   the port of PowerPC support from 3.x. */
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#define ARGS(plist)				plist
#define VARARGS(newlist,oldlist,olddcls)	newlist
#else
#define ARGS(plist)				()
#define VARARGS(newlist,oldlist,olddcls)	oldlist olddcls
#endif

#line 83 "book/alloc.nw"
#define NEW(p,a) ((p) = allocate(sizeof *(p), (a)))
#define NEW0(p,a) memset(NEW((p),(a)), 0, sizeof *(p))
#line 1664 "book/expr.nw"
#define isaddrop(op) (specific(op)==ADDRG+P || specific(op)==ADDRL+P \
	|| specific(op)==ADDRF+P)

#line 177 "book/input.nw"
#define	MAXLINE  512
#define	BUFSIZE 4096

#line 551 "book/lex.nw"
#define istypename(t,tsym) (kind[t] == CHAR \
	|| t == ID && tsym && tsym->sclass == TYPEDEF)
#line 237 "book/inter.nw"
#define sizeop(n) ((n)<<10)
#line 1226 "book/inter.nw"
#define generic(op)  ((op)&0x3F0)
#define specific(op) ((op)&0x3FF)
#line 1274 "book/inter.nw"
#define opindex(op) (((op)>>4)&0x3F)
#line 1279 "book/inter.nw"
#define opkind(op)  ((op)&~0x3F0)
#define opsize(op)  ((op)>>10)
#define optype(op)  ((op)&0xF)
#line 829 "book/intro.nw"
#ifdef __LCC__
#ifndef __STDC__
#define __STDC__
#endif
#endif
#line 925 "book/intro.nw"
#define NELEMS(a) ((int)(sizeof (a)/sizeof ((a)[0])))
#undef roundup
#define roundup(x,n) (((x)+((n)-1))&(~((n)-1)))
#line 59 "book/simp.nw"
#define mkop(op,ty) (specific((op) + ttob(ty)))

#line 224 "book/simp.nw"
#define extend(x,ty) ((x)&(1<<(8*(ty)->size-1)) ? (x)|((~0UL)<<(8*(ty)->size-1)) : (x)&ones(8*(ty)->size))
#line 335 "book/types.nw"
#define ones(n) ((n)>=8*sizeof (unsigned long) ? ~0UL : ~((~0UL)<<(n)))

#line 463 "book/types.nw"
#define isqual(t)     ((t)->op >= CONST)
#define unqual(t)     (isqual(t) ? (t)->type : (t))

#line 467 "book/types.nw"
#define isvolatile(t) ((t)->op == VOLATILE \
                    || (t)->op == CONST+VOLATILE)
#define isconst(t)    ((t)->op == CONST \
                    || (t)->op == CONST+VOLATILE)
#define isarray(t)    (unqual(t)->op == ARRAY)
#define isstruct(t)   (unqual(t)->op == STRUCT \
                    || unqual(t)->op == UNION)
#define isunion(t)    (unqual(t)->op == UNION)
#define isfunc(t)     (unqual(t)->op == FUNCTION)
#define isptr(t)      (unqual(t)->op == POINTER)
#define ischar(t)     ((t)->size == 1 && isint(t))
#define isint(t)      (unqual(t)->op == INT \
                    || unqual(t)->op == UNSIGNED)
#define isfloat(t)    (unqual(t)->op == FLOAT)
#define isarith(t)    (unqual(t)->op <= UNSIGNED)
#define isunsigned(t) (unqual(t)->op == UNSIGNED)
#define isscalar(t)   (unqual(t)->op <= POINTER \
                    || unqual(t)->op == ENUM)
#define isenum(t)     (unqual(t)->op == ENUM)
#line 787 "book/types.nw"
#define fieldsize(p)  (p)->bitsize
#define fieldright(p) ((p)->lsb - 1)
#define fieldleft(p)  (8*(p)->type->size - \
                        fieldsize(p) - fieldright(p))
#define fieldmask(p)  (~(~(unsigned)0<<fieldsize(p)))
#line 184 "book/inter.nw"
typedef struct node *Node;

#line 10 "book/list.nw"
typedef struct list *List;

#line 56 "book/stmt.nw"
typedef struct code *Code;

#line 871 "book/stmt.nw"
typedef struct swtch *Swtch;

#line 154 "book/sym.nw"
typedef struct symbol *Symbol;

#line 208 "book/sym.nw"
typedef struct coord {
	char *file;
	unsigned x, y;
} Coordinate;
#line 273 "book/sym.nw"
typedef struct table *Table;

#line 639 "book/sym.nw"
typedef union value {
	long i;
	unsigned long u;
	long double d;
	void *p;
	void (*g)(void);
	signed char b[1];
} Value;
#line 92 "book/tree.nw"
typedef struct tree *Tree;

#line 63 "book/types.nw"
typedef struct type *Type;

#line 766 "book/types.nw"
typedef struct field *Field;

#line 1461 "book/types.nw"
typedef struct {
	unsigned printed:1;
	unsigned marked;
	unsigned short typeno;
	void *xt;
} Xtype;

#line 822 "book/intro.nw"
#include "config.h"
#line 36 "book/inter.nw"
typedef struct metrics {
	unsigned char size, align, outofline;
} Metrics;
#line 81 "book/inter.nw"
typedef struct interface {
	
#line 46 "book/inter.nw"
Metrics charmetric;
Metrics shortmetric;
Metrics intmetric;
Metrics longmetric;
Metrics longlongmetric;
Metrics floatmetric;
Metrics doublemetric;
Metrics longdoublemetric;
Metrics ptrmetric;
Metrics structmetric;
#line 83 "book/inter.nw"
	
#line 621 "book/inter.nw"
unsigned little_endian:1;
#line 668 "book/inter.nw"
unsigned mulops_calls:1;
#line 678 "book/inter.nw"
unsigned wants_callb:1;
#line 703 "book/inter.nw"
unsigned wants_argb:1;
#line 722 "book/inter.nw"
unsigned left_to_right:1;
#line 733 "book/inter.nw"
unsigned wants_dag:1;
#line 746 "book/inter.nw"
unsigned unsigned_char:1;
#line 84 "book/inter.nw"
	
#line 105 "book/inter.nw"
void (*address)(Symbol p, Symbol q, long n);
void (*blockbeg)(Env *);
void (*blockend)(Env *);
void (*defaddress)(Symbol);
void (*defconst)  (int suffix, int size, Value v);
void (*defstring)(int n, char *s);
void (*defsymbol)(Symbol);
void (*emit)    (Node);
void (*export)(Symbol);
void (*function)(Symbol, Symbol[], Symbol[], int);
Node (*gen)     (Node);
void (*global)(Symbol);
void (*import)(Symbol);
void (*local)(Symbol);
void (*progbeg)(int argc, char *argv[]);
void (*progend)(void);
void (*segment)(int);
void (*space)(int);
void (*stabblock)(int, int, Symbol*);
void (*stabend)  (Coordinate *, Symbol, Coordinate **, Symbol *, Symbol *);
void (*stabfend) (Symbol, int);
void (*stabinit) (char *, int, char *[]);
void (*stabline) (Coordinate *);
void (*stabsym)  (Symbol);
void (*stabtype) (Symbol);
#line 85 "book/inter.nw"
	Xinterface x;
} Interface;
#line 1138 "book/inter.nw"
typedef struct binding {
	char *name;
	Interface *ir;
} Binding;

extern Binding bindings[];
#line 1147 "book/inter.nw"
extern Interface *IR;
#line 24 "book/event.nw"
typedef struct {
	List blockentry;
	List blockexit;
	List entry;
	List exit;
	List returns;
	List points;
	List calls;
	List end;
} Events;

#line 82 "book/lex.nw"
enum {
#define xx(a,b,c,d,e,f,g) a=b,
#define yy(a,b,c,d,e,f,g)
#include "token.h"
	LAST
};
#line 187 "book/inter.nw"
struct node {
	short op;
	short count;
 	Symbol syms[3];
	Node kids[2];
	Node link;
	Xnode x;
};
#line 223 "book/inter.nw"
enum {
	F=FLOAT,
	I=INT,
	U=UNSIGNED,
	P=POINTER,
	V=VOID,
	B=STRUCT
};
#line 239 "book/inter.nw"
#define gop(name,value) name=value<<4,
#define op(name,type,sizes)

enum { 
#line 247 "book/inter.nw"
gop(CNST,1)
	op(CNST,F,fdx)
	op(CNST,I,csilh)
	op(CNST,P,p)
	op(CNST,U,csilh)
gop(ARG,2)
	op(ARG,B,-)
	op(ARG,F,fdx)
	op(ARG,I,ilh)
	op(ARG,P,p)
	op(ARG,U,ilh)
gop(ASGN,3)
	op(ASGN,B,-)
	op(ASGN,F,fdx)
	op(ASGN,I,csilh)
	op(ASGN,P,p)
	op(ASGN,U,csilh)
gop(INDIR,4)
	op(INDIR,B,-)
	op(INDIR,F,fdx)
	op(INDIR,I,csilh)
	op(INDIR,P,p)
	op(INDIR,U,csilh)
gop(CVF,7)
	op(CVF,F,fdx)
	op(CVF,I,ilh)
gop(CVI,8)
	op(CVI,F,fdx)
	op(CVI,I,csilh)
	op(CVI,U,csilhp)
gop(CVP,9)
	op(CVP,U,p)
gop(CVU,11)
	op(CVU,I,csilh)
	op(CVU,P,p)
	op(CVU,U,csilh)
gop(NEG,12)
	op(NEG,F,fdx)
	op(NEG,I,ilh)
gop(CALL,13)
	op(CALL,B,-)
	op(CALL,F,fdx)
	op(CALL,I,ilh)
	op(CALL,P,p)
	op(CALL,U,ilh)
	op(CALL,V,-)
gop(RET,15)
	op(RET,F,fdx)
	op(RET,I,ilh)
	op(RET,P,p)
	op(RET,U,ilh)
	op(RET,V,-)
gop(ADDRG,16)
	op(ADDRG,P,p)
gop(ADDRF,17)
	op(ADDRF,P,p)
gop(ADDRL,18)
	op(ADDRL,P,p)
gop(ADD,19)
	op(ADD,F,fdx)
	op(ADD,I,ilh)
	op(ADD,P,p)
	op(ADD,U,ilhp)
gop(SUB,20)
	op(SUB,F,fdx)
	op(SUB,I,ilh)
	op(SUB,P,p)
	op(SUB,U,ilhp)
gop(LSH,21)
	op(LSH,I,ilh)
	op(LSH,U,ilh)
gop(MOD,22)
	op(MOD,I,ilh)
	op(MOD,U,ilh)
gop(RSH,23)
	op(RSH,I,ilh)
	op(RSH,U,ilh)
gop(BAND,24)
	op(BAND,I,ilh)
	op(BAND,U,ilh)
gop(BCOM,25)
	op(BCOM,I,ilh)
	op(BCOM,U,ilh)
gop(BOR,26)
	op(BOR,I,ilh)
	op(BOR,U,ilh)
gop(BXOR,27)
	op(BXOR,I,ilh)
	op(BXOR,U,ilh)
gop(DIV,28)
	op(DIV,F,fdx)
	op(DIV,I,ilh)
	op(DIV,U,ilh)
gop(MUL,29)
	op(MUL,F,fdx)
	op(MUL,I,ilh)
	op(MUL,U,ilh)
gop(EQ,30)
	op(EQ,F,fdx)
	op(EQ,I,ilh)
	op(EQ,U,ilhp)
gop(GE,31)
	op(GE,F,fdx)
	op(GE,I,ilh)
	op(GE,U,ilhp)
gop(GT,32)
	op(GT,F,fdx)
	op(GT,I,ilh)
	op(GT,U,ilhp)
gop(LE,33)
	op(LE,F,fdx)
	op(LE,I,ilh)
	op(LE,U,ilhp)
gop(LT,34)
	op(LT,F,fdx)
	op(LT,I,ilh)
	op(LT,U,ilhp)
gop(NE,35)
	op(NE,F,fdx)
	op(NE,I,ilh)
	op(NE,U,ilhp)
gop(JUMP,36)
	op(JUMP,V,-)
gop(LABEL,37)
	op(LABEL,V,-)
gop(LOAD,14)
	op(LOAD,B,-)
	op(LOAD,F,fdx)
	op(LOAD,I,csilh)
	op(LOAD,P,p)
	op(LOAD,U,csilhp)
#line 242 "book/inter.nw"
                     LASTOP };

#undef gop
#undef op
#line 847 "book/inter.nw"
enum { CODE=1, BSS, DATA, LIT };
#line 1197 "book/inter.nw"
enum { PERM=0, FUNC, STMT };
#line 13 "book/list.nw"
struct list {
	void *x;
	List link;
};

#line 59 "book/stmt.nw"
struct code {
	enum { Blockbeg, Blockend, Local, Address, Defpoint,
	       Label,    Start,    Gen,   Jump,    Switch
	} kind;
	Code prev, next;
	union {
		
#line 189 "book/stmt.nw"
struct {
	int level;
	Symbol *locals;
	Table identifiers, types;
	Env x;
} block;
#line 66 "book/stmt.nw"
		
#line 208 "book/stmt.nw"
Code begin;
#line 67 "book/stmt.nw"
		
#line 161 "book/stmt.nw"
Symbol var;

#line 68 "book/stmt.nw"
		
#line 177 "book/stmt.nw"
struct {
	Symbol sym;
	Symbol base;
	long offset;
} addr;
#line 69 "book/stmt.nw"
		
#line 249 "book/stmt.nw"
struct {
	Coordinate src;
	int point;
} point;
#line 69 "book/stmt.nw"
                   
		
#line 213 "book/stmt.nw"
Node forest;
#line 71 "book/stmt.nw"
		
#line 1487 "book/stmt.nw"
struct {
	Symbol sym;
	Symbol table;
	Symbol deflab;
	int size;
	long *values;
	Symbol *labels;
} swtch;

#line 72 "book/stmt.nw"
	} u;
};
#line 874 "book/stmt.nw"
struct swtch {
	Symbol sym;
	int lab;
	Symbol deflab;
	int ncases;
	int size;
	long *values;
	Symbol *labels;
};
#line 157 "book/sym.nw"
struct symbol {
	char *name;
	int scope;
	Coordinate src;
	Symbol up;
	List uses;
	int sclass;
	
#line 2170 "book/decl.nw"
unsigned structarg:1;

#line 1668 "book/expr.nw"
unsigned addressed:1;
#line 493 "book/simp.nw"
unsigned computed:1;
#line 796 "book/sym.nw"
unsigned temporary:1;
unsigned generated:1;
#line 839 "book/sym.nw"
unsigned defined:1;
#line 165 "book/sym.nw"
	Type type;
	float ref;
	union {
		
#line 589 "book/sym.nw"
struct {
	int label;
	Symbol equatedto;
} l;
#line 169 "book/sym.nw"
		
#line 755 "book/types.nw"
struct {
	unsigned cfields:1;
	unsigned vfields:1;
	Table ftab;		/* omit */
	Field flist;
} s;
#line 170 "book/sym.nw"
		
#line 924 "book/types.nw"
int value;
#line 171 "book/sym.nw"
		
#line 918 "book/types.nw"
Symbol *idlist;
#line 172 "book/sym.nw"
		
#line 288 "book/types.nw"
struct {
	Value min, max;
} limits;
#line 173 "book/sym.nw"
		
#line 672 "book/sym.nw"
struct {
	Value v;
	Symbol loc;
} c;
#line 174 "book/sym.nw"
		
#line 2031 "book/decl.nw"
struct {
	Coordinate pt;
	int label;
	int ncalls;
	Symbol *callee;
} f;
#line 175 "book/sym.nw"
		
#line 702 "book/decl.nw"
int seg;
#line 176 "book/sym.nw"
		
#line 2571 "book/decl.nw"
Symbol alias;
#line 177 "book/sym.nw"
		
#line 1979 "book/dag.nw"
struct {
	Node cse;
	int replace;
	Symbol next;
} t;
#line 178 "book/sym.nw"
	} u;
	Xsymbol x; struct { Symbol p; unsigned emitted:1; unsigned short pt[2]; } y;
};
#line 201 "book/sym.nw"
enum { CONSTANTS=1, LABELS, GLOBAL, PARAM, LOCAL };
#line 95 "book/tree.nw"
struct tree {
	int op;
	Type type;
	Tree kids[2];
	Node node;
	union {
		
#line 908 "book/expr.nw"
Value v;
#line 935 "book/expr.nw"
Symbol sym;

#line 1897 "book/expr.nw"
Field field;
#line 102 "book/tree.nw"
	} u;
};
#line 167 "book/tree.nw"
enum {
	AND=38<<4,
	NOT=39<<4,
	OR=40<<4,
	COND=41<<4,
	RIGHT=42<<4,
	FIELD=43<<4
};
#line 66 "book/types.nw"
struct type {
	int op;
	Type type;
	int align;
	int size;
	union {
		
#line 141 "book/types.nw"
Symbol sym;
#line 73 "book/types.nw"
		
#line 649 "book/types.nw"
struct {
	unsigned oldstyle:1;
	Type *proto;
} f;
#line 74 "book/types.nw"
	} u;
	Xtype x;
};
#line 769 "book/types.nw"
struct field {
	char *name;
	Type type;
	int offset;
	short bitsize;
	short lsb;
	Field link;
};
#line 1490 "book/dag.nw"
extern int assignargs;
#line 1573 "book/dag.nw"
extern int prunetemps;
#line 2303 "book/dag.nw"
extern int nodecount;
#line 2027 "book/decl.nw"
extern Symbol cfunc;
#line 2086 "book/decl.nw"
extern Symbol retv;
#line 858 "book/enode.nw"
extern Tree (*optree[])(int, Tree, Tree);

#line 979 "book/error.nw"
extern char kind[];
#line 1173 "book/error.nw"
extern int errcnt;
extern int errlimit;
extern int wflag;
#line 36 "book/event.nw"
extern Events events;
#line 2080 "book/expr.nw"
extern float refinc;

#line 83 "book/input.nw"
extern unsigned char *cp;
extern unsigned char *limit;
#line 156 "book/input.nw"
extern char *firstfile;
extern char *file;
extern char *line;
extern int lineno;
#line 49 "book/lex.nw"
extern int t;
extern char *token;
extern Symbol tsym;
extern Coordinate src;
#line 275 "book/main.nw"
extern int Aflag;
extern int Pflag;
extern Symbol YYnull;
extern Symbol YYcheck;
extern int glevel;
extern int xref;

#line 2 "book/prof.nw"
extern int ncalled;
extern int npoints;

#line 753 "book/simp.nw"
extern int needconst;
extern int explicitCast;
#line 92 "book/stmt.nw"
extern struct code codehead;
extern Code codelist;
#line 584 "book/stmt.nw"
extern Table stmtlabs;
#line 2032 "book/stmt.nw"
extern double density;
#line 276 "book/sym.nw"
extern Table constants;
extern Table externals;
extern Table globals;
extern Table identifiers;
extern Table labels;
extern Table types;
#line 417 "book/sym.nw"
extern int level;

#line 904 "book/sym.nw"
extern List loci, symbols;

#line 958 "book/sym.nw"
extern List symbols;

#line 204 "book/tree.nw"
extern int where;
#line 266 "book/types.nw"
extern Type chartype;
extern Type doubletype;
extern Type floattype;
extern Type inttype;
extern Type longdouble;
extern Type longtype;
extern Type longlong;
extern Type shorttype;
extern Type signedchar;
extern Type unsignedchar;
extern Type unsignedlonglong;
extern Type unsignedlong;
extern Type unsignedshort;
extern Type unsignedtype;
extern Type charptype;
extern Type funcptype;
extern Type voidptype;
extern Type voidtype;
extern Type unsignedptr;
extern Type signedptr;
extern Type widechar;
#line 58 "book/alloc.nw"
extern void  *allocate(unsigned long n, unsigned a);
extern void deallocate(unsigned a);
#line 107 "book/alloc.nw"
extern void *newarray(unsigned long m, unsigned long n, unsigned a);
#line 14 "book/dag.nw"
extern void walk(Tree e, int tlab, int flab);
extern Node listnodes(Tree e, int tlab, int flab);
extern Node newnode(int op, Node left, Node right, Symbol p);
#line 19 "book/dag.nw"
extern Tree cvtconst(Tree);
extern void printdag(Node, int);
#line 2803 "book/decl.nw"
extern void compound(int, Swtch, int);
extern void defglobal(Symbol, int);
extern void finalize(void);
extern void program(void);

#line 187 "book/enode.nw"
extern Tree vcall(Symbol func, Type ty, ...);
#line 842 "book/enode.nw"
extern Tree addrof(Tree);
extern Tree asgn(Symbol, Tree);
extern Tree asgntree(int, Tree, Tree);
extern Type assign(Type, Tree);
extern Tree bittree(int, Tree, Tree);
extern Tree call(Tree, Type, Coordinate);
extern Tree calltree(Tree, Type, Tree, Symbol);
extern Tree condtree(Tree, Tree, Tree);
extern Tree cnsttree(Type, ...);
extern Tree consttree(unsigned int, Type);
extern Tree eqtree(int, Tree, Tree);
extern int iscallb(Tree);
extern Tree shtree(int, Tree, Tree);
extern void typeerror(int, Tree, Tree);

#line 870 "book/error.nw"
extern void test(int tok, char set[]);
#line 905 "book/error.nw"
extern void expect(int tok);
#line 974 "book/error.nw"
extern void skipto(int tok, char set[]);
#line 1168 "book/error.nw"
extern void error(const char *, ...);
extern int fatal(const char *, const char *, int);
extern void warning(const char *, ...);

#line 73 "book/event.nw"
typedef void (*Apply)(void *, void *, void *);
extern void attach(Apply, void *, List *);
#line 80 "book/event.nw"
extern void apply(List event, void *arg1, void *arg2);
#line 1104 "book/expr.nw"
extern Tree retype(Tree p, Type ty);
#line 1124 "book/expr.nw"
extern Tree rightkid(Tree p);
#line 1146 "book/expr.nw"
extern int hascall(Tree p);
#line 2063 "book/expr.nw"
extern Type binary(Type, Type);
extern Tree cast(Tree, Type);
extern Tree cond(Tree);
extern Tree expr0(int);
extern Tree expr(int);
extern Tree expr1(int);
extern Tree field(Tree, const char *);
extern char *funcname(Tree);
extern Tree idtree(Symbol);
extern Tree incr(int, Tree, Tree);
extern Tree lvalue(Tree);
extern Tree nullcall(Type, Symbol, Tree, Tree);
extern Tree pointer(Tree);
extern Tree rvalue(Tree);
extern Tree value(Tree);

#line 2 "book/init.nw"
extern void defpointer(Symbol);
extern Type initializer(Type, int);
extern void swtoseg(int);

#line 288 "book/input.nw"
extern void input_init(int, char *[]);
extern void fillbuf(void);
extern void nextline(void);

#line 45 "book/lex.nw"
extern int getchr(void);
extern int gettok(void);

#line 951 "book/inter.nw"
extern void emitcode(void);
extern void gencode (Symbol[], Symbol[]);
#line 1215 "book/inter.nw"
extern void fprint(FILE *f, const char *fmt, ...);
#line 1313 "book/inter.nw"
extern char *stringf(const char *, ...);
#line 2166 "book/inter.nw"
extern void check(Node);
#line 907 "book/intro.nw"
extern void print(const char *, ...);

#line 19 "book/list.nw"
extern List append(void *x, List list);
extern int  length(List list);
extern void *ltov (List *list, unsigned a);
#line 9 "book/main.nw"
extern void init(int, char *[]);

#line 191 "book/main.nw"
extern Type typename(void);
#line 199 "book/main.nw"
extern void checklab(Symbol p, void *cl);
#line 257 "book/main.nw"
extern Type enumdcl(void);
#line 271 "book/main.nw"
extern void main_init(int, char *[]);
extern int main(int, char *[]);

#line 3 "book/output.nw"
extern void vfprint(FILE *, char *, const char *, va_list);

#line 2 "book/profio.nw"
extern int process(char *);
extern int findfunc(char *, char *);
extern int findcount(char *, int, int);

#line 747 "book/simp.nw"
extern Tree constexpr(int);
extern int intexpr(int, int);
extern Tree simplify(int, Type, Tree, Tree);
extern int ispow2(unsigned long u);

#line 139 "book/stmt.nw"
extern int reachable(int);

#line 2019 "book/stmt.nw"
extern void addlocal(Symbol);
extern void branch(int);
extern Code code(int);
extern void definelab(int);
extern void definept(Coordinate *);
extern void equatelab(Symbol, Symbol);
extern Node jump(int);
extern void retcode(Tree);
extern void statement(int, Swtch, int);
extern void swcode(Swtch, int *, int, int);
extern void swgen(Swtch);

#line 13 "book/string.nw"
extern char * string(const char *str);
extern char *stringn(const char *str, int len);
extern char *stringd(long n);
#line 489 "book/sym.nw"
extern Symbol relocate(const char *name, Table src, Table dst);
#line 900 "book/sym.nw"
extern void use(Symbol p, Coordinate src);
#line 907 "book/sym.nw"
extern void locus(Table tp, Coordinate *cp);
#line 923 "book/sym.nw"
extern Symbol allsymbols(Table);

#line 961 "book/sym.nw"
extern Symbol constant(Type, Value);
extern void enterscope(void);
extern void exitscope(void);
extern Symbol findlabel(int);
extern Symbol findtype(Type);
extern void foreach(Table, int, void (*)(Symbol, void *), void *);
extern Symbol genident(int, Type, int);
extern int genlabel(int);
extern Symbol install(const char *, Table *, int, int);
extern Symbol intconst(int);
extern Symbol lookup(const char *, Table);
extern Symbol mkstr(char *);
extern Symbol mksymbol(int, const char *, Type);
extern Symbol newtemp(int, int, int);
extern Table table(Table, int);
extern Symbol temporary(int, Type);
extern char *vtoa(Type, Value);

#line 255 "book/tree.nw"
extern int nodeid(Tree);
extern char *opname(int);
extern int *printed(int);
extern void printtree(Tree, int);
extern Tree root(Tree);
extern Tree texpr(Tree (*)(int), int, int);
extern Tree tree(int, Type, Tree, Tree);

#line 295 "book/types.nw"
extern void type_init(int, char *[]);

#line 1080 "book/types.nw"
extern Type signedint(Type);

#line 1276 "book/types.nw"
extern int hasproto(Type);
#line 1318 "book/types.nw"
extern void outtype(Type, FILE *);
#line 1324 "book/types.nw"
extern void printdecl (Symbol p, Type ty);
extern void printproto(Symbol p, Symbol args[]);
extern char *typestring(Type ty, char *id);
#line 1346 "book/types.nw"
extern Field fieldref(const char *name, Type ty);
#line 1413 "book/types.nw"
extern Type array(Type, int, int);
extern Type atop(Type);
extern Type btot(int, int);
extern Type compose(Type, Type);
extern Type deref(Type);
extern int eqtype(Type, Type, int);
extern Field fieldlist(Type);
extern Type freturn(Type);
extern Type ftype(Type, Type);
extern Type func(Type, Type *, int);
extern Field newfield(char *, Type, Type);
extern Type newstruct(int, char *);
extern void printtype(Type, int);
extern Type promote(Type);
extern Type ptr(Type);
extern Type qual(int, Type);
extern void rmtypes(int);
extern int ttob(Type);
extern int variadic(Type);

