"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/flatgoto.cc" between
ragel-7.0.0.11.tar.gz and ragel-7.0.0.12.tar.gz

About: Ragel compiles executable finite state machines from regular languages (C, C++, Obj-C, C#, D, Java, Go and Ruby). Development version.

flatgoto.cc  (ragel-7.0.0.11):flatgoto.cc  (ragel-7.0.0.12)
skipping to change at line 25 skipping to change at line 25
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
#include "flatgoto.h" #include "flatgoto.h"
void FlatGoto::COND_BIN_SEARCH( Variable &var, TableArray &keys, std::string ok,
std::string error )
{
out <<
" {\n"
" " << INDEX( ARR_TYPE( keys ), "_lower" ) << " = "
<< var << ";\n"
" " << INDEX( ARR_TYPE( keys ), "_upper" ) << " = "
<< var << " + " << klen << " - 1;\n"
" " << INDEX( ARR_TYPE( keys ), "_mid" ) << ";\n"
" while ( " << TRUE() << " ) {\n"
" if ( _upper < _lower )\n"
" break;\n"
"\n"
" _mid = _lower + ((_upper-_lower) >> 1);\n
"
" if ( " << cpc << " < " << CAST("int") <<
DEREF( ARR_REF( keys ), "_mid" ) << " )\n"
" _upper = _mid - 1;\n"
" else if ( " << cpc << " > " << CAST( "int
" ) << DEREF( ARR_REF( keys ), "_mid" ) << " )\n"
" _lower = _mid + 1;\n"
" else {\n"
" " << ok << "\n"
" }\n"
" }\n"
" " << vCS() << " = " << ERROR_STATE() << ";\n"
" " << error << "\n"
" }\n"
;
}
void FlatGoto::LOCATE_TRANS() void FlatGoto::LOCATE_TRANS()
{ {
if ( redFsm->classMap == 0 ) { if ( redFsm->classMap == 0 ) {
out << out <<
" " << trans << " = " << CAST(UINT()) << ARR_REF( i ndexDefaults ) << "[" << vCS() << "]" << ";\n"; " " << trans << " = " << CAST(UINT()) << ARR_REF( i ndexDefaults ) << "[" << vCS() << "]" << ";\n";
} }
else { else {
long lowKey = redFsm->lowKey.getVal(); long lowKey = redFsm->lowKey.getVal();
long highKey = redFsm->highKey.getVal(); long highKey = redFsm->highKey.getVal();
skipping to change at line 82 skipping to change at line 56
if ( !limitHigh ) if ( !limitHigh )
out << GET_KEY() << " <= " << highKey; out << GET_KEY() << " <= " << highKey;
if ( !limitHigh && !limitLow ) if ( !limitHigh && !limitLow )
out << " && "; out << " && ";
if ( !limitLow ) if ( !limitLow )
out << GET_KEY() << " >= " << lowKey; out << GET_KEY() << " >= " << lowKey;
out << " )\n {\n"; out << " ) {\n";
} }
out << out <<
" int _ic = " << CAST("int") << ARR_REF( charClass ) << "[" << CAST("int") << GET_KEY() << " " << ic << " = " << CAST("int") << ARR_REF( charC lass ) << "[" << CAST("int") << GET_KEY() <<
" - " << lowKey << "];\n" " - " << lowKey << "];\n"
" if ( _ic <= " << CAST("int") << DEREF( AR " if ( " << ic << " <= " << CAST("int") <<
R_REF( transKeys ), string(keys) + "+1" ) << " && " << DEREF( ARR_REF( transKeys ), string(keys) + "+1" ) << " && " <<
"_ic >= " << CAST("int") << DEREF "" << ic << " >= " << CAST("int")
( ARR_REF( transKeys ), string(keys) + "" ) << " )\n" << DEREF( ARR_REF( transKeys ), string(keys) + "" ) << " )\n"
" " << trans << " = " << CAST(UINT( )) << DEREF( ARR_REF( indicies ), " " << trans << " = " << CAST(UINT( )) << DEREF( ARR_REF( indicies ),
string(inds) + " + " + CAST("int") + "( _ic - " + CAST("int") + string(inds) + " + " + CAST("int") + "( " + string(ic) + " - " + CAST("int") +
DEREF( ARR_REF( t ransKeys ), string(keys) + "" ) + " ) " ) << "; \n" DEREF( ARR_REF( t ransKeys ), string(keys) + "" ) + " ) " ) << "; \n"
" else\n" " else\n"
" " << trans << " = " << CAST(UINT( )) << ARR_REF( indexDefaults ) << " " << trans << " = " << CAST(UINT( )) << ARR_REF( indexDefaults ) <<
"[" << vCS() << " ]" << ";\n"; "[" << vCS() << " ]" << ";\n";
if ( !limitLow || !limitHigh ) { if ( !limitLow || !limitHigh ) {
out << out <<
" }\n" " }\n"
" else {\n" " else {\n"
" " << trans << " = " << CAST(UINT( )) << ARR_REF( indexDefaults ) << "[" << vCS() << "]" << ";\n" " " << trans << " = " << CAST(UINT( )) << ARR_REF( indexDefaults ) << "[" << vCS() << "]" << ";\n"
" }\n" " }\n"
"\n"; "\n";
} }
} }
}
void FlatGoto::LOCATE_COND()
{
if ( red->condSpaceList.length() > 0 ) { if ( red->condSpaceList.length() > 0 ) {
out << out <<
" " << cond << " = " << CAST( UINT() ) << ARR_REF( transOffsets ) << "[" << trans << "];\n" " " << cond << " = " << CAST( UINT() ) << ARR_REF( transOffsets ) << "[" << trans << "];\n"
"\n"; "\n";
out << out <<
" " << cpc << " = 0;\n"; " " << cpc << " = 0;\n";
out << out <<
" switch ( " << ARR_REF( transCondSpaces ) << "[" < < trans << "] ) {\n" " switch ( " << ARR_REF( transCondSpaces ) << "[" < < trans << "] ) {\n"
"\n"; "\n";
for ( CondSpaceList::Iter csi = red->condSpaceList; csi.lte(); cs i++ ) { for ( CondSpaceList::Iter csi = red->condSpaceList; csi.lte(); cs i++ ) {
GenCondSpace *condSpace = csi; GenCondSpace *condSpace = csi;
if ( condSpace->numTransRefs > 0 ) { if ( condSpace->numTransRefs > 0 ) {
out << " " << CASE( STR(condSpace->condSpa ceId) ) << " {\n"; out << " " << CASE( STR(condSpace->condSpa ceId) ) << " {\n";
for ( GenCondSet::Iter csi = condSpace->condSet; csi.lte(); csi++ ) { for ( GenCondSet::Iter csi = condSpace->condSet; csi.lte(); csi++ ) {
out << TABS(2) << "if ( "; out << "if ( ";
CONDITION( out, *csi ); CONDITION( out, *csi );
Size condValOffset = (1 << csi.pos()); Size condValOffset = (1 << csi.pos());
out << " ) " << cpc << " += " << condValO ffset << ";\n"; out << " ) " << cpc << " += " << condValO ffset << ";\n";
} }
out << out <<
" " << CEND() << "}\n"; " " << CEND() << "\n}\n";
} }
} }
out << out <<
" }\n" " }\n"
" " << cond << " += " << CAST( UINT() ) << "" << cp c << ";\n"; " " << cond << " += " << CAST( UINT() ) << "" << cp c << ";\n";
} }
out <<
" goto _match_cond;\n"
;
} }
 End of changes. 9 change blocks. 
45 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)