📄 0.h
字号:
#define FPROC 23#define FFUNC 24#define CRANGE 25/* * Clnames points to an array of names for the * namelist classes. */char **clnames;/* * PRE-DEFINED NAMELIST OFFSETS * * The following are the namelist offsets for the * primitive types. The ones which are negative * don't actually exist, but are generated and tested * internally. These definitions are sensitive to the * initializations in nl.c. */#define TFIRST -7#define TFILE -7#define TREC -6#define TARY -5#define TSCAL -4#define TPTR -3#define TSET -2#define TSTR -1#define NIL 0#define TBOOL 1#define TCHAR 2#define TINT 3#define TDOUBLE 4#define TNIL 5#define T1INT 6#define T2INT 7#define T4INT 8#define T1CHAR 9#define T1BOOL 10#define T8REAL 11#define TLAST 11/* * SEMANTIC DEFINITIONS *//* * NOCON and SAWCON are flags in the tree telling whether * a constant set is part of an expression. * these are no longer used, * since we now do constant sets at compile time. */#define NOCON 0#define SAWCON 1/* * The variable cbn gives the current block number, * the variable bn is set as a side effect of a call to * lookup, and is the block number of the variable which * was found. */short bn, cbn;/* * The variable line is the current semantic * line and is set in stat.c from the numbers * embedded in statement type tree nodes. */short line;/* * The size of the display * which defines the maximum nesting * of procedures and functions allowed. * Because of the flags in the current namelist * this must be no greater than 32. */#define DSPLYSZ 20 /* * the following structure records whether a level declares * any variables which are (or contain) files. * this so that the runtime routines for file cleanup can be invoked. */bool dfiles[ DSPLYSZ ];/* * Structure recording information about a constant * declaration. It is actually the return value from * the routine "gconst", but since C doesn't support * record valued functions, this is more convenient. */struct { struct nl *ctype; short cival; double crval; char *cpval; /* note used to be int * */} con;/* * The set structure records the lower bound * and upper bound with the lower bound normalized * to zero when working with a set. It is set by * the routine setran in var.c. */struct { short lwrb, uprbp;} set; /* * structures of this kind are filled in by precset and used by postcset * to indicate things about constant sets. */struct csetstr { struct nl *csettype; long paircnt; long singcnt; bool comptime;};/* * The following flags are passed on calls to lvalue * to indicate how the reference is to affect the usage * information for the variable being referenced. * MOD is used to set the NMOD flag in the namelist * entry for the variable, ASGN permits diagnostics * to be formed when a for variable is assigned to in * the range of the loop. */#define NOFLAGS 0#define MOD 01#define ASGN 02#define NOUSE 04 /* * the following flags are passed to lvalue and rvalue * to tell them whether an lvalue or rvalue is required. * the semantics checking is done according to the function called, * but for pc, lvalue may put out an rvalue by indirecting afterwards, * and rvalue may stop short of putting out the indirection. */#define LREQ 01#define RREQ 02double MAXINT;double MININT;/* * Variables for generation of profile information. * Monflg is set when we want to generate a profile. * Gocnt record the total number of goto's and * cnts records the current counter for generating * COUNT operators. */short gocnt;short cnts;/* * Most routines call "incompat" rather than asking "!compat" * for historical reasons. */#define incompat !compat/* * Parts records which declaration parts have been seen. * The grammar allows the "label" "const" "type" "var" and routine * parts to be repeated and to be in any order, so that * they can be detected semantically to give better * error diagnostics. * * The flag NONLOCALVAR indicates that a non-local var has actually * been used hence the display must be saved; NONLOCALGOTO indicates * that a non-local goto has been done hence that a setjmp must be done. */int parts[ DSPLYSZ ];#define LPRT 0x0001#define CPRT 0x0002#define TPRT 0x0004#define VPRT 0x0008#define RPRT 0x0010#define NONLOCALVAR 0x0020#define NONLOCALGOTO 0x0040/* * Flags for the "you used / instead of div" diagnostic */bool divchk;bool divflg;bool errcnt[DSPLYSZ];/* * Forechain links those types which are * ^ sometype * so that they can be evaluated later, permitting * circular, recursive list structures to be defined. */struct nl *forechain;/* * Withlist links all the records which are currently * opened scopes because of with statements. */struct nl *withlist;struct nl *intset;struct nl *input, *output;struct nl *program;/* progseen flag used by PC to determine if * a routine segment is being compiled (and * therefore no program statement seen) */bool progseen;/* * STRUCTURED STATEMENT GOTO CHECKING * * The variable level keeps track of the current * "structured statement level" when processing the statement * body of blocks. This is used in the detection of goto's into * structured statements in a block. * * Each label's namelist entry contains two pieces of information * related to this check. The first `NL_GOLEV' either contains * the level at which the label was declared, `NOTYET' if the label * has not yet been declared, or `DEAD' if the label is dead, i.e. * if we have exited the level in which the label was defined. * * When we discover a "goto" statement, if the label has not * been defined yet, then we record the current level and the current line * for a later error check. If the label has been already become "DEAD" * then a reference to it is an error. Now the compiler maintains, * for each block, a linked list of the labels headed by "gotos[bn]". * When we exit a structured level, we perform the routine * ungoto in stat.c. It notices labels whose definition levels have been * exited and makes them be dead. For labels which have not yet been * defined, ungoto will maintain NL_GOLEV as the minimum structured level * since the first usage of the label. It is not hard to see that the label * must eventually be declared at this level or an outer level to this * one or a goto into a structured statement will exist. */short level;struct nl *gotos[DSPLYSZ];#define NOTYET 10000#define DEAD 10000/* * Noreach is true when the next statement will * be unreachable unless something happens along * (like exiting a looping construct) to save * the day. */bool noreach;/* * UNDEFINED VARIABLE REFERENCE STRUCTURES */struct udinfo { int ud_line; struct udinfo *ud_next; char nullch;};/* * CODE GENERATION DEFINITIONS *//* * NSTAND is or'ed onto the abstract machine opcode * for non-standard built-in procedures and functions. */#define NSTAND 0400#define codeon() cgenflg++#define codeoff() --cgenflg#define CGENNING ( cgenflg >= 0 )/* * Codeline is the last lino output in the code generator. * It used to be used to suppress LINO operators but no * more since we now count statements. * Lc is the intepreter code location counter. *short codeline; */#ifdef OBJchar *lc;#endif/* * Routines which need types * other than "integer" to be * assumed by the compiler. */long lwidth();long leven();long aryconst();long a8tol();long roundup();struct nl *tmpalloc();struct nl *lookup();int *hash();char *alloc();int *pcalloc();char *savestr();char *esavestr();char *parnam();char *getlab();char *getnext();char *skipbl();char *nameof();char *pstrcpy();char *myctime();char *putlab();bool fcompat();bool constval();bool precset();bool nilfnil();struct nl *funccod();struct nl *pcfunccod();struct nl *lookup1();struct nl *hdefnl();struct nl *defnl();struct nl *flvalue();struct nl *plist();struct nl *enter();struct nl *nlcopy();struct nl *tyrec();struct nl *tyary();struct nl *tyrang();struct nl *tyscal();struct nl *deffld();struct nl *stklval();struct nl *scalar();struct nl *gen();struct nl *stkrval();struct nl *funcext();struct nl *funchdr();struct nl *funcbody();struct nl *yybaduse();struct nl *stackRV();struct nl *defvnt();struct nl *tyrec1();struct nl *reclook();struct nl *asgnop1();struct nl *pcasgconf();struct nl *gtype();struct nl *call();struct nl *lvalue();struct nl *pclvalue();struct nl *rvalue();struct nl *cset();struct nl *tycrang();struct tnode *newlist();struct tnode *addlist();struct tnode *fixlist();struct tnode *setupvar();struct tnode *setuptyrec();struct tnode *setupfield();struct tnode *tree();struct tnode *tree1();struct tnode *tree2();struct tnode *tree3();struct tnode *tree4();struct tnode *tree5();/* * type cast NIL to keep lint happy (which is not so bad) */#define NLNIL ( (struct nl *) NIL )#define TR_NIL ( (struct tnode *) NIL)/* * Funny structures to use * pointers in wild and wooly ways */struct cstruct{ char pchar;};struct { short pint; short pint2;};struct lstruct { long plong;};struct { double pdouble;};#define OCT 1#define HEX 2/* * MAIN PROGRAM VARIABLES, MISCELLANY *//* * Variables forming a data base referencing * the command line arguments with the "i" option, e.g. * in "pi -i scanner.i compiler.p". */char **pflist;short pflstc;short pfcnt;char *filename; /* current source file name */long tvec;extern char *snark; /* SNARK */extern char *classes[ ]; /* maps namelist classes to string names */#define derror error#ifdef PC /* * the current function number, for [ lines */ int ftnno; /* * the pc output stream */ FILE *pcstream;#endif PC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -