One of the ST_* macros collides with a macro in windows.h.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Wed, 24 Oct 2007 22:54:01 +0000 (22:54 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Wed, 24 Oct 2007 22:54:01 +0000 (22:54 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@327 052ea7fc-9027-0410-9066-f65837a77df0

ragel/fsmap.cpp
ragel/fsmattach.cpp
ragel/fsmbase.cpp
ragel/fsmgraph.cpp
ragel/fsmgraph.h
ragel/fsmmin.cpp
ragel/fsmstate.cpp
ragel/parsetree.cpp

index 0674fa9..ff6f929 100644 (file)
@@ -126,7 +126,7 @@ void FsmAp::startFsmPrior( int ordering, PriorDesc *prior )
        /* If the new start state is final then set the out priority. This follows
         * the same convention as setting start action in the out action table of
         * a final start state. */
-       if ( startState->stateBits & SB_ISFINAL )
+       if ( startState->stateBits & STB_ISFINAL )
                startState->outPriorTable.setPrior( ordering, prior );
 }
 
@@ -190,7 +190,7 @@ void FsmAp::startFsmAction( int ordering, Action *action )
        /* If start state is final then add the action to the out action table.
         * This means that when the null string is accepted the start action will
         * not be bypassed. */
-       if ( startState->stateBits & SB_ISFINAL )
+       if ( startState->stateBits & STB_ISFINAL )
                startState->outActionTable.setAction( ordering, action );
 }
 
@@ -658,14 +658,14 @@ void FsmAp::verifyStates()
 {
        for ( StateList::Iter state = stateList; state.lte(); state++ ) {
                /* Non final states should not have leaving data. */
-               if ( ! (state->stateBits & SB_ISFINAL) ) {
+               if ( ! (state->stateBits & STB_ISFINAL) ) {
                        assert( state->outActionTable.length() == 0 );
                        assert( state->outCondSet.length() == 0 );
                        assert( state->outPriorTable.length() == 0 );
                }
 
                /* Data used in algorithms should be cleared. */
-               assert( (state->stateBits & SB_BOTH) == 0 );
+               assert( (state->stateBits & STB_BOTH) == 0 );
                assert( state->foreignInTrans > 0 );
        }
 }
index 6a90df6..16d2183 100644 (file)
@@ -183,7 +183,7 @@ void FsmAp::detachState( StateAp *state )
        state->outList.abandon();
 
        /* Unset final stateness before detaching from graph. */
-       if ( state->stateBits & SB_ISFINAL )
+       if ( state->stateBits & STB_ISFINAL )
                finStateSet.remove( state );
 }
 
index cbf33b7..4ed28e8 100644 (file)
@@ -144,10 +144,10 @@ FsmAp::~FsmAp()
 void FsmAp::setFinState( StateAp *state )
 {
        /* Is it already a fin state. */
-       if ( state->stateBits & SB_ISFINAL )
+       if ( state->stateBits & STB_ISFINAL )
                return;
        
-       state->stateBits |= SB_ISFINAL;
+       state->stateBits |= STB_ISFINAL;
        finStateSet.insert( state );
 }
 
@@ -156,14 +156,14 @@ void FsmAp::setFinState( StateAp *state )
 void FsmAp::unsetFinState( StateAp *state )
 {
        /* Is it already a non-final state? */
-       if ( ! (state->stateBits & SB_ISFINAL) )
+       if ( ! (state->stateBits & STB_ISFINAL) )
                return;
 
        /* When a state looses its final state status it must relinquish all the
         * properties that are allowed only for final states. */
        clearOutData( state );
 
-       state->stateBits &= ~ SB_ISFINAL;
+       state->stateBits &= ~ STB_ISFINAL;
        finStateSet.remove( state );
 }
 
