Minor refactoring. Added inputdata.h, which was left behind during previous
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Mon, 27 Oct 2008 16:04:14 +0000 (16:04 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Mon, 27 Oct 2008 16:04:14 +0000 (16:04 +0000)
commits.

git-svn-id: http://svn.complang.org/ragel/trunk@501 052ea7fc-9027-0410-9066-f65837a77df0

ragel/inputdata.h [new file with mode: 0644]
ragel/parsedata.cpp
ragel/xmlcodegen.cpp
ragel/xmlcodegen.h

diff --git a/ragel/inputdata.h b/ragel/inputdata.h
new file mode 100644 (file)
index 0000000..7e990f6
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ *  Copyright 2008 Adrian Thurston <thurston@complang.org>
+ */
+
+/*  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 <char*> writeOptions;
+};
+
+void generateReduced( const char *sourceFileName, bool outputActive, bool wantComplete );
+
+#endif
index e4f5a5c..2d8011e 100644 (file)
@@ -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();
 
index e327bc3..627e35c 100644 (file)
@@ -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 );
        
index 92729a9..ce9f1c4 100644 (file)
@@ -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;