###############################################################################
#
#	File:     ststructs_cls.icn
#
#	Subject:  russell language support procedures
#
#	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.
#
###############################################################################
#
# NOTE: I use Unicon classes (and subclasses and multiple inheritance) which
# should be more reliable and portable than the techniques used in the "C"
# code.
#
############################################################################### 

$include "defs.icn"
$include "global_vars.icn"

procedure special(tp,val)
    return ior(ishift(tp , 26) , val)
end

procedure mklist( va_alist )
    local i,p,l
    yyinfo("mklist va_alist")
    nodeinfo("mklist va_alist")
    listinfo("mklist va_alist")
    consinfo("mklist va_alist")


    lists_total_cnt +:= 1
    lists_made_cnt +:= 1
    l := emptylist()

    every (p := !va_alist) do {
	nodeinfo("mklist type p = " || dump_info(p))
	yyinfo("mklist type p = " || dump_info(p))
	if \p then {
#	    p.dump(nodes_created_file)
	}
	consinfo("mklist l before addright(l,p)")
	if \l then
	    l.cons_dump()
	else
	    consinfo("l nil")
	consinfo("mklist p before addright(l,p)")
	if \p then
	    p.cons_dump()
	else
	    consinfo("mklist p nil")
        l := addright(l,p)
	consinfo("mklist l after addright(l,p)")
	if \l then
	    l.cons_dump()
	else
	    consinfo("mklist l nil")
    }
    consinfo("mklist done")
	if \l then
	    l.cons_dump()
	else
	    consinfo("l nil")
    return l
end
procedure emptylist()
local ret
    nodeinfo("Creating emptylist")
    listinfo("Creating emptylist")

    ret := mknode([LISTHEADER,nil,nil])
#    ret.dump(nodes_created_file)
    return ret
end

#DJDSTOP
procedure cn_cons(hd,tl)
    local p
    listinfo("cn_cons")

    p := ConsNode(hd,tl)
    return p
end
#DJDSTART
procedure is_list(l_orig)
local l
    if /l_orig then fail
    l := fix_p(l_orig)
    if (/l) then fail
    if /l.kind | l.kind = LISTHEADER
    then return TRUE
    else fail
end

procedure should_examine(fld)
    if fld_table[fld] = TRUE 
    then return TRUE
    else fail
end




procedure is_empty(l)
    if not(is_list(l)) then {
	nodeinfo("is empty  not a list - TRUE")
	listinfo("is empty not a list - TRUE")
	return TRUE
    }
    if /l then {
	nodeinfo("is empty TRUE")
	listinfo("is empty TRUE")
	return TRUE
    }
    if /l.lh_first then {
	nodeinfo("is empty l.lh_first TRUE")
	listinfo("is empty l.lh_first TRUE")
	return TRUE
    }
    nodeinfo("is empty lh_first - FALSE")
    listinfo("is empty lh_first - FALSE")
    fail
end

procedure split(kindno, id_list, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 , arg10)
    local vrtx,  result, p, ptr
    # Build a node with the id pointed to by p in the id field */
	# end add it to the result.                                 */
	result := emptylist()
    listinfo("IN SPLIT")
    nodeinfo("IN SPLIT")
    ptr := id_list.cn_hd_field
    while \ptr  do {
	p :=  ptr.cn_hd_field
	{
	    yyinfo("listops split kindno = " || kindno)
            case ( argcnt_from_kind[kindno + 1])  of {
		0: vrtx := mknode([kindno])
		1: vrtx := mknode([kindno, p])
		2: vrtx := mknode([kindno, p, arg1])
                3: vrtx := mknode([ kindno, p ,arg1, arg2])
		4: vrtx := mknode([kindno, p, arg1, arg2, arg3])
		5: vrtx := mknode([kindno,p, arg1, arg2, arg3, arg4])
                6: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5 ])
                7: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6 ])
                8: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6,arg7 ])
                9: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6, arg7. arg8 ])
                10: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ])
                11: vrtx := mknode([ kindno, p,arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg7, arg9, arg10 ])
                default: rpt_err("split: bad node size: kind =  " ||  kindno)
            }
            result := addright(result, vrtx)
	}

	ptr := p.cn_tl_field
    }

    nodeinfo("Split")
#    result.dump(nodes_created_file)
    return ( result )
end
procedure conc(l1,l2)
    if ( is_empty(l1) ) then
	{
	    vfree(l1)
	    return(l2)
	}
    if ( not(is_empty(l2)) )  then
	{
	    l1.lh_last.cn_tl_field := l2.lh_first
	    l1.lh_last := l2.lh_last
	}
    # free l2. Note that vfree cannot be used without clearing the first */
	# last fields since the cons nodes are being reused. */
        l2 .lh_last := l2 .lh_first := nil
    vfree(l2)
    return ( l1 )
end
#
# Add node e at end of list l.
# If e is nil do nothing.
#
procedure addleft(l,e)
    local p
    listinfo("addleft dump_info(e) = " || dump_info(e))
    nodeinfo("addleft dump_info(e) = " || dump_info(e))
    
    if ( /e ) then return l
# p := ListHeaderNode(nil, nil, lock(e), nil)
    if( is_empty(l) ) then {
	p := ConsNode(lock(e),nil)
	l.lh_first :=  p
	l.lh_last := p
    } else {
	l.lh_first := ConsNode(lock(e),l.lh_first)
    }
    consinfo("addleft return")
    l.cons_dump()
    return  l
end
#
# add node e at beginning of list l.
# if e is NIL do nothing
# return l
#
procedure addright(l,e)
    local p
    listinfo("addright dump_info(e) = " || dump_info(e))
    nodeinfo("addright dump_info(e) = " || dump_info(e))
    if (/e) then {
	nodeinfo("addright 1 return l type l = " || dump_info(l))
	listinfo("addright 1 return l type l = " || dump_info(l))
	return l
    }
    p := ConsNode(lock(e),nil)
    nodeinfo("addright 2 p = " || dump_info(p))
    listinfo("addright 2 p = " || dump_info(p))
#    p.dump(nodes_created_file)
    if ( is_empty(l) ) then {
	nodeinfo("addright 3 l = empty" || dump_info(l))
	listinfo("addright 3 l = empty" || dump_info(l))
	l.lh_first := p
	l.lh_last :=  p
	nodeinfo("addright - in next node lh first & last should equal p above")
	listinfo("addright - in next node lh first & last should equal p above")
#	l.dump(nodes_created_file)
    } else {

	l.lh_last.cn_tl_field := p
	l.lh_last := p
	listinfo("addright - in next node lh last.cn_tl_field should equal p above")
	nodeinfo("addright - in next node lh last.cn_tl_field should equal p above")
#	l.lh_last.dump(nodes_created_file)
	nodeinfo("addright - in next node lh last should equal p above")

#	l.dump(nodes_created_file)


    }
    consinfo("addright return")
