Commit d2dc64e5 authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl

move functions MakeNewSymbolDefinition and NewNodeDef from checker_2.c to...

move functions MakeNewSymbolDefinition and NewNodeDef from checker_2.c to buildtree.c, move scc_dependency_list from checker_2.c to sa.c, remove unused functions from buildtree.c
parent 3053c692
......@@ -13,10 +13,10 @@
# include "sizes.h"
# include "set_scope_numbers.h"
# include "checker.h" /* scc_dependency_list, ClearOpenDefinitionModules, AddOpenDefinitionModule */
# include "checker.h" /* ClearOpenDefinitionModules, AddOpenDefinitionModule */
# include "comsupport.h" /* CurrentModule */
# include "buildtree.h" /* TupleSymbol, ApplySymbol */
# include "sa.h" /* StdMiscId,abort_symb_def,undef_symb_def */
# include "sa.h" /* StdMiscId,abort_symb_def,undef_symb_def,scc_dependency_list */
# include "backendsupport.h"
# define Clean(ignore)
......
......@@ -35,19 +35,6 @@ void InitGlobalSymbols (void)
clear_p_at_node_tree();
}
TypeArgs
NewTypeArgument (TypeNode pattern)
{
TypeArgs newarg;
newarg = CompAllocType (TypeArg);
newarg->type_arg_node = pattern;
newarg->type_arg_next = NIL;
return (newarg);
} /* NewTypeArgument */
Args
NewArgument (NodeP node)
{
......@@ -97,18 +84,6 @@ NewStrict (StrictNodeIdP next)
return (strictNodeId);
} /* NewStrict */
StrictNodeIdP
NewStrictNodeId (NodeId nodeId, StrictNodeIdP next)
{
StrictNodeIdP strictNodeId;
strictNodeId = NewStrict (next);
strictNodeId->snid_node_id = nodeId;
return (strictNodeId);
} /* NewStrictNodeId */
NodeP
NewNodeIdNode (NodeIdP node_id)
{
......@@ -173,69 +148,6 @@ NewUpdateNode (SymbolP symb, Args args, int arity)
return (NewNodeByKind (UpdateNode, symb, args, arity));
} /* NewUpdateNode */
NodeP
NewIfNode (void)
{
NodeP node;
struct if_node_contents *then_else_info;
node = CompAllocType (struct node);
then_else_info = CompAllocType (struct if_node_contents);
node->node_annotation = NoAnnot;
node->node_number = 0;
node->node_kind = IfNode;
node->node_contents.contents_if=then_else_info;
then_else_info->if_then_node_defs = NIL;
then_else_info->if_then_strict_node_ids = NIL;
then_else_info->if_else_node_defs = NIL;
then_else_info->if_else_strict_node_ids = NIL;
return (node);
} /* NewIfNode */
NodeP
NewSelectNode (SymbolP selectSymbol, NodeIdP selectId, int arity)
{
Args selectArg;
selectArg = NewArgument (NewNodeIdNode (selectId));
return (NewNode (selectSymbol, selectArg, arity));
} /* NewSelectNode */
NodeDefs
NewNodeDefinition (NodeIdP nid, NodeP node)
{
NodeDefs def;
def = CompAllocType (NodeDefS);
def->def_mark = 0;
def->def_id = nid;
def->def_node = node;
return (def);
} /* NewNodeDefinition */
NodeIdP
FreshNodeId (NodeP node, NodeDefs **node_defs_h)
{
NodeIdP nodeId;
NodeDefs def;
nodeId = NewNodeId();
def = NewNodeDefinition (nodeId, node);
**node_defs_h = def;
*node_defs_h = &def->def_next;
return (nodeId);
} /* FreshNodeId */
SymbolP
NewSymbol (SymbKind symbolKind)
{
......@@ -248,70 +160,47 @@ NewSymbol (SymbKind symbolKind)
return (symbol);
} /* NewSymbol */
SymbolP
NewTupleTypeSymbol (int arity)
NodeDefs NewNodeDef (NodeId nid,Node node)
{
SymbolP tuple;
NodeDefs new;
if ((tuple =TupleTypeSymbols [arity-1]) == NIL)
{
TupleTypeSymbols [arity-1] = tuple = NewSymbol (tuple_type);
tuple -> symb_arity = arity;
}
new = CompAllocType (NodeDefS);
return tuple;
new->def_id = nid;
new->def_node = node;
new->def_mark = 0;
} /* NewTupleTypeSymbol */
SymbolP
NewSelectSymbol (int arity)
{
SymbolP select;
if ((select = SelectSymbols [arity-1]) == NIL)
{
select = NewSymbol (select_symb);
select->symb_arity = arity;
SelectSymbols [arity-1] = select;
}
return (select);
} /* NewSelectSymbol */
return new;
}
ImpRules
NewImpRule (unsigned line_number,TypeAlts typeAlternative,NodeP rule_root)
SymbDef MakeNewSymbolDefinition (char *module, char *name, int arity, SDefKind kind)
{
ImpRules impRule;
impRule = CompAllocType (ImpRuleS);
impRule->rule_alts = NIL;
impRule->rule_root = rule_root;
impRule->rule_type = typeAlternative;
impRule->rule_next_changed_function = NULL;
SymbDef def;
int i,string_length;
char *new_string;
string_length = strlen (name);
new_string = CompAlloc (string_length+1);
impRule->rule_mark = 0;
impRule->rule_next = NIL;
for (i=0; i<string_length; ++i)
new_string[i] = name[i];
new_string [string_length] = '\0';
def = CompAllocType (SymbDefS);
def->sdef_module = module;
def->sdef_name = new_string;
def->sdef_arity = arity;
def->sdef_kind = kind;
return impRule;
} /* NewImpRule */
def->sdef_mark=0;
RuleAltP
NewRuleAlt (void)
{
RuleAltP alt;
def->sdef_exported=False;
alt = CompAllocType (RuleAltS);
def->sdef_arfun = NoArrayFun;
alt->alt_kind = Contractum;
alt->alt_lhs_root = NIL;
alt->alt_lhs_defs = NIL;
alt->alt_rhs_defs = NIL;
alt->alt_strict_node_ids = NIL;
alt->alt_line = 0;
return (alt);
} /* NewRuleAlt */
return def;
}
struct p_at_node_tree {
NodeP annoted_node;
......
......@@ -3,37 +3,17 @@ extern void InitGlobalSymbols (void);
extern Args NewArgument (NodeP pattern);
extern NodeP NewNode (SymbolP symb, Args args, int arity);
extern NodeP NewIfNode (void);
extern NodeP NewSelectorNode (SymbolP symb, Args args, int arity);
extern NodeP NewNodeIdNode (NodeIdP node_id);
extern NodeP NewUpdateNode (SymbolP symb,Args args,int arity);
extern NodeP NewNodeByKind (NodeKind nodeKind, SymbolP symb, Args args, int arity);
# define NewNormalNode(symb, args, arity) NewNodeByKind (NormalNode, (symb), (args), (arity))
# define NewRecordNode(symb, args, arity) NewNodeByKind (RecordNode, (symb), (args), (arity))
# define NewMatchNode(symb, args, arity) NewNodeByKind (MatchNode, (symb), (args), (arity))
# define NewFalse() NewNormalNode (FalseSymbol, NIL, 0)
# define NewTrue() NewNormalNode (TrueSymbol, NIL, 0)
extern NodeIdP NewNodeId (void);
extern StrictNodeIdP NewStrictNodeId (NodeIdP node_id, StrictNodeIdP next);
extern NodeDefs NewNodeDefinition (NodeIdP nid, NodeP node);
extern SymbolP NewSymbol (SymbKind symbolKind);
extern TypeArgs NewTypeArgument (TypeNode pattern);
extern NodeP NewSelectNode (SymbolP selectSymbol, NodeIdP selectId, int arity);
extern NodeIdP BuildSelect (NodeP node, NodeDefs **node_defs_p);
extern NodeIdP BuildSelectors (NodeP pattern, NodeP node, NodeDefs **node_defs_p);
extern NodeDefs NewNodeDef (NodeId nid, Node node);
extern SymbolP NewSelectSymbol (int arity);
extern SymbolP NewTupleTypeSymbol (int arity);
extern SymbolP NewListFunctionSymbol (void);
extern ImpRules NewImpRule (unsigned line_number,TypeAlts typeAlternative,NodeP rule_root);
extern RuleAltP NewRuleAlt (void);
extern NodeIdP FreshNodeId (NodeP node, NodeDefs **node_defs_h);
extern char *CopyString (char *to, char *from, int *rest_size);
extern SymbDef MakeNewSymbolDefinition (char *module, char *name, int arity, SDefKind kind);
extern SymbolP TrueSymbol, FalseSymbol, TupleSymbol,
ApplySymbol, ApplyTypeSymbol, SelectSymbols[],
......@@ -45,4 +25,3 @@ void clear_p_at_node_tree (void);
void store_p_at_node (NodeP annoted_node,NodeP at_node);
NodeP *get_p_at_node_p (NodeP annoted_node);
NodeP get_p_at_node (NodeP annoted_node);
extern SymbDef scc_dependency_list;
SymbDef MakeNewSymbolDefinition (char *module, char *name, int arity, SDefKind kind);
void InitChecker (void);
void GenDependencyList (void);
NodeDefs NewNodeDef (NodeId nid, Node node);
struct def_list {
DefMod mod_body;
......
......@@ -36,50 +36,6 @@ void GenDependencyList (void)
);
}
SymbDef scc_dependency_list;
SymbDef MakeNewSymbolDefinition (char *module, char *name, int arity, SDefKind kind)
{
SymbDef def;
int i,string_length;
char *new_string;
string_length = strlen (name);
new_string = CompAlloc (string_length+1);
for (i=0; i<string_length; ++i)
new_string[i] = name[i];
new_string [string_length] = '\0';
def = CompAllocType (SymbDefS);
def->sdef_module = module;
def->sdef_name = new_string;
def->sdef_arity = arity;
def->sdef_kind = kind;
def->sdef_mark=0;
def->sdef_exported=False;
def->sdef_arfun = NoArrayFun;
return def;
}
NodeDefs NewNodeDef (NodeId nid,Node node)
{
NodeDefs new;
new = CompAllocType (NodeDefS);
new->def_id = nid;
new->def_node = node;
new->def_mark = 0;
return new;
}
void InitChecker (void)
{
OpenDefinitionModules = NIL;
......
......@@ -3643,6 +3643,8 @@ static void convert_type (SymbDef sdef)
}
}
SymbDef scc_dependency_list;
static void ConvertSyntaxTree
(struct module_function_and_type_symbols mfts,int size_dcl_type_symbols_a,struct module_function_and_type_symbols dcl_type_symbols_a[])
{
......
......@@ -14,3 +14,5 @@ extern void free_unused_sa_blocks (void);
extern char *StdMiscId;
extern SymbDef abort_symb_def,undef_symb_def;
#endif
extern SymbDef scc_dependency_list;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment