home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / jikepg12.zip / jikespg / src / globals.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-11-04  |  6.5 KB  |  250 lines

  1. /* $Id: globals.c,v 1.4 1999/11/04 14:04:32 shields Exp $ */
  2. /*
  3.  This software is subject to the terms of the IBM Jikes Compiler
  4.  License Agreement available at the following URL:
  5.  http://www.ibm.com/research/jikes.
  6.  Copyright (C) 1983, 1999, International Business Machines Corporation
  7.  and others.  All Rights Reserved.
  8.  You must accept the terms of that agreement to use this software.
  9. */
  10. static char hostfile[] = __FILE__;
  11.  
  12. #include "common.h"
  13. #include "reduce.h"
  14. #include "space.h"
  15.  
  16. /*******************************************************************/
  17. /*******************************************************************/
  18. /**    The following are global variables declared in COMMON.H    **/
  19. /*******************************************************************/
  20. /*******************************************************************/
  21. const char HEADER_INFO[]  = "IBM Research Jikes Parser Generator";
  22. const char VERSION[] = "1.2";
  23. const char BLANK[]        = " ";
  24. const long MAX_TABLE_SIZE = MIN((long) USHRT_MAX, INT_MAX) - 1;
  25.  
  26. char *timeptr;
  27.  
  28. long output_line_no = 0;
  29.  
  30. char grm_file[80],
  31.      lis_file[80],
  32.      act_file[80],
  33.      hact_file[80],
  34.      tab_file[80],
  35.      prs_file[80]          = "",
  36.      sym_file[80]          = "",
  37.      def_file[80]          = "",
  38.      dcl_file[80]          = "",
  39.      file_prefix[80]       = "",
  40.      prefix[MAX_PARM_SIZE] = "",
  41.      suffix[MAX_PARM_SIZE] = "",
  42.      parm[256]             = "",
  43.      msg_line[MAX_MSG_SIZE];
  44.  
  45. FILE *sysgrm,
  46.      *syslis,
  47.      *sysact,
  48.      *syshact,
  49.      *systab,
  50.      *syssym,
  51.      *sysprs,
  52.      *sysdcl,
  53.      *sysdef;
  54.  
  55. /******************************************************/
  56. /*  The variables below are global counters.          */
  57. /******************************************************/
  58. long num_items          = 0,
  59.      num_states         = 0,
  60.      max_la_state;
  61.  
  62. int num_symbols             = 0,
  63.     symno_size,
  64.     num_names               = 0,
  65.     num_terminals,
  66.     num_non_terminals,
  67.     num_rules               = 0,
  68.     num_conflict_elements   = 0,
  69.     num_single_productions  = 0,
  70.     gotodom_size            = 0;
  71.  
  72. /*********************************************************************/
  73. /*   The variables below are used to hold information about special  */
  74. /* grammar symbols.                                                  */
  75. /*********************************************************************/
  76. short accept_image,
  77.       eoft_image,
  78.       eolt_image,
  79.       empty,
  80.       error_image;
  81.  
  82.                        /* Miscellaneous counters. */
  83.  
  84. int num_first_sets,
  85.     num_shift_maps = 0,
  86.     page_no        = 0;
  87.  
  88. long string_offset     = 0,
  89.      string_size       = 0,
  90.      num_shifts        = 0,
  91.      num_shift_reduces = 0,
  92.      num_gotos         = 0,
  93.      num_goto_reduces  = 0,
  94.      num_reductions    = 0,
  95.      num_sr_conflicts  = 0,
  96.      num_rr_conflicts  = 0,
  97.      num_entries;
  98.  
  99. int num_scopes       = 0,
  100.     scope_rhs_size   = 0,
  101.     scope_state_size = 0,
  102.     num_error_rules  = 0;
  103.  
  104. BOOLEAN list_bit               = FALSE,
  105.         slr_bit                = FALSE,
  106.         verbose_bit            = FALSE,
  107.         first_bit              = FALSE,
  108.         follow_bit             = FALSE,
  109.         action_bit             = FALSE,
  110.         edit_bit               = FALSE,
  111.         states_bit             = FALSE,
  112.         xref_bit               = FALSE,
  113.         nt_check_bit           = FALSE,
  114.         conflicts_bit          = TRUE,
  115.         read_reduce_bit        = TRUE,
  116.         goto_default_bit       = TRUE,
  117.         shift_default_bit      = FALSE,
  118.         byte_bit               = TRUE,
  119.         warnings_bit           = TRUE,
  120.         single_productions_bit = FALSE,
  121.         error_maps_bit         = FALSE,
  122.         debug_bit              = FALSE,
  123.         deferred_bit           = TRUE,
  124.         c_bit                  = FALSE,
  125.         cpp_bit                = FALSE,
  126.         java_bit               = FALSE,
  127.         scopes_bit             = FALSE;
  128.  
  129. int lalr_level       = 1,
  130.     default_opt      = 5,
  131.     trace_opt        = TRACE_CONFLICTS,
  132.     names_opt        = OPTIMIZE_PHRASES,
  133.     table_opt        = 0,
  134.     increment        = 30,
  135.     maximum_distance = 30,
  136.     minimum_distance = 3,
  137.     stack_size       = 128;
  138.  
  139. char escape = '%',
  140.      ormark = '|',
  141.      record_format = 'V';
  142.  
  143. char blockb[MAX_PARM_SIZE]  = {'/', '.'},
  144.      blocke[MAX_PARM_SIZE]  = {'.', '/'},
  145.      hblockb[MAX_PARM_SIZE] = {'/', ':'},
  146.      hblocke[MAX_PARM_SIZE] = {':', '/'},
  147.      errmsg[MAX_PARM_SIZE]  = "errmsg",
  148.      gettok[MAX_PARM_SIZE]  = "gettok",
  149.      smactn[MAX_PARM_SIZE]  = "smactn",
  150.      tkactn[MAX_PARM_SIZE]  = "tkactn";
  151.  
  152. char *string_table = (char *) NULL;
  153.  
  154. short *rhs_sym = NULL;
  155.  
  156. struct ruletab_type *rules = NULL;
  157.  
  158. struct node **closure       = NULL,
  159.             **clitems       = NULL,
  160.             **adequate_item = NULL;
  161.  
  162. struct itemtab *item_table = NULL;
  163.  
  164. struct symno_type *symno = NULL;
  165.  
  166. BOOLEAN *null_nt = NULL;
  167.  
  168. int term_set_size,
  169.     non_term_set_size,
  170.     state_set_size;
  171.  
  172. SET_PTR nt_first = NULL,
  173.         first    = NULL,
  174.         follow   = NULL;
  175.  
  176. struct shift_header_type *shift = NULL;
  177.  
  178. struct reduce_header_type *reduce = NULL;
  179.  
  180. short *shiftdf  = NULL,
  181.       *gotodef  = NULL,
  182.       *gd_index = NULL,
  183.       *gd_range = NULL;
  184.  
  185. int   *name;
  186.  
  187. struct statset_type *statset = NULL;
  188.  
  189. struct lastats_type *lastats = NULL;
  190.  
  191. struct node **in_stat = NULL;
  192.  
  193. struct scope_type *scope = NULL;
  194.  
  195. short *scope_right_side = NULL,
  196.       *scope_state      = NULL;
  197.  
  198. char *output_ptr    = NULL,
  199.      *output_buffer = NULL;
  200.  
  201. short *symbol_map    = NULL,
  202.       *ordered_state = NULL,
  203.       *state_list    = NULL;
  204.  
  205. int *next        = NULL,
  206.     *previous    = NULL,
  207.     *state_index = NULL;
  208.  
  209. long table_size,
  210.      action_size,
  211.      increment_size;
  212.  
  213. short last_non_terminal = 0,
  214.       last_terminal = 0;
  215.  
  216. int accept_act,
  217.     error_act,
  218.     first_index,
  219.     last_index,
  220.     last_symbol,
  221.     max_name_length = 0;
  222.  
  223. SET_PTR naction_symbols = NULL,
  224.         action_symbols  = NULL;
  225.  
  226. BOOLEAN byte_terminal_range = TRUE;
  227.  
  228. struct node **conflict_symbols = NULL;
  229. SET_PTR la_set   = NULL,
  230.         read_set = NULL;
  231. int highest_level = 0;
  232. long la_top = 0;
  233. short *la_index = NULL;
  234. BOOLEAN not_lrk;
  235.  
  236. struct new_state_type *new_state_element;
  237.  
  238. short *shift_image       = NULL,
  239.       *real_shift_number = NULL;
  240.  
  241. int *term_state_index  = NULL,
  242.     *shift_check_index = NULL;
  243.  
  244. int shift_domain_count,
  245.     num_terminal_states,
  246.     check_size,
  247.     term_check_size,
  248.     term_action_size,
  249.     shift_check_size;
  250.