[kaffe] CVS kaffe (robilad): Merged in GNU Classpath tools rmic

Kaffe CVS cvs-commits at kaffe.org
Tue Mar 8 08:37:50 PST 2005


PatchSet 5496 
Date: 2005/03/08 16:33:19
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Merged in GNU Classpath tools rmic

2005-03-08  Dalibor Topic  <robilad at kaffe.org>

        * kaffe/scripts/rmic.in:
        Use gnu.classpath.tools.rmi.rmic.RMIC.

        * libraries/javalib/Makefile.am,
        libraries/javalib/Makefile.in,
        libraries/javalib/all.files:
        Regenerated.

        * libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_gcj.java,
        libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_jikes.java,
        libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_kjc.java,
        libraries/javalib/gnu/classpath/tools/rmi/rmic/Compiler.java,
        libraries/javalib/gnu/classpath/tools/rmi/rmic/CompilerProcess.java,
        libraries/javalib/gnu/classpath/tools/rmi/rmic/RMIC.java,
        libraries/javalib/gnu/classpath/tools/rmi/rmic/RMICException.java,
        libraries/javalib/gnu/classpath/tools/rmi/rmic/TabbedWriter.java:
        New files, taken from GNU Classpath tools project.

        * libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java,
        libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java,
        libraries/javalib/gnu/java/rmi/rmic/Compile_kjc.java,
        libraries/javalib/gnu/java/rmi/rmic/Compiler.java,
        libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java,
        libraries/javalib/gnu/java/rmi/rmic/RMIC.java,
        libraries/javalib/gnu/java/rmi/rmic/RMICException.java,
        libraries/javalib/gnu/java/rmi/rmic/TabbedWriter.java:
        Removed.

Members: 
	ChangeLog:1.3670->1.3671 
	kaffe/scripts/rmic.in:1.7->1.8 
	libraries/javalib/Makefile.am:1.317->1.318 
	libraries/javalib/Makefile.in:1.403->1.404 
	libraries/javalib/all.files:1.97->1.98 
	libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_gcj.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_jikes.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_kjc.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/tools/rmi/rmic/Compiler.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/tools/rmi/rmic/CompilerProcess.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/tools/rmi/rmic/RMIC.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/tools/rmi/rmic/RMICException.java:INITIAL->1.1 
	libraries/javalib/gnu/classpath/tools/rmi/rmic/TabbedWriter.java:INITIAL->1.1 
	libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java:1.2->1.3(DEAD) 
	libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java:1.3->1.4(DEAD) 
	libraries/javalib/gnu/java/rmi/rmic/Compile_kjc.java:1.2->1.3(DEAD) 
	libraries/javalib/gnu/java/rmi/rmic/Compiler.java:1.2->1.3(DEAD) 
	libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java:1.3->1.4(DEAD) 
	libraries/javalib/gnu/java/rmi/rmic/RMIC.java:1.7->1.8(DEAD) 
	libraries/javalib/gnu/java/rmi/rmic/RMICException.java:1.2->1.3(DEAD) 
	libraries/javalib/gnu/java/rmi/rmic/TabbedWriter.java:1.3->1.4(DEAD) 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3670 kaffe/ChangeLog:1.3671
