Some cleanup of the java code generation files.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 15 Nov 2008 00:51:53 +0000 (00:51 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 15 Nov 2008 00:51:53 +0000 (00:51 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@567 052ea7fc-9027-0410-9066-f65837a77df0

ragel/Makefile.in
ragel/cs-main.cpp [deleted file]
ragel/java-codegen.cpp [moved from ragel/java-javacodegen.cpp with 95% similarity]
ragel/java-codegen.h [moved from ragel/java-javacodegen.h with 100% similarity]
ragel/java-main.cpp [deleted file]
ragel/java-rlgen-java.h [deleted file]

index 970cb4e..e3b42f5 100644 (file)
@@ -33,7 +33,7 @@ CC_SRCS = \
        cd-tabcodegen.cpp cd-ftabcodegen.cpp cd-flatcodegen.cpp \
        cd-fflatcodegen.cpp cd-gotocodegen.cpp cd-fgotocodegen.cpp \
        cd-ipgotocodegen.cpp cd-splitcodegen.cpp  \
-       java-main.cpp java-javacodegen.cpp \
+       java-codegen.cpp \
        ruby-main.cpp ruby-codegen.cpp ruby-tabcodegen.cpp ruby-ftabcodegen.cpp \
        ruby-flatcodegen.cpp ruby-fflatcodegen.cpp ruby-rbx-gotocodegen.cpp \
        cs-fsmcodegen.cpp cs-tabcodegen.cpp cs-ftabcodegen.cpp cs-flatcodegen.cpp \
diff --git a/ragel/cs-main.cpp b/ragel/cs-main.cpp
deleted file mode 100644 (file)
index 201281d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Copyright 2001-2007 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 
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <iostream>
-#include <fstream>
-#include <unistd.h>
-
-#include "common.h"
-#include "ragel.h"
-#include "xmlparse.h"
-#include "pcheck.h"
-#include "vector.h"
-#include "version.h"
-
similarity index 95%
rename from ragel/java-javacodegen.cpp
rename to ragel/java-codegen.cpp
index fe9c5af..5e152bb 100644 (file)
@@ -20,8 +20,8 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
  */
 
-#include "java-rlgen-java.h"
-#include "java-javacodegen.h"
+#include "ragel.h"
+#include "java-codegen.h"
 #include "redfsm.h"
 #include "gendata.h"
 #include <iomanip>
@@ -46,6 +46,71 @@ using std::ostringstream;
 using std::string;
 using std::cerr;
 
+using std::istream;
+using std::ifstream;
+using std::ostream;
+using std::ios;
+using std::cin;
+using std::cout;
+using std::cerr;
+using std::endl;
+
+/* Invoked by the parser when the root element is opened. */
+ostream *javaOpenOutput( const char *inputFile )
+{
+       if ( hostLang->lang != HostLang::Java ) {
+               error() << "this code generator is for Java only" << endl;
+               exit(1);
+       }
+
+       /* If the output format is code and no output file name is given, then
+        * make a default. */
+       if ( outputFileName == 0 ) {
+               const char *ext = findFileExtension( inputFile );
+               if ( ext != 0 && strcmp( ext, ".rh" ) == 0 )
+                       outputFileName = fileNameFromStem( inputFile, ".h" );
+               else
+                       outputFileName = fileNameFromStem( inputFile, ".java" );
+       }
+
+       /* Make sure we are not writing to the same file as the input file. */
+       if ( outputFileName != 0 && strcmp( inputFile, outputFileName  ) == 0 ) {
+               error() << "output file \"" << outputFileName  << 
+                               "\" is the same as the input file" << endl;
+       }
+
+       if ( outputFileName != 0 ) {
+               /* Create the filter on the output and open it. */
+               outFilter = new output_filter( outputFileName );
+               outFilter->open( outputFileName, ios::out|ios::trunc );
+               if ( !outFilter->is_open() ) {
+                       error() << "error opening " << outputFileName << " for writing" << endl;
+                       exit(1);
+               }
+
+               /* Open the output stream, attaching it to the filter. */
+               outStream = new ostream( outFilter );
+       }
+       else {
+               /* Writing out ot std out. */
+               outStream = &cout;
+       }
+       return outStream;
+}
+
+/* Invoked by the parser when a ragel definition is opened. */
+CodeGenData *javaMakeCodeGen( const char *sourceFileName, const char *fsmName, 
+               ostream &out, bool wantComplete )
+{
+       CodeGenData *codeGen = new JavaTabCodeGen(out);
+
+       codeGen->sourceFileName = sourceFileName;
+       codeGen->fsmName = fsmName;
+       codeGen->wantComplete = wantComplete;
+
+       return codeGen;
+}
+
 void javaLineDirective( ostream &out, const char *fileName, int line )
 {
        /* Write the preprocessor line info for to the input file. */
diff --git a/ragel/java-main.cpp b/ragel/java-main.cpp
deleted file mode 100644 (file)
index 87992da..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  Copyright 2001-2007 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 
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <iostream>
-#include <fstream>
-#include <unistd.h>
-
-#include "java-rlgen-java.h"
-#include "xmlparse.h"
-#include "pcheck.h"
-#include "vector.h"
-#include "version.h"
-#include "common.h"
-#include "java-javacodegen.h"
-
-using std::istream;
-using std::ifstream;
-using std::ostream;
-using std::ios;
-using std::cin;
-using std::cout;
-using std::cerr;
-using std::endl;
-
-/* Io globals. */
-extern istream *inStream;
-extern ostream *outStream;
-extern output_filter *outFilter;
-extern const char *outputFileName;
-
-extern int numSplitPartitions;
-
-/*
- * Callbacks invoked by the XML data parser.
- */
-
-/* Invoked by the parser when the root element is opened. */
-ostream *javaOpenOutput( const char *inputFile )
-{
-       if ( hostLang->lang != HostLang::Java ) {
-               error() << "this code generator is for Java only" << endl;
-               exit(1);
-       }
-
-       /* If the output format is code and no output file name is given, then
-        * make a default. */
-       if ( outputFileName == 0 ) {
-               const char *ext = findFileExtension( inputFile );
-               if ( ext != 0 && strcmp( ext, ".rh" ) == 0 )
-                       outputFileName = fileNameFromStem( inputFile, ".h" );
-               else
-                       outputFileName = fileNameFromStem( inputFile, ".java" );
-       }
-
-       /* Make sure we are not writing to the same file as the input file. */
-       if ( outputFileName != 0 && strcmp( inputFile, outputFileName  ) == 0 ) {
-               error() << "output file \"" << outputFileName  << 
-                               "\" is the same as the input file" << endl;
-       }
-
-       if ( outputFileName != 0 ) {
-               /* Create the filter on the output and open it. */
-               outFilter = new output_filter( outputFileName );
-               outFilter->open( outputFileName, ios::out|ios::trunc );
-               if ( !outFilter->is_open() ) {
-                       error() << "error opening " << outputFileName << " for writing" << endl;
-                       exit(1);
-               }
-
-               /* Open the output stream, attaching it to the filter. */
-               outStream = new ostream( outFilter );
-       }
-       else {
-               /* Writing out ot std out. */
-               outStream = &cout;
-       }
-       return outStream;
-}
-
-/* Invoked by the parser when a ragel definition is opened. */
-CodeGenData *javaMakeCodeGen( const char *sourceFileName, const char *fsmName, 
-               ostream &out, bool wantComplete )
-{
-       CodeGenData *codeGen = new JavaTabCodeGen(out);
-
-       codeGen->sourceFileName = sourceFileName;
-       codeGen->fsmName = fsmName;
-       codeGen->wantComplete = wantComplete;
-
-       return codeGen;
-}
diff --git a/ragel/java-rlgen-java.h b/ragel/java-rlgen-java.h
deleted file mode 100644 (file)
index 0a9d5cd..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Copyright 2001-2007 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 _RLGEN_JAVA_H
-#define _RLGEN_JAVA_H
-
-#include <iostream>
-#include "config.h"
-
-extern int gblErrorCount;
-std::ostream &error();
-
-#endif /* _RLGEN_JAVA_H */