From 6877df322fe8bbcf05212dd6bf333ba4d6564c4f Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Sun, 7 Nov 2021 15:24:11 -0800 Subject: moved the findAlphType code over to ragel --- src/libfsm/common.cc | 37 ------------------------------------- src/libfsm/common.h | 4 ---- src/libfsm/gendata.cc | 12 ------------ src/libfsm/gendata.h | 1 - 4 files changed, 54 deletions(-) (limited to 'src') diff --git a/src/libfsm/common.cc b/src/libfsm/common.cc index 97715b82..7a4df841 100644 --- a/src/libfsm/common.cc +++ b/src/libfsm/common.cc @@ -26,43 +26,6 @@ #include #include "ragel.h" -HostType *findAlphType( const HostLang *hostLang, const char *s1 ) -{ - for ( int i = 0; i < hostLang->numHostTypes; i++ ) { - if ( strcmp( s1, hostLang->hostTypes[i].data1 ) == 0 && - hostLang->hostTypes[i].data2 == 0 ) - { - return hostLang->hostTypes + i; - } - } - - return 0; -} - -HostType *findAlphType( const HostLang *hostLang, const char *s1, const char *s2 ) -{ - for ( int i = 0; i < hostLang->numHostTypes; i++ ) { - if ( strcmp( s1, hostLang->hostTypes[i].data1 ) == 0 && - hostLang->hostTypes[i].data2 != 0 && - strcmp( s2, hostLang->hostTypes[i].data2 ) == 0 ) - { - return hostLang->hostTypes + i; - } - } - - return 0; -} - -HostType *findAlphTypeInternal( const HostLang *hostLang, const char *s1 ) -{ - for ( int i = 0; i < hostLang->numHostTypes; i++ ) { - if ( strcmp( s1, hostLang->hostTypes[i].internalName ) == 0 ) - return hostLang->hostTypes + i; - } - - return 0; -} - std::streamsize output_filter::countAndWrite( const char *s, std::streamsize n ) { for ( int i = 0; i < n; i++ ) { diff --git a/src/libfsm/common.h b/src/libfsm/common.h index 980118f1..2be2bb55 100644 --- a/src/libfsm/common.h +++ b/src/libfsm/common.h @@ -242,10 +242,6 @@ 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 ); -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 ); - /* An abstraction of the key operators that manages key operations such as * comparison and increment according the signedness of the key. */ struct KeyOps diff --git a/src/libfsm/gendata.cc b/src/libfsm/gendata.cc index 718b0d38..355ed12c 100644 --- a/src/libfsm/gendata.cc +++ b/src/libfsm/gendata.cc @@ -864,9 +864,6 @@ void Reducer::makeMachine() void Reducer::make( const HostLang *hostLang, const HostType *alphType ) { - /* Alphabet type. */ - setAlphType( hostLang, alphType->internalName ); - /* Getkey expression. */ if ( fsmCtx->getKeyExpr != 0 ) { getKeyExpr = new GenInlineList; @@ -1202,15 +1199,6 @@ void Reducer::resolveTargetStates() #endif } -bool Reducer::setAlphType( const HostLang *hostLang, const char *data ) -{ - HostType *alphType = findAlphTypeInternal( hostLang, data ); - if ( alphType == 0 ) - return false; - - return true; -} - void Reducer::condSpaceItem( int cnum, long condActionId ) { GenCondSpace *cond = allCondSpaces + cnum; diff --git a/src/libfsm/gendata.h b/src/libfsm/gendata.h index 7ba4e683..1ad63429 100644 --- a/src/libfsm/gendata.h +++ b/src/libfsm/gendata.h @@ -297,7 +297,6 @@ public: void makeMachine(); void makeExports(); void makeGenInlineList( GenInlineList *outList, InlineList *inList ); - bool setAlphType( const HostLang *hostLang, const char *data ); void analyzeMachine(); void make( const HostLang *hostLang, const HostType *alphType ); -- cgit v1.2.1