--- kaffe/ChangeLog:1.3670	Tue Mar  8 00:30:13 2005
+++ kaffe/ChangeLog	Tue Mar  8 16:33:19 2005
@@ -1,3 +1,33 @@
+2005-03-08  Dalibor Topic  <robilad at kaffe.org>
+
+        * kaffe/scripts/rmic.in:
+	Use gnu.classpath.tools.rmi.rmic.RMIC.
+
+        * libraries/javalib/Makefile.am,
+        libraries/javalib/Makefile.in,
+        libraries/javalib/all.files:
+	Regenerated.
+
+        * libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_gcj.java,
+        libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_jikes.java,
+        libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_kjc.java,
+        libraries/javalib/gnu/classpath/tools/rmi/rmic/Compiler.java,
+        libraries/javalib/gnu/classpath/tools/rmi/rmic/CompilerProcess.java,
+        libraries/javalib/gnu/classpath/tools/rmi/rmic/RMIC.java,
+        libraries/javalib/gnu/classpath/tools/rmi/rmic/RMICException.java,
+        libraries/javalib/gnu/classpath/tools/rmi/rmic/TabbedWriter.java:
+	New files, taken from GNU Classpath tools project.
+
+        * libraries/javalib/gnu/java/rmi/rmic/Compile_gcj.java,
+        libraries/javalib/gnu/java/rmi/rmic/Compile_jikes.java,
+        libraries/javalib/gnu/java/rmi/rmic/Compile_kjc.java,
+        libraries/javalib/gnu/java/rmi/rmic/Compiler.java,
+        libraries/javalib/gnu/java/rmi/rmic/CompilerProcess.java,
+        libraries/javalib/gnu/java/rmi/rmic/RMIC.java,
+        libraries/javalib/gnu/java/rmi/rmic/RMICException.java,
+        libraries/javalib/gnu/java/rmi/rmic/TabbedWriter.java:
+	Removed.
+
 2005-03-08  Jim Huang  <jserv at kaffe.org>
 
 	* WHATSNEW:
Index: kaffe/kaffe/scripts/rmic.in
diff -u kaffe/kaffe/scripts/rmic.in:1.7 kaffe/kaffe/scripts/rmic.in:1.8
--- kaffe/kaffe/scripts/rmic.in:1.7	Fri May 21 14:39:32 2004
+++ kaffe/kaffe/scripts/rmic.in	Tue Mar  8 16:33:22 2005
@@ -5,6 +5,6 @@
 PATH=${PATH}:@bindir@
 export PATH
 
-exec @bindir@/@kaffe_TRANSF@ -Dclasspath.compiler=kjc $JAVA_OPTS gnu.java.rmi.rmic.RMIC ${1+"$@"}
+exec @bindir@/@kaffe_TRANSF@ -Dclasspath.compiler=jikes $JAVA_OPTS gnu.classpath.tools.rmi.rmic.RMIC ${1+"$@"}
 exit $?
 
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.317 kaffe/libraries/javalib/Makefile.am:1.318
--- kaffe/libraries/javalib/Makefile.am:1.317	Thu Mar  3 19:15:47 2005
+++ kaffe/libraries/javalib/Makefile.am	Tue Mar  8 16:33:23 2005
@@ -56,6 +56,7 @@
 	$(gnu_classpath_tools_SRCS) \
 	$(gnu_classpath_tools_javap_SRCS) \
 	$(gnu_classpath_tools_native2ascii_SRCS) \
+	$(gnu_classpath_tools_rmi_rmic_SRCS) \
 	$(gnu_crypto_SRCS) \
 	$(gnu_crypto_assembly_SRCS) \
 	$(gnu_crypto_auth_SRCS) \
@@ -138,7 +139,6 @@
 	$(gnu_java_rmi_SRCS) \
 	$(gnu_java_rmi_dgc_SRCS) \
 	$(gnu_java_rmi_registry_SRCS) \
-	$(gnu_java_rmi_rmic_SRCS) \
 	$(gnu_java_rmi_server_SRCS) \
 	$(gnu_java_security_SRCS) \
 	$(gnu_java_security_action_SRCS) \
@@ -403,6 +403,15 @@
 	gnu/classpath/tools/javap/JavapMain.java
 gnu_classpath_tools_native2ascii_SRCS = \
 	gnu/classpath/tools/native2ascii/Native2ASCII.java
+gnu_classpath_tools_rmi_rmic_SRCS = \
+	gnu/classpath/tools/rmi/rmic/Compile_gcj.java \
+	gnu/classpath/tools/rmi/rmic/Compile_jikes.java \
+	gnu/classpath/tools/rmi/rmic/Compile_kjc.java \
+	gnu/classpath/tools/rmi/rmic/Compiler.java \
+	gnu/classpath/tools/rmi/rmic/CompilerProcess.java \
+	gnu/classpath/tools/rmi/rmic/RMIC.java \
+	gnu/classpath/tools/rmi/rmic/RMICException.java \
+	gnu/classpath/tools/rmi/rmic/TabbedWriter.java
 gnu_crypto_SRCS = \
 	gnu/crypto/Properties.java \
 	gnu/crypto/Registry.java
