1 /* Begin include file pl1_macro_lex_dcls.incl.pl1 */
  2 
  3 
  4 /****^  HISTORY COMMENTS:
  5   1) change(87-05-11,Huen), approve(87-05-11,MCR7675),
  6      audit(87-05-11,RWaters), install(87-12-01,MR12.2-1005):
  7      Fix PL/1 bug2163 : Speeding up the macro processing.
  8                                                    END HISTORY COMMENTS */
  9 
 10 /* format: style2 */
 11 
 12 /* Created          Dec 80 M E Presser
 13    Modified
 14           11 May 87 - SH, speeding up the macro processing
 15           3 August 81 - MEP redefined token
 16           18 May 81 - MEP, redefined token, temp_seg_3, and token types
 17 */
 18 
 19 /* automatic */
 20 
 21      declare temp_segs              (5) pointer;
 22 
 23 /* use of temp_segs:
 24    1. tokens in pl1_macro_lex_
 25    2. output_string
 26    3. job information
 27    4. listing and cross_ref
 28    5. Unused just now
 29 */
 30 /* area */
 31 
 32      declare area                   area based (temp_seg_3.area_ptr);
 33 
 34 /* based */
 35 
 36      declare 1 atoken               aligned based,
 37                2 string_size        fixed binary (21) unaligned,
 38                                                             /* length of token string */
 39                2 created            bit (1) unaligned,      /* "1" iff created by pl1_macro */
 40                2 pct_type           fixed binary (5) unsigned unaligned,
 41                2 type               fixed binary (8) unsigned unaligned,
 42                                                             /* token_type */
 43                2 replace_by         fixed binary,           /* index of replacement value, if any */
 44                2 string_ptr         unaligned pointer;      /* pointer to start of token */
 45 
 46      declare 1 token                (divide (sys_info$max_seg_size, size (atoken), 19)) aligned based (temp_segs (1))
 47                                     like atoken;
 48 
 49 /* builtin */
 50 
 51      declare size                   builtin;
 52 
 53 /* structure for command line args */
 54 
 55      declare 1 args                 aligned based,
 56                2 string_size        fixed binary (21),
 57                2 string_ptr         unaligned pointer;
 58 
 59 /* structure for command line parameter control arg arguments */
 60 
 61      declare 1 params               aligned based,
 62                2 name               aligned like args,
 63                2 value              aligned like token;
 64 
 65 /* temp_seg_3 is used for general storage of system wide information */
 66 
 67      declare 1 temp_seg_3           aligned based (temp_segs (3)),
 68                2 area_ptr           pointer,                /* base of area */
 69                2 source_ptr         pointer,                /* ptr to source seg */
 70                2 source_length      fixed binary (21),      /* lenght (chars) of source */
 71                2 output_length      fixed binary (21),      /* length (chars) of output */
 72                2 constant_base      pointer,                /* start of chain of constant nodes */
 73                2 variable_base      pointer,                /* start of chain of variable nodes */
 74                2 source_depth       fixed binary,           /* depth of file_macro_stack */
 75                2 file_stack_ptr     pointer,                /* ptr -> file_macro_stack */
 76                2 flags              unaligned,
 77                  3 list             bit (1),                /* if .maclist to be made */
 78                  3 pad1             bit (35),
 79                2 target_value       fixed binary (17),      /* as returned by system_type_ */
 80                2 number_of_clargs   fixed binary,
 81                2 number_of_params   fixed binary,
 82                2 cl_args            (64) aligned like args,
 83                2 cl_params          (64) aligned like params;
 84 
 85 
 86      declare output_string          char (4 * sys_info$max_seg_size) based (temp_segs (2));
 87 
 88 /* variable node */
 89 
 90      declare 1 variable             aligned based,
 91                2 next               pointer unaligned,      /* next alloc in chain */
 92                2 nextv              pointer unaligned,      /* next var in hash chain */
 93                2 alias_id           fixed binary (17) unaligned,
 94                                                             /* index into token chain */
 95                2 variable_type      fixed binary unaligned, /* default, replace or set type */
 96                2 name_length        fixed binary (17) unaligned,
 97                2 name               character (variable_name_length refer (variable.name_length));
 98 
 99      declare variable_name_length   fixed binary;