#    l.cons_dump()
    return l
end

#############################################################################
class Node(kind,vlineno,pre_num,post_num)
method dump(nodes_created_file)
{ # SignatureSig
if /kind 
then write(nodes_created_file,"nil")
else
    {
write(nodes_created_file, left("kind   = ",20 + dump_tree_depth) || dump_info(self.kind))
if integer(self.kind) then 
write(nodes_created_file, left("kind name = ",20 + dump_tree_depth) || NodeTypeName[self.kind + 1])
else 
write(nodes_created_file,dump_info(self.kind))
write(nodes_created_file, left("vlineno   = ",20 + dump_tree_depth) || dump_info(self.vlineno))
write(nodes_created_file, left("pre_num   = ",20 + dump_tree_depth) || dump_info(self.pre_num))
write(nodes_created_file, left("post_num   = ",20 + dump_tree_depth) || dump_info(self.post_num))
}
}
end
method dump_tree()
{ # SignatureSig
	    proc_dump_tree(self,"kind   = ", self.kind)
	    proc_dump_tree(self,"vlineno   = ",self.vlineno)
	    proc_dump_tree(self,"pre_num   = ",self.pre_num)
	    proc_dump_tree(self,"post_num   = ",self.post_num)
	}

end

initially (knd, line, pre, post)
{
kind := knd
vlineno := line
pre_num := pre
post_num := post
}

end

############################################################################

class ConsNode(unique_id,cn_hd_field,cn_tl_field)
method dump(nodes_created_file)
{ 
	    write(nodes_created_file, left("cn_hd_field   = ",20 + dump_tree_depth) || dump_info(self.cn_hd_field))
	    write(nodes_created_file, left("cn_tl_field   = ",20 + dump_tree_depth) || dump_info(self.cn_tl_field))
	    write(nodes_created_file, left("Unique Id   = ",20 + dump_tree_depth) || dump_info(self.unique_id))
	}
end
method dump_tree()
{ 
	    proc_dump_tree(self,"cn_hd_field   = ",self.cn_hd_field)
	    proc_dump_tree(self,"cn_tl_field   = ",self.cn_tl_field)
	    proc_dump_tree(self,"Unique Id   = ",self.unique_id)
	}
end
method cons_dump()
{ 
	    write(cons_file, left("cn_hd_field   = ",20 + dump_tree_depth) || dump_info(self.cn_hd_field))
	    write(cons_file, left("cn_tl_field   = ",20 + dump_tree_depth) || dump_info(self.cn_tl_field))
	    write(cons_file, left("Unique Id   = ",20 + dump_tree_depth) || dump_info(self.unique_id))
	}
end

#DJDSTOP
method head()
return cn_hd_field
end
method tail()
return cn_tl_field
end
method cn_sethead(hd)
listinfo("cn_sethead")
cn_hd_field := hd
end
method cn_settail(tl)
listinfo("cn_settail")
cn_hd_field := tl
end
initially(cn_hd,cn_tl)
{
cn_tl_field := cn_tl
cn_hd_field := cn_hd

unique_node_id +:= 1
unique_id := unique_node_id
}
end
#DJDSTART

initially(cn_hd,cn_tl)
{
cn_tl_field := cn_tl
cn_hd_field := cn_hd

unique_node_id +:= 1
unique_id := unique_node_id
}
end

###########################################################################

class  ListHeaderNode: Node : ConsNode (lh_first,lh_last)

method dump(nodes_created_file)
{ # DeclarationNode
self$Node.dump(nodes_created_file)
# self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file, left("lh_first   = ",20 + dump_tree_depth) || dump_info(self.lh_first))
	    write(nodes_created_file, left("lh_last   = ",20 + dump_tree_depth) || dump_info(self.lh_last))
}
end
method dump_tree()
{ # DeclarationNode
self$Node.dump_tree(treefile)
# self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"lh_first   = ", self.lh_first)
proc_dump_tree(self,"lh_last   = ", self.lh_last)
}
end
method list_dump()
{ # DeclarationNode
self$Node.dump()
# self$ConsNode.dump()
	    write(nodes_created_file, left("lh_first   = ",20 + dump_tree_depth) || dump_info(self.lh_first))
	    write(nodes_created_file, left("lh_last   = ",20 + dump_tree_depth) || dump_info(self.lh_last))
}
end

method first()
return self.lh_first
end


method  last()
return self.lh_last
end

method setfirst(p)
lh_first := p
end
method setlast(p)
lh_last := p
end



#
#     conc(l1,l2)
#
#  Destructively appends l1 to l2 and returns the result.
#   l1 becomes the result. l2 is destroyed.
#
#
method conc(l2)
if (is_empty(self) ) then
    {
return(l2)
}
if ( not is_empty(l2) ) then
    {
self.cn_tl_field.cn_settail(l2.cn_hd_field)
self.cn_settail(l2.cn_tl_field)
}
l2 := l2.hd_field := l2.tl_field := nil
# free l2. Note that vfree cannot be used without clearing the first
# last fields since the cons nodes are being reused.
l2.lh_last := l2.lh_first := nil
vfree(l2)
return (self)
end

#
# length(l)
#
#  assuming l is a list
#    return the number of elements in it
#
method  length()
local count, v, tmp
listinfo("IN LENGTH")
count := 0
listinfo("length count = " || count || "dump_info(self.lh_first) = " || (dump_info(self.lh_first)))