@@ -1538,15 +1547,6 @@
 	gnu/java/rmi/registry/RegistryImpl.java \
 	gnu/java/rmi/registry/RegistryImpl_Skel.java \
 	gnu/java/rmi/registry/RegistryImpl_Stub.java
-gnu_java_rmi_rmic_SRCS = \
-	gnu/java/rmi/rmic/Compile_gcj.java \
-	gnu/java/rmi/rmic/Compile_jikes.java \
-	gnu/java/rmi/rmic/Compile_kjc.java \
-	gnu/java/rmi/rmic/Compiler.java \
-	gnu/java/rmi/rmic/CompilerProcess.java \
-	gnu/java/rmi/rmic/RMIC.java \
-	gnu/java/rmi/rmic/RMICException.java \
-	gnu/java/rmi/rmic/TabbedWriter.java
 gnu_java_rmi_server_SRCS = \
 	gnu/java/rmi/server/ConnectionRunnerPool.java \
 	gnu/java/rmi/server/ProtocolConstants.java \
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.403 kaffe/libraries/javalib/Makefile.in:1.404
--- kaffe/libraries/javalib/Makefile.in:1.403	Thu Mar  3 19:15:48 2005
+++ kaffe/libraries/javalib/Makefile.in	Tue Mar  8 16:33:24 2005
@@ -408,6 +408,7 @@
 	$(gnu_classpath_tools_SRCS) \
 	$(gnu_classpath_tools_javap_SRCS) \
 	$(gnu_classpath_tools_native2ascii_SRCS) \
+	$(gnu_classpath_tools_rmi_rmic_SRCS) \
 	$(gnu_crypto_SRCS) \
 	$(gnu_crypto_assembly_SRCS) \
 	$(gnu_crypto_auth_SRCS) \
@@ -490,7 +491,6 @@
 	$(gnu_java_rmi_SRCS) \
 	$(gnu_java_rmi_dgc_SRCS) \
 	$(gnu_java_rmi_registry_SRCS) \
-	$(gnu_java_rmi_rmic_SRCS) \
 	$(gnu_java_rmi_server_SRCS) \
 	$(gnu_java_security_SRCS) \
 	$(gnu_java_security_action_SRCS) \
@@ -762,6 +762,16 @@
 gnu_classpath_tools_native2ascii_SRCS = \
 	gnu/classpath/tools/native2ascii/Native2ASCII.java
 
+gnu_classpath_tools_rmi_rmic_SRCS = \
+	gnu/classpath/tools/rmi/rmic/Compile_gcj.java \
+	gnu/classpath/tools/rmi/rmic/Compile_jikes.java \
+	gnu/classpath/tools/rmi/rmic/Compile_kjc.java \
+	gnu/classpath/tools/rmi/rmic/Compiler.java \
+	gnu/classpath/tools/rmi/rmic/CompilerProcess.java \
+	gnu/classpath/tools/rmi/rmic/RMIC.java \
+	gnu/classpath/tools/rmi/rmic/RMICException.java \
+	gnu/classpath/tools/rmi/rmic/TabbedWriter.java
+
 gnu_crypto_SRCS = \
 	gnu/crypto/Properties.java \
 	gnu/crypto/Registry.java
@@ -1978,16 +1988,6 @@
 	gnu/java/rmi/registry/RegistryImpl.java \
 	gnu/java/rmi/registry/RegistryImpl_Skel.java \
 	gnu/java/rmi/registry/RegistryImpl_Stub.java
-
-gnu_java_rmi_rmic_SRCS = \
-	gnu/java/rmi/rmic/Compile_gcj.java \
-	gnu/java/rmi/rmic/Compile_jikes.java \
-	gnu/java/rmi/rmic/Compile_kjc.java \
-	gnu/java/rmi/rmic/Compiler.java \
-	gnu/java/rmi/rmic/CompilerProcess.java \
-	gnu/java/rmi/rmic/RMIC.java \
-	gnu/java/rmi/rmic/RMICException.java \
-	gnu/java/rmi/rmic/TabbedWriter.java
 
 gnu_java_rmi_server_SRCS = \
 	gnu/java/rmi/server/ConnectionRunnerPool.java \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.97 kaffe/libraries/javalib/all.files:1.98
