From: thurston Date: Mon, 27 Oct 2008 16:04:14 +0000 (+0000) Subject: Minor refactoring. Added inputdata.h, which was left behind during previous X-Git-Tag: 2.0_alpha~85 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89629ce78de7564c6cf873b30eaf0006f3ce547d;p=external%2Fragel.git Minor refactoring. Added inputdata.h, which was left behind during previous commits. git-svn-id: http://svn.complang.org/ragel/trunk@501 052ea7fc-9027-0410-9066-f65837a77df0 --- diff --git a/ragel/inputdata.h b/ragel/inputdata.h new file mode 100644 index 0000000..7e990f6 --- /dev/null +++ b/ragel/inputdata.h @@ -0,0 +1,52 @@ +/* + * Copyright 2008 Adrian Thurston + */ + +/* This file is part of Ragel. + * + * Ragel is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * Ragel is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Ragel; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _INPUT_DATA +#define _INPUT_DATA + +#include "gendata.h" + +struct InputData +{ + InputData( const char *sourceFileName, bool outputActive, bool wantComplete ) : + sourceFileName(sourceFileName), + outStream(0), + outputActive(outputActive), + wantComplete(wantComplete), + cgd(0) { } + + void openOutput(); + + /* The name of the root section, this does not change during an include. */ + const char *sourceFileName; + ostream *outStream; + bool outputActive; + bool wantComplete; + + CodeGenData *cgd; + CodeGenMap codeGenMap; + + Vector writeOptions; +}; + +void generateReduced( const char *sourceFileName, bool outputActive, bool wantComplete ); + +#endif diff --git a/ragel/parsedata.cpp b/ragel/parsedata.cpp index e4f5a5c..2d8011e 100644 --- a/ragel/parsedata.cpp +++ b/ragel/parsedata.cpp @@ -1435,6 +1435,9 @@ void ParseData::generateReduced( InputData &inputData ) /* Make the generator. */ BackendGen backendGen( sectionName, this, sectionGraph, inputData ); + /* Open the definition. */ + backendGen.open_ragel_def( sectionName ); + /* Write out with it. */ backendGen.makeBackend(); diff --git a/ragel/xmlcodegen.cpp b/ragel/xmlcodegen.cpp index e327bc3..627e35c 100644 --- a/ragel/xmlcodegen.cpp +++ b/ragel/xmlcodegen.cpp @@ -1321,9 +1321,6 @@ void BackendGen::close_ragel_def() void BackendGen::makeBackend() { - /* Open the definition. */ - open_ragel_def( fsmName ); - /* Alphabet type. */ inputData.cgd->setAlphType( keyOps->alphType->internalName ); diff --git a/ragel/xmlcodegen.h b/ragel/xmlcodegen.h index 92729a9..ce9f1c4 100644 --- a/ragel/xmlcodegen.h +++ b/ragel/xmlcodegen.h @@ -142,6 +142,7 @@ class BackendGen : protected GenBase public: BackendGen( char *fsmName, ParseData *pd, FsmAp *fsm, InputData &inputData ); void makeBackend( ); + void open_ragel_def( char *fsmName ); private: void makeGenInlineList( GenInlineList *outList, InlineList *inList ); @@ -174,7 +175,6 @@ private: void makeTransList( StateAp *state ); void makeTrans( Key lowKey, Key highKey, TransAp *trans ); - void open_ragel_def( char *fsmName ); void close_ragel_def(); InputData &inputData;