tmp := self.lh_first
while \tmp  do {
v := tmp.cn_hd_field
count +:= 1
tmp := tmp.cn_tl_field
listinfo("length count = " || count || "dump_info(v) = " || dump_info(v))
}
return ( count )
end
#
#  list_to_array(l)
#
#  input: A list l.
#
#  output: An array containing pointers to the elements of l.
#          The elements of l are locked.
#          l is vfreed (but unaffected if it has nonzero reference count).
#
method list_to_array()
local    a, len, tmp, v, it, count
len := self.length()
it := list(len + 1)
count := 0
listinfo("list_to_array count = " || count || "dump_info(self.lh_first) = " || (dump_info(self.lh_first)))
tmp := self.lh_first
listinfo("list to array len = " || len || " tmp = " || dump_info(tmp))
while \tmp  do {
v := tmp.cn_hd_field
count +:= 1
listinfo("list to array count = " || count || " v = " || dump_info(v))
it[count] := v
tmp := tmp.cn_tl_field
}
a := Array(len,it)
return ( a )
end
initially
kind := LISTHEADER
end
##############################################################################
class DeclarationNode  : Node : ConsNode(decl_id,decl_denotation,displacement,level,decl_signature,decl_done,decl_sig_transp,decl_innermost_id,decl_previous_definition,decl_scope,decl_can_be_refd,decl_special,decl_sel_index,decl_needed,decl_const_val)
method dump(nodes_created_file)
{ # DeclarationNode
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("decl_id   = ",20 + dump_tree_depth) || dump_info(self.decl_id))
	    write(nodes_created_file,left("decl_denotation   = ",20 + dump_tree_depth) || dump_info(self.decl_denotation))
	    write(nodes_created_file,left("displacement   = ",20 + dump_tree_depth) || dump_info(self.displacement))
	    write(nodes_created_file,left("level   = ",20 + dump_tree_depth) || dump_info(self.level))
	    write(nodes_created_file,left("decl_signature   = ",20 + dump_tree_depth) || dump_info(self.decl_signature))
	    write(nodes_created_file,left("decl_done   = ",20 + dump_tree_depth) || dump_info(self.decl_done))
	    write(nodes_created_file,left("decl_sig_transp   = ",20 + dump_tree_depth) || dump_info(self.decl_sig_transp))
	    write(nodes_created_file,left("decl_innermost_id   = ",20 + dump_tree_depth) || dump_info(self.decl_innermost_id))
	    write(nodes_created_file,left("decl_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.decl_previous_definition))
	    write(nodes_created_file,left("decl_scope   = ",20 + dump_tree_depth) || dump_info(self.decl_scope))
	    write(nodes_created_file,left("decl_can_be_refd   = ",20 + dump_tree_depth) || dump_info(self.decl_can_be_refd))
	    write(nodes_created_file,left("decl_special   = ",20 + dump_tree_depth) || dump_info(self.decl_special))
	    write(nodes_created_file,left("decl_sel_index   = ",20 + dump_tree_depth) || dump_info(self.decl_sel_index))
	    write(nodes_created_file,left("decl_needed   = ",20 + dump_tree_depth) || dump_info(self.decl_needed))
	    write(nodes_created_file,left("decl_const_val   = ",20 + dump_tree_depth) || dump_info(self.decl_const_val))
	}
end
method dump_tree()
{ # DeclarationNode
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"decl_id   = ", self.decl_id)
proc_dump_tree(self,"decl_denotation   = ", self.decl_denotation)
proc_dump_tree(self,"displacement   = ", self.displacement)
proc_dump_tree(self,"level   = ", self.level)
proc_dump_tree(self,"decl_signature   = ", self.decl_signature)
proc_dump_tree(self,"decl_done   = ", self.decl_done)
proc_dump_tree(self,"decl_sig_transp   = ", self.decl_sig_transp)
proc_dump_tree(self,"decl_innermost_id   = ", self.decl_innermost_id)
proc_dump_tree(self,"decl_previous_definition   = ", self.decl_previous_definition)
proc_dump_tree(self,"decl_scope   = ", self.decl_scope)
proc_dump_tree(self,"decl_can_be_refd   = ", self.decl_can_be_refd)
proc_dump_tree(self,"decl_special   = ", self.decl_special)
proc_dump_tree(self,"decl_sel_index   = ", self.decl_sel_index)
proc_dump_tree(self,"decl_needed   = ", self.decl_needed)
proc_dump_tree(self,"decl_const_val   = ", self.decl_const_val)
	}
end
end
class ParameterNode : Node : ConsNode(par_id,par_signature,displacement,level,par_previous_definition,par_scope,par_only_def)
method dump(nodes_created_file)
{ # Parameter
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)

	    write(nodes_created_file,left("par_id   = ",20 + dump_tree_depth) || dump_info(self.par_id))
	    write(nodes_created_file,left("par_signature   = ",20 + dump_tree_depth) || dump_info(self.par_signature))
	    write(nodes_created_file,left("displacement   = ",20 + dump_tree_depth) || dump_info(self.displacement))
	    write(nodes_created_file,left("level   = ",20 + dump_tree_depth) || dump_info(self.level))
	    write(nodes_created_file,left("par_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.par_previous_definition))
	    write(nodes_created_file,left("par_scope   = ",20 + dump_tree_depth) || dump_info(self.par_scope))
	    write(nodes_created_file,left("par_only_def   = ",20 + dump_tree_depth) || dump_info(self.par_only_def))
	}
end
method dump_tree()
{ # Parameter
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)

proc_dump_tree(self,"par_id   = ", self.par_id)
proc_dump_tree(self,"par_signature   = ", self.par_signature)
proc_dump_tree(self,"displacement   = ", self.displacement)
proc_dump_tree(self,"level   = ", self.level)
proc_dump_tree(self,"par_previous_definition   = ", self.par_previous_definition)
proc_dump_tree(self,"par_scope   = ", self.par_scope)
proc_dump_tree(self,"par_only_def   = ", self.par_only_def)
	}
end
end
class RElementNode : Node : ConsNode(re_id,re_denotation,re_New_index,re_ValueOf_index,re_assign_index)

method dump(nodes_created_file)
{ # RElement
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)

	    write(nodes_created_file,left("re_id   = ",20 + dump_tree_depth) || dump_info(self.re_id))
	    write(nodes_created_file,left("re_denotation   = ",20 + dump_tree_depth) || dump_info(self.re_denotation))
	    write(nodes_created_file,left("re_New_index   = ",20 + dump_tree_depth) || dump_info(self.re_New_index))
	    write(nodes_created_file,left("re_ValueOf_index   = ",20 + dump_tree_depth) || dump_info(self.re_ValueOf_index))
	    write(nodes_created_file,left("re_assign_index   = ",20 + dump_tree_depth) || dump_info(self.re_assign_index))
	}
end
method dump_tree()
{ # RElement
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)

proc_dump_tree(self,"re_id   = ", self.re_id)
proc_dump_tree(self,"re_denotation   = ", self.re_denotation)
proc_dump_tree(self,"re_New_index   = ", self.re_New_index)
proc_dump_tree(self,"re_ValueOf_index   = ", self.re_ValueOf_index)
proc_dump_tree(self,"re_assign_index   = ", self.re_assign_index)
	}
end
end
class VarSignature : Node : ConsNode(signature,sig_done,var_denotation)
method dump(nodes_created_file)
 { # VarSignature
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("var_denotation   = ",20 + dump_tree_depth) || dump_info(self.var_denotation))
	}
end
method dump_tree()
 { # VarSignature
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"var_denotation   = ", self.var_denotation)
	}
end
end
class ValSignature : Node : ConsNode(signature,sig_done,val_denotation)

method dump(nodes_created_file)
{ # ValSignature
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)

	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("val_denotation   = ",20 + dump_tree_depth) || dump_info(self.val_denotation))
	}
end
method dump_tree()
{ # ValSignature
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)

proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"val_denotation   = ", self.val_denotation)
	}
