Commit be79b171 authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl
Browse files

move struct ident to scanner_2.c, remove function NewIdent, in backend

parent d2651653
......@@ -2333,16 +2333,9 @@ BEDeclareRuleType (int functionIndex, int moduleIndex, CleanString name)
Assert (functions != NULL);
Assert (functions [functionIndex].symb_kind == erroneous_symb);
if (module->bem_isSystemModule){
IdentP newIdent;
/* for inline code */
newIdent = PutStringInHashTable (ConvertCleanString (name), FirstSystemModuleTable + moduleIndex);
newSymbDef = ConvertAllocType (SymbDefS);
newIdent->ident_sys_rule_def = newSymbDef;
} else {
newSymbDef = ConvertAllocType (SymbDefS);
}
newSymbDef = ConvertAllocType (SymbDefS);
if (module->bem_isSystemModule) /* for inline code */
PutStringInHashTable (ConvertCleanString (name), FirstSystemModuleTable + moduleIndex, newSymbDef);
newSymbDef->sdef_kind = NEWDEFINITION;
newSymbDef->sdef_exported = False;
......
......@@ -36,8 +36,6 @@ extern NodeIdP FreshNodeId (NodeP node, NodeDefs **node_defs_h);
extern char *CopyString (char *to, char *from, int *rest_size);
extern IdentP DetermineNewSymbolId (char *prefix, TypeNode inst_type, TableKind table);
extern SymbolP TrueSymbol, FalseSymbol, TupleSymbol,
ApplySymbol, ApplyTypeSymbol, SelectSymbols[],
FailSymbol, IfSymbol;
......
......@@ -1020,13 +1020,11 @@ static void CodeNormalRootNode (Node root,NodeId rootid,int asp,int bsp,CodeGenN
return;
case fail_symb:
{
IdentS case_ident_s;
SymbDefS case_def_s;
case_ident_s.ident_name=rootsymb->symb_string;
Assume (case_ident_s.ident_name != NULL, "codegen3", "CodeNormalRootNode (fail_symb)");
Assume (rootsymb->symb_string != NULL, "codegen3", "CodeNormalRootNode (fail_symb)");
case_def_s.sdef_name = case_ident_s.ident_name;
case_def_s.sdef_name = rootsymb->symb_string;
if (FunctionMayFailWarningOrError!=0)
StaticMessage (FunctionMayFailWarningOrError==2, "%D", "case may fail", &case_def_s);
......
......@@ -222,14 +222,10 @@ void FatalCompError (char *mod, char *proc, char *mess)
void PrintSymbol (Symbol symbol, File file)
{
Ident symb_id;
unsigned line_nr;
switch (symbol -> symb_kind)
{
case definition:
line_nr = 0;
PrintSymbolOfIdent (symbol->symb_def->sdef_name, line_nr, file);
PrintSymbolOfIdent (symbol->symb_def->sdef_name, 0, file);
return;
case int_denot:
FPutS (symbol->symb_int, file);
......@@ -271,9 +267,6 @@ void PrintSymbol (Symbol symbol, File file)
FPutS (ConvertSymbolKindToString ((SymbKind)symbol -> symb_kind), file);
return;
}
PrintSymbolOfIdent (symb_id->ident_name, line_nr, file);
} /* PrintSymbol */
#include <stdarg.h>
......
extern IdentP NewIdent (char *name);
extern IdentP PutStringInHashTable (char *string, TableKind tabkind);
extern void PutStringInHashTable (char *string, TableKind tabkind, SymbDefP sys_rule_def);
extern void InitScanner (void);
......
......@@ -23,6 +23,16 @@
# include "scanner.h"
# include "sizes.h"
STRUCT(ident,Ident){
char * ident_name;
struct symbol_def * ident_sys_rule_def;
struct ident * ident_next;
unsigned char ident_table; /* TableKind */
unsigned char ident_mark;
};
#define INLINE_MASK 8
typedef struct ident_string *IdentStringP;
struct ident_string {
......@@ -66,23 +76,6 @@ AllocString (char *string, short length)
return (newString);
} /* AllocString */
IdentP
NewIdent (char *name)
{
IdentP ident;
ident = CompAllocType (struct ident);
ident->ident_name = AllocString (name,strlen (name));
ident->ident_table = LastSystemModuleTable;
ident->ident_next = NULL;
ident->ident_sys_rule_def = NULL;
ident->ident_mark = 0;
return ident;
}
# define kIdentStringTableSizeBits 10
# define kIdentStringTableSize ((1 << kIdentStringTableSizeBits) - 1)
......@@ -164,14 +157,15 @@ PutIdentStringInTable (IdentStringP identString, TableKind tableKind)
return (ident);
} /* PutIdentStringInTable */
IdentP
PutStringInHashTable (char *string, TableKind tableKind)
void PutStringInHashTable (char *string, TableKind tableKind, SymbDefP sys_rule_def)
{
IdentStringP identString;
IdentP newIdent;
identString = StringInTable (string, strlen (string));
return (PutIdentStringInTable (identString, tableKind));
newIdent = PutIdentStringInTable (identString, tableKind);
newIdent->ident_sys_rule_def = sys_rule_def;
} /* PutStringInHashTable */
static IdentP RetrieveFromSymbolTable (char *string,TableKind table_kind)
......
......@@ -155,16 +155,6 @@ STRUCT (symbol,Symbol) {
#define symb_arity symb_val.val_arity
#define symb_apply_instance_field_def symb_val.val_apply_instance_field_def
STRUCT(ident,Ident){
char * ident_name;
struct symbol_def * ident_sys_rule_def;
struct ident * ident_next;
unsigned char ident_table; /* TableKind */
unsigned char ident_mark;
};
#define INLINE_MASK 8
/*
The order in which the annotationkinds appear in the enum type
determines their priority
......
Supports Markdown
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