Commit 5455f843 authored by John van Groningen's avatar John van Groningen
Browse files

make RetrieveFromSymbolTable static,

remove old prototypes from scanner.h,
remove #ifndef CLEAN2 .. #endif
parent b2aefeae
/*
+---------------------------------------------------------------------+
| For each identifier stored in the symbol table a structure of |
| type 'Ident' is reserved. |
+---------------------------------------------------------------------+
*/
extern char *ConvertNextTokenToString (void);
typedef
enum
......@@ -21,7 +13,7 @@ typedef
atsym,boolsym, codesym, charsym,defsym,
falsesym, filesym, fromsym, ifsym, impsym,
/* RWS */
allsym,
importsym, intsym, macrosym, modulesym, procidsym, redidsym,
realsym, rulesym, stringsym,
......@@ -65,51 +57,15 @@ extern char **ReservedWords;
kTokenDefault, kTokenResync
};
typedef unsigned int Token;
STRUCT (tokenValue, TokenValue)
{
Token token;
long lineNumber;
union {
char *literal;
IdentStringP identString;
} value;
};
typedef unsigned int Token;
typedef enum { kScanModeNormal,kScanModeTypes,kScanModeInstructions } ScanMode;
extern IdentP RetrieveFromSymbolTable (char *name);
extern IdentP PutStringInHashTable (char *string, TableKind tabkind);
extern IdentP PutIdentStringInTable (IdentStringP identString, TableKind tabkind);
extern void InitScanner (void);
extern void ScanInit (void);
extern void ScanSetMode (ScanMode scanMode);
enum {kOffsideOnHardBrace = True, kNoOffsideOnHardBrace = False};
extern void ScanSetOffside (Bool offsideOnHardBrace);
extern Bool ScanUnsetOffside (void);
extern void ScanSetLayoutOption (void);
extern Bool ScanOpenFile (char *fileName, FileKind fileKind);
#if WRITE_DCL_MODIFICATION_TIME
extern Bool ScanOpenFileWithModificationTime (char *fileName, FileKind fileKind, FileTime *file_time_p);
#endif
extern void ScanCloseFile (void);
extern Bool ScanTokenToString (Token token, char *string);
/*
ScanCleanToken fills the global structure gCurrentToken.
*/
extern void ScanInitialise (void);
extern void ScanInitialise (void);
#ifdef CLEAN2
extern void ScanInitIdentStringTable (void);
#endif
extern void ScanCleanToken (void);
extern TokenValueS gCurrentToken;
extern void ScanInlineFile (char *fname);
extern Bool gApplyLayoutRule;
......@@ -185,17 +185,15 @@ PutKeyWordInTable (KeyWordInfoP keyWord)
identString->ident = ident;
} /* PutKeyWordInTable */
IdentP
RetrieveFromSymbolTable (char *string)
static IdentP RetrieveFromSymbolTable (char *string)
{
char *s;
unsigned long hash;
IdentStringP identString;
IdentP ident;
hash = 0;
for (s = string; *s != '\0'; s++)
{
hash = 0;
for (s = string; *s != '\0'; s++){
hash <<= 2;
hash += *s;
}
......@@ -208,8 +206,7 @@ RetrieveFromSymbolTable (char *string)
identString = gIdentStringTable [hash];
while (identString != NIL)
{
while (identString != NIL){
int compare;
compare = strcmp (identString->string, string);
......@@ -223,17 +220,15 @@ RetrieveFromSymbolTable (char *string)
identString = identString->right;
}
if (identString != NIL)
{
if (identString != NIL){
for (ident = identString->ident; ident != NIL; ident = ident->ident_next)
if (ident->ident_table == SymbolIdTable)
break;
}
else
} else
ident = NIL;
return (ident);
} /* RetrieveFromSymbolTable */
return ident;
}
/*
+-----------------------------------------------------------------------+
......@@ -688,20 +683,6 @@ void
ScanInitialise (void)
{
int i;
#ifndef CLEAN2
gCharTypeTable = (unsigned char*)CompAlloc (256 * sizeof (unsigned char)),
InitialiseCharTypeTable (gCharTypeTable);
gStateNormalTable = (ScanState*)CompAlloc (256 * sizeof (ScanState)),
InitialiseStateNormalTable (gStateNormalTable);
gStateInstructionsTable = (ScanState*)CompAlloc (256 * sizeof (ScanState)),
InitialiseStateInstructionTable (gStateInstructionsTable);
ScanSetMode (kScanModeNormal);
gInputBuffer = (unsigned char*)CompAlloc (kInputBufferSize);
#endif
ScanInitIdentStringTable();
......
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