end
end
class FSignature : Node : ConsNode(signature,sig_done,fsig_construction,fsig_special,fsig_slink_known,fsig_inline_code,fsig_param_list,fsig_result_sig,fc_code_label)
method dump(nodes_created_file)
 { # FSignature
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("fsig_construction   = ",20 + dump_tree_depth) || dump_info(self.fsig_construction))
	    write(nodes_created_file,left("fsig_special   = ",20 + dump_tree_depth) || dump_info(self.fsig_special))
	    write(nodes_created_file,left("fsig_slink_known   = ",20 + dump_tree_depth) || dump_info(self.fsig_slink_known))
	    write(nodes_created_file,left("fsig_inline_code   = ",20 + dump_tree_depth) || dump_info(self.fsig_inline_code))
	    write(nodes_created_file,left("fsig_param_list   = ",20 + dump_tree_depth) || dump_info(self.fsig_param_list))
	    write(nodes_created_file,left("fsig_result_sig   = ",20 + dump_tree_depth) || dump_info(self.fsig_result_sig))
	    write(nodes_created_file,left("fc_code_label   = ",20 + dump_tree_depth) || dump_info(self.fc_code_label))
	}
end
method dump_tree()
 { # FSignature
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"fsig_construction   = ", self.fsig_construction)
proc_dump_tree(self,"fsig_special   = ", self.fsig_special)
proc_dump_tree(self,"fsig_slink_known   = ", self.fsig_slink_known)
proc_dump_tree(self,"fsig_inline_code   = ", self.fsig_inline_code)
proc_dump_tree(self,"fsig_param_list   = ", self.fsig_param_list)
proc_dump_tree(self,"fsig_result_sig   = ", self.fsig_result_sig)
proc_dump_tree(self,"fc_code_label   = ", self.fc_code_label)
	}
end
initially
self.fsig_param_list := emptylist() 
end
class TSignature : Node : ConsNode(signature,sig_done,ts_simple_type,ts_local_type_id,ts_clist,ts_previous_definition,ts_const_code,ts_string_code,ts_element_code,ts_string_max,ts_meta_concat)
method dump(nodes_created_file)
{ # TSignature
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("ts_simple_type   = ",20 + dump_tree_depth) || dump_info(self.ts_simple_type))
	    write(nodes_created_file,left("ts_local_type_id   = ",20 + dump_tree_depth) || dump_info(self.ts_local_type_id))
	    write(nodes_created_file,left("ts_clist   = ",20 + dump_tree_depth) || dump_info(self.ts_clist))
	    write(nodes_created_file,left("ts_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.ts_previous_definition))
	    write(nodes_created_file,left("ts_const_code   = ",20 + dump_tree_depth) || dump_info(self.ts_const_code))
	    write(nodes_created_file,left("ts_string_code   = ",20 + dump_tree_depth) || dump_info(self.ts_string_code))
	    write(nodes_created_file,left("ts_element_code   = ",20 + dump_tree_depth) || dump_info(self.ts_element_code))
	    write(nodes_created_file,left("ts_string_max   = ",20 + dump_tree_depth) || dump_info(self.ts_string_max))
	    write(nodes_created_file,left("ts_meta_concat   = ",20 + dump_tree_depth) || dump_info(self.ts_meta_concat))
	}
end
method dump_tree()
{ # TSignature
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"ts_simple_type   = ", self.ts_simple_type)
proc_dump_tree(self,"ts_local_type_id   = ", self.ts_local_type_id)
proc_dump_tree(self,"ts_clist   = ", self.ts_clist)
proc_dump_tree(self,"ts_previous_definition   = ", self.ts_previous_definition)
proc_dump_tree(self,"ts_const_code   = ", self.ts_const_code)
proc_dump_tree(self,"ts_string_code   = ", self.ts_string_code)
proc_dump_tree(self,"ts_element_code   = ", self.ts_element_code)
proc_dump_tree(self,"ts_string_max   = ", self.ts_string_max)
proc_dump_tree(self,"ts_meta_concat   = ", self.ts_meta_concat)
	}
end
initially
self.ts_clist := emptylist()
end
class TSComponentNode : Node : ConsNode(tsc_id,tsc_signature)
method dump(nodes_created_file)
 { # TSComponent
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)

	    write(nodes_created_file,left("tsc_id   = ",20 + dump_tree_depth) || dump_info(self.tsc_id))
	    write(nodes_created_file,left("tsc_signature   = ",20 + dump_tree_depth) || dump_info(self.tsc_signature))
	}
end
method dump_tree()
 { # TSComponent
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)

proc_dump_tree(self,"tsc_id   = ", self.tsc_id)
proc_dump_tree(self,"tsc_signature   = ", self.tsc_signature)
	}
end
end
class DefCharSigNode : Node : ConsNode(dcs_0,dcs_1,dcs_2,dcs_3,dcsexceptions)
method dump(nodes_created_file)
 { # DefCharSig
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)

	    write(nodes_created_file,left("dcs_0   = ",20 + dump_tree_depth) || dump_info(self.dcs_0))
	    write(nodes_created_file,left("dcs_1   = ",20 + dump_tree_depth) || dump_info(self.dcs_1))
	    write(nodes_created_file,left("dcs_2   = ",20 + dump_tree_depth) || dump_info(self.dcs_2))
	    write(nodes_created_file,left("dcs_3   = ",20 + dump_tree_depth) || dump_info(self.dcs_3))
	    write(nodes_created_file,left("dcsexceptions   = ",20 + dump_tree_depth) || dump_info(self.dcsexceptions))
	}
end
method dump_tree()
 { # DefCharSig
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)

proc_dump_tree(self,"dcs_0   = ", self.dcs_0)
proc_dump_tree(self,"dcs_1   = ", self.dcs_1)
proc_dump_tree(self,"dcs_2   = ", self.dcs_2)
proc_dump_tree(self,"dcs_3   = ", self.dcs_3)
proc_dump_tree(self,"dcsexceptions   = ", self.dcsexceptions)
	}
end
end

class SignatureSigNode : Node : ConsNode(signature,sig_done)
method dump(nodes_created_file)
{ # SignatureSig
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)

	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	}
end
method dump_tree()
{ # SignatureSig
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)

proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
	}
end
end
class BlDenotationNode : Node : ConsNode(signature,sig_done,ar_size,ar_static_link,ar_static_level,bld_declaration_list,bld_den_seq,bld_precedence,bld_flags,fc_code_label)
method dump(nodes_created_file)
{ # BlDenotation
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)

	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("ar_size   = ",20 + dump_tree_depth) || dump_info(self.ar_size))
	    write(nodes_created_file,left("ar_static_link   = ",20 + dump_tree_depth) || dump_info(self.ar_static_link))
	    write(nodes_created_file,left("ar_static_level   = ",20 + dump_tree_depth) || dump_info(self.ar_static_level))
	    write(nodes_created_file,left("bld_declaration_list   = ",20 + dump_tree_depth) || dump_info(self.bld_declaration_list))
	    write(nodes_created_file,left("bld_den_seq   = ",20 + dump_tree_depth) || dump_info(self.bld_den_seq))
	    write(nodes_created_file,left("bld_precedence   = ",20 + dump_tree_depth) || dump_info(self.bld_precedence))
	    write(nodes_created_file,left("bld_flags   = ",20 + dump_tree_depth) || dump_info(self.bld_flags))
	    write(nodes_created_file,left("fc_code_label  = ",20 + dump_tree_depth) || dump_info(self.fc_code_label))
	}
