A bit more cleanup.
[external/ragel.git] / ragel / main.cpp
index 14b6552..120fae7 100644 (file)
@@ -125,8 +125,8 @@ void usage()
 "   -x                   Run the frontend only: emit XML intermediate format\n"
 "   -V                   Generate a dot file for Graphviz\n"
 "   -p                   Display printable characters on labels\n"
-"   -S <spec>            FSM specification to output (for rlgen-dot)\n"
-"   -M <machine>         Machine definition/instantiation to output (for rlgen-dot)\n"
+"   -S <spec>            FSM specification to output (for graphviz output)\n"
+"   -M <machine>         Machine definition/instantiation to output (for graphviz output)\n"
 "host language:\n"
 "   -C                   The host language is C, C++, Obj-C or Obj-C++ (default)\n"
 "   -D                   The host language is D\n"
@@ -487,8 +487,24 @@ void process( const char *inputFileName )
                outputActive = false;
        }
 
-       /* Write the machines, then the surrounding code. */
-       generateReduced( inputFileName, outputActive, wantComplete );
+       InputData inputData( inputFileName, outputActive, wantComplete );
+
+       /* Compiles machines. */
+       inputData.prepareMachineGen();
+
+       if ( gblErrorCount > 0 )
+               exit(1);
+
+       inputData.openOutput();
+
+       /* Generates the reduced machine, which we use to write output. */
+       inputData.generateReduced();
+
+       if ( gblErrorCount > 0 )
+               exit(1);
+
+       inputData.openOutput2();
+       inputData.writeOutput();
 
        /* Close the input and the intermediate file. */
        delete inFile;