diff options
author | Adrian Thurston <thurston@colm.net> | 2021-11-07 15:04:18 -0800 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2021-11-07 15:04:18 -0800 |
commit | 34c1750600a14193b74915bfd4d53bac61e77788 (patch) | |
tree | f140590db503154638ba62abfbbff841b4bcb307 | |
parent | d8f6df9fa3932acaa7417c0ce52221ccbe7e8667 (diff) | |
download | colm-34c1750600a14193b74915bfd4d53bac61e77788.tar.gz |
moved the C and ASM host types over to ragel
-rw-r--r-- | src/libfsm/common.cc | 75 | ||||
-rw-r--r-- | src/libfsm/common.h | 6 |
2 files changed, 0 insertions, 81 deletions
diff --git a/src/libfsm/common.cc b/src/libfsm/common.cc index 9a14a290..97715b82 100644 --- a/src/libfsm/common.cc +++ b/src/libfsm/common.cc @@ -26,81 +26,6 @@ #include <assert.h> #include "ragel.h" -/* - * C - */ - -const char *defaultOutFnC( const char *inputFileName ) -{ - const char *ext = findFileExtension( inputFileName ); - if ( ext != 0 && strcmp( ext, ".rh" ) == 0 ) - return fileNameFromStem( inputFileName, ".h" ); - else - return fileNameFromStem( inputFileName, ".c" ); -} - -HostType hostTypesC[] = -{ - { "char", 0, "char", (CHAR_MIN != 0), true, false, SCHAR_MIN, SCHAR_MAX, 0, UCHAR_MAX, sizeof(char) }, - { "signed", "char", "char", true, true, false, SCHAR_MIN, SCHAR_MAX, 0, 0, sizeof(signed char) }, - { "unsigned", "char", "uchar", false, true, false, 0, 0, 0, UCHAR_MAX, sizeof(unsigned char) }, - { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, sizeof(short) }, - { "signed", "short", "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, sizeof(signed short) }, - { "unsigned", "short", "ushort", false, true, false, 0, 0, 0, USHRT_MAX, sizeof(unsigned short) }, - { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, sizeof(int) }, - { "signed", "int", "int", true, true, false, INT_MIN, INT_MAX, 0, 0, sizeof(signed int) }, - { "unsigned", "int", "uint", false, true, false, 0, 0, 0, UINT_MAX, sizeof(unsigned int) }, - { "long", 0, "long", true, true, false, LONG_MIN, LONG_MAX, 0, 0, sizeof(long) }, - { "signed", "long", "long", true, true, false, LONG_MIN, LONG_MAX, 0, 0, sizeof(signed long) }, - { "unsigned", "long", "ulong", false, true, false, 0, 0, 0, ULONG_MAX, sizeof(unsigned long) }, -}; - -const HostLang hostLangC = { - hostTypesC, - 12, - 0, - true, - false, /* loopLabels */ - Direct, - GotoFeature, - &makeCodeGen, - &defaultOutFnC, - &genLineDirectiveC -}; - -/* - * ASM - */ -const char *defaultOutFnAsm( const char *inputFileName ) -{ - return fileNameFromStem( inputFileName, ".s" ); -} - -HostType hostTypesAsm[] = -{ - { "char", 0, "char", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, sizeof(char) }, - { "unsigned", "char", "uchar", false, true, false, 0, 0, 0, UCHAR_MAX, sizeof(unsigned char) }, - { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, sizeof(short) }, - { "unsigned", "short", "ushort", false, true, false, 0, 0, 0, USHRT_MAX, sizeof(unsigned short) }, - { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, sizeof(int) }, - { "unsigned", "int", "uint", false, true, false, 0, 0, 0, UINT_MAX, sizeof(unsigned int) }, - { "long", 0, "long", true, true, false, LONG_MIN, LONG_MAX, 0, 0, sizeof(long) }, - { "unsigned", "long", "ulong", false, true, false, 0, 0, 0, ULONG_MAX, sizeof(unsigned long) }, -}; - -const HostLang hostLangAsm = { - hostTypesAsm, - 8, - 0, - true, - false, /* loopLabels */ - Direct, - GotoFeature, - &makeCodeGenAsm, - &defaultOutFnC, - &genLineDirectiveAsm -}; - HostType *findAlphType( const HostLang *hostLang, const char *s1 ) { for ( int i = 0; i < hostLang->numHostTypes; i++ ) { diff --git a/src/libfsm/common.h b/src/libfsm/common.h index 142eb735..980118f1 100644 --- a/src/libfsm/common.h +++ b/src/libfsm/common.h @@ -242,16 +242,10 @@ void genLineDirectiveC( std::ostream &out, bool nld, int line, const char *file void genLineDirectiveAsm( std::ostream &out, bool nld, int line, const char *file ); void genLineDirectiveTrans( std::ostream &out, bool nld, int line, const char *file ); -extern const HostLang hostLangC; -extern const HostLang hostLangAsm; - HostType *findAlphType( const HostLang *hostLang, const char *s1 ); HostType *findAlphType( const HostLang *hostLang, const char *s1, const char *s2 ); HostType *findAlphTypeInternal( const HostLang *hostLang, const char *s1 ); -const char *defaultOutFnC( const char *inputFileName ); -extern HostType hostTypesC[]; - /* An abstraction of the key operators that manages key operations such as * comparison and increment according the signedness of the key. */ struct KeyOps |