end
method dump_tree()
{ # BlDenotation
self$Node.dump_tree()
self$ConsNode.dump_tree()

	    proc_dump_tree(self,"signature   = ",self.signature)
	    proc_dump_tree(self,"sig_done   = ",self.sig_done)
	    proc_dump_tree(self,"ar_size   = ",self.ar_size)
	    proc_dump_tree(self,"ar_static_link   = ",self.ar_static_link)
	    proc_dump_tree(self,"ar_static_level   = ",self.ar_static_level)
	    proc_dump_tree(self,"bld_declaration_list   = ",self.bld_declaration_list)
	    proc_dump_tree(self,"bld_den_seq   = ",self.bld_den_seq)
	    proc_dump_tree(self,"bld_precedence   = ",self.bld_precedence)
	    proc_dump_tree(self,"bld_flags   = ",self.bld_flags)
	    proc_dump_tree(self,"fc_code_label   = ",self.fc_code_label)
	}
end
initially
self.bld_flags := 0
self.bld_declaration_list := emptylist()
self.bld_den_seq := emptylist()
end
class UseListNode : Node : ConsNode(signature,sig_done,usl_type_list,usl_den_seq,usl_previous_list,usl_precedence)
method dump(nodes_created_file)
 { # UseList
self$Node.dump_tree(treefile)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("usl_type_list   = ",20 + dump_tree_depth) || dump_info(self.usl_type_list))
	    write(nodes_created_file,left("usl_den_seq   = ",20 + dump_tree_depth) || dump_info(self.usl_den_seq))
	    write(nodes_created_file,left("usl_previous_list   = ",20 + dump_tree_depth) || dump_info(self.usl_previous_list))
	    write(nodes_created_file,left("usl_precedence   = ",20 + dump_tree_depth) || dump_info(self.usl_precedence))
	}
end
method dump_tree()
 { # UseList
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"usl_type_list   = ", self.usl_type_list)
proc_dump_tree(self,"usl_den_seq   = ", self.usl_den_seq)
proc_dump_tree(self,"usl_previous_list   = ", self.usl_previous_list)
proc_dump_tree(self,"usl_precedence   = ", self.usl_precedence)
	}
end
initially
self.usl_type_list := emptylist()
self.usl_previous_list := emptylist()
end
class ApplicationNode : Node : ConsNode(signature,sig_done,ap_operator,ap_args,ap_void_decl)
method dump(nodes_created_file)
 { # Application
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("ap_operator   = ",20 + dump_tree_depth) || dump_info(self.ap_operator))
	    write(nodes_created_file,left("ap_args   = ",20 + dump_tree_depth) || dump_info(self.ap_args))
	    write(nodes_created_file,left("ap_void_decl   = ",20 + dump_tree_depth) || dump_info(self.ap_void_decl))
	}
end
method dump_tree()
 { # Application
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"ap_operator   = ", self.ap_operator)
proc_dump_tree(self,"ap_args   = ", self.ap_args)
proc_dump_tree(self,"ap_void_decl   = ", self.ap_void_decl)
	}
end
initially
self.ap_args := emptylist()
end
class EnumerationNode : Node : ConsNode(signature,sig_done,enum_id_list)
method dump(nodes_created_file)
 { # Enumeration
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("enum_id_list   = ",20 + dump_tree_depth) || dump_info(self.enum_id_list))
	}
end
method dump_tree()
 { # Enumeration
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"enum_id_list   = ", self.enum_id_list)
	}
end
initially
self.enum_id_list := emptylist()
end
class ExtensionNode : Node : ConsNode(signature,sig_done,ext_denotation,In_index,Out_index)
method dump(nodes_created_file)
 { # Extension
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("ext_denotation   = ",20 + dump_tree_depth) || dump_info(self.ext_denotation))
	    write(nodes_created_file,left("In_index   = ",20 + dump_tree_depth) || dump_info(self.In_index))
	    write(nodes_created_file,left("Out_index   = ",20 + dump_tree_depth) || dump_info(self.Out_index))
	}
end
method dump_tree()
 { # Extension
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"ext_denotation   = ", self.ext_denotation)
proc_dump_tree(self,"In_index   = ", self.In_index)
proc_dump_tree(self,"Out_index   = ", self.Out_index)
	}
end
end
class ProductNode : Node : ConsNode(signature,sig_done,prod_local_type_id,prod_components,prod_previous_definition)
method dump(nodes_created_file)
 { # Product
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("prod_local_type_id   = ",20 + dump_tree_depth) || dump_info(self.prod_local_type_id))
	    write(nodes_created_file,left("prod_components   = ",20 + dump_tree_depth) || dump_info(self.prod_components))
	    write(nodes_created_file,left("prod_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.prod_previous_definition))
	}
end
method dump_tree()
 { # Product
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"prod_local_type_id   = ", self.prod_local_type_id)
proc_dump_tree(self,"prod_components   = ", self.prod_components)
proc_dump_tree(self,"prod_previous_definition   = ", self.prod_previous_definition)
	}
end
end
class RecordConstructionNode : Node : ConsNode(signature,sig_done,rec_component_list,rec_previous_definition)
method dump(nodes_created_file)
{ # RecordConstruction
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("rec_component_list   = ",20 + dump_tree_depth) || dump_info(self.rec_component_list))
	    write(nodes_created_file,left("rec_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.rec_previous_definition))
	}
end
method dump_tree()
{ # RecordConstruction
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"rec_component_list   = ", self.rec_component_list)
proc_dump_tree(self,"rec_previous_definition   = ", self.rec_previous_definition)
	}
end
initially
self.rec_component_list := emptylist()
end
class UnionConstructionNode : Node : ConsNode(signature,sig_done,prod_local_type_id,prod_components,prod_previous_definition)
method dump(nodes_created_file)
 { # UnionConstruction
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("prod_local_type_id   = ",20 + dump_tree_depth) || dump_info(self.prod_local_type_id))
	    write(nodes_created_file,left("prod_components   = ",20 + dump_tree_depth) || dump_info(self.prod_components))
	    write(nodes_created_file,left("prod_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.prod_previous_definition))
	}
end
method dump_tree()
 { # UnionConstruction
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"prod_local_type_id   = ", self.prod_local_type_id)
proc_dump_tree(self,"prod_components   = ", self.prod_components)
proc_dump_tree(self,"prod_previous_definition   = ", self.prod_previous_definition)
	}
