You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by cj...@apache.org on 2001/01/19 18:37:11 UTC
cvs commit: xml-batik/sources/org/apache/batik/refimpl/script/rhino RhinoInterpreterFactory.java
cjolif 01/01/19 09:37:10
Modified: sources/org/apache/batik/refimpl/script/jacl
JaclInterpreter.java JaclInterpreterFactory.java
sources/org/apache/batik/refimpl/script/jpython
JPythonInterpreter.java
JPythonInterpreterFactory.java
sources/org/apache/batik/refimpl/script/rhino
RhinoInterpreterFactory.java
Log:
minor cleanups
Revision Changes Path
1.2 +14 -25 xml-batik/sources/org/apache/batik/refimpl/script/jacl/JaclInterpreter.java
Index: JaclInterpreter.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/refimpl/script/jacl/JaclInterpreter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JaclInterpreter.java 2000/10/10 18:41:46 1.1
+++ JaclInterpreter.java 2001/01/19 17:36:45 1.2
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
- *---------------------------------------------------------------------------*
+ *---------------------------------------------------------------------------*
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
@@ -13,37 +13,26 @@
import org.apache.batik.script.*;
import tcl.lang.*;
-
/**
* A simple implementation of <code>Interpreter</code> interface to use
* JACL Tcl parser.
* @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
- * @version $Id: JaclInterpreter.java,v 1.1 2000/10/10 18:41:46 hillion Exp $
+ * @version $Id: JaclInterpreter.java,v 1.2 2001/01/19 17:36:45 cjolif Exp $
*/
public class JaclInterpreter implements org.apache.batik.script.Interpreter {
private Interp interpreter = null;
-
+
public JaclInterpreter() {
interpreter = new Interp();
try {
interpreter.eval("package require java", 0);
} catch (TclException e) {
}
- // import Java lang package & DOM Level 2 & SVG DOM packages
- // JavaImportCmd import = new JavaImportCmd();
- // import.cmdProc();
- // pkg = new NativeJavaPackage("org.w3c.dom");
- // pkg = new NativeJavaPackage("org.w3c.dom.css");
- // pkg = new NativeJavaPackage("org.w3c.dom.events");
- // pkg = new NativeJavaPackage("org.w3c.dom.smil");
- // pkg = new NativeJavaPackage("org.w3c.dom.stylesheets");
- // pkg = new NativeJavaPackage("org.w3c.dom.svg");
- // pkg = new NativeJavaPackage("org.w3c.dom.views");
}
// org.apache.batik.script.Intepreter implementation
-
- public Object evaluate(Reader scriptreader)
+
+ public Object evaluate(Reader scriptreader)
throws InterpreterException, IOException {
try {
// oups jacl doesn't accept reader in its eval method :-(
@@ -56,33 +45,33 @@
String str = sbuffer.toString();
interpreter.eval(str, 0);
} catch (TclException e) {
- e.printStackTrace();
throw new InterpreterException(e, e.getMessage(), -1, -1);
} catch (RuntimeException re) {
throw new InterpreterException(re, re.getMessage(), -1, -1);
}
return interpreter.getResult();
}
-
+
public void dispose() {
interpreter.dispose();
}
-
+
public void bindObject(String name, Object object) {
try {
interpreter.
setVar(name,
- ReflectObject.newInstance(interpreter, object.getClass(), object),
+ ReflectObject.
+ newInstance(interpreter, object.getClass(), object),
0);
} catch (TclException e) {
- //
+ // should not happened we just register an object
}
- }
-
+ }
+
public void setOut(Writer out) {
// no implementation of a default output function in Jacl
}
-
+
// org.apache.batik.i18n.Localizable implementation
public Locale getLocale() {
@@ -91,7 +80,7 @@
public void setLocale(Locale locale) {
}
-
+
public String formatMessage(String key, Object[] args) {
return null;
}
1.2 +3 -2 xml-batik/sources/org/apache/batik/refimpl/script/jacl/JaclInterpreterFactory.java
Index: JaclInterpreterFactory.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/refimpl/script/jacl/JaclInterpreterFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JaclInterpreterFactory.java 2000/10/10 18:41:46 1.1
+++ JaclInterpreterFactory.java 2001/01/19 17:36:47 1.2
@@ -8,12 +8,13 @@
package org.apache.batik.refimpl.script.jacl;
-import org.apache.batik.script.*;
+import org.apache.batik.script.Interpreter;
+import org.apache.batik.script.InterpreterFactory;
/**
* Allows to create instances of <code>JaclInterpreterFactory</code>.
* @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
- * @version $Id: JaclInterpreterFactory.java,v 1.1 2000/10/10 18:41:46 hillion Exp $
+ * @version $Id: JaclInterpreterFactory.java,v 1.2 2001/01/19 17:36:47 cjolif Exp $
*/
public class JaclInterpreterFactory implements InterpreterFactory {
1.2 +10 -22 xml-batik/sources/org/apache/batik/refimpl/script/jpython/JPythonInterpreter.java
Index: JPythonInterpreter.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/refimpl/script/jpython/JPythonInterpreter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JPythonInterpreter.java 2000/10/10 18:41:48 1.1
+++ JPythonInterpreter.java 2001/01/19 17:36:56 1.2
@@ -17,29 +17,18 @@
* A simple implementation of <code>Interpreter</code> interface to use
* JPython python parser.
* @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
- * @version $Id: JPythonInterpreter.java,v 1.1 2000/10/10 18:41:48 hillion Exp $
+ * @version $Id: JPythonInterpreter.java,v 1.2 2001/01/19 17:36:56 cjolif Exp $
*/
public class JPythonInterpreter implements org.apache.batik.script.Interpreter {
private PythonInterpreter interpreter = null;
-
+
public JPythonInterpreter() {
interpreter = new PythonInterpreter();
- // import Java lang package & DOM Level 2 & SVG DOM packages
- /*
- NativeJavaPackage pkg = new NativeJavaPackage("java.lang");
- pkg = new NativeJavaPackage("org.w3c.dom");
- pkg = new NativeJavaPackage("org.w3c.dom.css");
- pkg = new NativeJavaPackage("org.w3c.dom.events");
- pkg = new NativeJavaPackage("org.w3c.dom.smil");
- pkg = new NativeJavaPackage("org.w3c.dom.stylesheets");
- pkg = new NativeJavaPackage("org.w3c.dom.svg");
- pkg = new NativeJavaPackage("org.w3c.dom.views");
- */
}
// org.apache.batik.script.Intepreter implementation
-
- public Object evaluate(Reader scriptreader)
+
+ public Object evaluate(Reader scriptreader)
throws InterpreterException, IOException {
try {
// oups jpython doesn't accept reader in its eval method :-(
@@ -52,25 +41,24 @@
String str = sbuffer.toString();
interpreter.exec(str);
} catch (org.python.core.PyException e) {
- e.printStackTrace();
throw new InterpreterException(e, e.getMessage(), -1, -1);
} catch (RuntimeException re) {
throw new InterpreterException(re, re.getMessage(), -1, -1);
}
return null;
}
-
+
public void dispose() {
}
-
+
public void bindObject(String name, Object object) {
interpreter.set(name, object);
- }
-
+ }
+
public void setOut(Writer out) {
interpreter.setOut(out);
}
-
+
// org.apache.batik.i18n.Localizable implementation
public Locale getLocale() {
@@ -79,7 +67,7 @@
public void setLocale(Locale locale) {
}
-
+
public String formatMessage(String key, Object[] args) {
return null;
}
1.2 +3 -2 xml-batik/sources/org/apache/batik/refimpl/script/jpython/JPythonInterpreterFactory.java
Index: JPythonInterpreterFactory.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/refimpl/script/jpython/JPythonInterpreterFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JPythonInterpreterFactory.java 2000/10/10 18:41:48 1.1
+++ JPythonInterpreterFactory.java 2001/01/19 17:36:58 1.2
@@ -8,12 +8,13 @@
package org.apache.batik.refimpl.script.jpython;
-import org.apache.batik.script.*;
+import org.apache.batik.script.Interpreter;
+import org.apache.batik.script.InterpreterFactory;
/**
* Allows to create instances of <code>JPythonInterpreterFactory</code>.
* @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
- * @version $Id: JPythonInterpreterFactory.java,v 1.1 2000/10/10 18:41:48 hillion Exp $
+ * @version $Id: JPythonInterpreterFactory.java,v 1.2 2001/01/19 17:36:58 cjolif Exp $
*/
public class JPythonInterpreterFactory implements InterpreterFactory {
1.2 +3 -2 xml-batik/sources/org/apache/batik/refimpl/script/rhino/RhinoInterpreterFactory.java
Index: RhinoInterpreterFactory.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/refimpl/script/rhino/RhinoInterpreterFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RhinoInterpreterFactory.java 2000/10/10 18:41:50 1.1
+++ RhinoInterpreterFactory.java 2001/01/19 17:37:05 1.2
@@ -8,12 +8,13 @@
package org.apache.batik.refimpl.script.rhino;
-import org.apache.batik.script.*;
+import org.apache.batik.script.Interpreter;
+import org.apache.batik.script.InterpreterFactory;
/**
* Allows to create instances of <code>RhinoInterpreterFactory</code>.
* @author <a href="mailto:cjolif@ilog.fr">Christophe Jolif</a>
- * @version $Id: RhinoInterpreterFactory.java,v 1.1 2000/10/10 18:41:50 hillion Exp $
+ * @version $Id: RhinoInterpreterFactory.java,v 1.2 2001/01/19 17:37:05 cjolif Exp $
*/
public class RhinoInterpreterFactory implements InterpreterFactory {