@@ -346,12 +346,12 @@ void FsmAp::epsilonTrans( int id )
 void FsmAp::markReachableFromHere( StateAp *state )
 {
        /* Base case: return; */
-       if ( state->stateBits & SB_ISMARKED )
+       if ( state->stateBits & STB_ISMARKED )
                return;
        
        /* Set this state as processed. We are going to visit all states that this
         * state has a transition to. */
-       state->stateBits |= SB_ISMARKED;
+       state->stateBits |= STB_ISMARKED;
 
        /* Recurse on all out transitions. */
        for ( TransList::Iter trans = state->outList; trans.lte(); trans++ ) {
@@ -363,12 +363,12 @@ void FsmAp::markReachableFromHere( StateAp *state )
 void FsmAp::markReachableFromHereStopFinal( StateAp *state )
 {
        /* Base case: return; */
-       if ( state->stateBits & SB_ISMARKED )
+       if ( state->stateBits & STB_ISMARKED )
                return;
        
        /* Set this state as processed. We are going to visit all states that this
         * state has a transition to. */
-       state->stateBits |= SB_ISMARKED;
+       state->stateBits |= STB_ISMARKED;
 
        /* Recurse on all out transitions. */
        for ( TransList::Iter trans = state->outList; trans.lte(); trans++ ) {
@@ -383,12 +383,12 @@ void FsmAp::markReachableFromHereStopFinal( StateAp *state )
 void FsmAp::markReachableFromHereReverse( StateAp *state )
 {
        /* Base case: return; */
-       if ( state->stateBits & SB_ISMARKED )
+       if ( state->stateBits & STB_ISMARKED )
                return;
        
        /* Set this state as processed. We are going to visit all states with
         * transitions into this state. */
-       state->stateBits |= SB_ISMARKED;
+       state->stateBits |= STB_ISMARKED;
 
        /* Recurse on all items in transitions. */
        for ( TransInList::Iter trans = state->inList; trans.lte(); trans++ ) 
@@ -424,7 +424,7 @@ void FsmAp::copyInEntryPoints( FsmAp *other )
 void FsmAp::unsetAllFinStates()
 {
        for ( StateSet::Iter st = finStateSet; st.lte(); st++ )
-               (*st)->stateBits &= ~ SB_ISFINAL;
+               (*st)->stateBits &= ~ STB_ISFINAL;
        finStateSet.empty();
 }
 
@@ -460,8 +460,8 @@ void FsmAp::verifyReachability()
        /* Check that everything got marked. */
        for ( StateList::Iter st = stateList; st.lte(); st++ ) {
                /* Assert it got marked and then clear the mark. */
-               assert( st->stateBits & SB_ISMARKED );
-               st->stateBits &= ~ SB_ISMARKED;
+               assert( st->stateBits & STB_ISMARKED );
+               st->stateBits &= ~ STB_ISMARKED;
        }
 }
 
@@ -472,24 +472,24 @@ void FsmAp::verifyNoDeadEndStates()
                markReachableFromHereReverse( *pst );
 
        /* Start state gets honorary marking. Must be done AFTER recursive call. */
-       startState->stateBits |= SB_ISMARKED;
+       startState->stateBits |= STB_ISMARKED;
 
        /* Make sure everything got marked. */
        for ( StateList::Iter st = stateList; st.lte(); st++ ) {
                /* Assert the state got marked and unmark it. */
-               assert( st->stateBits & SB_ISMARKED );
-               st->stateBits &= ~ SB_ISMARKED;
+               assert( st->stateBits & STB_ISMARKED );
+               st->stateBits &= ~ STB_ISMARKED;
        }
 }
 
 void FsmAp::depthFirstOrdering( StateAp *state )
 {
        /* Nothing to do if the state is already on the list. */
-       if ( state->stateBits & SB_ONLIST )
+       if ( state->stateBits & STB_ONLIST )
                return;
 
        /* Doing depth first, put state on the list. */
-       state->stateBits |= SB_ONLIST;
+       state->stateBits |= STB_ONLIST;
        stateList.append( state );
        
        /* Recurse on everything ranges. */
@@ -504,7 +504,7 @@ void FsmAp::depthFirstOrdering()
 {
        /* Init on state list flags. */
        for ( StateList::Iter st = stateList; st.lte(); st++ )
-               st->stateBits &= ~SB_ONLIST;
+               st->stateBits &= ~STB_ONLIST;
        
        /* Clear out the state list, we will rebuild it. */
        int stateListLen = stateList.length();
index 0956e84..1ff0936 100644 (file)
@@ -293,7 +293,7 @@ void FsmAp::optionalRepeatOp( int times )
                /* Make a duplicate for concating and set the fin bits to graph 2 so we
                 * can pick out it's final states after the optional style concat. */
                FsmAp *dup = new FsmAp( *copyFrom );
-               dup->setFinBits( SB_GRAPH2 );
+               dup->setFinBits( STB_GRAPH2 );
                doConcat( dup, &lastFinSet, true );
 
                /* Clear the last final state set and make the new one by taking only
@@ -303,9 +303,9 @@ void FsmAp::optionalRepeatOp( int times )
                        /* If the state came from graph 2, add it to the last set and clear
                         * the bits. */
                        StateAp *fs = finStateSet[i];
-                       if ( fs->stateBits & SB_GRAPH2 ) {
+                       if ( fs->stateBits & STB_GRAPH2 ) {
                                lastFinSet.insert( fs );
-                               fs->stateBits &= ~SB_GRAPH2;
+                               fs->stateBits &= ~STB_GRAPH2;
                        }
                }
        }
@@ -455,8 +455,8 @@ void FsmAp::intersectOp( FsmAp *other )
        other->setMisfitAccounting( true );
 
        /* Set the fin bits on this and other to want each other. */
-       setFinBits( SB_GRAPH1 );
-       other->setFinBits( SB_GRAPH2 );
+       setFinBits( STB_GRAPH1 );
+       other->setFinBits( STB_GRAPH2 );
 
        /* Call worker Or routine. */
        doOr( other );
@@ -481,7 +481,7 @@ void FsmAp::subtractOp( FsmAp *other )
        other->setMisfitAccounting( true );
 
        /* Set the fin bits of other to be killers. */
-       other->setFinBits( SB_GRAPH1 );
+       other->setFinBits( STB_GRAPH1 );
 
        /* Call worker Or routine. */
        doOr( other );
@@ -725,7 +725,7 @@ void FsmAp::joinOp( int startId, int finalId, FsmAp **others, int numOthers )
        /* Invoke the relinquish final callback on any states that did not get
         * final state status back. */
        for ( StateSet::Iter st = finStateSetCopy; st.lte(); st++ ) {
-               if ( !((*st)->stateBits & SB_ISFINAL) )
+               if ( !((*st)->stateBits & STB_ISFINAL) )
                        clearOutData( *st );
        }
 
@@ -818,14 +818,14 @@ void FsmAp::unsetKilledFinals()
        for ( int s = 0; s < fin.length(); s++ ) {
                /* Check for killing bit. */
                StateAp *state = fin.data[s];
-               if ( state->stateBits & SB_GRAPH1 ) {
+               if ( state->stateBits & STB_GRAPH1 ) {
                        /* One final state is a killer, set to non-final. */
                        unsetFinState( state );
                }
 
                /* Clear all killing bits. Non final states should never have had those
                 * state bits set in the first place. */
-               state->stateBits &= ~SB_GRAPH1;
+               state->stateBits &= ~STB_GRAPH1;
        }
 }
 
@@ -838,8 +838,8 @@ void FsmAp::unsetIncompleteFinals()
        for ( int s = 0; s < fin.length(); s++ ) {
                /* Check for one set but not the other. */
                StateAp *state = fin.data[s];
-               if ( state->stateBits & SB_BOTH && 
-                               (state->stateBits & SB_BOTH) != SB_BOTH )
+               if ( state->stateBits & STB_BOTH && 
+                               (state->stateBits & STB_BOTH) != STB_BOTH )
                {
                        /* One state wants the other but it is not there. */
                        unsetFinState( state );
@@ -847,7 +847,7 @@ void FsmAp::unsetIncompleteFinals()
 
                /* Clear wanting bits. Non final states should never have had those
                 * state bits set in the first place. */
-               state->stateBits &= ~SB_BOTH;
+               state->stateBits &= ~STB_BOTH;
        }
 }
 
@@ -1220,7 +1220,7 @@ void FsmAp::mergeStates( MergeData &md, StateAp *destState, StateAp *srcState )
        expList2.empty();
 
        /* Get its bits and final state status. */
-       destState->stateBits |= ( srcState->stateBits & ~SB_ISFINAL );
+       destState->stateBits |= ( srcState->stateBits & ~STB_ISFINAL );
        if ( srcState->isFinState() )
                setFinState( destState );
 
index b10ff3a..8b0ffd7 100644 (file)
 //#define LOG_CONDS
 
 /* Flags that control merging. */
-#define SB_GRAPH1     0x01
-#define SB_GRAPH2     0x02
-#define SB_BOTH       0x03
-#define SB_ISFINAL    0x04
-#define SB_ISMARKED   0x08
-#define SB_ONLIST     0x10
+#define STB_GRAPH1     0x01
+#define STB_GRAPH2     0x02
+#define STB_BOTH       0x03
+#define STB_ISFINAL    0x04
+#define STB_ISMARKED   0x08
+#define STB_ONLIST     0x10
 
 using std::ostream;
 
@@ -672,7 +672,7 @@ struct StateAp
        ~StateAp();
 
        /* Is the state final? */
-       bool isFinState() { return stateBits & SB_ISFINAL; }
+       bool isFinState() { return stateBits & STB_ISFINAL; }
 
        /* Out transition list and the pointer for the default out trans. */
        TransList outList;
index 046d11a..c9ace1b 100644 (file)
@@ -509,8 +509,8 @@ void FsmAp::removeUnreachableStates()
        while ( state ) {
                StateAp *next = state->next;
 
-               if ( state->stateBits & SB_ISMARKED )
-                       state->stateBits &= ~ SB_ISMARKED;
+               if ( state->stateBits & STB_ISMARKED )
+                       state->stateBits &= ~ STB_ISMARKED;
                else {
                        detachState( state );
                        stateList.detach( state );
@@ -573,7 +573,7 @@ void FsmAp::removeDeadEndStates()
         * recursive call on all the final states so that it does not cause the
         * start state in transitions to be skipped when the start state is
         * visited by the traversal. */
-       startState->stateBits |= SB_ISMARKED;
+       startState->stateBits |= STB_ISMARKED;
 
        /* Delete all states that are not marked
         * and unmark the ones that are marked. */
@@ -581,8 +581,8 @@ void FsmAp::removeDeadEndStates()
        while ( state != 0 ) {
                StateAp *next = state->next;
 
-               if ( state->stateBits & SB_ISMARKED  )
-                       state->stateBits &= ~ SB_ISMARKED;
+               if ( state->stateBits & STB_ISMARKED  )
+                       state->stateBits &= ~ STB_ISMARKED;
                else {
                        detachState( state );
                        stateList.detach( state );
index 82675ba..722f9d8 100644 (file)
@@ -177,9 +177,9 @@ int ApproxCompare::compare( const StateAp *state1, const StateAp *state2 )
        int compareRes;
 
        /* Test final state status. */
-       if ( (state1->stateBits & SB_ISFINAL) && !(state2->stateBits & SB_ISFINAL) )
+       if ( (state1->stateBits & STB_ISFINAL) && !(state2->stateBits & STB_ISFINAL) )
                return -1;
-       else if ( !(state1->stateBits & SB_ISFINAL) && (state2->stateBits & SB_ISFINAL) )
+       else if ( !(state1->stateBits & STB_ISFINAL) && (state2->stateBits & STB_ISFINAL) )
                return 1;
        
        /* Test epsilon transition sets. */
@@ -239,9 +239,9 @@ int InitPartitionCompare::compare( const StateAp *state1 , const StateAp *state2
        int compareRes;
 
        /* Test final state status. */
-       if ( (state1->stateBits & SB_ISFINAL) && !(state2->stateBits & SB_ISFINAL) )
+       if ( (state1->stateBits & STB_ISFINAL) && !(state2->stateBits & STB_ISFINAL) )
                return -1;
-       else if ( !(state1->stateBits & SB_ISFINAL) && (state2->stateBits & SB_ISFINAL) )
+       else if ( !(state1->stateBits & STB_ISFINAL) && (state2->stateBits & STB_ISFINAL) )
                return 1;
 
        /* Test epsilon transition sets. */
index f809f3c..7310e16 100644 (file)
@@ -296,9 +296,9 @@ void LongestMatch::runLonestMatch( ParseData *pd, FsmAp *graph )
 {
        graph->markReachableFromHereStopFinal( graph->startState );
        for ( StateList::Iter ms = graph->stateList; ms.lte(); ms++ ) {
-               if ( ms->stateBits & SB_ISMARKED ) {
+               if ( ms->stateBits & STB_ISMARKED ) {
                        ms->lmItemSet.insert( 0 );
-                       ms->stateBits &= ~ SB_ISMARKED;
+                       ms->stateBits &= ~ STB_ISMARKED;
                }
        }
 
@@ -320,9 +320,9 @@ void LongestMatch::runLonestMatch( ParseData *pd, FsmAp *graph )
                                        /* Fill the item sets. */
                                        graph->markReachableFromHereStopFinal( toState );
                                        for ( StateList::Iter ms = graph->stateList; ms.lte(); ms++ ) {
-                                               if ( ms->stateBits & SB_ISMARKED ) {
+                                               if ( ms->stateBits & STB_ISMARKED ) {
                                                        ms->lmItemSet.insert( lmAct->value );
-                                                       ms->stateBits &= ~ SB_ISMARKED;
+                                                       ms->stateBits &= ~ STB_ISMARKED;
                                                }
                                        }
                                }
@@ -338,10 +338,10 @@ void LongestMatch::runLonestMatch( ParseData *pd, FsmAp *graph )
        int maxItemSetLength = 0;
        graph->markReachableFromHereStopFinal( graph->startState );
        for ( StateList::Iter ms = graph->stateList; ms.lte(); ms++ ) {
-               if ( ms->stateBits & SB_ISMARKED ) {
+               if ( ms->stateBits & STB_ISMARKED ) {
                        if ( ms->lmItemSet.length() > maxItemSetLength )
                                maxItemSetLength = ms->lmItemSet.length();
-                       ms->stateBits &= ~ SB_ISMARKED;
+                       ms->stateBits &= ~ STB_ISMARKED;
                }
        }
 
@@ -394,12 +394,12 @@ void LongestMatch::runLonestMatch( ParseData *pd, FsmAp *graph )
                                        maxItemSetLength = 0;
                                        graph->markReachableFromHereStopFinal( toState );
                                        for ( StateList::Iter ms = graph->stateList; ms.lte(); ms++ ) {
-                                               if ( ms->stateBits & SB_ISMARKED ) {
+                                               if ( ms->stateBits & STB_ISMARKED ) {
                                                        if ( ms->lmItemSet.length() > 0 && !ms->isFinState() )
                                                                nonFinalNonEmptyItemSet = true;
                                                        if ( ms->lmItemSet.length() > maxItemSetLength )
                                                                maxItemSetLength = ms->lmItemSet.length();
-                                                       ms->stateBits &= ~ SB_ISMARKED;
+                                                       ms->stateBits &= ~ STB_ISMARKED;
                                                }
                                        }