home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / misc / ada1110b.lha / AmigaSources / gvars.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-10  |  9.7 KB  |  277 lines

  1. /*
  2.  * Copyright (C) 1985-1992  New York University
  3.  * 
  4.  * This file is part of the Ada/Ed-C system.  See the Ada/Ed README file for
  5.  * warranty (none) and distribution info and also the GNU General Public
  6.  * License for more details.
  7.  
  8.  */
  9. #define GEN
  10.  
  11.  
  12. /* ada_min_integer; ada_max_integer; are defined in vars.c */
  13.  
  14. /* SETL GENflag is list_code in C */
  15. extern  int    list_code; /* set if GEN option selected */
  16.  
  17. #ifdef TBSN
  18. PREDEF_UNITS; /* predefined units */
  19. #endif
  20.  
  21. extern  int    debug_flag;
  22. /* set debug_line to line number to cause call to trap_line when
  23.  * starting to generating code for that line 
  24.  * (see maincase.c)        ds 7-19-85
  25.  */
  26. extern  int    debug_line;
  27.  
  28. /* MAINunit identifies the main unit. In SETL this is specified by
  29.  * MAIN program option. In C it will be character string
  30.  */
  31. extern  char *MAINunit; /* name of main unit (from MAIN opo */
  32. extern  char *interface_files;
  33.  
  34.  
  35. extern  int    bind_option; /* bind option */
  36. extern  int   bind_only_option; /* set when binding only, no generation */
  37. extern  int    line_option; /* LINE option use -L to set */
  38. extern  int    gen_option; /* GEN option: set if want to generate code */
  39.  
  40.  
  41. extern  int ada_line; /* line number for error file (mixed_case) */
  42. extern  int save_ada_line; /* used to save value of ada_line  */
  43.  
  44.  
  45. #ifdef TBSN
  46. /* STIME and BTIME are used to hold elapsed times in SETL version
  47.  * and are reals there. They are not needed in first C version.
  48.  */
  49. STIME; /* ?? time */
  50. BTIME; /* binding time */
  51. #endif
  52.  
  53. extern  int     NB_INSTRUCTIONS; /* number of instructions generated */
  54. extern  int     NB_STATEMENTS; /* number of statements processed?? */
  55.  
  56. extern  int     ERROR_IN_UNIT; /* boolean set if errors in unit */
  57. extern  int     STUBS_IN_UNIT; /* boolean set if stubs in unit */
  58.  
  59. /* In SETL, TARGET indicates target machine and is either SETL or IBMPC
  60.  * In C will be integer
  61.  */
  62. extern  int     TARGET; 
  63.  
  64.  
  65. extern  Node    FIRST_NODE;         /* first node in a compilation unit */
  66.  
  67. extern  Tuple     UNIT_FIRST_NODE;     /* map { unit -> FIRST_NODE } */
  68. /* Represent as 'tuple map' in C */
  69.  
  70.  
  71. extern  Tuple    RENAME_MAP;          
  72. /* map { generic_name -> instance_name } 
  73.  * This is kept as a tuple in C with successive pairs of elements giving
  74.  * domain and range values (tuple as map).
  75.  */
  76.  
  77. #ifdef TBSN
  78. -- this is not referenced        ds 22-feb-85
  79. extern     Node ROOT_NODE;           /* root node of unit to be expanded */
  80. #endif
  81.  
  82. /* Generated code is built up in CODE_SEGMENT, generated data in
  83.  * DATA_SEGMENT. In SETL these are tuples, and will also be tuples
  84.  * in first C version.
  85.  * DATA_SEGMENT_MAIN is data segment for main code slot, initialized
  86.  * by segment_main_data();
  87.  * Since the type of these (Segment) is not known to all files
  88.  * the variables CODE_SEGMENT, DATA_SEGMENT, DATA_SEGMENT_MAIN
  89.  * VARIANT_TABLE and FIELD_TABLE are defined in init.c and
  90.  * declared as extern's explicitly where needed.
  91.  */
  92.  
  93.  
  94. extern  Tuple    CODE_SLOTS;          /* map showing code_slots occupation */
  95.                          /*  { procedure_names -> number } */
  96.  
  97. extern  Tuple    DATA_SLOTS;          /* map showing data_slots occupation */
  98.                          /*  { compilation_unit_names -> number } */
  99.  
  100. extern  Tuple    EXCEPTION_SLOTS;     /* map showing exception_slots occupation */
  101.                     /*  { exception_names -> number } */
  102. extern  Tuple    CODE_SEGMENT_MAP;    /* map { number -> [actual code] } */
  103. extern  Tuple    DATA_SEGMENT_MAP;    /* map { number -> [actual data] } */
  104.  
  105.  
  106. extern  int    CURRENT_DATA_SEGMENT;   /* number of current data segment */
  107. extern  int    CURRENT_CODE_SEGMENT;   /* number of current code  segment */
  108. /* UNIT_NAME is variable unit_name declared in vars.c */
  109.     /* name of the current compilation unit */
  110.  
  111. /*
  112.  * GENERATED_OBJECTS is a set of symbols in the SETL version. It is
  113.  * kept as a tuple in the C version. The most common use is in the
  114.  * form
  115.  *    GENERATED_OBJECTS with:= sym;
  116.  * which we will write in C as
  117.  *    generate_object(sym);
  118.  * This will permit option of choosing more efficient data structure
  119.  * later.
  120.  */
  121. extern  Tuple    GENERATED_OBJECTS;
  122.  
  123. /*  Symbol table and extended symbol table : */
  124.  
  125.  
  126. #ifdef TBSN
  127. /* MISC will be symbol table fields in C version */
  128.     MISC,           /* map used to store miscellanous infos like: */
  129.                     /* for types: */
  130.                     /*   a boolean indicating that they contain tasks */
  131. /* NOTE: Info in MISC is save in library (AXQ files) */
  132.  
  133. #endif
  134.  
  135. /* REFERENCE_MAP and LOCAL_REFERENCE_MAP are used in SETL to give
  136.  * the address assigned to symbols. 
  137.  * LOCAL_REFERENCE_MAP is 'sparse' map from symbols to offsets; note
  138.  * in particular that it is copied.
  139.  * See ghdr.c for description of realization of local_reference_map.
  140.  */
  141. extern  Tuple LOCAL_REFERENCE_MAP;
  142.  
  143. /* reference_of sets these globals */
  144. extern  int REFERENCE_SEGMENT;
  145. extern  int REFERENCE_OFFSET;
  146.  
  147. /* CONSTANT_MAP is a map from constant values to generated symbols. It
  148.  * is referenced only in procedure get_constant_name. The representation
  149.  * in C is still not clear. 
  150.  *
  151.  * Constant map is optimization that is not needed in C 
  152.  * It is referenced ony in get_constant_name to reuse locations having
  153.  * the same value. 
  154.  */
  155. #ifdef TBSN
  156. Tuple    CONSTANT_MAP;
  157. #endif
  158.  
  159.  
  160. extern  int    LAST_OFFSET;    /* first available offset in current stack frame */
  161. extern  int    MAX_OFFSET;     /* largest offset in current stack frame */
  162. extern  int    TASKS_DECLARED; /* flag indicating possible presence of tasks in frame */
  163. extern  int    SPECS_DECLARED; /* count of # of specs requiring a */
  164.                /* body in a library package. */
  165. extern  Tuple  SUBPROG_SPECS; /* set of subprograms having an explicit spec in the */
  166.                /* current program unit. */
  167.  
  168. extern  Tuple    SOURCE;         /* the current list of statements to be processed */
  169.  
  170.  
  171. /* in C, EMAP is maintained by emap_... procedures: */
  172. extern  Tuple    EMAP;           /* Various temporary storage: */
  173.                     /* Type:     -> list of dependent deferred types */
  174.                     /* Constant: -> Boolean true if a deferred constant */
  175. /* NOTE: info in EMAP is NOT save in libarry (AXQ files) */
  176. extern  Tuple    EMAP_VALUE; /* value of emap if defined, set by emap_get */
  177.  
  178. extern  int    CURRENT_LEVEL;  /* used for static depth of blocks */
  179.  
  180. extern  Tuple    PARAMETER_SET; /* Tuple of symbols for formal parameters */
  181.  
  182. /* RELAY_SET is a tuple of symbols. */
  183. /* Note; need to review if this need be copied */
  184. /* Note: RELAY_SET should be represented more efficiently than just
  185.  * as tuple if possible, as may be 'large'.
  186.  */
  187. extern  Tuple    RELAY_SET;
  188.  
  189. /* DANGLING_RELAY_SETS is a tuple of relay sets */
  190. extern  Tuple    DANGLING_RELAY_SETS;
  191.  
  192. extern  Tuple    SUBPROG_PATCH;
  193.     
  194. extern  Tuple   CODE_PATCH_SET;
  195. extern  Tuple    DATA_PATCH_SET;
  196.  
  197. /* Global variables used for record type elaboration */
  198.  
  199. extern  int    CURRENT_FIELD_NUMBER;
  200. extern  int    CURRENT_FIELD_OFFSET;
  201. extern  int    REC_WITH_TASKS; /* boolean */
  202. extern  int    STATIC_REC; /* boolean */
  203. extern  Tuple   INTERNAL_ACCESSED_TYPES; /* of symbols */
  204.  
  205. /* Variables used by the binder */
  206. extern  Tuple  axqfiles_read;        /* set of already read AXQfiles */
  207. extern  Tuple  call_lib_unit;        /* Accumulates code for idle_task to call library */
  208.                    /* packages. */
  209. extern  Tuple  PRECEDES_MAP;      /* Map representing relationship between units */
  210. extern  Tuple  DELAYED_MAP;
  211. extern  Tuple  compilation_table; /* Table of compilation units giving the order of */
  212.                      /* compilation. */
  213. extern  Tuple  late_instances;    /* Map from unit unique name to a set of late */
  214.                             /* instances */
  215. extern  Tuple interfaced_procedures;
  216.                      /* set of the part of codes generated for each
  217.                         intefaced procedures */
  218. extern  int     interface_counter;
  219.                 /* integer associated with each subprogram which */
  220.                 /* has a pragma INTERFACE */
  221. extern  int    interface_flag;    /* equals 1 if there are interfaced procedures, 
  222.                                       0 otherwise */
  223.  
  224. /* Variables used by the peep-hole optimizer */
  225.  
  226. extern  int deleted_instructions;
  227. #ifdef TBSN
  228.     optimizable_codes,
  229. #endif
  230.  
  231.  
  232. /* "local" variables (do not use these names elsewhere!) */
  233.  
  234. extern     Tuple    just_read;
  235. extern  Node    unit_node;
  236.  
  237. /* TBSL: symbol_constrained_type added 21 jan - needs to be initialized*/
  238. extern  Symbol symbol_constrained_type;
  239. extern  Symbol symbol_accept_return; /* see gen_accept */
  240. /* TBSL: see if following really needed for 'used' and 'unused':
  241.   Note; "used" and "unused" are just used for loops can use TRUE and FALSE
  242.   There is label generated at startof loop needed only if exit; if exit
  243.   not present, the label is "unused" and some needless code need not
  244.   be generated.
  245.  */
  246. extern  Symbol symbol_used,symbol_unused;
  247. /* symbol_main_task_type is defined in adasem (vars.c) */
  248. /* define symbol_main_task used for main_task here */
  249. extern  Symbol symbol_main_task;
  250. extern  Symbol symbol_type_mark;
  251. extern  Symbol symbol_task_block;
  252. extern  Symbol symbol_mulfix; /* expr.c ...*/
  253.  
  254. /* rat_tof() returns its results in the globals:*/
  255. /* make RAT_TOF_1 long for initial C version  ds 6-6-86 */
  256. extern  long RAT_TOF_1,RAT_TOF_2;
  257.  
  258. extern  Explicit_ref explicit_ref_0; /* for explicit reference of [0,0] */
  259. /* unit_slots is global tuple maintained by unit_slots_get() and
  260.  * unit_slots_put(). Entries are indexed by unit number. Each entry
  261.  * is tuple of slot numbers; the first three corresponding to OWNED_SLOTS
  262.  * the last two to BORROWED slots.
  263.  */
  264. extern  Tuple unit_slots;
  265. extern  int *ivalue_1,*ivalue_10; /* long integer forms of 1 and 10 */
  266. extern  Const int_const_0; /* Const for integer 0 */
  267. extern  Rational rat_value_10; /* 10 as rational */
  268. /* global_reference_tupel is used for saving global addresses
  269.  * for trace printout 
  270.  */
  271. extern  Tuple global_reference_tuple;
  272.  
  273. extern  Const int_const_null_task; /* for NULL_TASK */
  274. #ifdef BINDER_GEN
  275. extern  int binder_phase; /* set non-zero if binder phase */
  276. #endif
  277.