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

move function ConvertSymbolKindToString from checksupport.c to comsupport.c,...

move function ConvertSymbolKindToString from checksupport.c to comsupport.c, add function symbol_to_string
parent d158c7cc
......@@ -9,30 +9,6 @@
#include "checker.h"
#include <ctype.h>
char *ConvertSymbolKindToString (SymbKind skind)
{
switch (skind)
{
case int_type: return "Int";
case bool_type: return "Bool";
case char_type: return "Char";
case real_type: return "Real";
case file_type: return "File";
case array_type: return "{ }";
case strict_array_type: return "{ ! }";
case unboxed_array_type:return "{ # }";
case world_type: return "World";
case procid_type: return "ProcId";
case redid_type: return "RedId";
case fun_type: return "=>";
case list_type: return "List";
case tuple_type: return "Tuple";
case dynamic_type: return "Dynamic";
default: return "Erroneous";
}
} /* ConvertSymbolKindToString */
static int string_and_string_begin_equal (char *s1,char *s2_begin,char *s2_passed_end)
{
char c,*s2;
......
extern char *ConvertSymbolKindToString (SymbKind skind);
extern void PrintSymbolOfIdent (char *name,unsigned line_nr,File file);
......@@ -279,54 +279,70 @@ void FatalCompError (char *mod, char *proc, char *mess)
longjmp (ExitEnv, 1);
}
void PrintSymbol (Symbol symbol, File file)
static char *ConvertSymbolKindToString (SymbKind skind)
{
switch (symbol -> symb_kind)
{
case definition:
PrintSymbolOfIdent (symbol->symb_def->sdef_name, 0, file);
return;
switch (skind){
case int_type: return "Int";
case bool_type: return "Bool";
case char_type: return "Char";
case real_type: return "Real";
case file_type: return "File";
case array_type: return "{ }";
case strict_array_type: return "{ ! }";
case unboxed_array_type:return "{ # }";
case world_type: return "World";
case procid_type: return "ProcId";
case redid_type: return "RedId";
case fun_type: return "=>";
case list_type: return "List";
case tuple_type: return "Tuple";
case dynamic_type: return "Dynamic";
default: return "Erroneous";
}
}
/* do not use if symb_kind==definition */
static char *symbol_to_string (Symbol symbol)
{
switch (symbol->symb_kind){
case int_denot:
FPutS (symbol->symb_int, file);
return;
return symbol->symb_int;
case bool_denot:
FPutS (symbol->symb_bool ? "True" : "False", file);
return;
return symbol->symb_bool ? "True" : "False";
case char_denot:
FPutS (symbol->symb_char, file);
return;
return symbol->symb_char;
case string_denot:
FPutS (symbol->symb_string, file);
return;
return symbol->symb_string;
case real_denot:
FPutS (symbol->symb_real, file);
return;
return symbol->symb_real;
case tuple_symb:
FPutS ("Tuple", file);
return;
return "Tuple";
case cons_symb:
FPutS ("[:]", file);
return;
return "[:]";
case nil_symb:
FPutS ("[]", file);
return;
return "[]";
case select_symb:
FPutS ("_Select", file);
return;
return "_Select";
case apply_symb:
FPutS ("AP", file);
return;
return "AP";
case if_symb:
FPutS ("if", file);
return;
return "if";
case fail_symb:
FPutS ("_Fail", file);
return;
return "_Fail";
case definition:
return NULL;
default:
FPutS (ConvertSymbolKindToString ((SymbKind)symbol -> symb_kind), file);
return;
return ConvertSymbolKindToString ((SymbKind)symbol -> symb_kind);
}
} /* PrintSymbol */
}
void PrintSymbol (Symbol symbol, File file)
{
if (symbol->symb_kind==definition)
PrintSymbolOfIdent (symbol->symb_def->sdef_name, 0, file);
else
FPutS (symbol_to_string (symbol), file);
}
void StaticMessage_D_s (Bool error,struct symbol_def *symb_def_p,char *message)
{
......
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