diff --git a/ase/awk/Extio.java b/ase/awk/Extio.java index 9e110285..25fb4a8a 100644 --- a/ase/awk/Extio.java +++ b/ase/awk/Extio.java @@ -13,6 +13,8 @@ class Extio protected static final int TYPE_FILE = 2; protected static final int TYPE_CONSOLE = 3; + /* PROBLEMS WITH GCJ 3.4.6 if these fields are protected. + * protected static final int MODE_PIPE_READ = 0; protected static final int MODE_PIPE_WRITE = 1; @@ -22,6 +24,14 @@ class Extio protected static final int MODE_CONSOLE_READ = 0; protected static final int MODE_CONSOLE_WRITE = 1; + */ + public static final int MODE_PIPE_READ = 0; + public static final int MODE_PIPE_WRITE = 1; + public static final int MODE_FILE_READ = 0; + public static final int MODE_FILE_WRITE = 1; + public static final int MODE_FILE_APPEND = 2; + public static final int MODE_CONSOLE_READ = 0; + public static final int MODE_CONSOLE_WRITE = 1; private String name; private int type; diff --git a/ase/test/awk/AseAwk.java b/ase/test/awk/AseAwk.java index 0572ff94..0476765c 100644 --- a/ase/test/awk/AseAwk.java +++ b/ase/test/awk/AseAwk.java @@ -79,26 +79,54 @@ public class AseAwk extends StdAwk { URL url = AseAwk.class.getResource ( AseAwk.class.getName() + ".class"); - java.io.File file = new java.io.File (url.getFile()); - - String osname = System.getProperty ("os.name").toLowerCase(); - String aseBase = file.getParentFile().getParentFile().getParent(); - String path; - - if (osname.startsWith ("windows")) + if (url == null) { - path = aseBase + "\\lib\\aseawk_jni.dll"; - return path.substring(6); - } - else if (osname.startsWith ("mac")) - { - path = aseBase + "/lib/.libs/libaseawk_jni.dylib"; - return path.substring(5); + // probably it is compiled with gcj + + // TODO: .... + String osname = System.getProperty ("os.name").toLowerCase(); + String aseBase = ".."; + String path; + + if (osname.startsWith ("windows")) + { + path = aseBase + "\\lib\\aseawk_jni.dll"; + } + else if (osname.startsWith ("mac")) + { + path = aseBase + "/lib/.libs/libaseawk_jni.dylib"; + } + else + { + path = aseBase + "/lib/.libs/libaseawk_jni.so"; + } + + return path; } else { - path = aseBase + "/lib/.libs/libaseawk_jni.so"; - return path.substring(5); + java.io.File file = new java.io.File (url.getFile()); + + String osname = System.getProperty ("os.name").toLowerCase(); + String aseBase = file.getParentFile().getParentFile().getParent(); + + String path; + + if (osname.startsWith ("windows")) + { + path = aseBase + "\\lib\\aseawk_jni.dll"; + return path.substring(6); + } + else if (osname.startsWith ("mac")) + { + path = aseBase + "/lib/.libs/libaseawk_jni.dylib"; + return path.substring(5); + } + else + { + path = aseBase + "/lib/.libs/libaseawk_jni.so"; + return path.substring(5); + } } } @@ -135,10 +163,13 @@ public class AseAwk extends StdAwk String srcout = null; int nsrcins = 0; int nsrcouts = 0; - ArrayList params = new ArrayList (); + //ArrayList params = new ArrayList (); + ArrayList params = new ArrayList (); - for (String arg: args) + //for (String arg: args) + for (int i = 0; i < args.length; i++) { + String arg = args[i]; if (mode == 0) { if (arg.equals("-si")) mode = 1; @@ -239,7 +270,8 @@ public class AseAwk extends StdAwk try { awk.parse (srcin, srcout); - awk.run (mainfn, params.toArray(new String[0])); + //awk.run (mainfn, params.toArray(new String[0])); + awk.run (mainfn, (String[])params.toArray(new String[0])); } catch (ase.awk.Exception e) {