|
|
1.1 root 1: #define P1_UNKNOWN 0
2: #define P1_COMMENT 1 /* Fortan comment string */
3: #define P1_EOF 2 /* End of file dummy token */
4: #define P1_SET_LINE 3 /* Reset the line counter */
5: #define P1_FILENAME 4 /* Name of current input file */
6: #define P1_NAME_POINTER 5 /* Pointer to hash table entry */
7: #define P1_CONST 6 /* Some constant value */
8: #define P1_EXPR 7 /* Followed by opcode */
9:
10: /* The next two tokens could be grouped together, since they always come
11: from an Addr structure */
12:
13: #define P1_IDENT 8 /* Char string identifier in addrp->user
14: field */
15: #define P1_EXTERN 9 /* Pointer to external symbol entry */
16:
17: #define P1_HEAD 10 /* Function header info */
18: #define P1_LIST 11 /* A list of data (e.g. arguments) will
19: follow the tag, type, and count */
20: #define P1_LITERAL 12 /* Hold the index into the literal pool */
21: #define P1_LABEL 13 /* label value */
22: #define P1_ASGOTO 14 /* Store the hash table pointer of
23: variable used in assigned goto */
24: #define P1_GOTO 15 /* Store the statement number */
25: #define P1_IF 16 /* store the condition as an expression */
26: #define P1_ELSE 17 /* No data */
27: #define P1_ELIF 18 /* store the condition as an expression */
28: #define P1_ENDIF 19 /* Marks the end of a block IF */
29: #define P1_ENDELSE 20 /* Marks the end of a block ELSE */
30: #define P1_ADDR 21 /* Addr data; used for arrays, common and
31: equiv addressing, NOT for names, idents
32: or externs */
33: #define P1_SUBR_RET 22 /* Subroutine return; the return expression
34: follows */
35: #define P1_COMP_GOTO 23 /* Computed goto; has expr, label list */
36: #define P1_FOR 24 /* C FOR loop; three expressions follow */
37: #define P1_ENDFOR 25 /* End of C FOR loop */
38: #define P1_FORTRAN 26 /* original Fortran source */
39: #define P1_CHARP 27 /* user.Charp field -- for long names */
40: #define P1_WHILE1START 28 /* start of DO WHILE */
41: #define P1_WHILE2START 29 /* rest of DO WHILE */
42: #define P1_PROCODE 30 /* invoke procode() -- to adjust params */
43: #define P1_ELSEIFSTART 31 /* handle extra code for abs, min, max
44: in else if() */
45:
46: #define P1_FILENAME_MAX 256 /* max filename length to retain (for -g) */
47: #define P1_STMTBUFSIZE 1400
48:
49:
50:
51: #define COMMENT_BUFFER_SIZE 255 /* max number of chars in each comment */
52: #define CONSTANT_STR_MAX 1000 /* max number of chars in string constant */
53:
54: extern void p1put (/* int */);
55: extern void p1_comment (/* char * */);
56: extern void p1_label (/* int */);
57: extern void p1_line_number (/* int */);
58: extern void p1put_filename();
59: extern void p1_expr (/* expptr */);
60: extern void p1_head (/* int, char * */);
61: extern void p1_if (/* expptr */);
62: extern void p1_else ();
63: extern void p1_elif (/* expptr */);
64: extern void p1_endif ();
65: extern void p1else_end ();
66: extern void p1_subr_ret (/* expptr */);
67: extern void p1_goto(/* long */);
68: extern void p1comp_goto (/* expptr, int, struct Labelblock *[] */);
69: extern void p1_for (/* expptr, expptr, expptr */);
70: extern void p1for_end ();
71:
72:
73: extern void p1puts (/* int, char * */);
74:
75: /* The pass 1 intermediate file has the following format:
76:
77: <ascii-integer-rep> [ : [ <sp> [ <data> ]]] \n
78:
79: e.g. 1: This is a comment
80:
81: This format is destined to change in the future, but for now a readable
82: form is more desirable than a compact form.
83:
84: NOTES ABOUT THE P1 FORMAT
85: ----------------------------------------------------------------------
86:
87: P1_COMMENT: The comment string (in <data>) may be at most
88: COMMENT_BUFFER_SIZE bytes long. It must contain no newlines
89: or null characters. A side effect of the way comments are
90: read in lex.c is that no '\377' chars may be in a
91: comment either.
92:
93: P1_SET_LINE: <data> holds the line number in the current source file.
94:
95: P1_INC_LINE: Increment the source line number; <data> is empty.
96:
97: P1_NAME_POINTER: <data> holds the integer representation of a
98: pointer into a hash table entry.
99:
100: P1_CONST: the first field in <data> is a type tag (one of the
101: TYxxxx macros), the next field holds the constant
102: value
103:
104: P1_EXPR: <data> holds the opcode number of the expression,
105: followed by the type of the expression (required for
106: OPCONV). Next is the value of vleng.
107: The type of operation represented by the
108: opcode determines how many of the following data items
109: are part of this expression.
110:
111: P1_IDENT: <data> holds the type, then storage, then the
112: char string identifier in the addrp->user field.
113:
114: P1_EXTERN: <data> holds an offset into the external symbol
115: table entry
116:
117: P1_HEAD: the first field in <data> is the procedure class, the
118: second is the name of the procedure
119:
120: P1_LIST: the first field in <data> is the tag, the second the
121: type of the list, the third the number of elements in
122: the list
123:
124: P1_LITERAL: <data> holds the litnum of a value in the
125: literal pool.
126:
127: P1_LABEL: <data> holds the statement number of the current
128: line
129:
130: P1_ASGOTO: <data> holds the hash table pointer of the variable
131:
132: P1_GOTO: <data> holds the statement number to jump to
133:
134: P1_IF: <data> is empty, the following expression is the IF
135: condition.
136:
137: P1_ELSE: <data> is empty.
138:
139: P1_ELIF: <data> is empty, the following expression is the IF
140: condition.
141:
142: P1_ENDIF: <data> is empty.
143:
144: P1_ENDELSE: <data> is empty.
145:
146: P1_ADDR: <data> holds a direct copy of the structure. The
147: next expression is a copy of vleng, and the next a
148: copy of memoffset.
149:
150: P1_SUBR_RET: The next token is an expression for the return value.
151:
152: P1_COMP_GOTO: The next token is an integer expression, the
153: following one a list of labels.
154:
155: P1_FOR: The next three expressions are the Init, Test, and
156: Increment expressions of a C FOR loop.
157:
158: P1_ENDFOR: Marks the end of the body of a FOR loop
159:
160: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.