"Fossies" - the Fresh Open Source Software Archive  

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

About:

allocgen.cc  (ragel-7.0.0.9):allocgen.cc  (ragel-7.0.0.10)
/* /*
* Copyright 2005-2011 Adrian Thurston <thurston@complang.org> * Copyright 2005-2011 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 "ragel.h" #include "ragel.h"
#include "parsedata.h" #include "parsedata.h"
#include "fsmgraph.h" #include "fsmgraph.h"
#include "gendata.h" #include "gendata.h"
#include "inputdata.h" #include "inputdata.h"
#include "version.h" #include "version.h"
/* /*
* Code generators. * Code generators.
*/ */
#include "binvarloop.h" #include "binloop.h"
#include "bingotoloop.h" #include "binexp.h"
#include "binvarexp.h" #include "flatloop.h"
#include "bingotoexp.h" #include "flatexp.h"
#include "flatgotoloop.h"
#include "flatvarloop.h"
#include "flatgotoexp.h"
#include "flatvarexp.h"
#include "gotoloop.h" #include "gotoloop.h"
#include "gotoexp.h" #include "gotoexp.h"
#include "ipgoto.h" #include "ipgoto.h"
#include "asm.h" #include "asm.h"
/* Invoked by the parser when a ragel definition is opened. */ /* Invoked by the parser when a ragel definition is opened. */
CodeGenData *makeCodeGen( const HostLang *hostLang, const CodeGenArgs &args ) CodeGenData *makeCodeGen( const HostLang *hostLang, const CodeGenArgs &args )
{ {
FsmGbl *id = args.id;
CodeGenData *codeGen = 0; CodeGenData *codeGen = 0;
if ( hostLang->lang == HostLang::Asm ) { if ( hostLang->lang == HostLang::Asm ) {
codeGen = new AsmCodeGen( args ); codeGen = new AsmCodeGen( args );
} }
else if ( id->backend == Direct ) { else {
switch ( args.codeStyle ) { switch ( args.codeStyle ) {
case GenBinaryLoop: case GenBinaryLoop:
if ( id->backendFeature == GotoFeature ) codeGen = new BinaryLoopGoto( args );
codeGen = new BinaryLoopGoto( args );
else
codeGen = new BinaryLoopVar( args );
break; break;
case GenBinaryExp: case GenBinaryExp:
if ( id->backendFeature == GotoFeature ) codeGen = new BinaryExpGoto( args );
codeGen = new BinaryExpGoto( args );
else
codeGen = new BinaryExpVar( args );
break; break;
case GenFlatLoop: case GenFlatLoop:
if ( id->backendFeature == GotoFeature ) codeGen = new FlatLoopGoto( args );
codeGen = new FlatLoopGoto( args );
else
codeGen = new FlatLoopVar( args );
break; break;
case GenFlatExp: case GenFlatExp:
if ( id->backendFeature == GotoFeature ) codeGen = new FlatExpGoto( args );
codeGen = new FlatExpGoto( args );
else
codeGen = new FlatExpVar( args );
break; break;
case GenSwitchLoop: case GenSwitchLoop:
codeGen = new SwitchLoopGoto( args ); codeGen = new SwitchLoopGoto( args );
break; break;
case GenSwitchExp: case GenSwitchExp:
codeGen = new SwitchExpGoto( args ); codeGen = new SwitchExpGoto( args );
break; break;
case GenIpGoto: case GenIpGoto:
codeGen = new IpGoto( args ); codeGen = new IpGoto( args );
break; break;
} }
} }
else {
switch ( args.codeStyle ) {
case GenBinaryLoop:
if ( id->backendFeature == GotoFeature )
codeGen = new BinaryLoopGoto( args );
else
codeGen = new BinaryLoopVar( args);
break;
case GenBinaryExp:
if ( id->backendFeature == GotoFeature )
codeGen = new BinaryExpGoto( args );
else
codeGen = new BinaryExpVar( args );
break;
case GenFlatLoop:
if ( id->backendFeature == GotoFeature )
codeGen = new FlatLoopGoto( args );
else
codeGen = new FlatLoopVar( args );
break;
case GenFlatExp:
if ( id->backendFeature == GotoFeature )
codeGen = new FlatExpGoto( args );
else
codeGen = new FlatExpVar( args );
break;
case GenSwitchLoop:
if ( id->backendFeature == GotoFeature )
codeGen = new SwitchLoopGoto(args);
else
id->error() << "unsupported lang/style combinatio
n" << endp;
break;
case GenSwitchExp:
if ( id->backendFeature == GotoFeature )
codeGen = new SwitchExpGoto(args);
else
id->error() << "unsupported lang/style combinatio
n" << endp;
break;
case GenIpGoto:
if ( id->backendFeature == GotoFeature )
codeGen = new IpGoto(args);
else
id->error() << "unsupported lang/style combinatio
n" << endp;
break;
}
}
return codeGen; return codeGen;
} }
 End of changes. 14 change blocks. 
95 lines changed or deleted 26 lines changed or added

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