GnuCOBOL  2.0
A free COBOL compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
tree.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Keisuke Nishida
3  Copyright (C) 2007-2012 Roger While
4 
5  This file is part of GNU Cobol.
6 
7  The GNU Cobol compiler is free software: you can redistribute it
8  and/or modify it under the terms of the GNU General Public License
9  as published by the Free Software Foundation, either version 3 of the
10  License, or (at your option) any later version.
11 
12  GNU Cobol is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with GNU Cobol. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef CB_TREE_H
23 #define CB_TREE_H
24 
25 #define CB_BEFORE cb_int0
26 #define CB_AFTER cb_int1
27 
28 #define COB_MAX_SUBSCRIPTS 16
29 
30 #define CB_PREFIX_ATTR "a_" /* Field attribute (cob_field_attr) */
31 #define CB_PREFIX_BASE "b_" /* Base address (unsigned char *) */
32 #define CB_PREFIX_CONST "c_" /* Constant or literal (cob_field) */
33 #define CB_PREFIX_DECIMAL "d_" /* Decimal number (cob_decimal) */
34 #define CB_PREFIX_FIELD "f_" /* Field (cob_field) */
35 #define CB_PREFIX_FILE "h_" /* File (cob_file) */
36 #define CB_PREFIX_KEYS "k_" /* File keys (cob_file_key []) */
37 #define CB_PREFIX_LABEL "l_" /* Label */
38 #define CB_PREFIX_SEQUENCE "s_" /* Collating sequence */
39 #define CB_PREFIX_STRING "st_" /* String */
40 
41 #define CB_PROGRAM_TYPE 0
42 #define CB_FUNCTION_TYPE 1
43 
44 #define CB_CALL_BY_REFERENCE 1
45 #define CB_CALL_BY_CONTENT 2
46 #define CB_CALL_BY_VALUE 3
47 
48 #define CB_SIZE_AUTO 0
49 #define CB_SIZE_1 1
50 #define CB_SIZE_2 2
51 #define CB_SIZE_4 3
52 #define CB_SIZE_8 4
53 #define CB_SIZE_UNSIGNED 8
54 
55 /* Hash values */
56 /* Power of 2 - see hash function in tree.c */
57 #define CB_WORD_HASH_SIZE (1U << 11)
58 #define CB_WORD_HASH_MASK (CB_WORD_HASH_SIZE - 1U)
59 
60 /* Basic tree tag */
61 enum cb_tag {
62  /* Primitives */
63  CB_TAG_CONST = 0, /* 0 Constant value */
64  CB_TAG_INTEGER, /* 1 Integer constant */
65  CB_TAG_STRING, /* 2 String constant */
66  CB_TAG_ALPHABET_NAME, /* 3 Alphabet-name */
67  CB_TAG_CLASS_NAME, /* 4 Class-name */
68  CB_TAG_LOCALE_NAME, /* 5 Locale-name */
69  CB_TAG_SYSTEM_NAME, /* 6 System-name */
70  CB_TAG_LITERAL, /* 7 Numeric/alphanumeric literal */
71  CB_TAG_DECIMAL, /* 8 Decimal number */
72  CB_TAG_FIELD, /* 9 User-defined variable */
73  CB_TAG_FILE, /* 10 File description */
74  CB_TAG_REPORT, /* 11 Report description */
75  /* Expressions */
76  CB_TAG_REFERENCE, /* 12 Reference to a field, file, or label */
77  CB_TAG_BINARY_OP, /* 13 Binary operation */
78  CB_TAG_FUNCALL, /* 14 Run-time function call */
79  CB_TAG_CAST, /* 15 Type cast */
80  CB_TAG_INTRINSIC, /* 16 Intrinsic function */
81  /* Statements */
82  CB_TAG_LABEL, /* 17 Label statement */
83  CB_TAG_ASSIGN, /* 18 Assignment statement */
84  CB_TAG_INITIALIZE, /* 19 INITIALIZE statement */
85  CB_TAG_SEARCH, /* 20 SEARCH statement */
86  CB_TAG_CALL, /* 21 CALL statement */
87  CB_TAG_GOTO, /* 22 GO TO statement */
88  CB_TAG_IF, /* 23 IF statement */
89  CB_TAG_PERFORM, /* 24 PERFORM statement */
90  CB_TAG_STATEMENT, /* 25 General statement */
91  CB_TAG_CONTINUE, /* 26 CONTINUE statement */
92  CB_TAG_CANCEL, /* 27 CANCEL statement */
93  CB_TAG_ALTER, /* 28 ALTER statement */
94  CB_TAG_SET_ATTR, /* 29 SET ATTRIBUTE statement */
95  /* Miscellaneous */
96  CB_TAG_PERFORM_VARYING, /* 30 PERFORM VARYING parameter */
97  CB_TAG_PICTURE, /* 31 PICTURE clause */
98  CB_TAG_LIST, /* 32 List */
99  CB_TAG_DIRECT, /* 33 Code output or comment */
100  CB_TAG_DEBUG, /* 34 Debug item set */
101  CB_TAG_DEBUG_CALL /* 35 Debug callback */
102 };
103 
104 /* Alphabet type */
105 #define CB_ALPHABET_NATIVE 0
106 #define CB_ALPHABET_ASCII 1
107 #define CB_ALPHABET_EBCDIC 2
108 #define CB_ALPHABET_CUSTOM 3
109 
110 /* Call convention bits */
111 /* Bit number Meaning Value */
112 /* 0 Parameter order 0 - Right to left */
113 /* 1 - Left to right */
114 /* 1 Stack manipulation 0 - Caller removes params */
115 /* 1 - Callee removes params */
116 /* 2 RETURN-CODE update 0 - Updated */
117 /* 1 - Not updated */
118 /* 3 Linking behaviour 0 - Normal linking */
119 /* 1 - Static CALL linking */
120 /* 4 OS/2 Optlink 0 - ?? */
121 /* 1 - ?? */
122 /* 5 Thunked to 16 bit 0 - No thunk */
123 /* 1 - Thunk */
124 /* 6 STDCALL convention 0 - CDECL */
125 /* 1 - STDCALL */
126 
127 #define CB_CONV_L_TO_R (1 << 0)
128 #define CB_CONV_CALLEE_STACK (1 << 1)
129 #define CB_CONV_NO_RET_UPD (1 << 2)
130 #define CB_CONV_STATIC_LINK (1 << 3)
131 #define CB_CONV_OPT_LINK (1 << 4)
132 #define CB_CONV_THUNK_16 (1 << 5)
133 #define CB_CONV_STDCALL (1 << 6)
134 
135 /* System category */
147 };
148 
149 /* Mnemonic defines */
150 /* Devices */
151 #define CB_DEVICE_SYSIN 0
152 #define CB_DEVICE_SYSOUT 1
153 #define CB_DEVICE_SYSERR 2
154 #define CB_DEVICE_CONSOLE 3
155 /* Switches */
156 #define CB_SWITCH_0 0
157 #define CB_SWITCH_1 1
158 #define CB_SWITCH_2 2
159 #define CB_SWITCH_3 3
160 #define CB_SWITCH_4 4
161 #define CB_SWITCH_5 5
162 #define CB_SWITCH_6 6
163 #define CB_SWITCH_7 7
164 #define CB_SWITCH_8 8
165 #define CB_SWITCH_9 9
166 #define CB_SWITCH_10 10
167 #define CB_SWITCH_11 11
168 #define CB_SWITCH_12 12
169 #define CB_SWITCH_13 13
170 #define CB_SWITCH_14 14
171 #define CB_SWITCH_15 15
172 /* Features */
173 #define CB_FEATURE_FORMFEED 0
174 #define CB_FEATURE_CONVENTION 1
175 #define CB_FEATURE_C01 2
176 #define CB_FEATURE_C02 3
177 #define CB_FEATURE_C03 4
178 #define CB_FEATURE_C04 5
179 #define CB_FEATURE_C05 6
180 #define CB_FEATURE_C06 7
181 #define CB_FEATURE_C07 8
182 #define CB_FEATURE_C08 9
183 #define CB_FEATURE_C09 10
184 #define CB_FEATURE_C10 11
185 #define CB_FEATURE_C11 12
186 #define CB_FEATURE_C12 13
187 
188 
189 /* Class category */
190 enum cb_class {
191  CB_CLASS_UNKNOWN = 0, /* 0 */
195  CB_CLASS_INDEX, /* 4 */
200 };
201 
202 /* Category */
204  CB_CATEGORY_UNKNOWN = 0, /* 0 */
217 };
218 
219 /* Storage sections */
221  CB_STORAGE_CONSTANT = 0, /* Constants */
222  CB_STORAGE_FILE, /* FILE SECTION */
223  CB_STORAGE_WORKING, /* WORKING-STORAGE SECTION */
224  CB_STORAGE_LOCAL, /* LOCAL-STORAGE SECTION */
225  CB_STORAGE_LINKAGE, /* LINKAGE SECTION */
226  CB_STORAGE_SCREEN, /* SCREEN SECTION */
227  CB_STORAGE_REPORT, /* REPORT SECTION */
228  CB_STORAGE_COMMUNICATION /* COMMUNICATION SECTION */
229 };
230 
231 /* Field types */
232 enum cb_usage {
233  CB_USAGE_BINARY = 0, /* 0 */
234  CB_USAGE_BIT, /* 1 */
238  CB_USAGE_FLOAT, /* 5 */
240  CB_USAGE_INDEX, /* 7 */
243  CB_USAGE_PACKED, /* 10 */
246  CB_USAGE_LENGTH, /* 13 */
256  CB_USAGE_COMP_6, /* 23 */
263 };
264 
265 
266 /* Cast type */
268  CB_CAST_INTEGER = 0, /* 0 */
272  CB_CAST_LENGTH, /* 4 */
274 };
275 
276 /* Intrinsic functions */
382 };
383 
384 /* Perform type */
391 };
392 
393 /* Reserved word list structure */
394 struct cobc_reserved {
395  const char *name; /* Word */
396  const unsigned short nodegen; /* Statement with END-xxx */
397  const unsigned short context_sens; /* Context sensitive */
398  const int token; /* Token */
399  const unsigned int context_set; /* Set context sensitive */
400  const unsigned int context_test; /* Test context sensitive */
401 };
402 
403 /* Basic common tree structure */
404 
405 struct cb_tree_common {
406  enum cb_tag tag; /* TAG - see below */
407  enum cb_category category; /* Category */
408  const char *source_file; /* Source file */
409  int source_line; /* Line */
410  int source_column; /* Column */
411 };
412 
413 /* Define common cb_tree/CB_TREE for following defines */
414 
415 typedef struct cb_tree_common *cb_tree;
416 
417 #define CB_TREE(x) ((struct cb_tree_common *) (x))
418 #define CB_TREE_TAG(x) (CB_TREE (x)->tag)
419 #define CB_TREE_CLASS(x) cb_tree_class (CB_TREE (x))
420 #define CB_TREE_CATEGORY(x) cb_tree_category (CB_TREE (x))
421 
422 #define CB_VALID_TREE(x) (x && CB_TREE (x) != cb_error_node)
423 #define CB_INVALID_TREE(x) (!(x) || CB_TREE (x) == cb_error_node)
424 
425 #ifdef COB_TREE_DEBUG
426 
427 #ifdef COB_HAVE_STEXPR
428 #define CB_TREE_CAST(tg,ty,x) \
429 ({ \
430  cb_tree _x = (x); \
431  if (unlikely(!_x || CB_TREE_TAG (_x) != tg)) { \
432  cobc_tree_cast_error (_x, __FILE__, __LINE__, tg); \
433  } \
434  ((ty *) (_x)); \
435 })
436 #else
437 #define CB_TREE_CAST(tg,ty,x) \
438  ((ty *)cobc_tree_cast_check (x, __FILE__, __LINE__, tg))
439 #endif
440 
441 #else
442 #define CB_TREE_CAST(tg,ty,x) ((ty *) (x))
443 #endif
444 
445 
446 /* Constant */
447 
448 struct cb_const {
449  struct cb_tree_common common; /* Common values */
450  const char *val; /* Constant value */
451 };
452 
453 #define CB_CONST(x) (CB_TREE_CAST (CB_TAG_CONST, struct cb_const, x))
454 #define CB_CONST_P(x) (CB_TREE_TAG (x) == CB_TAG_CONST)
455 
456 /* Code output or comment */
457 
458 struct cb_direct {
459  struct cb_tree_common common; /* Common values */
460  const char *line; /* Line redirect */
461  cob_u32_t flag_is_direct; /* Is directed */
462  cob_u32_t flag_new_line; /* Need new line */
463 };
464 
465 #define CB_DIRECT(x) (CB_TREE_CAST (CB_TAG_DIRECT, struct cb_direct, x))
466 #define CB_DIRECT_P(x) (CB_TREE_TAG (x) == CB_TAG_DIRECT)
467 
468 /* DEBUG */
469 
470 struct cb_debug {
471  struct cb_tree_common common; /* Common values */
472  cb_tree target; /* Target for debug */
473  const char *value; /* Value for debug */
474  cb_tree fld; /* Reference */
475  size_t size; /* Size if relevant */
476 };
477 
478 #define CB_DEBUG(x) (CB_TREE_CAST (CB_TAG_DEBUG, struct cb_debug, x))
479 #define CB_DEBUG_P(x) (CB_TREE_TAG (x) == CB_TAG_DEBUG)
480 
481 /* DEBUG Callback */
482 
483 struct cb_debug_call {
484  struct cb_tree_common common; /* Common values */
485  struct cb_label *target; /* Target label */
486 };
487 
488 #define CB_DEBUG_CALL(x) (CB_TREE_CAST (CB_TAG_DEBUG_CALL, struct cb_debug_call, x))
489 #define CB_DEBUG_CALL_P(x) (CB_TREE_TAG (x) == CB_TAG_DEBUG_CALL)
490 
491 /* Integer */
492 
493 struct cb_integer {
494  struct cb_tree_common common; /* Common values */
495  int val; /* Integer value */
496  unsigned int hexval; /* Output hex value */
497 };
498 
499 #define CB_INTEGER(x) (CB_TREE_CAST (CB_TAG_INTEGER, struct cb_integer, x))
500 #define CB_INTEGER_P(x) (CB_TREE_TAG (x) == CB_TAG_INTEGER)
501 
502 /* String */
503 
504 struct cb_string {
505  struct cb_tree_common common; /* Common values */
506  const unsigned char *data; /* Data */
507  size_t size; /* Data size */
508 };
509 
510 #define CB_STRING(x) (CB_TREE_CAST (CB_TAG_STRING, struct cb_string, x))
511 #define CB_STRING_P(x) (CB_TREE_TAG (x) == CB_TAG_STRING)
512 
513 /* Alphabet-name */
514 
515 struct cb_alphabet_name {
516  struct cb_tree_common common; /* Common values */
517  const char *name; /* Original name */
518  char *cname; /* Name used in C */
519  cb_tree custom_list; /* Custom ALPHABET */
520  unsigned int alphabet_type; /* ALPHABET type */
521  int low_val_char; /* LOW-VALUE */
522  int high_val_char; /* HIGH-VALUE */
523  int values[256]; /* Collating values */
524  int alphachr[256]; /* Actual values */
525 };
526 
527 #define CB_ALPHABET_NAME(x) (CB_TREE_CAST (CB_TAG_ALPHABET_NAME, struct cb_alphabet_name, x))
528 #define CB_ALPHABET_NAME_P(x) (CB_TREE_TAG (x) == CB_TAG_ALPHABET_NAME)
529 
530 /* Class-name */
531 
532 struct cb_class_name {
533  struct cb_tree_common common; /* Common values */
534  const char *name; /* Original name */
535  char *cname; /* Name used in C */
536  cb_tree list; /* List of CLASS definitions */
537 };
538 
539 #define CB_CLASS_NAME(x) (CB_TREE_CAST (CB_TAG_CLASS_NAME, struct cb_class_name, x))
540 #define CB_CLASS_NAME_P(x) (CB_TREE_TAG (x) == CB_TAG_CLASS_NAME)
541 
542 /* Locale name */
543 
544 struct cb_locale_name {
545  struct cb_tree_common common; /* Common values */
546  const char *name; /* Original name */
547  char *cname; /* Name used in C */
548  cb_tree list; /* List of locale definitions */
549 };
550 
551 #define CB_LOCALE_NAME(x) (CB_TREE_CAST (CB_TAG_LOCALE_NAME, struct cb_locale_name, x))
552 #define CB_LOCALE_NAME_P(x) (CB_TREE_TAG (x) == CB_TAG_LOCALE_NAME)
553 
554 /* System-name */
555 
556 struct cb_system_name {
557  struct cb_tree_common common; /* Common values */
558  cb_tree value; /* System value */
559  enum cb_system_name_category category; /* System category */
560  int token; /* Device attributes */
561 };
562 
563 #define CB_SYSTEM_NAME(x) (CB_TREE_CAST (CB_TAG_SYSTEM_NAME, struct cb_system_name, x))
564 #define CB_SYSTEM_NAME_P(x) (CB_TREE_TAG (x) == CB_TAG_SYSTEM_NAME)
565 
566 /* Literal */
567 
568 struct cb_literal {
569  struct cb_tree_common common; /* Common values */
570  unsigned char *data; /* Literal data */
571  cob_u32_t size; /* Literal size */
572  int scale; /* Numeric scale */
573  cob_u32_t llit; /* 'L' literal */
574  short sign; /* unsigned: 0 negative: -1 positive: 1 */
575  short all; /* ALL */
576 };
577 
578 #define CB_LITERAL(x) (CB_TREE_CAST (CB_TAG_LITERAL, struct cb_literal, x))
579 #define CB_LITERAL_P(x) (CB_TREE_TAG (x) == CB_TAG_LITERAL)
580 #define CB_NUMERIC_LITERAL_P(x) \
581  (CB_LITERAL_P (x) && CB_TREE_CATEGORY (x) == CB_CATEGORY_NUMERIC)
582 
583 /* Decimal */
584 
585 struct cb_decimal {
586  struct cb_tree_common common; /* Common values */
587  int id; /* Id for this decimal */
588 };
589 
590 #define CB_DECIMAL(x) (CB_TREE_CAST (CB_TAG_DECIMAL, struct cb_decimal, x))
591 #define CB_DECIMAL_P(x) (CB_TREE_TAG (x) == CB_TAG_DECIMAL)
592 
593 /* Picture */
594 
595 struct cb_picture {
596  struct cb_tree_common common; /* Common values */
597  char *orig; /* Original picture string */
598  char *str; /* Packed picture string */
599  int size; /* Byte size */
600  int lenstr; /* Length of picture string */
601  enum cb_category category; /* Field category */
602  cob_u32_t digits; /* Number of digit places */
603  int scale; /* 1/10^scale */
604  cob_u32_t have_sign; /* Have 'S' */
605  cob_u32_t real_digits; /* Real number of digits */
606 };
607 
608 #define CB_PICTURE(x) (CB_TREE_CAST (CB_TAG_PICTURE, struct cb_picture, x))
609 #define CB_PICTURE_P(x) (CB_TREE_TAG (x) == CB_TAG_PICTURE)
610 
611 /* Field */
612 
613 struct cb_key {
614  cb_tree key; /* KEY */
615  cb_tree ref; /* Reference used in SEARCH ALL */
616  cb_tree val; /* Value to be compared in SEARCH ALL */
617  int dir; /* ASCENDING or DESCENDING */
618 };
619 
620 struct cb_field {
621  struct cb_tree_common common; /* Common values */
622  const char *name; /* Original name */
623  const char *ename; /* Externalized name */
624  cb_tree depending; /* OCCURS ... DEPENDING ON */
625  cb_tree values; /* VALUE */
626  cb_tree false_88; /* 88 FALSE clause */
627  cb_tree index_list; /* INDEXED BY */
628  struct cb_field *parent; /* Upper level field (if any) */
629  struct cb_field *children; /* Top of lower level fields */
630  struct cb_field *sister; /* Fields at the same level */
631  struct cb_field *redefines; /* REDEFINES */
632  struct cb_field *rename_thru; /* RENAMES THRU */
633  struct cb_field *index_qual; /* INDEXED BY qualifier */
634  struct cb_file *file; /* FD section file name */
635  struct cb_key *keys; /* SEARCH key */
636  struct cb_picture *pic; /* PICTURE */
637  struct cb_field *vsize; /* Variable size cache */
638  struct cb_label *debug_section; /* DEBUG section */
639 
640  cb_tree screen_line; /* LINE */
641  cb_tree screen_column; /* COLUMN */
642  cb_tree screen_from; /* TO and USING */
643  cb_tree screen_to; /* FROM and USING */
644  cb_tree screen_foreg; /* FOREGROUND */
645  cb_tree screen_backg; /* BACKGROUND */
646  cb_tree screen_prompt; /* PROMPT */
647 
648  int id; /* Field id */
649  int size; /* Field size */
650  int level; /* Level number */
651  int memory_size; /* Memory size */
652  int offset; /* Byte offset from 01 level */
653  int occurs_min; /* OCCURS <max> */
654  int occurs_max; /* or OCCURS <min> TO <max> */
655  int indexes; /* Indices count (OCCURS) */
656 
657  int count; /* Reference count */
658  int mem_offset; /* Memory offset */
659  int nkeys; /* Number of keys */
660  int param_num; /* CHAINING param number */
661  int screen_flag; /* Flags used in SCREEN SECTION */
662  int step_count; /* STEP in REPORT */
663  unsigned int vaddr; /* Variable address cache */
664  cob_u32_t special_index; /* Special field */
665 
666  enum cb_storage storage; /* Storage section */
667  enum cb_usage usage; /* USAGE */
668 
669  /* Flags */
670  unsigned char flag_base; /* Has memory allocation */
671  unsigned char flag_external; /* EXTERNAL */
672  unsigned char flag_local_storage; /* LOCAL storage */
673  unsigned char flag_is_global; /* Is GLOBAL */
674 
675  unsigned int flag_local : 1; /* Has local scope */
676  unsigned int flag_occurs : 1; /* OCCURS */
677  unsigned int flag_sign_separate : 1; /* SIGN IS SEPARATE */
678  unsigned int flag_sign_leading : 1; /* SIGN IS LEADING */
679  unsigned int flag_blank_zero : 1; /* BLANK WHEN ZERO */
680  unsigned int flag_justified : 1; /* JUSTIFIED RIGHT */
681  unsigned int flag_binary_swap : 1; /* Binary byteswap */
682  unsigned int flag_real_binary : 1; /* BINARY-CHAR/SHORT/LONG/DOUBLE */
683 
684  unsigned int flag_is_pointer : 1; /* Is POINTER */
685  unsigned int flag_item_78 : 1; /* Is 78 level */
686  unsigned int flag_any_length : 1; /* Is ANY LENGTH */
687  unsigned int flag_item_based : 1; /* Is BASED */
688  unsigned int flag_filler : 1; /* Implicit/explicit filler */
689  unsigned int flag_synchronized : 1; /* SYNCHRONIZED */
690  unsigned int flag_invalid : 1; /* Is broken */
691  unsigned int flag_field : 1; /* Has been internally cached */
692 
693  unsigned int flag_chained : 1; /* CHAINING item */
694  unsigned int flag_anylen_done : 1; /* ANY LENGTH is set up */
695  unsigned int flag_indexed_by : 1; /* INDEXED BY item */
696  unsigned int flag_is_verified : 1; /* Has been verified */
697  unsigned int flag_is_c_long : 1; /* Is BINARY-C-LONG */
698  unsigned int flag_is_pdiv_parm : 1; /* Is PROC DIV USING */
699  unsigned int flag_local_alloced : 1; /* LOCAL storage is allocated */
700  unsigned int flag_no_init : 1; /* No initialize unless used */
701 
702  unsigned int flag_vsize_done : 1; /* Variable size cached */
703  unsigned int flag_vaddr_done : 1; /* Variable address cached */
704  unsigned int flag_odo_item : 1; /* ODO item */
705  unsigned int flag_field_debug : 1; /* DEBUGGING */
706  unsigned int flag_all_debug : 1; /* DEBUGGING */
707  unsigned int flag_no_field : 1; /* SCREEN dummy field */
708  unsigned int flag_any_numeric : 1; /* Is ANY NUMERIC */
709  unsigned int flag_is_returning : 1; /* Is RETURNING item */
710 };
711 
712 #define CB_FIELD(x) (CB_TREE_CAST (CB_TAG_FIELD, struct cb_field, x))
713 #define CB_FIELD_P(x) (CB_TREE_TAG (x) == CB_TAG_FIELD)
714 
715 #define CB_REF_OR_FIELD_P(x) (CB_REFERENCE_P (x) || CB_FIELD_P (x))
716 
717 #define CB_FIELD_PTR(x) \
718  (CB_REFERENCE_P (x) ? CB_FIELD (cb_ref (x)) : CB_FIELD (x))
719 
720 /* Index */
721 
722 #define CB_INDEX_P(x) cb_check_index_p (x)
723 
724 /* Label */
725 
726 struct cb_para_label {
727  struct cb_para_label *next;
728  struct cb_label *para;
729 };
730 
731 struct cb_alter_id {
732  struct cb_alter_id *next;
733  int goto_id;
734 };
735 
736 struct cb_label {
737  struct cb_tree_common common; /* Common values */
738  const char *name; /* Name */
739  const char *orig_name; /* Original name */
740  struct cb_label *section; /* Parent SECTION */
741  struct cb_label *debug_section; /* DEBUG SECTION */
742  struct cb_para_label *para_label; /* SECTION Paragraphs */
743  cb_tree exit_label; /* EXIT label */
744  struct cb_alter_id *alter_gotos; /* ALTER ids */
745  int id; /* Unique id */
746  int section_id; /* SECTION id */
747  int segment; /* Segment number */
748 
749  unsigned int flag_section : 1; /* Section */
750  unsigned int flag_entry : 1; /* Entry */
751  unsigned int flag_begin : 1; /* Begin label */
752  unsigned int flag_return : 1; /* End label */
753  unsigned int flag_real_label : 1; /* Is real label */
754  unsigned int flag_global : 1; /* GLOBAL */
755  unsigned int flag_declarative_exit : 1; /* Final EXIT */
756  unsigned int flag_declaratives : 1; /* DECLARATIVES */
757 
758  unsigned int flag_fatal_check : 1; /* Fatal check */
759  unsigned int flag_dummy_section : 1; /* Dummy MAIN */
760  unsigned int flag_dummy_paragraph : 1; /* Dummy MAIN */
761  unsigned int flag_dummy_exit : 1; /* Dummy EXIT */
762  unsigned int flag_next_sentence : 1; /* NEXT SENTENCE */
763  unsigned int flag_default_handler : 1; /* Error handler */
764  unsigned int flag_statement : 1; /* Has statement */
765  unsigned int flag_first_is_goto : 1; /* 1st is GO TO */
766 
767  unsigned int flag_alter : 1; /* ALTER code */
768  unsigned int flag_debugging_mode : 1; /* DEBUGGING MODE */
769  unsigned int flag_is_debug_sect : 1; /* DEBUGGING sect */
770  unsigned int flag_skip_label : 1; /* Skip label gen */
771 };
772 
773 #define CB_LABEL(x) (CB_TREE_CAST (CB_TAG_LABEL, struct cb_label, x))
774 #define CB_LABEL_P(x) (CB_TREE_TAG (x) == CB_TAG_LABEL)
775 
776 struct handler_struct {
777  struct cb_label *handler_label; /* Handler label */
778  struct cb_program *handler_prog; /* Handler program */
779 };
780 
781 /* File */
782 
783 struct cb_alt_key {
784  struct cb_alt_key *next; /* Pointer to next */
785  cb_tree key; /* Key item */
786  int duplicates; /* DUPLICATES */
787  int offset; /* Offset from start */
788 };
789 
790 struct cb_file {
791  struct cb_tree_common common; /* Common values */
792  const char *name; /* Original name */
793  char *cname; /* Name used in C */
794  /* SELECT */
795  cb_tree assign; /* ASSIGN */
796  cb_tree file_status; /* FILE STATUS */
797  cb_tree sharing; /* SHARING */
798  cb_tree key; /* RECORD KEY */
799  struct cb_alt_key *alt_key_list; /* ALTERNATE RECORD KEY */
800  /* FD/SD */
801  struct cb_field *record; /* Record descriptions */
802  cb_tree record_depending; /* RECORD DEPENDING */
803  cb_tree reports; /* REPORTS */
804  cb_tree linage; /* LINAGE */
805  cb_tree linage_ctr; /* LINAGE COUNTER */
806  cb_tree latfoot; /* LINAGE FOOTING */
807  cb_tree lattop; /* LINAGE TOP */
808  cb_tree latbot; /* LINAGE BOTTOM */
809  struct cb_label *handler; /* Error handler */
810  struct cb_program *handler_prog; /* Prog where defined */
811  struct cb_label *debug_section; /* DEBUG SECTION */
812  struct cb_alphabet_name *code_set; /* CODE-SET */
813  int record_min; /* RECORD CONTAINS */
814  int record_max; /* RECORD CONTAINS */
815  int optional; /* OPTIONAL */
816  int organization; /* ORGANIZATION */
817  int access_mode; /* ACCESS MODE */
818  int lock_mode; /* LOCK MODE */
819  int special; /* Special file */
820  int same_clause; /* SAME clause */
821  unsigned int flag_finalized : 1; /* Is finalized */
822  unsigned int flag_external : 1; /* Is EXTERNAL */
823  unsigned int flag_ext_assign : 1; /* ASSIGN EXTERNAL */
824  unsigned int flag_fileid : 1; /* ASSIGN DISK */
825  unsigned int flag_global : 1; /* Is GLOBAL */
826  unsigned int flag_fl_debug : 1; /* DEBUGGING */
827  unsigned int flag_line_adv : 1; /* LINE ADVANCING */
828 };
829 
830 #define CB_FILE(x) (CB_TREE_CAST (CB_TAG_FILE, struct cb_file, x))
831 #define CB_FILE_P(x) (CB_TREE_TAG (x) == CB_TAG_FILE)
832 
833 /* Reference */
834 
835 struct cb_word {
836  struct cb_word *next; /* Next word with the same hash value */
837  const char *name; /* Word name */
838  cb_tree items; /* Objects associated with this word */
839  int count; /* Number of words with the same name */
840  int error; /* Set to 1 if error detected */
841 };
842 
843 #define CB_WORD_TABLE_SIZE (CB_WORD_HASH_SIZE * sizeof (struct cb_word))
844 
845 struct cb_reference {
846  struct cb_tree_common common; /* Common values */
847  cb_tree chain; /* Next qualified name */
848  cb_tree value; /* Item referred to */
849  cb_tree subs; /* List of subscripts */
850  cb_tree offset; /* Reference mod offset */
851  cb_tree length; /* Reference mod length */
852  cb_tree check; /* Runtime checks */
853  struct cb_word *word; /* Pointer to word list */
854  struct cb_label *section; /* Current section */
855  struct cb_label *paragraph; /* Current paragraph */
856  struct cb_label *debug_section; /* Debug section */
857  size_t hashval; /* Hash value of name */
858 
859  unsigned int flag_receiving : 1; /* Reference target */
860  unsigned int flag_all : 1; /* ALL */
861  unsigned int flag_in_decl : 1; /* In DECLARATIVE */
862  unsigned int flag_decl_ok : 1; /* DECLARATIVE ref OK */
863  unsigned int flag_alter_code : 1; /* Needs ALTER code */
864  unsigned int flag_debug_code : 1; /* Needs DEBUG code */
865  unsigned int flag_all_debug : 1; /* Needs ALL DEBUG code */
866  unsigned int flag_target : 1; /* DEBUG item is target */
867 
868  unsigned int flag_optional : 1; /* Definition optional */
869  unsigned int flag_filler_ref : 1; /* Ref to FILLER */
870  unsigned int flag_duped : 1; /* Duplicate name */
871 };
872 
873 #define CB_REFERENCE(x) (CB_TREE_CAST (CB_TAG_REFERENCE, struct cb_reference, x))
874 #define CB_REFERENCE_P(x) (CB_TREE_TAG (x) == CB_TAG_REFERENCE)
875 
876 #define CB_NAME(x) (CB_REFERENCE (x)->word->name)
877 #define CB_WORD_COUNT(x) (CB_REFERENCE (x)->word->count)
878 #define CB_WORD_ITEMS(x) (CB_REFERENCE (x)->word->items)
879 
880 /* Binary operation */
881 
882 /*
883  '+' x + y
884  '-' x - y
885  '*' x * y
886  '/' x / y
887  '^' x ** y
888  '=' x = y
889  '>' x > y
890  '<' x < y
891  '[' x <= y
892  ']' x >= y
893  '~' x != y
894  '!' not x
895  '&' x and y
896  '|' x or y
897  '@' ( x )
898 */
899 
900 struct cb_binary_op {
901  struct cb_tree_common common; /* Common values */
902  cb_tree x; /* LHS */
903  cb_tree y; /* RHS */
904  int op; /* Operation */
905  unsigned int flag; /* Special usage */
906 };
907 
908 #define CB_BINARY_OP(x) (CB_TREE_CAST (CB_TAG_BINARY_OP, struct cb_binary_op, x))
909 #define CB_BINARY_OP_P(x) (CB_TREE_TAG (x) == CB_TAG_BINARY_OP)
910 
911 /* Function call */
912 
913 struct cb_funcall {
914  struct cb_tree_common common; /* Common values */
915  const char *name; /* Function name */
916  cb_tree argv[10]; /* Function arguments */
917  int argc; /* Number of arguments */
918  int varcnt; /* Variable argument count */
919  unsigned int screenptr; /* SCREEN usage */
920  unsigned int nolitcast; /* No cast for literals */
921 };
922 
923 #define CB_FUNCALL(x) (CB_TREE_CAST (CB_TAG_FUNCALL, struct cb_funcall, x))
924 #define CB_FUNCALL_P(x) (CB_TREE_TAG (x) == CB_TAG_FUNCALL)
925 
926 /* Type cast */
927 
928 struct cb_cast {
929  struct cb_tree_common common; /* Common values */
930  cb_tree val;
931  enum cb_cast_type cast_type;
932 };
933 
934 #define CB_CAST(x) (CB_TREE_CAST (CB_TAG_CAST, struct cb_cast, x))
935 #define CB_CAST_P(x) (CB_TREE_TAG (x) == CB_TAG_CAST)
936 
937 /* Assign */
938 
939 struct cb_assign {
940  struct cb_tree_common common; /* Common values */
941  cb_tree var;
942  cb_tree val;
943 };
944 
945 #define CB_ASSIGN(x) (CB_TREE_CAST (CB_TAG_ASSIGN, struct cb_assign, x))
946 #define CB_ASSIGN_P(x) (CB_TREE_TAG (x) == CB_TAG_ASSIGN)
947 
948 /* Intrinsic FUNCTION */
949 
950 struct cb_intrinsic_table {
951  const char *name; /* FUNCTION NAME */
952  const char *intr_routine; /* Routine name */
953  const int args; /* 0-n, negative = variable */
954  const int implemented; /* Have we implemented it? */
955  const enum cb_intr_enum intr_enum; /* Enum intrinsic */
956  const enum cb_category category; /* Category */
957  const unsigned int refmod; /* Can be refmodded */
958  const int min_args; /* Minimum number of args */
959  const int token; /* Token value */
960 };
961 
962 struct cb_intrinsic {
963  struct cb_tree_common common; /* Common values */
964  cb_tree name; /* INTRINSIC name */
965  cb_tree args; /* Arguments */
966  cb_tree intr_field; /* Field to use */
967  struct cb_intrinsic_table *intr_tab; /* Table pointer */
968  cb_tree offset; /* Reference mod */
969  cb_tree length; /* Reference mod */
970  int isuser; /* User function */
971 };
972 
973 #define CB_INTRINSIC(x) (CB_TREE_CAST (CB_TAG_INTRINSIC, struct cb_intrinsic, x))
974 #define CB_INTRINSIC_P(x) (CB_TREE_TAG (x) == CB_TAG_INTRINSIC)
975 
976 /* INITIALIZE */
977 
978 struct cb_initialize {
979  struct cb_tree_common common; /* Common values */
980  cb_tree var; /* Field */
981  cb_tree val; /* Value */
982  cb_tree rep; /* Replacing */
983  unsigned char flag_default; /* Default */
984  unsigned char flag_init_statement; /* INITIALIZE statement */
985  unsigned char flag_no_filler_init; /* No FILLER initialize */
986  unsigned char padding; /* Padding */
987 };
988 
989 #define CB_INITIALIZE(x) (CB_TREE_CAST (CB_TAG_INITIALIZE, struct cb_initialize, x))
990 #define CB_INITIALIZE_P(x) (CB_TREE_TAG (x) == CB_TAG_INITIALIZE)
991 
992 /* SEARCH */
993 
994 struct cb_search {
995  struct cb_tree_common common; /* Common values */
996  cb_tree table; /* Table name */
997  cb_tree var; /* Varying */
998  cb_tree end_stmt; /* AT END */
999  cb_tree whens; /* WHEN */
1000  int flag_all; /* SEARCH ALL */
1001 };
1002 
1003 #define CB_SEARCH(x) (CB_TREE_CAST (CB_TAG_SEARCH, struct cb_search, x))
1004 #define CB_SEARCH_P(x) (CB_TREE_TAG (x) == CB_TAG_SEARCH)
1005 
1006 /* CALL */
1007 
1008 struct cb_call {
1009  struct cb_tree_common common; /* Common values */
1010  cb_tree name; /* CALL name */
1011  cb_tree args; /* Arguments */
1012  cb_tree stmt1; /* ON EXCEPTION */
1013  cb_tree stmt2; /* NOT ON EXCEPTION */
1014  cb_tree call_returning; /* RETURNING */
1015  cob_u32_t is_system; /* System call */
1016  int convention; /* CALL convention */
1017 };
1018 
1019 #define CB_CALL(x) (CB_TREE_CAST (CB_TAG_CALL, struct cb_call, x))
1020 #define CB_CALL_P(x) (CB_TREE_TAG (x) == CB_TAG_CALL)
1021 
1022 /* CANCEL */
1023 
1024 struct cb_cancel {
1025  struct cb_tree_common common; /* Common values */
1026  cb_tree target; /* CANCEL target(s) */
1027 };
1028 
1029 #define CB_CANCEL(x) (CB_TREE_CAST (CB_TAG_CANCEL, struct cb_cancel, x))
1030 #define CB_CANCEL_P(x) (CB_TREE_TAG (x) == CB_TAG_CANCEL)
1031 
1032 /* ALTER */
1033 
1034 struct cb_alter {
1035  struct cb_tree_common common; /* Common values */
1036  cb_tree source; /* ALTER source paragraph */
1037  cb_tree target; /* ALTER target GO TO paragraph */
1038 };
1039 
1040 #define CB_ALTER(x) (CB_TREE_CAST (CB_TAG_ALTER, struct cb_alter, x))
1041 #define CB_ALTER_P(x) (CB_TREE_TAG (x) == CB_TAG_ALTER)
1042 
1043 /* GO TO */
1044 
1045 struct cb_goto {
1046  struct cb_tree_common common; /* Common values */
1047  cb_tree target; /* Procedure name(s) */
1048  cb_tree depending; /* DEPENDING */
1049 };
1050 
1051 #define CB_GOTO(x) (CB_TREE_CAST (CB_TAG_GOTO, struct cb_goto, x))
1052 #define CB_GOTO_P(x) (CB_TREE_TAG (x) == CB_TAG_GOTO)
1053 
1054 /* IF */
1055 
1056 struct cb_if {
1057  struct cb_tree_common common; /* Common values */
1058  cb_tree test; /* Condition */
1059  cb_tree stmt1; /* Statement list */
1060  cb_tree stmt2; /* ELSE/WHEN statement list */
1061  unsigned int is_if; /* From IF */
1062 };
1063 
1064 #define CB_IF(x) (CB_TREE_CAST (CB_TAG_IF, struct cb_if, x))
1065 #define CB_IF_P(x) (CB_TREE_TAG (x) == CB_TAG_IF)
1066 
1067 /* PERFORM */
1068 
1069 struct cb_perform_varying {
1070  struct cb_tree_common common; /* Common values */
1071  cb_tree name; /* VARYING item */
1072  cb_tree from; /* FROM */
1073  cb_tree step; /* Increment */
1074  cb_tree until; /* UNTIL */
1075 };
1076 
1077 struct cb_perform {
1078  struct cb_tree_common common; /* Common values */
1079  cb_tree test; /* Condition */
1080  cb_tree body; /* Statements */
1081  cb_tree data; /* TIMES or procedure */
1082  cb_tree varying; /* VARYING */
1083  cb_tree exit_label; /* Implicit exit label */
1084  cb_tree cycle_label; /* EXIT PERFORM CYCLE */
1085  enum cb_perform_type perform_type; /* Perform type */
1086 };
1087 
1088 #define CB_PERFORM_VARYING(x) (CB_TREE_CAST (CB_TAG_PERFORM_VARYING, struct cb_perform_varying, x))
1089 
1090 #define CB_PERFORM(x) (CB_TREE_CAST (CB_TAG_PERFORM, struct cb_perform, x))
1091 #define CB_PERFORM_P(x) (CB_TREE_TAG (x) == CB_TAG_PERFORM)
1092 
1093 /* Struct for extended ACCEPT / DISPLAY */
1094 
1095 struct cb_attr_struct {
1096  cb_tree fgc; /* FOREGROUND COLOR */
1097  cb_tree bgc; /* BACKGROUND COLOR */
1098  cb_tree scroll; /* SCROLL */
1099  cb_tree timeout; /* TIMEOUT */
1100  cb_tree prompt; /* PROMPT */
1101  int dispattrs; /* Attributes */
1102 };
1103 
1104 /* Statement */
1105 
1106 struct cb_statement {
1107  struct cb_tree_common common; /* Common values */
1108  const char *name; /* Statement name */
1109  const char *statement; /* Statement line */
1110  cb_tree body; /* Statement body */
1111  cb_tree file; /* File reference */
1112  cb_tree handler1; /* Exception handler */
1113  cb_tree handler2; /* Exception handler */
1114  cb_tree handler3; /* INTO clause */
1115  cb_tree null_check; /* NULL check */
1116  cb_tree debug_check; /* Field DEBUG */
1117  cb_tree debug_nodups; /* Field DEBUG dups */
1118  struct cb_attr_struct *attr_ptr; /* Attributes */
1119  int handler_id; /* Handler id */
1120  unsigned int flag_no_based : 1; /* Check BASED */
1121  unsigned int flag_in_debug : 1; /* In DEBUGGING */
1122  unsigned int flag_merge : 1; /* Is MERGE */
1123  unsigned int flag_callback : 1; /* DEBUG Callback */
1124 };
1125 
1126 #define CB_STATEMENT(x) (CB_TREE_CAST (CB_TAG_STATEMENT, struct cb_statement, x))
1127 #define CB_STATEMENT_P(x) (CB_TREE_TAG (x) == CB_TAG_STATEMENT)
1128 
1129 /* CONTINUE */
1130 
1131 struct cb_continue {
1132  struct cb_tree_common common; /* Common values */
1133 };
1134 
1135 #define CB_CONTINUE(x) (CB_TREE_CAST (CB_TAG_CONTINUE, struct cb_continue, x))
1136 #define CB_CONTINUE_P(x) (CB_TREE_TAG (x) == CB_TAG_CONTINUE)
1137 
1138 /* SET ATTRIBUTE */
1139 
1140 struct cb_set_attr {
1141  struct cb_tree_common common; /* Common values */
1142  struct cb_field *fld;
1143  int val_on;
1144  int val_off;
1145 };
1146 
1147 #define CB_SET_ATTR(x) (CB_TREE_CAST (CB_TAG_SET_ATTR, struct cb_set_attr, x))
1148 #define CB_SET_ATTR_P(x) (CB_TREE_TAG (x) == CB_TAG_SET_ATTR)
1149 
1150 /* List */
1151 
1152 struct cb_list {
1153  struct cb_tree_common common; /* Common values */
1154  cb_tree chain; /* Next in list */
1155  cb_tree value; /* Reference to item(s) */
1156  cb_tree purpose; /* Purpose */
1157  int sizes; /* BY VALUE SIZE */
1158 };
1159 
1160 #define CB_LIST(x) (CB_TREE_CAST (CB_TAG_LIST, struct cb_list, x))
1161 #define CB_LIST_P(x) (CB_TREE_TAG (x) == CB_TAG_LIST)
1162 
1163 #define CB_PURPOSE(x) (CB_LIST (x)->purpose)
1164 #define CB_VALUE(x) (CB_LIST (x)->value)
1165 #define CB_CHAIN(x) (CB_LIST (x)->chain)
1166 #define CB_SIZES(x) (CB_LIST (x)->sizes)
1167 
1168 #define CB_PURPOSE_INT(x) (CB_INTEGER (CB_PURPOSE (x))->val)
1169 
1170 #define CB_SIZES_INT(x) ((CB_LIST (x)->sizes) & 0x07)
1171 #define CB_SIZES_INT_UNSIGNED(x) ((CB_LIST (x)->sizes) & CB_SIZE_UNSIGNED)
1172 
1173 /* Pair */
1174 
1175 #define CB_PAIR_P(x) (CB_LIST_P (x) && CB_PAIR_X (x))
1176 #define CB_PAIR_X(x) CB_PURPOSE (x)
1177 #define CB_PAIR_Y(x) CB_VALUE (x)
1178 
1179 /* Report */
1180 
1181 struct cb_report {
1182  struct cb_tree_common common; /* Common values */
1183  const char *name; /* Original name */
1184  char *cname; /* Name used in C */
1185  struct cb_file *file; /* File */
1186  cb_tree line_counter; /* LINE-COUNTER */
1187  cb_tree page_counter; /* PAGE-COUNTER */
1188  cb_tree code_clause; /* CODE */
1189  cb_tree controls; /* CONTROLS */
1190  int lines; /* PAGE LIMIT LINES */
1191  int columns; /* PAGE LIMIT COLUMNS */
1192  int heading; /* HEADING */
1193  int first_detail; /* FIRST DE */
1194  int last_control; /* LAST CH */
1195  int last_detail; /* LAST DE */
1196  int footing; /* FOOTING */
1197 };
1198 
1199 #define CB_REPORT(x) (CB_TREE_CAST (CB_TAG_REPORT, struct cb_report, x))
1200 #define CB_REPORT_P(x) (CB_TREE_TAG (x) == CB_TAG_REPORT)
1201 
1202 /* Program */
1203 
1204 struct nested_list {
1205  struct nested_list *next;
1206  struct cb_program *nested_prog;
1207 };
1208 
1209 struct cb_program {
1210  /* Program variables */
1211  struct cb_program *next_program; /* Nested/contained */
1212  const char *program_id; /* Demangled PROGRAM-ID */
1213  char *source_name; /* Source name */
1214  char *orig_program_id; /* Original PROGRAM-ID */
1215  struct cb_word **word_table; /* Name hash table */
1216  struct local_filename *local_include; /* Local include info */
1217  struct nested_list *nested_prog_list; /* Callable contained */
1218  struct nested_list *common_prog_list; /* COMMON contained */
1219  cb_tree entry_list; /* Entry point list */
1220  cb_tree file_list; /* File list */
1221  cb_tree exec_list; /* Executable statements */
1222  cb_tree label_list; /* Label list */
1223  cb_tree reference_list; /* Reference list */
1224  cb_tree alphabet_name_list; /* ALPHABET list */
1225  cb_tree symbolic_char_list; /* SYMBOLIC list */
1226  cb_tree class_name_list; /* CLASS list */
1227  cb_tree parameter_list; /* USING parameters */
1228  cb_tree locale_list; /* LOCALE list */
1229  cb_tree global_list; /* GLOBAL list */
1230  cb_tree report_list; /* REPORT list */
1231  cb_tree alter_list; /* ALTER list */
1232  cb_tree debug_list; /* DEBUG ref list */
1233  cb_tree cb_return_code; /* RETURN-CODE */
1234  cb_tree cb_sort_return; /* SORT-RETURN */
1235  cb_tree cb_call_params; /* Number of CALL params */
1236  cb_tree mnemonic_spec_list; /* MNEMONIC spec */
1237  cb_tree class_spec_list; /* CLASS spec */
1238  cb_tree interface_spec_list; /* INTERFACE spec */
1239  cb_tree function_spec_list; /* FUNCTION spec */
1240  cb_tree user_spec_list; /* User FUNCTION spec */
1241  cb_tree program_spec_list; /* PROGRAM spec */
1242  cb_tree property_spec_list; /* PROPERTY spec */
1243  struct cb_alter_id *alter_gotos; /* ALTER ids */
1244  struct cb_field *working_storage; /* WORKING-STORAGE */
1245  struct cb_field *local_storage; /* LOCAL-STORAGE */
1246  struct cb_field *linkage_storage; /* LINKAGE */
1247  struct cb_field *screen_storage; /* SCREEN */
1248  struct cb_field *report_storage; /* REPORT */
1249  cb_tree local_file_list; /* Local files */
1250  cb_tree global_file_list; /* Global files */
1251  struct handler_struct global_handler[5]; /* Global handlers */
1252  cb_tree collating_sequence; /* COLLATING */
1253  cb_tree classification; /* CLASSIFICATION */
1254  cb_tree cursor_pos; /* CURSOR */
1255  cb_tree crt_status; /* CRT STATUS */
1256  cb_tree returning; /* RETURNING */
1257  struct cb_label *all_procedure; /* DEBUGGING */
1258 
1259  /* Internal variables */
1260  int loop_counter; /* Loop counters */
1261  int decimal_index; /* cob_decimal count */
1262  int decimal_index_max; /* cob_decimal max */
1263  int nested_level; /* Nested program level */
1264  int num_proc_params; /* PROC DIV params */
1265  int toplev_count; /* Top level source count */
1266  int max_call_param; /* Max params */
1267 
1268  unsigned char decimal_point; /* '.' or ',' */
1269  unsigned char currency_symbol; /* '$' or user-specified */
1270  unsigned char numeric_separator; /* ',' or '.' */
1271  unsigned char prog_type; /* Program type */
1272 
1273  unsigned int flag_main : 1; /* Gen main function */
1274  unsigned int flag_common : 1; /* COMMON PROGRAM */
1275  unsigned int flag_initial : 1; /* INITIAL PROGRAM */
1276  unsigned int flag_recursive : 1; /* RECURSIVE PROGRAM */
1277  unsigned int flag_screen : 1; /* Have SCREEN SECTION */
1278  unsigned int flag_validated : 1; /* End program validate */
1279  unsigned int flag_chained : 1; /* PROCEDURE CHAINING */
1280  unsigned int flag_global_use : 1; /* USE GLOBAL */
1281 
1282  unsigned int flag_gen_error : 1; /* Gen error routine */
1283  unsigned int flag_file_global : 1; /* Global FD */
1284  unsigned int flag_has_external : 1; /* Has EXTERNAL */
1285  unsigned int flag_segments : 1; /* Has segments */
1286  unsigned int flag_trailing_separate : 1; /* TRAILING SEPARATE */
1287  unsigned int flag_console_is_crt : 1; /* CONSOLE IS CRT */
1288  unsigned int flag_debugging : 1; /* DEBUGGING MODE */
1289  unsigned int flag_gen_debug : 1; /* DEBUGGING MODE */
1290 
1291  unsigned int flag_save_exception : 1; /* Save execption code */
1292 };
1293 
1294 
1295 /* Functions/variables */
1296 
1297 /* tree.c */
1298 
1299 extern cb_tree cb_any;
1300 extern cb_tree cb_true;
1301 extern cb_tree cb_false;
1302 extern cb_tree cb_null;
1303 extern cb_tree cb_zero;
1304 extern cb_tree cb_one;
1305 extern cb_tree cb_space;
1306 extern cb_tree cb_low;
1307 extern cb_tree cb_high;
1308 extern cb_tree cb_norm_low;
1309 extern cb_tree cb_norm_high;
1310 extern cb_tree cb_quote;
1311 extern cb_tree cb_int0;
1312 extern cb_tree cb_int1;
1313 extern cb_tree cb_int2;
1314 extern cb_tree cb_int3;
1315 extern cb_tree cb_int4;
1316 extern cb_tree cb_int5;
1317 extern cb_tree cb_i[COB_MAX_SUBSCRIPTS];
1318 extern cb_tree cb_error_node;
1319 
1320 extern cb_tree cb_intr_whencomp;
1321 
1322 extern cb_tree cb_standard_error_handler;
1323 extern cb_tree cb_depend_check;
1324 
1325 extern unsigned int gen_screen_ptr;
1326 
1327 extern char *cb_name (cb_tree);
1328 extern enum cb_class cb_tree_class (cb_tree);
1329 extern enum cb_category cb_tree_category (cb_tree);
1330 extern int cb_tree_type (const cb_tree,
1331  const struct cb_field *);
1332 extern int cb_category_is_alpha (cb_tree);
1333 extern int cb_fits_int (const cb_tree);
1334 extern int cb_fits_long_long (const cb_tree);
1335 extern int cb_get_int (const cb_tree);
1336 extern cob_s64_t cb_get_long_long (const cb_tree);
1337 extern cob_u64_t cb_get_u_long_long (const cb_tree);
1338 
1339 extern void cb_init_constants (void);
1340 
1341 extern cb_tree cb_int (const int);
1342 extern cb_tree cb_int_hex (const int);
1343 
1344 extern cb_tree cb_build_string (const void *, const size_t);
1345 
1346 extern cb_tree cb_build_class_name (cb_tree, cb_tree);
1347 
1348 extern cb_tree cb_build_locale_name (cb_tree, cb_tree);
1349 
1350 extern cb_tree cb_build_numeric_literal (const int,
1351  const void *,
1352  const int);
1353 extern cb_tree cb_build_alphanumeric_literal (const void *,
1354  const size_t);
1355 extern cb_tree cb_build_numsize_literal (const void *,
1356  const size_t,
1357  const int);
1358 extern cb_tree cb_concat_literals (const cb_tree,
1359  const cb_tree);
1360 
1361 extern cb_tree cb_build_decimal (const int);
1362 
1363 extern cb_tree cb_build_picture (const char *);
1364 extern cb_tree cb_build_comment (const char *);
1365 extern cb_tree cb_build_direct (const char *,
1366  const unsigned int);
1367 extern cb_tree cb_build_debug (const cb_tree, const char *,
1368  const cb_tree);
1369 extern cb_tree cb_build_debug_call (struct cb_label *);
1370 
1371 extern struct cb_picture *cb_build_binary_picture (const char *,
1372  const cob_u32_t,
1373  const cob_u32_t);
1374 
1375 extern cb_tree cb_build_field (cb_tree);
1376 extern cb_tree cb_build_implicit_field (cb_tree, const int);
1377 extern cb_tree cb_build_constant (cb_tree, cb_tree);
1378 
1379 extern void cb_build_symbolic_chars (const cb_tree,
1380  const cb_tree);
1381 
1382 extern struct cb_field *cb_field_add (struct cb_field *,
1383  struct cb_field *);
1384 extern struct cb_field *cb_field_founder (const struct cb_field *);
1385 extern struct cb_field *cb_field_variable_size (const struct cb_field *);
1386 extern unsigned int cb_field_variable_address (const struct cb_field *);
1387 extern int cb_field_subordinate (const struct cb_field *,
1388  const struct cb_field *);
1389 
1390 extern cb_tree cb_build_label (cb_tree, struct cb_label *);
1391 
1392 extern struct cb_file *build_file (cb_tree);
1393 extern void validate_file (struct cb_file *, cb_tree);
1394 extern void finalize_file (struct cb_file *,
1395  struct cb_field *);
1396 
1397 extern cb_tree cb_build_filler (void);
1398 extern cb_tree cb_build_reference (const char *);
1399 extern cb_tree cb_build_field_reference (struct cb_field *,
1400  cb_tree);
1401 extern const char *cb_define (cb_tree, cb_tree);
1402 extern char *cb_to_cname (const char *);
1403 extern void cb_set_system_names (void);
1404 extern cb_tree cb_ref (cb_tree);
1405 
1406 extern cb_tree cb_build_binary_op (cb_tree, const int,
1407  cb_tree);
1408 extern cb_tree cb_build_binary_list (cb_tree, const int);
1409 
1410 extern cb_tree cb_build_funcall (const char *, const int,
1411  const cb_tree, const cb_tree,
1412  const cb_tree, const cb_tree,
1413  const cb_tree, const cb_tree,
1414  const cb_tree, const cb_tree,
1415  const cb_tree, const cb_tree);
1416 
1417 extern cb_tree cb_build_cast (const enum cb_cast_type,
1418  const cb_tree);
1419 extern cb_tree cb_build_cast_int (const cb_tree);
1420 extern cb_tree cb_build_cast_llint (const cb_tree);
1421 
1422 extern cb_tree cb_build_assign (const cb_tree, const cb_tree);
1423 
1424 extern cb_tree cb_build_intrinsic (cb_tree, cb_tree,
1425  cb_tree, const int);
1426 extern cb_tree cb_build_any_intrinsic (cb_tree);
1427 
1428 extern cb_tree cb_build_search (const int,
1429  const cb_tree, const cb_tree,
1430  const cb_tree, const cb_tree);
1431 
1432 extern cb_tree cb_build_call (const cb_tree, const cb_tree,
1433  const cb_tree, const cb_tree,
1434  const cb_tree, const cob_u32_t,
1435  const int);
1436 
1437 extern cb_tree cb_build_alter (const cb_tree, const cb_tree);
1438 
1439 extern cb_tree cb_build_cancel (const cb_tree);
1440 
1441 extern cb_tree cb_build_goto (const cb_tree, const cb_tree);
1442 
1443 extern cb_tree cb_build_if (const cb_tree, const cb_tree,
1444  const cb_tree, const unsigned int);
1445 
1446 extern cb_tree cb_build_perform (const enum cb_perform_type);
1447 extern cb_tree cb_build_perform_varying (cb_tree, cb_tree,
1448  cb_tree, cb_tree);
1449 
1450 extern struct cb_statement *cb_build_statement (const char *);
1451 
1452 extern cb_tree cb_build_continue (void);
1453 
1454 extern cb_tree cb_build_list (cb_tree, cb_tree, cb_tree);
1455 extern cb_tree cb_list_add (cb_tree, cb_tree);
1456 extern cb_tree cb_pair_add (cb_tree, cb_tree, cb_tree);
1457 extern cb_tree cb_list_append (cb_tree, cb_tree);
1458 extern cb_tree cb_list_reverse (cb_tree);
1459 extern int cb_list_length (cb_tree);
1460 
1461 extern struct cb_report *build_report (cb_tree);
1462 
1463 extern void cb_add_common_prog (struct cb_program *);
1464 extern void cb_insert_common_prog (struct cb_program *,
1465  struct cb_program *);
1466 
1467 
1468 extern struct cb_intrinsic_table *lookup_intrinsic (const char *,
1469  const int,
1470  const int);
1471 
1472 extern cb_tree cb_build_alphabet_name (cb_tree);
1473 
1474 extern cb_tree cb_build_initialize (const cb_tree, const cb_tree,
1475  const cb_tree,
1476  const unsigned int,
1477  const unsigned int,
1478  const unsigned int);
1479 
1480 struct cb_literal *build_literal (enum cb_category,
1481  const void *,
1482  const size_t);
1483 
1484 extern cb_tree cb_build_system_name (const enum cb_system_name_category,
1485  const int);
1486 
1487 /* parser.y */
1488 extern cb_tree cobc_printer_node;
1489 extern int non_const_word;
1490 extern unsigned int cobc_in_procedure;
1491 extern unsigned int cobc_in_repository;
1492 extern unsigned int cobc_force_literal;
1493 extern unsigned int cobc_cs_check;
1494 
1495 /* reserved.c */
1496 extern struct cobc_reserved *lookup_reserved_word (const char *);
1497 extern cb_tree lookup_system_name (const char *);
1498 extern void cb_list_reserved (void);
1499 extern void cb_list_intrinsics (void);
1500 extern void cb_list_mnemonics (void);
1501 extern void cb_list_system (void);
1502 extern void cb_list_map (cb_tree (*) (cb_tree), cb_tree);
1503 
1504 /* error.c */
1505 extern void cb_warning_x (cb_tree, const char *, ...) COB_A_FORMAT23;
1506 extern void cb_error_x (cb_tree, const char *, ...) COB_A_FORMAT23;
1507 
1508 extern void redefinition_error (cb_tree);
1509 extern void redefinition_warning (cb_tree, cb_tree);
1510 extern void undefined_error (cb_tree);
1511 extern void ambiguous_error (cb_tree);
1512 extern void group_error (cb_tree, const char *);
1513 extern void level_redundant_error (cb_tree, const char *);
1514 extern void level_require_error (cb_tree, const char *);
1515 extern void level_except_error (cb_tree, const char *);
1516 
1517 /* field.c */
1518 extern size_t cb_needs_01;
1519 extern int cb_get_level (cb_tree);
1520 extern cb_tree cb_build_field_tree (cb_tree, cb_tree, struct cb_field *,
1521  enum cb_storage, struct cb_file *,
1522  const int);
1523 extern struct cb_field *cb_resolve_redefines (struct cb_field *, cb_tree);
1524 extern void cb_validate_field (struct cb_field *);
1525 extern void cb_validate_88_item (struct cb_field *);
1526 extern struct cb_field *cb_validate_78_item (struct cb_field *, const cob_u32_t);
1527 extern struct cb_field *cb_get_real_field (void);
1528 extern void cb_clear_real_field (void);
1529 
1530 /* typeck.c */
1531 extern cb_tree cb_debug_item;
1532 extern cb_tree cb_debug_line;
1533 extern cb_tree cb_debug_name;
1534 extern cb_tree cb_debug_sub_1;
1535 extern cb_tree cb_debug_sub_2;
1536 extern cb_tree cb_debug_sub_3;
1537 extern cb_tree cb_debug_contents;
1538 
1539 extern struct cb_program *cb_build_program (struct cb_program *,
1540  const int);
1541 
1542 extern cb_tree cb_check_numeric_value (cb_tree);
1543 extern size_t cb_check_index_p (cb_tree x);
1544 
1545 extern void cb_build_registers (void);
1546 extern void cb_build_debug_item (void);
1547 extern void cb_check_field_debug (cb_tree);
1548 extern char *cb_encode_program_id (const char *);
1549 extern char *cb_build_program_id (cb_tree, cb_tree, const cob_u32_t);
1550 extern cb_tree cb_define_switch_name (cb_tree, cb_tree, const int);
1551 extern cb_tree cb_build_section_name (cb_tree, const int);
1552 extern cb_tree cb_build_assignment_name (struct cb_file *, cb_tree);
1553 extern cb_tree cb_build_index (cb_tree, cb_tree,
1554  const unsigned int, struct cb_field *);
1555 extern cb_tree cb_build_identifier (cb_tree, const int);
1556 extern cb_tree cb_build_length (cb_tree);
1557 extern cb_tree cb_build_const_length (cb_tree);
1558 extern cb_tree cb_build_address (cb_tree);
1559 extern cb_tree cb_build_ppointer (cb_tree);
1560 
1561 extern void cb_validate_program_environment (struct cb_program *);
1562 extern void cb_validate_program_data (struct cb_program *);
1563 extern void cb_validate_program_body (struct cb_program *);
1564 
1565 extern cb_tree cb_build_expr (cb_tree);
1566 extern cb_tree cb_build_cond (cb_tree);
1567 
1568 extern void cb_emit_arithmetic (cb_tree, const int, cb_tree);
1569 extern cb_tree cb_build_add (cb_tree, cb_tree, cb_tree);
1570 extern cb_tree cb_build_sub (cb_tree, cb_tree, cb_tree);
1571 extern void cb_emit_corresponding (
1572  cb_tree (*) (cb_tree, cb_tree, cb_tree),
1573  cb_tree, cb_tree, cb_tree);
1574 extern void cb_emit_move_corresponding (cb_tree, cb_tree);
1575 
1576 extern void cb_emit_accept (cb_tree, cb_tree,
1577  struct cb_attr_struct *);
1578 extern void cb_emit_accept_line_or_col (cb_tree, const int);
1579 extern void cb_emit_accept_escape_key (cb_tree);
1580 extern void cb_emit_accept_exception_status (cb_tree);
1581 extern void cb_emit_accept_user_name (cb_tree);
1582 extern void cb_emit_accept_date (cb_tree);
1583 extern void cb_emit_accept_date_yyyymmdd (cb_tree);
1584 extern void cb_emit_accept_day (cb_tree);
1585 extern void cb_emit_accept_day_yyyyddd (cb_tree);
1586 extern void cb_emit_accept_day_of_week (cb_tree);
1587 extern void cb_emit_accept_time (cb_tree);
1588 extern void cb_emit_accept_command_line (cb_tree);
1589 extern void cb_emit_accept_environment (cb_tree);
1590 extern void cb_emit_accept_mnemonic (cb_tree, cb_tree);
1591 extern void cb_emit_accept_name (cb_tree, cb_tree);
1592 extern void cb_emit_accept_arg_number (cb_tree);
1593 extern void cb_emit_accept_arg_value (cb_tree);
1594 extern void cb_emit_get_environment (cb_tree, cb_tree);
1595 
1596 extern void cb_emit_allocate (cb_tree, cb_tree,
1597  cb_tree, cb_tree);
1598 extern void cb_emit_alter (cb_tree, cb_tree);
1599 extern void cb_emit_free (cb_tree);
1600 
1601 extern void cb_emit_call (cb_tree, cb_tree, cb_tree, cb_tree,
1602  cb_tree, cb_tree);
1603 
1604 extern void cb_emit_cancel (cb_tree);
1605 extern void cb_emit_close (cb_tree, cb_tree);
1606 extern void cb_emit_commit (void);
1607 extern void cb_emit_continue (void);
1608 extern void cb_emit_delete (cb_tree);
1609 extern void cb_emit_delete_file (cb_tree);
1610 extern void cb_emit_display (cb_tree, cb_tree,
1611  cb_tree, cb_tree,
1612  struct cb_attr_struct *);
1613 extern cb_tree cb_build_display_mnemonic (cb_tree);
1614 extern cb_tree cb_build_display_name (cb_tree);
1615 extern void cb_emit_env_name (cb_tree);
1616 extern void cb_emit_env_value (cb_tree);
1617 extern void cb_emit_arg_number (cb_tree);
1618 extern void cb_emit_command_line (cb_tree);
1619 
1620 extern void cb_emit_divide (cb_tree, cb_tree,
1621  cb_tree, cb_tree);
1622 
1623 extern void cb_emit_evaluate (cb_tree, cb_tree);
1624 
1625 extern void cb_emit_goto (cb_tree, cb_tree);
1626 extern void cb_emit_exit (const unsigned int);
1627 
1628 extern void cb_emit_if (cb_tree, cb_tree, cb_tree);
1629 extern cb_tree cb_build_if_check_break (cb_tree, cb_tree);
1630 
1631 extern void cb_emit_initialize (cb_tree, cb_tree,
1632  cb_tree, cb_tree,
1633  cb_tree);
1634 
1635 extern void cb_emit_inspect (cb_tree, cb_tree,
1636  cb_tree, const unsigned int);
1637 extern void cb_init_tallying (void);
1638 extern cb_tree cb_build_tallying_data (cb_tree);
1639 extern cb_tree cb_build_tallying_characters (cb_tree);
1640 extern cb_tree cb_build_tallying_all (void);
1641 extern cb_tree cb_build_tallying_leading (void);
1642 extern cb_tree cb_build_tallying_trailing (void);
1643 extern cb_tree cb_build_tallying_value (cb_tree, cb_tree);
1644 extern cb_tree cb_build_replacing_characters (cb_tree, cb_tree);
1645 extern cb_tree cb_build_replacing_all (cb_tree, cb_tree, cb_tree);
1646 extern cb_tree cb_build_replacing_leading (cb_tree, cb_tree, cb_tree);
1647 extern cb_tree cb_build_replacing_first (cb_tree, cb_tree, cb_tree);
1648 extern cb_tree cb_build_replacing_trailing (cb_tree, cb_tree, cb_tree);
1649 extern cb_tree cb_build_converting (cb_tree, cb_tree, cb_tree);
1650 extern cb_tree cb_build_inspect_region_start (void);
1651 
1652 extern int validate_move (cb_tree, cb_tree, const unsigned int);
1653 extern cb_tree cb_build_move (cb_tree, cb_tree);
1654 extern void cb_emit_move (cb_tree, cb_tree);
1655 
1656 extern void cb_emit_open (cb_tree, cb_tree, cb_tree);
1657 
1658 extern void cb_emit_perform (cb_tree, cb_tree);
1659 extern cb_tree cb_build_perform_once (cb_tree);
1660 extern cb_tree cb_build_perform_times (cb_tree);
1661 extern cb_tree cb_build_perform_until (cb_tree, cb_tree);
1662 extern cb_tree cb_build_perform_forever (cb_tree);
1663 extern cb_tree cb_build_perform_exit (struct cb_label *);
1664 
1665 extern void cb_emit_read (cb_tree, cb_tree, cb_tree,
1666  cb_tree, cb_tree);
1667 
1668 extern void cb_emit_ready_trace (void);
1669 extern void cb_emit_rewrite (cb_tree, cb_tree, cb_tree);
1670 
1671 extern void cb_emit_release (cb_tree, cb_tree);
1672 extern void cb_emit_reset_trace (void);
1673 extern void cb_emit_return (cb_tree, cb_tree);
1674 
1675 extern void cb_emit_rollback (void);
1676 
1677 extern void cb_emit_search (cb_tree, cb_tree,
1678  cb_tree, cb_tree);
1679 extern void cb_emit_search_all (cb_tree, cb_tree,
1680  cb_tree, cb_tree);
1681 
1682 extern void cb_emit_setenv (cb_tree, cb_tree);
1683 extern void cb_emit_set_to (cb_tree, cb_tree);
1684 extern void cb_emit_set_up_down (cb_tree, cb_tree, cb_tree);
1685 extern void cb_emit_set_on_off (cb_tree, cb_tree);
1686 extern void cb_emit_set_true (cb_tree);
1687 extern void cb_emit_set_false (cb_tree);
1688 extern void cb_emit_set_attribute (cb_tree, const int, const int);
1689 extern cb_tree cb_build_set_attribute (const struct cb_field *,
1690  const int, const int);
1691 
1692 extern void cb_emit_sort_init (cb_tree, cb_tree, cb_tree);
1693 extern void cb_emit_sort_using (cb_tree, cb_tree);
1694 extern void cb_emit_sort_input (cb_tree);
1695 extern void cb_emit_sort_giving (cb_tree, cb_tree);
1696 extern void cb_emit_sort_output (cb_tree);
1697 extern void cb_emit_sort_finish (cb_tree);
1698 
1699 extern void cb_emit_start (cb_tree, cb_tree, cb_tree, cb_tree);
1700 
1701 extern void cb_emit_stop_run (cb_tree);
1702 
1703 extern void cb_emit_string (cb_tree, cb_tree, cb_tree);
1704 
1705 extern void cb_emit_unlock (cb_tree);
1706 
1707 extern void cb_emit_unstring (cb_tree, cb_tree, cb_tree, cb_tree,
1708  cb_tree);
1709 extern cb_tree cb_build_unstring_delimited (cb_tree, cb_tree);
1710 extern cb_tree cb_build_unstring_into (cb_tree, cb_tree, cb_tree);
1711 
1712 extern void cb_emit_write (cb_tree, cb_tree, cb_tree, cb_tree);
1713 extern cb_tree cb_build_write_advancing_lines (cb_tree, cb_tree);
1714 extern cb_tree cb_build_write_advancing_mnemonic (cb_tree, cb_tree);
1715 extern cb_tree cb_build_write_advancing_page (cb_tree);
1716 
1717 DECLNORET extern void cobc_tree_cast_error (const cb_tree, const char *,
1718  const int,
1719  const enum cb_tag) COB_A_NORETURN;
1720 
1721 #if !defined(__GNUC__) && defined(COB_TREE_DEBUG)
1722 extern cb_tree cobc_tree_cast_check (const cb_tree, const char *,
1723  const int, const enum cb_tag);
1724 #endif
1725 
1726 
1727 /* codegen.c */
1728 extern void codegen (struct cb_program *, const int);
1729 
1730 /* scanner.l */
1731 extern void cb_unput_dot (void);
1732 extern void cb_add_78 (struct cb_field *);
1733 extern void cb_reset_78 (void);
1734 extern void cb_reset_global_78 (void);
1735 extern struct cb_field *check_level_78 (const char *);
1736 
1737 /* Function defines */
1738 
1739 #define CB_BUILD_FUNCALL_0(f) \
1740  cb_build_funcall (f, 0, NULL, NULL, NULL, NULL, NULL, \
1741  NULL, NULL, NULL, NULL, NULL)
1742 
1743 #define CB_BUILD_FUNCALL_1(f,a1) \
1744  cb_build_funcall (f, 1, a1, NULL, NULL, NULL, NULL, \
1745  NULL, NULL, NULL, NULL, NULL)
1746 
1747 #define CB_BUILD_FUNCALL_2(f,a1,a2) \
1748  cb_build_funcall (f, 2, a1, a2, NULL, NULL, NULL, \
1749  NULL, NULL, NULL, NULL, NULL)
1750 
1751 #define CB_BUILD_FUNCALL_3(f,a1,a2,a3) \
1752  cb_build_funcall (f, 3, a1, a2, a3, NULL, NULL, \
1753  NULL, NULL, NULL, NULL, NULL)
1754 
1755 #define CB_BUILD_FUNCALL_4(f,a1,a2,a3,a4) \
1756  cb_build_funcall (f, 4, a1, a2, a3, a4, NULL, \
1757  NULL, NULL, NULL, NULL, NULL)
1758 
1759 #define CB_BUILD_FUNCALL_5(f,a1,a2,a3,a4,a5) \
1760  cb_build_funcall (f, 5, a1, a2, a3, a4, a5, \
1761  NULL, NULL, NULL, NULL, NULL)
1762 
1763 #define CB_BUILD_FUNCALL_6(f,a1,a2,a3,a4,a5,a6) \
1764  cb_build_funcall (f, 6, a1, a2, a3, a4, a5, a6, \
1765  NULL, NULL, NULL, NULL)
1766 
1767 #define CB_BUILD_FUNCALL_7(f,a1,a2,a3,a4,a5,a6,a7) \
1768  cb_build_funcall (f, 7, a1, a2, a3, a4, a5, a6, a7, \
1769  NULL, NULL, NULL)
1770 
1771 #define CB_BUILD_FUNCALL_8(f,a1,a2,a3,a4,a5,a6,a7,a8) \
1772  cb_build_funcall (f, 8, a1, a2, a3, a4, a5, a6, a7, a8, \
1773  NULL, NULL)
1774 
1775 #define CB_BUILD_FUNCALL_9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
1776  cb_build_funcall (f, 9, a1, a2, a3, a4, a5, a6, a7, a8, \
1777  a9, NULL)
1778 
1779 /* Miscellanous defines */
1780 
1781 #define CB_BUILD_CAST_ADDRESS(x) cb_build_cast (CB_CAST_ADDRESS, x)
1782 #define CB_BUILD_CAST_ADDR_OF_ADDR(x) cb_build_cast (CB_CAST_ADDR_OF_ADDR, x)
1783 #define CB_BUILD_CAST_LENGTH(x) cb_build_cast (CB_CAST_LENGTH, x)
1784 #define CB_BUILD_CAST_PPOINTER(x) cb_build_cast (CB_CAST_PROGRAM_POINTER, x)
1785 
1786 #define CB_BUILD_PARENTHESIS(x) cb_build_binary_op (x, '@', NULL)
1787 #define CB_BUILD_NEGATION(x) cb_build_binary_op (x, '!', NULL)
1788 
1789 #define CB_BUILD_STRING0(str) cb_build_string (str, strlen ((char *)(str)))
1790 
1791 #define CB_LIST_INIT(x) cb_build_list (NULL, x, NULL)
1792 #define CB_BUILD_CHAIN(x,y) cb_build_list (NULL, x, y)
1793 #define CB_BUILD_PAIR(x,y) cb_build_list (x, y, NULL)
1794 #define CB_ADD_TO_CHAIN(x,y) y = CB_BUILD_CHAIN (x, y)
1795 #define CB_CHAIN_PAIR(x,y,z) x = cb_pair_add (x, y, z)
1796 #define CB_FIELD_ADD(x,y) x = cb_field_add (x, y)
1797 
1798 
1799 #endif /* CB_TREE_H */