end
end
class WithListNode : Node : ConsNode(wl_local_type_id,wl_component_list,wl_previous_definition)
method dump(nodes_created_file)

{ # WithList
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("wl_local_type_id   = ",20 + dump_tree_depth) || dump_info(self.wl_local_type_id))
	    write(nodes_created_file,left("wl_component_list   = ",20 + dump_tree_depth) || dump_info(self.wl_component_list))
	    write(nodes_created_file,left("wl_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.wl_previous_definition))
	}
end
method dump_tree()

{ # WithList
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"wl_local_type_id   = ", self.wl_local_type_id)
proc_dump_tree(self,"wl_component_list   = ", self.wl_component_list)
proc_dump_tree(self,"wl_previous_definition   = ", self.wl_previous_definition)
	}
end
initially
self.wl_component_list := emptylist()
end
class ModPrimaryNode : Node : ConsNode(signature,sig_done,displacement,level,mp_primary,mp_type_modifier,mp_delete_v,mp_orig_length,mp_needed,mp_no_surr_loop)
method dump(nodes_created_file)
{ # ModPrimary
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("displacement   = ",20 + dump_tree_depth) || dump_info(self.displacement))
	    write(nodes_created_file,left("level   = ",20 + dump_tree_depth) || dump_info(self.level))
	    write(nodes_created_file,left("mp_primary   = ",20 + dump_tree_depth) || dump_info(self.mp_primary))
	    write(nodes_created_file,left("mp_type_modifier   = ",20 + dump_tree_depth) || dump_info(self.mp_type_modifier))
	    write(nodes_created_file,left("mp_delete_v   = ",20 + dump_tree_depth) || dump_info(self.mp_delete_v))
	    write(nodes_created_file,left("mp_orig_length   = ",20 + dump_tree_depth) || dump_info(self.mp_orig_length))
	    write(nodes_created_file,left("mp_needed   = ",20 + dump_tree_depth) || dump_info(self.mp_needed))
	    write(nodes_created_file,left("mp_no_surr_loop   = ",20 + dump_tree_depth) || dump_info(self.mp_no_surr_loop))
	}
end
method dump_tree()
{ # ModPrimary
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"displacement   = ", self.displacement)
proc_dump_tree(self,"level   = ", self.level)
proc_dump_tree(self,"mp_primary   = ", self.mp_primary)
proc_dump_tree(self,"mp_type_modifier   = ", self.mp_type_modifier)
proc_dump_tree(self,"mp_delete_v   = ", self.mp_delete_v)
proc_dump_tree(self,"mp_orig_length   = ", self.mp_orig_length)
proc_dump_tree(self,"mp_needed   = ", self.mp_needed)
proc_dump_tree(self,"mp_no_surr_loop   = ", self.mp_no_surr_loop)
	}
end
end
class ExportListNode : Node : ConsNode(el_local_type_id,el_export_element_list,el_previous_definition)
method dump(nodes_created_file)
{ # ExportList
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("el_local_type_id   = ",20 + dump_tree_depth) || dump_info(self.el_local_type_id))
	    write(nodes_created_file,left("el_export_element_list   = ",20 + dump_tree_depth) || dump_info(self.el_export_element_list))
	    write(nodes_created_file,left("el_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.el_previous_definition))
	}
end
method dump_tree()
{ # ExportList
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"el_local_type_id   = ", self.el_local_type_id)
proc_dump_tree(self,"el_export_element_list   = ", self.el_export_element_list)
proc_dump_tree(self,"el_previous_definition   = ", self.el_previous_definition)
	}
end
initially
self.el_export_element_list := emptylist()
end
class HideListNode : Node : ConsNode(el_local_type_id,el_export_element_list,el_previous_definition)
method dump(nodes_created_file)
{ # HideList
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("el_local_type_id   = ",20 + dump_tree_depth) || dump_info(self.el_local_type_id))
	    write(nodes_created_file,left("el_export_element_list   = ",20 + dump_tree_depth) || dump_info(self.el_export_element_list))
	    write(nodes_created_file,left("el_previous_definition   = ",20 + dump_tree_depth) || dump_info(self.el_previous_definition))
	}
end
method dump_tree()
{ # HideList
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"el_local_type_id   = ", self.el_local_type_id)
proc_dump_tree(self,"el_export_element_list   = ", self.el_export_element_list)
proc_dump_tree(self,"el_previous_definition   = ", self.el_previous_definition)
	}
end
initially
self.el_export_element_list := emptylist()
end
class ExportElementNode : Node : ConsNode(ee_id,ee_signature,ee_export_list)
method dump(nodes_created_file)
 { # ExportElement
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("ee_id   = ",20 + dump_tree_depth) || dump_info(self.ee_id))
	    write(nodes_created_file,left("ee_signature   = ",20 + dump_tree_depth) || dump_info(self.ee_signature))
	    write(nodes_created_file,left("ee_export_list   = ",20 + dump_tree_depth) || dump_info(self.ee_export_list))
	}
end

method dump_tree()
 { # ExportElement
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"ee_id   = ", self.ee_id)
proc_dump_tree(self,"ee_signature   = ", self.ee_signature)
proc_dump_tree(self,"ee_export_list   = ", self.ee_export_list)
	}
end

initially
self.ee_export_list := emptylist()
end
class AllConstantsNode()
method dump(nodes_created_file)
{ # AllConstantsNode
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	}
end
method dump_tree()
{ # AllConstantsNode
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
	}
end
end
class WordElseNode : Node : ConsNode(signature,sig_done)
method dump(nodes_created_file)
{ # WordElse
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	}
end
method dump_tree()
{ # WordElse
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
	}
end
end
class WordCandNode : Node : ConsNode ()
method dump()
 { # WordCand
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	}
end
method dump_tree()
 { # WordCand
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
	}
end
end
class WordCorNode : Node : ConsNode ()
method dump(nodes_created_file)
 { # WordCor
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	}
end
method dump_tree()
 { # WordCor
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
	}
end
end
class GuardedListNode : Node : ConsNode(signature,sig_done,gl_list)
method dump(nodes_created_file)
{ # GuardedList
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("gl_list   = ",20 + dump_tree_depth) || dump_info(self.gl_list))
	}
end
method dump_tree()
{ # GuardedList
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"gl_list   = ", self.gl_list)
	}
end
initially
self.gl_list := emptylist()
end
class LoopDenotationNode : Node : ConsNode(signature,sig_done,gl_list)
method dump(nodes_created_file)
{ # LoopDenotation
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("gl_list   = ",20 + dump_tree_depth) || dump_info(self.gl_list))
	}
end
method dump_tree()
{ # LoopDenotation
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"gl_list   = ", self.gl_list)
	}