100 
101 /* constant node */
102 
103      declare 1 constant             aligned based,
104                2 next               pointer,                /* next in chain */
105                2 string_length      fixed binary (21),
106                2 string_value       character (constant_length refer (constant.string_length));
107 
108      declare constant_length        fixed binary (21);
109 
110 /* token types */
111 
112      declare (
113              no_token               initial (0),
114              invalid_char           initial (1),
115              identifier             initial (2),
116              keyword_token          initial (3),
117              isub                   initial (4),
118              plus                   initial (5),
119              minus                  initial (6),
120              asterisk               initial (7),
121              slash                  initial (8),
122              expon                  initial (9),
123              not                    initial (10),
124              and                    initial (11),
125              or                     initial (12),
126              cat                    initial (13),
127              eq                     initial (14),
128              ne                     initial (15),
129              lt                     initial (16),
130              gt                     initial (17),
131              le                     initial (18),
132              ge                     initial (19),
133              ngt                    initial (20),
134              nlt                    initial (21),
135              prefix_plus            initial (22),
136              prefix_minus           initial (23),
137              assignment             initial (24),
138              colon                  initial (25),
139              semi_colon             initial (26),
140              comma                  initial (27),
141              period                 initial (28),
142              arrow                  initial (29),
143              left_parn              initial (30),
144              right_parn             initial (31),
145              percent                initial (32),
146              target_comma           initial (33),
147              comment_token          initial (34),
148              nl_vt_np_token         initial (35),
149              bit_string             initial (36),
150              char_string            initial (37),
151              fixed_bin              initial (38),
152              bin_integer            initial (39),
153              fixed_dec              initial (40),
154              dec_integer            initial (41),
155              float_bin              initial (42),
156              token_hole_1           initial (43),
157              float_dec              initial (44),
158              token_hole_2           initial (45),
159              i_fixed_bin            initial (46),
160              i_bin_integer          initial (47),
161              i_fixed_dec            initial (48),
162              i_dec_integer          initial (49),
163              i_float_bin            initial (50),
164              token_hole_3           initial (51),
165              i_float_dec            initial (52),
166              token_hole_4           initial (53),
167              white_space_token      initial (54)
168              )                      fixed binary (8) unsigned internal static options (constant);
169 
170 /* token class limits */
171 
172      declare (
173              min_delimiter_token    initial (5),
174              max_delimiter_token    initial (35),
175              min_constant_token     initial (36),
176              max_constant_token     initial (53),
177              min_arithmetic_token   initial (38),
178              max_arithmetic_token   initial (53)
179              )                      fixed binary (8) unsigned internal static options (constant);
180 
181 /* arithmetic token type masks */
182 
183      declare (
184              is_imaginary_constant  initial ("1000"b),
185              is_float_constant      initial ("0100"b),
186              is_decimal_constant    initial ("0010"b),
187              is_integral_constant   initial ("0001"b)
188              )                      bit (4) aligned internal static options (constant);
189 
190 /* valid keyword following a percent_sign and their attributes */
191 
192 /* format: off */
193 
194      declare 1 pct_keywords (19) aligned structure internal static options (constant),
195              2 name  character (8) varying
196 initial(
197                      "page",  "skip",   "replace",          "default",          "target", "isarg",  "isdef",
198                      "include","if",    "then",             "else",             "elseif", "endif",  "print",
199                      "error", "warn",   "abort",            "INCLUDE",          "set"),
200 
201              2 terminator fixed binary (17) unaligned /* refer to macro stack types */
202 initial(
203                      3,       3,        3,                  3,                  1,        1,        1,
204                      3,       2,        2,                  2,                  2,        2,        3,
205                      3,       3,        3,                  3,                  3),
206 
207              2 needs_reinterpreation bit (1) unaligned
208 initial(
209                     "0"b,     "0"b,     "1"b,               "1"b,               "1"b,     "1"b,     "1"b,
210                     "0"b,     "1"b,     "1"b,               "1"b,               "1"b,     "1"b,     "1"b,
211                     "1"b,     "1"b,     "1"b,               "1"b,               "1"b),
212 
213              2 m_index fixed binary (17) unaligned
214 initial(
215                     2,        3,        4,                  1,                  7,        8,        6,
216                     15,       9,        10,                 11,                 12,       13,       16,
217                     5,        17,       18,                 14,                 19);
218 
219 /* format: on */
220 
221 /* pct_types */
222 
223      declare (
224              pct_default            initial (1),
225              pct_page               initial (2),
226              pct_skip               initial (3),
227              pct_replace            initial (4),
228              pct_error              initial (5),
229              pct_isdef              initial (6),
230              pct_target             initial (7),
231              pct_isarg              initial (8),
232              pct_if                 initial (9),
233              pct_then               initial (10),
234              pct_else               initial (11),
235              pct_elseif             initial (12),
236              pct_endif              initial (13),
237              pct_INCLUDE            initial (14),
238              pct_include            initial (15),
239              pct_print              initial (16),
240              pct_warn               initial (17),
241              pct_abort              initial (18),
242              pct_set                initial (19)
243              )                      fixed binary internal static options (constant);
244 
245 /* variable types - in which statement type they were first declared */
246 
247      declare (
248              replace_var            initial (1),
249              default_var            initial (2),
250              set_var                initial (3),
251              parameter_var          initial (4)
252              )                      fixed binary internal static options (constant);
253 
254 /* macro stack types */
255 
256      declare (
257              paren_macro            initial (1),
258              if_macro               initial (2),
259              semicolon_macro        initial (3),
260              reinterpret_macro      initial (4)
261              )                      fixed binary internal static options (constant);
262 
263 /* lexical limits */
264 
265      declare (
266              max_bit_string_constant
267                                     initial (253),
268              max_char_string_constant
269                                     initial (254),
270              max_identifier_length  initial (256)
271              )                      fixed binary internal static options (constant);
272 
273 
274 /* external static */
275 
276      declare pl1_macro_severity_    fixed binary (35) external static;
277      declare sys_info$max_seg_size  fixed binary (19) external static;
278 
279 /* entry */
280 
281      declare pl1_macro_error_       entry (fixed binary (35), char (*), pointer, fixed binary (21), fixed binary (21));
282      declare pl1_macro_lex_         entry ((*) pointer, fixed binary (35));
283      declare pl1_macro_lex_$cleanup entry ((*) pointer);
284      declare system_type_           entry (char (*), char (*), fixed binary (17), fixed binary (35));
285 
286 /* constants mostly used by lex */
287 
288      declare arithchar              char (28) internal static options (constant)
289                                     initial ("0123456789(=^=<=>=+-*/)           .""
290 ");
291      declare alphabetics            char (52) internal static options (constant)
292                                     initial ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
293 
294      declare numerals               char (10) internal static options (constant) initial ("0123456789");
295 
296      declare identifier_chars       char (64) internal static options (constant)
297                                     initial ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$");
298 
299      declare lower_case_letters     char (26) internal static options (constant) initial ("abcdefghijklmnopqrstuvwxyz");
300      declare upper_case_letters     char (26) internal static options (constant) initial ("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
301 
302      declare zero_one               char (2) internal static options (constant) initial ("01");
303      declare QUOTE                  char (1) internal static options (constant) initial ("""");
304      declare QUOTEQUOTE             char (2) internal static options (constant) initial ("""""");
305 
306 /* miscellaneous constants */
307 
308      declare none                   fixed binary internal static options (constant) initial (0);
309 
310      declare macro_version          character (5) internal static options (constant) initial (" 2.0 ");
311      declare command                character (9) internal static options (constant) initial ("pl1_macro");
312 
313 /* error codes */
314 
315      declare NO_RESULT              fixed binary (35) internal static options (constant) initial (1);
316      declare COMPILER_ERROR         fixed binary (35) internal static options (constant) initial (2);
317      declare SYNTAX_ERROR           fixed binary (35) internal static options (constant) initial (3);
318      declare SEMANTIC_ERROR         fixed binary (35) internal static options (constant) initial (4);
319      declare STORAGE_SYSTEM_ERROR   fixed binary (35) internal static options (constant) initial (5);
320      declare IMPLEMENTATION_RESTRICTION
321                                     fixed binary (35) internal static options (constant) initial (6);
322      declare TARGET_STRING_ERROR    fixed binary (35) internal static options (constant) initial (7);
323 
324 %include system_types;
325 
326 /* END INCLUDE FILE . . . pl1_macro_lex_dcls.incl. */