aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohnvg2016-06-06 12:57:01 +0000
committerjohnvg2016-06-06 12:57:01 +0000
commit1fa286e7697c284ca585fe75d9b2221659a76cc6 (patch)
tree761b933fa7c019ea819ed7c0b8de11aed8a1dad7
parentremove #pragma options (!macsbug_names) (diff)
make RetrieveFromSymbolTable static,
remove old prototypes from scanner.h, remove #ifndef CLEAN2 .. #endif git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2721 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r--backendC/CleanCompilerSources/scanner.h50
-rw-r--r--backendC/CleanCompilerSources/scanner_2.c35
2 files changed, 11 insertions, 74 deletions
diff --git a/backendC/CleanCompilerSources/scanner.h b/backendC/CleanCompilerSources/scanner.h
index b550cc4..45d6532 100644
--- a/backendC/CleanCompilerSources/scanner.h
+++ b/backendC/CleanCompilerSources/scanner.h
@@ -1,11 +1,3 @@
-/*
- +---------------------------------------------------------------------+
- | 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;
diff --git a/backendC/CleanCompilerSources/scanner_2.c b/backendC/CleanCompilerSources/scanner_2.c
index fe1187c..dd377e8 100644
--- a/backendC/CleanCompilerSources/scanner_2.c
+++ b/backendC/CleanCompilerSources/scanner_2.c
@@ -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();