###############################################################################
#
#	File:     global_vars.icn
#
#	Subject:  russell language global variable declarations
#
#	Author:   Dennis J Darland
#
#	Date:     October - Novmber, 2015
#
###############################################################################
#
# Copyright 1986-1989 Hans-Juergen Boehm, Alan J. Demers, Kumar Srikantan,
# Vernon Lee, and Lucy Hederman.
# Copyright Digital Equipment Corporation & INRIA 1988, 1989.
# Copyright (c) 1990-1993 by Xerox Corporation.  All rights reserved.
#
# This material is provided as is, with no warranty expressed or implied.
# Any use is at your own risk.
# 
# Permission is hereby granted to copy this compiler for any non-commercial
# purpose, provided the above notices are retained on all copies.  Further
# restrictions apply to the DEC/INRIA BigNum package.  These are stated in
# the file runtime/BigNum/doc/bnbody.tex.
#
# This work uses the BigNum package developed jointly by INRIA and
# Digital PRL.  It has been modified by Hans-J. Boehm in August 1990
# and February 1993 at Xerox PARC.  When you receive this software,
# please send mail to librarian@prl.dec.com to inform them that you
# have a copy of the package.
###############################################################################
#
#   NOTE From Dennis J. Darland (11/2/2015)
#
#   I obtained the "c" language source code for "russell" copyrighted above
#   in the 1990's. I have made efforts to get it to work over the years, but
#   always failed. It has many hardware and OS dependancies. Now (October 2015
#   forward, I am tring to port to the language "Unicon". Practically every
#   line of code will need to be changed, as someing as simple as the
#   assignment operator is different. Also I will not use the BigNum package
#   mentioned above. Also I am doing this not for profit, and am sharing
#   freely. I am not at all confident that I will get it working well, but
#   believe in open source, so am sharing my work as I make progress.
#   Unicon is also much more portable.
#
###############################################################################

# following from main
global dloadflag ,initflag ,BADflag ,aflag ,yydebug,  Mflag ,cflag ,pflag ,Lflag ,Pflag ,Tflag ,Gflag ,Vflag ,Nflag ,fflag ,Fflag ,Rflag ,OOflag ,OOOflag ,Oflag ,Xflag ,xflag ,hflag ,dbgmsg , insrtptr, rpt_lvl

global ifname ,ofname ,sigfname ,optfname ,actual_ifname 
global ofile, sigfile, optfile, unparse_file, optsfile, callfile
# global yyinfnm # should not need

global yyline

global usl_ptr, insig

global entry_nam    # "" for regular compilations.  Used for -c 
# global GC_dont_gc  # should not need
# will not be assigned a value
global nil


# global etext # should not need  end of text symbol used in writing out initialized compiler

# following from pass1/parser/initids
#
#   Initialize the string table to contain various identifiers with
# builtin meanings and/or precedences.  Then build trees to correspond
# to default signatures, as well as certain other standard subtrees.
#


global indx_assign      # precedence 0 
global indx_passign
global indx_massign
#   cor             precedence 1 
#   cand            precedence 2 
# other operators   precedence 3 
global indx_or          #  precedence 4 
global indx_and         #  precedence 5 
global indx_not         #  precedence 6 
global indx_equals      #  precedence 7 
global indx_less
global indx_le
global indx_ge
global indx_ne
global indx_greater
global indx_plus        #  precedence 8 
global indx_minus
global indx_times       #  precedence 9 
global indx_divide      
global indx_mod
global indx_pconc       #  precedence 10 
global indx_sconc
global indx_exp         #  precedence 11 
global indx_deref       #  precedence 12 
global indx_subscr      #  precedence 13 
global indx_New         #  no precedence 
global indx_ValueOf
global indx_First
global indx_Last
global indx_Pred
global indx_Succ
global indx_Ord
global indx_OrdInv
global indx_Card
global indx_In
global indx_Out
global indx_put
global indx_Callcc
global indx_size
global indx_ptr_New
global indx_init_New
global indx_empty
global indx_standard
global indx_inline

global pend   #  pend[n] global  last string table entry with precedence 
#  level n                                           
global indx_Boolean
global indx_Void
global indx_true
global indx_false
global indx_simple
global indx_Null
global indx_Mk
global indx_Integer
global indx_Void
global indx_Array

global sig_assign
global sig_equals
global sig_less
global sig_greater
global sig_New
global sig_const
global sig_ValueOf
global sig_pconc
global sig_sconc
global sig_Signature
global val_Boolean
global val_Integer
global val_Void
global var_Void
global sel_true  #  Trees for Boolean$true[] and Boolean$false[] 
global sel_false
global id_Boolean #  Note that the last definition field needs to be 
#  set later 
global id_Integer
global id_Void
global id_put
global id_ValueOf
global id_New
global id_size
global id_Null
global id_times
global id_plus
global appl_Null