end
initially
self.gl_list := emptylist()
end
class GuardedElementNode : Node : ConsNode(ge_guard,ge_element)
method dump(nodes_created_file)
{ # GuardedElement
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("ge_guard   = ",20 + dump_tree_depth) || dump_info(self.ge_guard))
	    write(nodes_created_file,left("ge_element   = ",20 + dump_tree_depth) || dump_info(self.ge_element))
	}
end
method dump_tree()
{ # GuardedElement
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"ge_guard   = ", self.ge_guard)
proc_dump_tree(self,"ge_element   = ", self.ge_element)
	}
end
end
class OpridNode : Node : ConsNode(signature,sig_done,sel_type,id_str_table_index,id_use_list,id_last_definition,id_def_found,sel_index,id_appl,id_forward_ref)
method dump(nodes_created_file)
{ # Oprid
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("sel_type   = ",20 + dump_tree_depth) || dump_info(self.sel_type))
	    write(nodes_created_file,left("id_str_table_index   = ",20 + dump_tree_depth) || dump_info(self.id_str_table_index))
	    write(nodes_created_file,left("id_use_list   = ",20 + dump_tree_depth) || dump_info(self.id_use_list))
	    write(nodes_created_file,left("id_last_definition   = ",20 + dump_tree_depth) || dump_info(self.id_last_definition))
	    write(nodes_created_file,left("id_def_found   = ",20 + dump_tree_depth) || dump_info(self.id_def_found))
	    write(nodes_created_file,left("sel_index   = ",20 + dump_tree_depth) || dump_info(self.sel_index))
	    write(nodes_created_file,left("id_appl   = ",20 + dump_tree_depth) || dump_info(self.id_appl))
	    write(nodes_created_file,left("id_forward_ref   = ",20 + dump_tree_depth) || dump_info(self.id_forward_ref))
	}
end
method dump_tree()
{ # Oprid
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"sel_type   = ", self.sel_type)
proc_dump_tree(self,"id_str_table_index   = ", self.id_str_table_index)
proc_dump_tree(self,"id_use_list   = ", self.id_use_list)
proc_dump_tree(self,"id_last_definition   = ", self.id_last_definition)
proc_dump_tree(self,"id_def_found   = ", self.id_def_found)
proc_dump_tree(self,"sel_index   = ", self.sel_index)
proc_dump_tree(self,"id_appl   = ", self.id_appl)
proc_dump_tree(self,"id_forward_ref   = ", self.id_forward_ref)
	}
end
initially
self.id_use_list := emptylist()
end
class LetterId : Node : ConsNode(signature,sig_done,sel_type,id_str_table_index,id_use_list,id_last_definition,id_def_found,sel_index,id_appl,id_forward_ref)
method dump(nodes_created_file)
 { # LetterId
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("sel_type   = ",20 + dump_tree_depth) || dump_info(self.sel_type))
	    write(nodes_created_file,left("id_str_table_index   = ",20 + dump_tree_depth) || dump_info(self.id_str_table_index))
	    write(nodes_created_file,left("id_use_list   = ",20 + dump_tree_depth) || dump_info(self.id_use_list))
	    write(nodes_created_file,left("id_last_definition   = ",20 + dump_tree_depth) || dump_info(self.id_last_definition))
	    write(nodes_created_file,left("id_def_found   = ",20 + dump_tree_depth) || dump_info(self.id_def_found))
	    write(nodes_created_file,left("sel_index   = ",20 + dump_tree_depth) || dump_info(self.sel_index))
	    write(nodes_created_file,left("id_appl   = ",20 + dump_tree_depth) || dump_info(self.id_appl))
	    write(nodes_created_file,left("id_forward_ref   = ",20 + dump_tree_depth) || dump_info(self.id_forward_ref))
	}
end
method dump_tree()
 { # LetterId
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"sel_type   = ", self.sel_type)
proc_dump_tree(self,"id_str_table_index   = ", self.id_str_table_index)
proc_dump_tree(self,"id_use_list   = ", self.id_use_list)
proc_dump_tree(self,"id_last_definition   = ", self.id_last_definition)
proc_dump_tree(self,"id_def_found   = ", self.id_def_found)
proc_dump_tree(self,"sel_index   = ", self.sel_index)
proc_dump_tree(self,"id_appl   = ", self.id_appl)
proc_dump_tree(self,"id_forward_ref   = ", self.id_forward_ref)
	}
end
initially
self.id_use_list := emptylist()
end
class QStrNode : Node : ConsNode(signature,sig_done,sel_type,str_string,str_use_list,str_expansion)
method dump(nodes_created_file)
{ # QStr
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("sel_type   = ",20 + dump_tree_depth) || dump_info(self.sel_type))
	    write(nodes_created_file,left("str_string   = ",20 + dump_tree_depth) || dump_info(self.str_string))
	    write(nodes_created_file,left("str_use_list   = ",20 + dump_tree_depth) || dump_info(self.str_use_list))
	    write(nodes_created_file,left("str_expansion   = ",20 + dump_tree_depth) || dump_info(self.str_expansion))
	}
end
method dump_tree()
{ # QStr
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"sel_type   = ", self.sel_type)
proc_dump_tree(self,"str_string   = ", self.str_string)
proc_dump_tree(self,"str_use_list   = ", self.str_use_list)
proc_dump_tree(self,"str_expansion   = ", self.str_expansion)
	}
end
initially
self.str_use_list := emptylist()
end
class UQStrNode : Node : ConsNode(signature,sig_done,sel_type,str_string,str_use_list,str_expansion)
method dump(nodes_created_file)
{ # UQStr
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("sel_type   = ",20 + dump_tree_depth) || dump_info(self.sel_type))
	    write(nodes_created_file,left("str_string   = ",20 + dump_tree_depth) || dump_info(self.str_string))
	    write(nodes_created_file,left("str_use_list   = ",20 + dump_tree_depth) || dump_info(self.str_use_list))
	    write(nodes_created_file,left("str_expansion   = ",20 + dump_tree_depth) || dump_info(self.str_expansion))
	}
end
method dump_tree()
{ # UQStr
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"sel_type   = ", self.sel_type)
proc_dump_tree(self,"str_string   = ", self.str_string)
proc_dump_tree(self,"str_use_list   = ", self.str_use_list)
proc_dump_tree(self,"str_expansion   = ", self.str_expansion)
	}
