"Fossies" - the Fresh Open Source Software Archive  

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

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

redfsm.cc  (ragel-7.0.0.10):redfsm.cc  (ragel-7.0.0.11)
/* /*
* Copyright 2001-2006 Adrian Thurston <thurston@colm.net> * Copyright 2001-2018 Adrian Thurston <thurston@colm.net>
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to * of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the * deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * 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 * sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in al l * The above copyright notice and this permission notice shall be included in al l
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
skipping to change at line 29 skipping to change at line 29
* 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 "redfsm.h" #include "redfsm.h"
#include "avlmap.h" #include "avlmap.h"
#include "mergesort.h" #include "mergesort.h"
#include "fsmgraph.h" #include "fsmgraph.h"
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <ctime>
using std::ostringstream; using std::ostringstream;
GenInlineItem::~GenInlineItem() GenInlineItem::~GenInlineItem()
{ {
if ( children != 0 ) { if ( children != 0 ) {
children->empty(); children->empty();
delete children; delete children;
} }
} }
skipping to change at line 444 skipping to change at line 445
st->onStateList = false; st->onStateList = false;
/* Clear out the state list, we will rebuild it. */ /* Clear out the state list, we will rebuild it. */
int stateListLen = stateList.length(); int stateListLen = stateList.length();
stateList.abandon(); stateList.abandon();
srand( time( 0 ) ); srand( time( 0 ) );
for ( int i = nextStateId; i > 0; i-- ) { for ( int i = nextStateId; i > 0; i-- ) {
/* Pick one from 0 ... i (how many are left). */ /* Pick one from 0 ... i (how many are left). */
int nth = random() % i; int nth = rand() % i;
/* Go forward through the list adding the nth. Need to scan becau se /* Go forward through the list adding the nth. Need to scan becau se
* there are items already added in the list. */ * there are items already added in the list. */
for ( int j = 0; j < nextStateId; j++ ) { for ( int j = 0; j < nextStateId; j++ ) {
if ( !allStates[j].onStateList ) { if ( !allStates[j].onStateList ) {
if ( nth == 0 ) { if ( nth == 0 ) {
/* Add. */ /* Add. */
allStates[j].onStateList = true; allStates[j].onStateList = true;
stateList.append( &allStates[j] ); stateList.append( &allStates[j] );
break; break;
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added

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