--- kaffe/libraries/javalib/all.files:1.97	Thu Mar  3 19:15:49 2005
+++ kaffe/libraries/javalib/all.files	Tue Mar  8 16:33:25 2005
@@ -67,6 +67,14 @@
 gnu/classpath/tools/javap/Javap.java
 gnu/classpath/tools/javap/JavapMain.java
 gnu/classpath/tools/native2ascii/Native2ASCII.java
+gnu/classpath/tools/rmi/rmic/Compile_gcj.java
+gnu/classpath/tools/rmi/rmic/Compile_jikes.java
+gnu/classpath/tools/rmi/rmic/Compile_kjc.java
+gnu/classpath/tools/rmi/rmic/Compiler.java
+gnu/classpath/tools/rmi/rmic/CompilerProcess.java
+gnu/classpath/tools/rmi/rmic/RMIC.java
+gnu/classpath/tools/rmi/rmic/RMICException.java
+gnu/classpath/tools/rmi/rmic/TabbedWriter.java
 gnu/crypto/Properties.java
 gnu/crypto/Registry.java
 gnu/crypto/assembly/Assembly.java
@@ -1120,14 +1128,6 @@
 gnu/java/rmi/registry/RegistryImpl.java
 gnu/java/rmi/registry/RegistryImpl_Skel.java
 gnu/java/rmi/registry/RegistryImpl_Stub.java