end
initially
self.str_use_list:= emptylist()
end
class FConstruction : Node : ConsNode(signature,sig_done,ar_size,ar_static_link,ar_static_level,fc_body,fc_complexity,fc_code_label,fc_free_vars,fc_body_needed)
method dump(nodes_created_file)
{ # FuncConstr
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("ar_size   = ",20 + dump_tree_depth) || dump_info(self.ar_size))
	    write(nodes_created_file,left("ar_static_link   = ",20 + dump_tree_depth) || dump_info(self.ar_static_link))
	    write(nodes_created_file,left("ar_static_level   = ",20 + dump_tree_depth) || dump_info(self.ar_static_level))
	    write(nodes_created_file,left("fc_body   = ",20 + dump_tree_depth) || dump_info(self.fc_body))
	    write(nodes_created_file,left("fc_complexity   = ",20 + dump_tree_depth) || dump_info(self.fc_complexity))
	    write(nodes_created_file,left("fc_code_label   = ",20 + dump_tree_depth) || dump_info(self.fc_code_label))
	    write(nodes_created_file,left("fc_free_vars   = ",20 + dump_tree_depth) || dump_info(self.fc_free_vars))
	    write(nodes_created_file,left("fc_body_needed   = ",20 + dump_tree_depth) || dump_info(self.fc_body_needed))
	}
end
method dump_tree()
{ # FuncConstr
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"ar_size   = ", self.ar_size)
proc_dump_tree(self,"ar_static_link   = ", self.ar_static_link)
proc_dump_tree(self,"ar_static_level   = ", self.ar_static_level)
proc_dump_tree(self,"fc_body   = ", self.fc_body)
proc_dump_tree(self,"fc_complexity   = ", self.fc_complexity)
proc_dump_tree(self,"fc_code_label   = ", self.fc_code_label)
proc_dump_tree(self,"fc_free_vars   = ", self.fc_free_vars)
proc_dump_tree(self,"fc_body_needed   = ", self.fc_body_needed)
	}
end
end
class FreeVarNode : Node : ConsNode(fv_last_definition,fv_surr_class,fv_surr_index,fv_index)
method dump(nodes_created_file)
{ # FreeVarNode
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("fv_last_definition   = ",20 + dump_tree_depth) || dump_info(self.fv_last_definition))
	    write(nodes_created_file,left("fv_surr_   = ",20 + dump_tree_depth) || dump_info(self.fv_surr_))
	    write(nodes_created_file,left("fv_surr_index   = ",20 + dump_tree_depth) || dump_info(self.fv_surr_index))
	    write(nodes_created_file,left("fv_index   = ",20 + dump_tree_depth) || dump_info(self.fv_index))
	}
end
method dump_tree()
{ # FreeVarNode
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"fv_last_definition   = ", self.fv_last_definition)
proc_dump_tree(self,"fv_surr_   = ", self.fv_surr_)
proc_dump_tree(self,"fv_surr_index   = ", self.fv_surr_index)
proc_dump_tree(self,"fv_index   = ", self.fv_index)
	}
end
end
class ExternDefNode : Node : ConsNode(ext_name)
method dump(nodes_created_file)
{ # ExternDef
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("ext_name   = ",20 + dump_tree_depth) || dump_info(self.ext_name))
	}
end
method dump_tree()
{ # ExternDef
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"ext_name   = ", self.ext_name)
	}
end
end
class RExternDef : Node : ConsNode(signature,sig_done,r_ext_name)
method dump(nodes_created_file)
{ # RExternDef
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("signature   = ",20 + dump_tree_depth) || dump_info(self.signature))
	    write(nodes_created_file,left("sig_done   = ",20 + dump_tree_depth) || dump_info(self.sig_done))
	    write(nodes_created_file,left("r_ext_name   = ",20 + dump_tree_depth) || dump_info(self.r_ext_name))
	}
end
method dump_tree()
{ # RExternDef
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"signature   = ", self.signature)
proc_dump_tree(self,"sig_done   = ", self.sig_done)
proc_dump_tree(self,"r_ext_name   = ", self.r_ext_name)
	}
end
end
class DcsException : Node : ConsNode(dcse_char,dcse_inline,dcse_special,dcse_construction)
method dump(nodes_created_file)
 { # DcsException
self$Node.dump(nodes_created_file)
self$ConsNode.dump(nodes_created_file)
	    write(nodes_created_file,left("dcse_char   = ",20 + dump_tree_depth) || dump_info(self.dcse_char))
	    write(nodes_created_file,left("dcse_inline   = ",20 + dump_tree_depth) || dump_info(self.dcse_inline))
	    write(nodes_created_file,left("dcse_special   = ",20 + dump_tree_depth) || dump_info(self.dcse_special))
	    write(nodes_created_file,left("dcse_construction   = ",20 + dump_tree_depth) || dump_info(self.dcse_construction))
	}
end
method dump_tree()
 { # DcsException
self$Node.dump_tree(treefile)
self$ConsNode.dump_tree(treefile)
proc_dump_tree(self,"dcse_char   = ", self.dcse_char)
proc_dump_tree(self,"dcse_inline   = ", self.dcse_inline)
proc_dump_tree(self,"dcse_special   = ", self.dcse_special)
proc_dump_tree(self,"dcse_construction   = ", self.dcse_construction)
	}
end
end
#######################################################################
procedure dump_info(it)
if type(it) == "integer" then return it
else if type(it) == "string"then return it
else if type(it) == "real" then return it
else return type(it)
end


procedure proc_dump_tree(me,str,it)
static cnt, depth, ex_fl, ex_set
initial 
{ex_fl := open("ex.tmp","w") 
ex_set := set()
cnt := 0
visited := set()
dump_tree_depth := 0
}
cnt +:= 1
if cnt > 100000 then return
if type(it) == "integer" then write(treefile,left(str,20 + dump_tree_depth) || it)
else if type(it) == "string" then write(treefile,left(str,20 + dump_tree_depth) || it)
else if type(it) == "real" then write(treefile,left(str,20 + dump_tree_depth) || it)
else if type(it) == "co-expression" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "cset" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "file" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "list" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "null" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "procedure" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "set" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "table" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "window" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else if type(it) == "Array" then write(treefile,left(str,20 + dump_tree_depth) || type(it))
else { dump_tree_depth +:= 1 
       if not (member(ex_set,str)) then {
       write(ex_fl,"examine " || str || type(it))
       insert(ex_set,str)
   }
    if not (member(visited,it)) then
	      {
	      insert(visited,it)
	      write(treefile,left("Begin Subtree for ",20 + dump_tree_depth) || str)
	      write(treefile,left("Begin Subtree for " ,20 + dump_tree_depth) || type(it))
	      it.dump_tree(treefile)
	      write(treefile,left("End Subtree",20 + dump_tree_depth) || type(it))
	  }
	  else
	      {
	      write(treefile,left("Begin Subtree already visited for ",20 + dump_tree_depth) || str)
	      write(treefile,left("Begin Subtree alreay visited for " ,20 + dump_tree_depth) || type(it))
	      it.dump(treefile)
	      write(treefile,left("End Subtree already visited",20 + dump_tree_depth) ||type(it))
	  }
       dump_tree_depth -:= 1
   }
end