global yyvline  #  initialized here since it is incorporated into 
#  the structures created here.                   

global stt_table, stt_unique_cnt, stt_reference_cnt, reverse_stt

global errfile, infofile, reduce, progress , debug_file, stats, nodes, ccode_file
global nodes_file, lists_created_file, cons_file, treefile, symfile, sym2file
global nodes_created_file

global line_cnt, char_cnt, token_cnt, reserved_id_cnt, reserved_op_cnt, stt_unique_cnt, stt_reference_cnt, numeral_cnt, nodes_total_cnt, nodes_made_cnt, lists_total_cnt, lists_made_cnt, yyn_switches_cnt, yyn_compute_cnt, newstate_cnt, setstate_cnt, backup_cnt, default_cnt, reduce_cnt, errlab_cnt, errlab1_cnt
global defined_id_cnt, defined_op_cnt, seperator_cnt
global RIC_table,RIC_op_code_cnt,RIC_table_entry_cnt, comments_cnt
global sing_quoted_cnt, dbl_quoted_cnt

# from main
global infile, optfile, entry_name, yyinfnm, yyline, addposition, inline_cnvt
global Ginline_cnvt, Vinline_cnvt

# following for grammar.y
#DJDSTOP
global paramstop, denseqstop, condstop, declstop
#DJDSART
global stxtree, yystate , fn_count, scanstk, stktop, scansavc
global yydescr, has_externs, argcnt_from_kind, parser_actions_cnt 
global curr_void_decl, curr_sig_transp, curr_tsig, err_node, in_sig
global in_loop,  var_Void,  sig_Signature


# for scanner
global linebuf, restab, cctab, tokenlgth

# for applinfer/mkappl2
# global cor_cond();

global yynerrs


# NODE * cand_cond();

# NODE ** outermost_op();


# for sigio
global decl_num, decl_nums, Outer_arg   #   last number assigned to a declaration 
global file_sigs, decl_num_in, sig_table
# decl_nul & decl_num_in had same name -but static!!

global argcnt_from_kind
global unique_node_id
global objfilelist
global Idtable
global dump_tree_depth

global next_pre, next_post   # next pre- and post-order numbers to be 
                                  # assigned.                              
global visited

# Pass 5d
global Gfc_list 
global Glevel        # current static nesting level 

global Gcurrent
global Goutfile

global finished_accessible             # Finished BOTH accessibility    
global all_fcs, all_fcs_tail, outer_fc, whole_program, currect_fcs

global Vcurrent_func       # Immediately surrounding function construction 
global Vcurrent_ar         # Immediately surrounding construct (block 
			    # or function) requiring an act. record.   

global Vstatic_level
global Vnext_free            # Next location in activation record to be 
			    # allocated.                               
global Vhigh_water            # max(Vnext_free, Vhigh_water) = highest   
			    # numbered location allocated so far.  At  
			    # the end of a fn this is the required a.r.
			    # size.                                    

global Vextent_limited     # Variables can't outlive current function  
			     # activation & current block is executed    
			     # only once in current fn activation.       
global Vallocate_on_stack  # It is safe to allocate variables directly 
			     # in the activation record in the current   
			     # context.                                  
			     # This implies Vextent_limited and callcc   
			     # can't be called.                          
			     # On the VAX it also means that a.r. must   
			     # always be stack allocated, since pointers 
			     # to the middle of objects may o.w. result  
			     # Even if this is false, individual vars    
			     # may be allocated directly in a.r. if no   
			     # references to that particular             
			     # variable can be created.                  
global Vcallcc             # Current function may save a continuation  

global max_addr_regs # Try to allocate this many non-parameter 
			   # represented by pointers to registers    
global max_int_regs  # Number of non-pointers to allocate to regs 
global  n_addr_regs       # Number of virtual registers allocated to 
global n_int_regs        # variables so far.                        
			   # Note that the distinction between int and  
			   # addr is very approximate.  All initialized 
			   # variables, as well as all non-variables    
			   # count as ints.                             
global Vcurrent_blocks 
global found_non_vacuous # Saw a real argument 
global n_vacuous                 # Number of vacuous arguments found so far 
global avail_loc
global compile_fcs, sl_available
global stplinks
global fld_table

global surr_loop, callcc_call

global catchsigs, Gspcl_to_inline
global htable # RIC.icn
global  avail_loc # RIC.icn
