A bit more cleanup.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sun, 15 Mar 2009 13:53:33 +0000 (13:53 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sun, 15 Mar 2009 13:53:33 +0000 (13:53 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@737 052ea7fc-9027-0410-9066-f65837a77df0

ragel/inputdata.cpp
ragel/inputdata.h

index aa336c6..5d65470 100644 (file)
@@ -69,11 +69,6 @@ void InputData::generateSpecificReduced()
        writeOutput();
 }
 
-/* Invoked by the parser when the root element is opened. */
-void InputData::dotDefaultFileName( const char *inputFile )
-{
-}
-
 
 /* Invoked by the parser when the root element is opened. */
 void InputData::cdDefaultFileName( const char *inputFile )
@@ -130,26 +125,31 @@ void InputData::csharpDefaultFileName( const char *inputFile )
 
 void InputData::openOutput()
 {
-       if ( generateDot )
-               dotDefaultFileName( inputFileName );
-       else if ( hostLang->lang == HostLang::C )
-               cdDefaultFileName( inputFileName );
-       else if ( hostLang->lang == HostLang::D )
-               cdDefaultFileName( inputFileName );
-       else if ( hostLang->lang == HostLang::Java )
-               javaDefaultFileName( inputFileName );
-       else if ( hostLang->lang == HostLang::Ruby )
-               rubyDefaultFileName( inputFileName );
-       else if ( hostLang->lang == HostLang::CSharp )
-               csharpDefaultFileName( inputFileName );
-
-       /* Make sure we are not writing to the same file as the input file. */
-       if ( outputFileName != 0 && strcmp( inputFileName, outputFileName  ) == 0 ) {
-               error() << "output file \"" << outputFileName  << 
-                               "\" is the same as the input file" << endl;
+       if ( ! generateDot ) {
+               switch ( hostLang->lang ) {
+                       case HostLang::C:
+                       case HostLang::D:
+                               cdDefaultFileName( inputFileName );
+                               break;
+                       case HostLang::Java:
+                               javaDefaultFileName( inputFileName );
+                               break;
+                       case HostLang::Ruby:
+                               rubyDefaultFileName( inputFileName );
+                               break;
+                       case HostLang::CSharp:
+                               csharpDefaultFileName( inputFileName );
+                               break;
+               }
        }
 
+       /* Make sure we are not writing to the same file as the input file. */
        if ( outputFileName != 0 ) {
+               if ( strcmp( inputFileName, outputFileName  ) == 0 ) {
+                       error() << "output file \"" << outputFileName  << 
+                                       "\" is the same as the input file" << endl;
+               }
+
                /* Create the filter on the output and open it. */
                outFilter = new output_filter( outputFileName );
 
index ad774b4..c1cdfef 100644 (file)
@@ -48,7 +48,6 @@ struct InputData
        void generateReduced();
        void prepareMachineGen();
 
-       void dotDefaultFileName( const char *inputFile );
        void cdDefaultFileName( const char *inputFile );
        void javaDefaultFileName( const char *inputFile );
        void rubyDefaultFileName( const char *inputFile );