From 2c2dd6ec08725643fe03b3d8c27757408e596c2b Mon Sep 17 00:00:00 2001 From: thurston Date: Sun, 15 Mar 2009 13:53:33 +0000 Subject: [PATCH] A bit more cleanup. git-svn-id: http://svn.complang.org/ragel/trunk@737 052ea7fc-9027-0410-9066-f65837a77df0 --- ragel/inputdata.cpp | 44 ++++++++++++++++++++++---------------------- ragel/inputdata.h | 1 - 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/ragel/inputdata.cpp b/ragel/inputdata.cpp index aa336c6..5d65470 100644 --- a/ragel/inputdata.cpp +++ b/ragel/inputdata.cpp @@ -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 ); diff --git a/ragel/inputdata.h b/ragel/inputdata.h index ad774b4..c1cdfef 100644 --- a/ragel/inputdata.h +++ b/ragel/inputdata.h @@ -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 ); -- 2.7.4