1 /* BEGIN INCLUDE FILE . . . format_pl1_dcls.incl.pl1 */
  2 
  3 /* DESCRIPTION:
  4    This include file contains common definitions used by the format_pl1
  5    programs.  It defines tokens, statement types, mode types, etc.
  6 */
  7 
  8 /* HISTORY:
  9 Written by somebody, sometime.
 10 Modified:
 11 07/15/84 by R. Michael Tague:  Added the statement types:
 12             percent_abort_statement through percent_warn_statement.  Added
 13             the condition is_macro_whitespace.  Added the modes: mode_indbegin,
 14             mode_indbeginend, mode_indthenbegin, mode_indthenbeginend,
 15             mode_indprocbody, mode_elsestmt, mode_equalind, and mode_linconind.
 16             Added style5.
 17 */
 18 
 19 /* format: style5 */
 20 
 21 /* automatic */
 22 
 23 declare temp_segs               (4) pointer;
 24 
 25 /* based */
 26 
 27 /* format_pl1_ places the unit_stack and the declare_stack after the token array */
 28 
 29 declare 1 token                 (divide (sys_info$max_seg_size, 3, 19))
 30                                 aligned based (temp_segs (1)),
 31           2 string_size         fixed binary (21) unaligned,
 32           2 pad                 bit (5) unaligned,
 33           2 type                fixed binary (8) unaligned,
 34           2 string_ptr          pointer unaligned,
 35           2 trailer_index       fixed binary (17);
 36 
 37 declare 1 trailer               (divide (sys_info$max_seg_size, 2, 19))
 38                                 aligned based (temp_segs (2)),
 39           2 string_size         fixed binary (21) unaligned,
 40           2 continued           bit (1) unaligned,
 41           2 pad                 bit (4) unaligned,
 42           2 type                fixed binary (8) unaligned,
 43           2 string_ptr          pointer unaligned;
 44 
 45 /* format_pl1_ places the item array and the levels array after the stmt array */
 46 
 47 declare 1 global_header         aligned based,
 48           2 source_ptr          pointer,
 49           2 source_length       fixed binary (21),
 50           2 n_tokens            fixed binary (17),
 51           2 n_trailers          fixed binary (17),
 52           2 n_stmts             fixed binary (17),
 53           2 output_length       fixed binary (21),
 54           2 max_severity        fixed binary (35),
 55           2 modes_ptr           pointer,
 56           2 modes_length        fixed binary (21),
 57           2 ca                  unaligned,
 58             3 check_comments    bit (1),
 59             3 check_strings     bit (1),
 60             3 force             bit (1),
 61             3 long              bit (1),
 62             3 record_style      bit (1),
 63             3 require_style_comment
 64                                 bit (1),
 65           2 flags               unaligned,
 66             3 include_file      bit (1),
 67             3 rdc_source        bit (1),
 68             3 pad               bit (28),
 69           2 command_line_style  aligned like style,
 70           2 prevailing_style    aligned like style,
 71           2 current_style       aligned like style;
 72 
 73 declare 1 global                aligned based (temp_segs (3)),
 74           2 header              aligned like global_header,
 75           2 stmt                (
 76                                 divide (sys_info$max_seg_size
 77                                 - size (global_header), 2, 19)),
 78             3 type              fixed binary (8) unaligned,
 79             3 subtype           fixed binary (8) unaligned,
 80             3 start             fixed binary (17) unaligned,
 81             3 end               fixed binary (17) unaligned,
 82             3 pad               bit (18) unaligned;
 83 
 84 declare output_string           char (4 * sys_info$max_seg_size)
 85                                 based (temp_segs (4));
 86 
 87 /* internal static */
 88 
 89 declare command                 char (10) internal static
 90                                 options (constant) initial ("format_pl1");
 91 
 92 /* token types */
 93 
 94 declare (
 95         no_token                initial (0),
 96         invalid_char            initial (1),
 97         identifier              initial (2),
 98         keyword_token           initial (3),
 99         isub                    initial (4),
100         plus                    initial (5),
101         minus                   initial (6),
102         asterisk                initial (7),
103         slash                   initial (8),
104         expon                   initial (9),
105         not                     initial (10),
106         and                     initial (11),
107         or                      initial (12),
108         cat                     initial (13),
109         eq                      initial (14),
110         ne                      initial (15),
111         lt                      initial (16),
112         gt                      initial (17),
113         le                      initial (18),
114         ge                      initial (19),
115         ngt                     initial (20),
116         nlt                     initial (21),
117         prefix_plus             initial (22),
118         prefix_minus            initial (23),
119         assignment              initial (24),
120         colon                   initial (25),
121         semi_colon              initial (26),
122         comma                   initial (27),
123         period                  initial (28),
124         arrow                   initial (29),
125         left_parn               initial (30),
126         right_parn              initial (31),
127         percent                 initial (32),
128         target_comma            initial (33),
129         comment_token           initial (34),
130         nl_vt_np_token          initial (35),
131         bit_string              initial (36),
132         char_string             initial (37),
133         fixed_bin               initial (38),
134         bin_integer             initial (39),
135         fixed_dec               initial (40),
136         dec_integer             initial (41),
137         float_bin               initial (42),
138         token_hole_1            initial (43),
139         float_dec               initial (44),
140         token_hole_2            initial (45),
141         i_fixed_bin             initial (46),
142         i_bin_integer           initial (47),
143         i_fixed_dec             initial (48),
144         i_dec_integer           initial (49),
145         i_float_bin             initial (50),
146         token_hole_3            initial (51),
147         i_float_dec             initial (52),
148         token_hole_4            initial (53)
149         )                       fixed binary (8) internal static
150                                 options (constant);
151 
152 /* token class limits */
153 
154 declare (
155         min_delimiter_token     initial (5),
156         max_delimiter_token     initial (35),
157         min_constant_token      initial (36),
158         max_constant_token      initial (53),
159         min_arithmetic_token    initial (38),
160         max_arithmetic_token    initial (53)
161         )                       fixed binary (8) internal static
162                                 options (constant);
163 
164 /* arithmetic token type masks */
165 
166 declare (
167         is_imaginary_constant   initial ("1000"b),
168         is_float_constant       initial ("0100"b),
169         is_decimal_constant     initial ("0010"b),
170         is_integral_constant    initial ("0001"b)
171         )                       bit (4) aligned internal static
172                                 options (constant);
173 
174 /* lexical limits */
175 
176 declare (
177         max_bit_string_constant initial (253),
178         max_char_string_constant
179                                 initial (254),
180         max_identifier_length   initial (256)
181         )                       fixed binary internal static options (constant);
182 
183 /* statement types */
184 
185 declare (
186         unknown_statement       initial (0),
187         allocate_statement      initial (1),
188         assignment_statement    initial (2),
189         begin_statement         initial (3),
190         call_statement          initial (4),
191         close_statement         initial (5),
192         declare_statement       initial (6),
193         lock_statement          initial (7),
194         delete_statement        initial (8),
195         display_statement       initial (9),
196         do_statement            initial (10),
197         else_clause             initial (11),
198         end_statement           initial (12),
199         entry_statement         initial (13),
200         exit_statement          initial (14),
201         format_statement        initial (15),
202         free_statement          initial (16),
203         get_statement           initial (17),
204         goto_statement          initial (18),
205         if_statement            initial (19),
206         locate_statement        initial (20),
207         null_statement          initial (21),
208         on_statement            initial (22),
209         open_statement          initial (23),
210         procedure_statement     initial (24),
211         put_statement           initial (25),
212         read_statement          initial (26),
213         return_statement        initial (27),
214         revert_statement        initial (28),
215         rewrite_statement       initial (29),
216         signal_statement        initial (30),
217         stop_statement          initial (31),
218         system_on_unit          initial (32),
219         unlock_statement        initial (33),
220         wait_statement          initial (34),
221         write_statement         initial (35),
222         default_statement       initial (36),
223         condition_prefix_list   initial (37),
224         label_prefix_list       initial (38),
225         percent_statement       initial (39),
226         percent_abort_statement initial (40),
227         percent_default_statement
228                                 initial (41),
229         percent_else_statement  initial (42),
230         percent_elseif_statement
231                                 initial (43),
232         percent_endif_statement initial (44),
233         percent_error_statement initial (45),
234         percent_if_statement    initial (46),
235         percent_include_statement
236                                 initial (47),
237         percent_page_statement  initial (48),
238         percent_print_statement initial (49),
239         percent_replace_statement
240                                 initial (50),
241         percent_set_statement   initial (51),
242         percent_skip_statement  initial (52),
243         percent_warn_statement  initial (53)
244         )                       fixed binary (8) internal static
245                                 options (constant);
246 
247 declare is_independent_statement
248                                 (0:53) bit (1) aligned internal static
249                                 options (constant)
250                                 initial ("0"b, (2) (1)"1"b, "0"b, (2) (1)"1"b,
251                                 "0"b, (3) (1)"1"b, (4) (1)"0"b, "1"b, "0"b,
252                                 (8) (1)"1"b, "0"b, (11) (1)"1"b, (18) (1)"0"b);
253 
254 declare is_macro_statement      (0:53) bit (1) aligned internal static
255                                 options (constant)
256                                 initial ((39) (1)"0"b, (15) (1)"1"b);
257 
258 declare is_macro_whitespace     (0:53) bit (1) aligned internal static
259                                 options (constant)
260                                 initial ((39) (1)"0"b, (3) (1)"1"b, (3) (1)"0"b,
261                                 "1"b, "0"b, (7) (1)"1"b);
262 
263 /* statement subtypes */
264 
265 declare (
266         subtype_none            initial (0),
267         subtype_noniterative_do initial (1)
268         )                       fixed binary (8) internal static
269                                 options (constant);
270 
271 /* style structures and constants */
272 
273 declare 1 style                 aligned based,
274           2 switches            (26) bit (1) unaligned,
275           2 pad                 bit (10) unaligned,
276           2 values              (10) fixed binary;
277 
278 /* named modes for format_pl1_ */
279 
280 declare (
281         mode_on                 defined (global.current_style.switches (1)),
282         mode_inddcls            defined (global.current_style.switches (2)),
283         mode_delnl              defined (global.current_style.switches (3)),
284         mode_insnl              defined (global.current_style.switches (4)),
285         mode_indattr            defined (global.current_style.switches (5)),
286         mode_linecom            defined (global.current_style.switches (6)),
287         mode_case               defined (global.current_style.switches (7)),
288         mode_ifthenstmt         defined (global.current_style.switches (8)),
289         mode_ifthendo           defined (global.current_style.switches (9)),
290         mode_ifthen             defined (global.current_style.switches (10)),
291         mode_indthenelse        defined (global.current_style.switches (11)),
292         mode_indnoniterdo       defined (global.current_style.switches (12)),
293         mode_indnoniterend      defined (global.current_style.switches (13)),
294         mode_indcomtxt          defined (global.current_style.switches (14)),
295         mode_thendo             defined (global.current_style.switches (15)),
296         mode_inditerdo          defined (global.current_style.switches (16)),
297         mode_indend             defined (global.current_style.switches (17)),
298         mode_indproc            defined (global.current_style.switches (18)),
299         mode_indcom             defined (global.current_style.switches (19)),
300         mode_indblkcom          defined (global.current_style.switches (20)),
301         mode_indbegin           defined (global.current_style.switches (21)),
302         mode_indbeginend        defined (global.current_style.switches (22)),
303         mode_indthenbegin       defined (global.current_style.switches (23)),
304         mode_indthenbeginend    defined (global.current_style.switches (24)),
305         mode_indprocbody        defined (global.current_style.switches (25)),
306         mode_elsestmt           defined (global.current_style.switches (26))
307         )                       bit (1);
308 
309 declare (
310         mode_ind                defined (global.current_style.values (1)),
311         mode_ll                 defined (global.current_style.values (2)),
312         mode_initcol            defined (global.current_style.values (3)),
313         mode_declareind         defined (global.current_style.values (4)),
314         mode_dclind             defined (global.current_style.values (5)),
315         mode_idind              defined (global.current_style.values (6)),
316         mode_struclvlind        defined (global.current_style.values (7)),
317         mode_comcol             defined (global.current_style.values (8)),
318         mode_equalind           defined (global.current_style.values (9)),
319         mode_lineconind         defined (global.current_style.values (10))
320         )                       fixed binary;
321 
322 /* mode names */
323 
324 declare switch_mode_names       (26) char (15) internal static
325                                 options (constant)
326                                 initial ("on", "inddcls", "delnl", "insnl",
327                                 "indattr", "linecom", "case", "ifthenstmt",
328                                 "ifthendo", "ifthen", "indthenelse",
329                                 "indnoniterdo", "indnoniterend", "indcomtxt",
330                                 "thendo", "inditerdo", "indend", "indproc",
331                                 "indcom", "indblkcom", "indbegin",
332                                 "indbeginend", "indthenbegin",
333                                 "indthenbeginend", "indprocbody", "elsestmt");
334 
335 declare switch_antonym_names    (26) char (4) internal static
336                                 options (constant)
337                                 initial ("off", (5) (1)"", "tree", (19) (1)"");
338 
339 declare value_mode_names        (10) char (12) internal static
340                                 options (constant)
341                                 initial ("ind", "ll", "initcol", "declareind",
342                                 "dclind", "idind", "struclvlind", "comcol",
343                                 "equalind", "lineconind");
344 
345 /* predefined styles */
346 
347 /* style1: on,inddcls,^delnl,^insnl,indattr,^linecom,case,^ifthenstmt,^ifthendo,^ifthen,^indthenelse,indnoniterdo,
348    ^indnoniterend,^indcomtxt,^thendo,inditerdo,^indend,^indproc,^indcom,indblkcom,indbegin,^indbeginend,indthenbegin,^indthenbeginend,indprocbody,elsestmt,ind5,ll122,initcol6,declareind8,
349    dclind8,idind23,struclvlind2,comcol61,equalind0,lineconind5
350    style2: style1,delnl,insnl
351    style3: style2,^inddcls,declareind10,dclind10,idind20
352    style4: style1,^inddcls,^indattr,linecom,ifthendo,^indnoniterdo,indcomtxt,^inditerdo,indproc,^indthenbegin,declareind9,dclind5
353    style5: style2,linecom,ifthen,^indnoniterdo,indnoniterend,indcomtxt,^indthenbegin,indthenbeginend,^indprocbody,^elsestmt,ind8,ll80,initcol0,idind24,comcol57,lineconind4
354 
355 
356 */
357 
358 declare 1 styles                (5) aligned internal static options (constant),
359           2 switches            (26) bit (1) unaligned
360                                 initial ("1"b, "1"b, "0"b, "0"b, "1"b, "0"b,
361                                 "1"b, "0"b, "0"b, "0"b, "0"b, "1"b, "0"b, "0"b,
362                                 "0"b, "1"b, "0"b, "0"b, "0"b, "1"b, "1"b, "0"b,
363                                 "1"b, "0"b, "1"b, "1"b, /* style1 */
364                                 "1"b, "1"b, "1"b, "1"b, "1"b, "0"b, "1"b, "0"b,
365                                 "0"b, "0"b, "0"b, "1"b, "0"b, "0"b, "0"b, "1"b,
366                                 "0"b, "0"b, "0"b, "1"b, "1"b, "0"b, "1"b, "0"b,
367                                 "1"b, "1"b,             /* style2 */
368                                 "1"b, "0"b, "1"b, "1"b, "1"b, "0"b, "1"b, "0"b,
369                                 "0"b, "0"b, "0"b, "1"b, "0"b, "0"b, "0"b, "1"b,
370                                 "0"b, "0"b, "0"b, "1"b, "1"b, "0"b, "1"b, "0"b,
371                                 "1"b, "1"b,             /* style3 */
372                                 "1"b, "0"b, "0"b, "0"b, "0"b, "1"b, "1"b, "0"b,
373                                 "1"b, "0"b, "0"b, "0"b, "0"b, "1"b, "0"b, "0"b,
374                                 "0"b, "1"b, "0"b, "1"b, "1"b, "0"b, "0"b, "0"b,
375                                 "1"b, "1"b,             /* style4 */
376                                 "1"b, "1"b, "1"b, "1"b, "1"b, "1"b, "1"b, "0"b,
377                                 "0"b, "1"b, "0"b, "0"b, "1"b, "1"b, "0"b, "1"b,
378                                 "0"b, "0"b, "0"b, "1"b, "1"b, "0"b, "0"b, "1"b,
379                                 "0"b, "0"b),            /* style5 */
380           2 pad                 bit (10) unaligned initial ((5) (1)""b),
381           2 values              (10) fixed binary
382                                 initial (5, 122, 6, 8, 8, 23, 2, 61, 0, 5,
383                                                         /* style1 */
384                                 5, 122, 6, 8, 8, 23, 2, 61, 0, 5,
385                                                         /* style2 */
386                                 5, 122, 6, 10, 10, 20, 2, 61, 0, 5,
387                                                         /* style3 */
388                                 5, 122, 6, 9, 5, 23, 2, 61, 0, 5,
389                                                         /* style4 */
390                                 8, 80, 1, 8, 8, 24, 2, 57, 0, 4);
391                                                         /* style5 */
392 
393 /* control comment constants */
394 
395 declare control_comment_indicator
396                                 char (7) internal static
397                                 options (constant) initial ("format:");
398 declare mode_separator          char (1) internal static
399                                 options (constant) initial (",");
400 declare revert_mode             char (6) internal static
401                                 options (constant) initial ("revert");
402 declare style_mode              char (5) internal static
403                                 options (constant) initial ("style");
404 declare switch_mode_not_indicator
405                                 char (1) internal static
406                                 options (constant) initial ("^");
407 
408 /* if statement control comments */
409 
410 declare case_control_comment    char (10) internal static
411                                 options (constant) initial ("/* case */");
412 declare tree_control_comment    char (10) internal static
413                                 options (constant) initial ("/* tree */");
414 
415 /* comment indicator constants */
416 
417 declare comment_indicator_extra_chars
418                                 char (3) internal static
419                                 options (constant) initial ((3)"*");
420 declare comment_indicator_no_indcomtxt
421                                 char (1) internal static
422                                 options (constant) initial ("^");
423 
424 /* external static */
425 
426 declare sys_info$max_seg_size   fixed binary (19) external static;
427 
428 /* entry */
429 
430 declare format_pl1_lex_         entry ((*) pointer);
431 declare format_pl1_stmt_type_   entry ((*) pointer);
432 declare format_pl1_             entry ((*) pointer);
433 declare format_pl1_modes_       entry ((*) pointer, char (*), pointer, bit (1),
434                                 bit (1));
435 declare format_pl1_record_style_
436                                 entry ((*) pointer, fixed binary (21),
437                                 fixed binary);
438 declare format_pl1_long_        entry ((*) pointer, pointer);
439 declare format_pl1_error_       entry ((*) pointer, fixed binary (35), char (*),
440                                 pointer);
441 
442 /* END INCLUDE FILE . . . format_pl1_dcls.incl.pl1 */