-gnu/java/rmi/rmic/Compile_gcj.java
-gnu/java/rmi/rmic/Compile_jikes.java
-gnu/java/rmi/rmic/Compile_kjc.java
-gnu/java/rmi/rmic/Compiler.java
-gnu/java/rmi/rmic/CompilerProcess.java
-gnu/java/rmi/rmic/RMIC.java
-gnu/java/rmi/rmic/RMICException.java
-gnu/java/rmi/rmic/TabbedWriter.java
 gnu/java/rmi/server/ConnectionRunnerPool.java
 gnu/java/rmi/server/ProtocolConstants.java
 gnu/java/rmi/server/RMIDefaultSocketFactory.java
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_gcj.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_gcj.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_gcj.java	Tue Mar  8 16:37:50 2005
@@ -0,0 +1,33 @@
+/*
+  Copyright (c) 2001, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+ 
+GNU Classpath 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. */
+
+package gnu.classpath.tools.rmi.rmic;
+
+/** Subclass of Compiler that can be used to invoke gcj.  */
+public class Compile_gcj extends CompilerProcess
+{
+  private static final String [] COMPILER_ARGS = 
+  {
+    "gcj",
+    "-C"
+  };
+
+  public String[] computeArguments (String filename)
+  {
+    return computeTypicalArguments(COMPILER_ARGS,
+				   getDestination(),
+				   filename);
+  }
+}
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_jikes.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_jikes.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_jikes.java	Tue Mar  8 16:37:50 2005
@@ -0,0 +1,39 @@
+/*
+  Copyright (c) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+ 
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.rmi.rmic;
+
+/** Subclass of Compiler that can be used to invoke jikes.  */
+public class Compile_jikes extends CompilerProcess
+{
+  /** Compiler arguments to invoke jikes */
+  private static final String [] COMPILER_ARGS = 
+  {
+    "jikes"
+  };
+
+  /** Compute the command line for the process.  */
+  public String[] computeArguments (String filename)
+  {
+    return computeTypicalArguments(COMPILER_ARGS,
+				   getDestination(),
+				   filename);
+  }
+}
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_kjc.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_kjc.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compile_kjc.java	Tue Mar  8 16:37:50 2005
@@ -0,0 +1,39 @@
+/*
+  Copyright (c) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+ 
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.rmi.rmic;
+
+/** Subclass of Compiler that can be used to invoke kjc.  */
+public class Compile_kjc extends CompilerProcess
+{
+  /** Compiler arguments to invoke kjc */
+  private static final String [] COMPILER_ARGS = 
+  {
+    "kjc"
+  };
+
+  /** Compute the command line for the process.  */
+  public String[] computeArguments (String filename)
+  {
+    return computeTypicalArguments(COMPILER_ARGS,
+				   getDestination(),
+				   filename);
+  }
+}
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compiler.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compiler.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/Compiler.java	Tue Mar  8 16:37:50 2005
@@ -0,0 +1,76 @@
+/*
+  Copyright (c) 2001, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+ 
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.rmi.rmic;
+
+/**
+ * A Compiler object can be used to compile a .java file into a
+ * .class file.  This is an abstract class; the
+ * <code>getInstance()</code> method is used to obtain the actual
+ * compiler object.
+ */
+public abstract class Compiler
+{
+  // Can't directly instantiate.
+  protected Compiler ()
+  {
+  }
+
+  /** Create a new compiler instance.  */
+  public static Compiler getInstance ()
+  {
+    return getInstance (System.getProperty ("classpath.compiler", "gcj"));
+  }
+
+  /** Create a new compiler instance given the name of the compiler.  */
+  public static Compiler getInstance (String name)
+  {
+    try
+      {
+	Class k = Class.forName (classPrefix + name);
+	return (Compiler) k.newInstance ();
+      }
+    catch (Throwable _)
+      {
+      }
+    return null;
+  }
+
+   /** Get the directory where output files will be put.  */
+   public String getDestination ()
+   {
+     return dest;
+   }
+
+  /** Set the directory where output files will be put.  */
+  public void setDestination (String dest)
+  {
+    this.dest = dest;
+  }
+
+  /** Compile the given file.  Throws exception on error.  */
+  public abstract void compile (String name) throws Exception;
+
+  /** The destination directory, or null if none set.  */
+  protected String dest;
+
+  /** Class prefix used when trying to find instance.  */
+  private static final String classPrefix = "gnu.java.rmi.rmic.Compile_";
+}
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/CompilerProcess.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/CompilerProcess.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/CompilerProcess.java	Tue Mar  8 16:37:50 2005
@@ -0,0 +1,107 @@
+/*
+  Copyright (c) 2001, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+ 
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.rmi.rmic;
+
+import java.io.InputStream;
+
+/**
+ * Subclass of Compiler that can be subclassed to invoke a process to
+ * do its work.
+ */
+public abstract class CompilerProcess extends Compiler
+{
+  /** This is used to compute the command line for the process.  */
+  public abstract String[] computeArguments (String filename);
+
+   /**
+    * This is used to compute the command line for the process.
+    * Most compilers typically arrange their arguments as in
+    * &lt;compiler name and arguments&gt; &lt;optional destination&gt; &lt;filename&gt;.
+    * This method builds an argument array out that. It should be used
+    * to define computeArguments for those compilers that follow the
+    * argument convention described above.
+    */
+   public static String[] computeTypicalArguments(String[] compilerArgs,
+	String destination, String filename)
+   {
+     /* length of compiler specific arguments */
+     final int len = compilerArgs.length;
+
+     /* length of returned array of arguments */
+     final int arglen = len + (destination == null ? 0 : 2) + 1;
+
+     /* Allocate String array for computed arguments. */
+     String [] args = new String[arglen];
+
+     /* Fill in compiler arguments. */
+     System.arraycopy(compilerArgs, 0, args, 0, len);
+
+     /* Fill in destination argument if necessary. */
+     if (destination != null)
+      {
+	args[len] = "-d";
+	args[len + 1] = destination;
+      }
+
+     /* Fill in filename */
+     args[arglen - 1] = filename;
+
+     return args;
+   }
+
+  public void compile (String name) throws Exception
+  {
+    String[] args = computeArguments (name);
+    Process p = Runtime.getRuntime ().exec (args);
+
+    /* Print compiler output to System.out. */
+    InputStream procin = p.getInputStream();
+    for (int ch = procin.read(); ch != -1; ch = procin.read())
+      System.out.print((char) ch);
+
+    /* Collect compiler error output in a buffer.
+     * If compilation fails, it will be used for an error message.
+     */
+    StringBuffer stderr = new StringBuffer();
+    InputStream procerr = p.getErrorStream();
+    for (int ch = procerr.read(); ch != -1; ch = procerr.read())
+      stderr.append((char) ch);
+
+    int result;
+    while (true)
+      {
+	try
+	  {
+	    result = p.waitFor ();
+	    break;
+	  }
+	catch (InterruptedException _)
+	  {
+	  }
+      }
+    if (result != 0)
+      {
+	// FIXME: wrong exception class.
+	throw new Exception ("compiler exited with status: " + result,
+			     new RMICException(stderr.toString()));
+      }
+  }
+}
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/RMIC.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/RMIC.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/tools/rmi/rmic/RMIC.java	Tue Mar  8 16:37:50 2005
@@ -0,0 +1,1060 @@
+/* RMIC.java --
+   Copyright (c) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
+   Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA. */
+
+package gnu.classpath.tools.rmi.rmic;
+
+import gnu.java.rmi.server.RMIHashes;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+
+public class RMIC
+{
+  private String[] args;
+  private int next;
+  private Exception exception;
+  private boolean keep = false;
+  private boolean need11Stubs = true;
+  private boolean need12Stubs = true;
+  private boolean compile = true;
+  private boolean verbose;
+  private String destination;
+  private PrintWriter out;
+  private TabbedWriter ctrl;
+  private Class clazz;
+  private String classname;
+  private String fullclassname;
+  private MethodRef[] remotemethods;
+  private String stubname;
+  private String skelname;
+  private int errorCount = 0;
+  private Class mRemoteInterface;
+
+  public RMIC(String[] a)
+  {
+    args = a;
+  }
+
+  public static void main(String[] args)
+  {
+    RMIC r = new RMIC(args);
+    if (r.run() == false)
+      {
+	Exception e = r.getException();
+	if (e != null)
+	  e.printStackTrace();
+	else
+	  System.exit(1);
+      }
+  }
+
+  public boolean run()
+  {
+    parseOptions();
+    if (next >= args.length)
+      error("no class names found");
+    for (int i = next; i < args.length; i++)
+      {
+	try
+	  {
+	    if (verbose)
+	      System.out.println("[Processing class " + args[i] + ".class]");
+	    processClass(args[i].replace(File.separatorChar, '.'));
+	  }
+	catch (Exception e)
+	  {
+	    exception = e;
+	    return (false);
+	  }
+      }
+    return (true);
+  }
+
+  private boolean processClass(String classname) throws Exception
+  {
+    errorCount = 0;
+    analyzeClass(classname);
+    if (errorCount > 0)
+      System.exit(1);
+    generateStub();
+    if (need11Stubs)
+      generateSkel();
+    if (compile)
+      {
+	compile(stubname.replace('.', File.separatorChar) + ".java");
+	if (need11Stubs)
+	  compile(skelname.replace('.', File.separatorChar) + ".java");
+      }
+    if (! keep)
+      {
+	(new File(stubname.replace('.', File.separatorChar) + ".java")).delete();
+	if (need11Stubs)
+	  (new File(skelname.replace('.', File.separatorChar) + ".java"))
+	  .delete();
+      }
+    return (true);
+  }
+
+  private void analyzeClass(String cname) throws Exception
+  {
+    if (verbose)
+      System.out.println("[analyze class " + cname + "]");
+    int p = cname.lastIndexOf('.');
+    if (p != -1)
+      classname = cname.substring(p + 1);
+    else
+      classname = cname;
+    fullclassname = cname;
+
+    HashSet rmeths = new HashSet();
+    findClass();
+
+    // get the remote interface
+    mRemoteInterface = getRemoteInterface(clazz);
+    if (mRemoteInterface == null)
+      return;
+    if (verbose)
+      System.out.println("[implements " + mRemoteInterface.getName() + "]");
+
+    // check if the methods of the remote interface declare RemoteExceptions
+    Method[] meths = mRemoteInterface.getDeclaredMethods();
+    for (int i = 0; i < meths.length; i++)
+      {
+	Class[] exceptions = meths[i].getExceptionTypes();
+	int index = 0;
+	for (; index < exceptions.length; index++)
+	  {
+	    if (exceptions[index].equals(RemoteException.class))
+	      break;
+	  }
+	if (index < exceptions.length)
+	  rmeths.add(meths[i]);
+	else
+	  logError("Method " + meths[i]
+	           + " does not throw a java.rmi.RemoteException");
+      }
+
+    // Convert into a MethodRef array and sort them
+    remotemethods = new MethodRef[rmeths.size()];
+    int c = 0;
+    for (Iterator i = rmeths.iterator(); i.hasNext();)
+      remotemethods[c++] = new MethodRef((Method) i.next());
+    Arrays.sort(remotemethods);
+  }
+
+  public Exception getException()
+  {
+    return (exception);
+  }
+
+  private void findClass() throws ClassNotFoundException
+  {
+    clazz =
+      Class.forName(fullclassname, true, ClassLoader.getSystemClassLoader());
+  }
+
+  private void generateStub() throws IOException
+  {
+    stubname = fullclassname + "_Stub";
+    String stubclassname = classname + "_Stub";
+    ctrl =
+      new TabbedWriter(new FileWriter((destination == null ? ""
+                                                           : destination
+                                                           + File.separator)
+                                      + stubname.replace('.',
+                                                         File.separatorChar)
+                                      + ".java"));
+    out = new PrintWriter(ctrl);
+
+    if (verbose)
+      System.out.println("[Generating class " + stubname + ".java]");
+
+    out.println("// Stub class generated by rmic - DO NOT EDIT!");
+    out.println();
+    if (fullclassname != classname)
+      {
+	String pname =
+	  fullclassname.substring(0, fullclassname.lastIndexOf('.'));
+	out.println("package " + pname + ";");
+	out.println();
+      }
+
+    out.print("public final class " + stubclassname);
+    ctrl.indent();
+    out.println("extends java.rmi.server.RemoteStub");
+
+    // Output interfaces we implement
+    out.print("implements ");
+    /* Scan implemented interfaces, and only print remote interfaces. */
+    Class[] ifaces = clazz.getInterfaces();
+    Set remoteIfaces = new HashSet();
+    for (int i = 0; i < ifaces.length; i++)
+      {
+	Class iface = ifaces[i];
+	if (java.rmi.Remote.class.isAssignableFrom(iface))
+	  remoteIfaces.add(iface);
+      }
+    Iterator iter = remoteIfaces.iterator();
+    while (iter.hasNext())
+      {
+	/* Print remote interface. */
+	Class iface = (Class) iter.next();
+	out.print(iface.getName());
+
+	/* Print ", " if more remote interfaces follow. */
+	if (iter.hasNext())
+	  out.print(", ");
+      }
+    ctrl.unindent();
+    out.print("{");
+    ctrl.indent();
+
+    // UID
+    if (need12Stubs)
+      {
+	out.println("private static final long serialVersionUID = 2L;");
+	out.println();
+      }
+
+    // InterfaceHash - don't know how to calculate this - XXX
+    if (need11Stubs)
+      {
+	out.println("private static final long interfaceHash = "
+	            + RMIHashes.getInterfaceHash(clazz) + "L;");
+	out.println();
+	if (need12Stubs)
+	  {
+	    out.println("private static boolean useNewInvoke;");
+	    out.println();
+	  }
+
+	// Operation table
+	out.print("private static final java.rmi.server.Operation[] operations = {");
+
+	ctrl.indent();
+	for (int i = 0; i < remotemethods.length; i++)
+	  {
+	    Method m = remotemethods[i].meth;
+	    out.print("new java.rmi.server.Operation(\"");
+	    out.print(getPrettyName(m.getReturnType()) + " ");
+	    out.print(m.getName() + "(");
+	    // Output signature
+	    Class[] sig = m.getParameterTypes();
+	    for (int j = 0; j < sig.length; j++)
+	      {
+		out.print(getPrettyName(sig[j]));
+		if (j + 1 < sig.length)
+		  out.print(", ");
+	      }
+	    out.print(")\")");
+	    if (i + 1 < remotemethods.length)
+	      out.println(",");
+	  }
+	ctrl.unindent();
+	out.println("};");
+	out.println();
+      }
+
+    // Set of method references.
+    if (need12Stubs)
+      {
+	for (int i = 0; i < remotemethods.length; i++)
+	  {
+	    Method m = remotemethods[i].meth;
+	    out.println("private static java.lang.reflect.Method $method_"
+	                + m.getName() + "_" + i + ";");
+	  }
+
+	// Initialize the methods references.
+	out.println();
+	out.print("static {");
+	ctrl.indent();
+
+	out.print("try {");
+	ctrl.indent();
+
+	if (need11Stubs)
+	  {
+	    out.println("java.rmi.server.RemoteRef.class.getMethod(\"invoke\", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });");
+	    out.println("useNewInvoke = true;");
+	  }
+
+	for (int i = 0; i < remotemethods.length; i++)
+	  {
+	    Method m = remotemethods[i].meth;
+	    out.print("$method_" + m.getName() + "_" + i + " = ");
+	    out.print(mRemoteInterface.getName() + ".class.getMethod(\""
+	              + m.getName() + "\"");
+	    out.print(", new java.lang.Class[] {");
+	    // Output signature
+	    Class[] sig = m.getParameterTypes();
+	    for (int j = 0; j < sig.length; j++)
+	      {
+		out.print(getPrettyName(sig[j]) + ".class");
+		if (j + 1 < sig.length)
+		  out.print(", ");
+	      }
+	    out.println("});");
+	  }
+	ctrl.unindent();
+	out.println("}");
+	out.print("catch (java.lang.NoSuchMethodException e) {");
+	ctrl.indent();
+	if (need11Stubs)
+	  out.print("useNewInvoke = false;");
+	else
+	  out.print("throw new java.lang.NoSuchMethodError(\"stub class initialization failed\");");
+
+	ctrl.unindent();
+	out.print("}");
+
+	ctrl.unindent();
+	out.println("}");
+	out.println();
+      }
+
+    // Constructors
+    if (need11Stubs)
+      {
+	out.print("public " + stubclassname + "() {");
+	ctrl.indent();
+	out.print("super();");
+	ctrl.unindent();
+	out.println("}");
+      }
+
+    if (need12Stubs)
+      {
+	out.print("public " + stubclassname
+	          + "(java.rmi.server.RemoteRef ref) {");
+	ctrl.indent();
+	out.print("super(ref);");
+	ctrl.unindent();
+	out.println("}");
+      }
+
+    // Method implementations
+    for (int i = 0; i < remotemethods.length; i++)
+      {
+	Method m = remotemethods[i].meth;
+	Class[] sig = m.getParameterTypes();
+	Class returntype = m.getReturnType();
+	Class[] except = sortExceptions(m.getExceptionTypes());
+
+	out.println();
+	out.print("public " + getPrettyName(returntype) + " " + m.getName()
+	          + "(");
+	for (int j = 0; j < sig.length; j++)
+	  {
+	    out.print(getPrettyName(sig[j]));
+	    out.print(" $param_" + j);
+	    if (j + 1 < sig.length)
+	      out.print(", ");
+	  }
+	out.print(") ");
+	out.print("throws ");
+	for (int j = 0; j < except.length; j++)
+	  {
+	    out.print(getPrettyName(except[j]));
+	    if (j + 1 < except.length)
+	      out.print(", ");
+	  }
+	out.print(" {");
+	ctrl.indent();
+
+	out.print("try {");
+	ctrl.indent();
+
+	if (need12Stubs)
+	  {
+	    if (need11Stubs)
+	      {
+		out.print("if (useNewInvoke) {");
+		ctrl.indent();
+	      }
+	    if (returntype != Void.TYPE)
+	      out.print("java.lang.Object $result = ");
+	    out.print("ref.invoke(this, $method_" + m.getName() + "_" + i
+	              + ", ");
+	    if (sig.length == 0)
+	      out.print("null, ");

*** Patch too long, truncated ***




More information about the kaffe mailing list