"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/fsmap.cc" between
ragel-7.0.0.9.tar.gz and ragel-7.0.0.10.tar.gz

About:

fsmap.cc  (ragel-7.0.0.9):fsmap.cc  (ragel-7.0.0.10)
/* /*
* Copyright 2002-2004 Adrian Thurston <thurston@complang.org> * Copyright 2002-2004 Adrian Thurston <thurston@colm.net>
*/
/* This file is part of Ragel.
* *
* Ragel is free software; you can redistribute it and/or modify * Permission is hereby granted, free of charge, to any person obtaining a copy
* it under the terms of the GNU General Public License as published by * of this software and associated documentation files (the "Software"), to
* the Free Software Foundation; either version 2 of the License, or * deal in the Software without restriction, including without limitation the
* (at your option) any later version. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* *
* Ragel is distributed in the hope that it will be useful, * The above copyright notice and this permission notice shall be included in al
* but WITHOUT ANY WARRANTY; without even the implied warranty of l
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * copies or substantial portions of the Software.
* GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* along with Ragel; if not, write to the Free Software * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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
* SOFTWARE.
*/ */
#include "fsmgraph.h" #include "fsmgraph.h"
#include <iostream> #include <iostream>
using std::endl; using std::endl;
/* Insert an action into an action table. */ /* Insert an action into an action table. */
void ActionTable::setAction( int ordering, Action *action ) void ActionTable::setAction( int ordering, Action *action )
{ {
/* Multi-insert in case specific instances of an action appear in a /* Multi-insert in case specific instances of an action appear in a
skipping to change at line 945 skipping to change at line 946
/* Keys and priorities are equal, advance both. */ /* Keys and priorities are equal, advance both. */
pd1.increment(); pd1.increment();
pd2.increment(); pd2.increment();
} }
} }
/* No differing priorities on the same key. */ /* No differing priorities on the same key. */
return 0; return 0;
} }
int FsmAp::compareCondListBitElim( const CondList &condList1, const CondList &co
ndList2 )
{
ValPairIter< PiList<CondAp> > outPair( condList1, condList2 );
for ( ; !outPair.end(); outPair++ ) {
switch ( outPair.userState ) {
case ValPairIter<CondAp>::RangeInS1: {
int compareRes = FsmAp::compareCondBitElimPtr<CondAp>( ou
tPair.s1Tel.trans, 0 );
if ( compareRes != 0 )
return compareRes;
break;
}
case ValPairIter<CondAp>::RangeInS2: {
int compareRes = FsmAp::compareCondBitElimPtr<CondAp>( 0,
outPair.s2Tel.trans );
if ( compareRes != 0 )
return compareRes;
break;
}
case ValPairIter<CondAp>::RangeOverlap: {
int compareRes = FsmAp::compareCondBitElimPtr<CondAp>(
outPair.s1Tel.trans, outPair.s2Tel.trans
);
if ( compareRes != 0 )
return compareRes;
break;
}}
}
return 0;
}
/* Compares two transitions according to priority and functions. Pointers /* Compares two transitions according to priority and functions. Pointers
* should not be null. Does not consider to state or from state. Compare two * should not be null. Does not consider to state or from state. Compare two
* transitions according to the data contained in the transitions. Data means * transitions according to the data contained in the transitions. Data means
* any properties added to user transitions that may differentiate them. Since * any properties added to user transitions that may differentiate them. Since
* the base transition has no data, the default is to return equal. */ * the base transition has no data, the default is to return equal. */
int FsmAp::compareTransData( TransAp *trans1, TransAp *trans2 ) int FsmAp::compareTransData( TransAp *trans1, TransAp *trans2 )
{ {
if ( trans1->condSpace < trans2->condSpace ) if ( trans1->condSpace < trans2->condSpace )
return -1; return -1;
else if ( trans2->condSpace < trans1->condSpace ) else if ( trans2->condSpace < trans1->condSpace )
skipping to change at line 1008 skipping to change at line 1037
/* Compare the prior table. */ /* Compare the prior table. */
int cmpRes = CmpPriorTable::compare( trans1->priorTable, int cmpRes = CmpPriorTable::compare( trans1->priorTable,
trans2->priorTable ); trans2->priorTable );
if ( cmpRes != 0 ) if ( cmpRes != 0 )
return cmpRes; return cmpRes;
/* Compare longest match action tables. */ /* Compare longest match action tables. */
cmpRes = CmpLmActionTable::compare(trans1->lmActionTable, cmpRes = CmpLmActionTable::compare(trans1->lmActionTable,
trans2->lmActionTable); trans2->lmActionTable);
if ( cmpRes != 0 ) if ( cmpRes != 0 )
return cmpRes;
/* Compare action tables. */
return CmpActionTable::compare(trans1->actionTable,
trans2->actionTable);
}
/* Compares two transitions according to priority and functions. Pointers
* should not be null. Does not consider to state or from state. Compare two
* transitions according to the data contained in the transitions. Data means
* any properties added to user transitions that may differentiate them. Since
* the base transition has no data, the default is to return equal. */
template< class Trans > int FsmAp::compareCondBitElim( Trans *trans1, Trans *tra
ns2 )
{
if ( trans1->toState < trans2->toState )
return -1;
else if ( trans1->toState > trans2->toState )
return 1;
/* Compare the prior table. */
int cmpRes = CmpPriorTable::compare( trans1->priorTable,
trans2->priorTable );
if ( cmpRes != 0 )
return cmpRes;
/* Compare longest match action tables. */
cmpRes = CmpLmActionTable::compare(trans1->lmActionTable,
trans2->lmActionTable);
if ( cmpRes != 0 )
return cmpRes; return cmpRes;
/* Compare action tables. */ /* Compare action tables. */
return CmpActionTable::compare(trans1->actionTable, return CmpActionTable::compare(trans1->actionTable,
trans2->actionTable); trans2->actionTable);
} }
/* Compare the properties of states that are embedded by users. Compares out /* Compare the properties of states that are embedded by users. Compares out
* priorities, out transitions, to, from, out, error and eof action tables. */ * priorities, out transitions, to, from, out, error and eof action tables. */
int FsmAp::compareStateData( const StateAp *state1, const StateAp *state2 ) int FsmAp::compareStateData( const StateAp *state1, const StateAp *state2 )
 End of changes. 6 change blocks. 
15 lines changed or deleted 79 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS