This commit is contained in:
hyung-hwan 2007-12-10 08:38:51 +00:00
parent 7a2266658b
commit d177fe5398
2 changed files with 61 additions and 19 deletions

View File

@ -13,6 +13,8 @@ class Extio
protected static final int TYPE_FILE = 2; protected static final int TYPE_FILE = 2;
protected static final int TYPE_CONSOLE = 3; 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_READ = 0;
protected static final int MODE_PIPE_WRITE = 1; 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_READ = 0;
protected static final int MODE_CONSOLE_WRITE = 1; 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 String name;
private int type; private int type;

View File

@ -79,26 +79,54 @@ public class AseAwk extends StdAwk
{ {
URL url = AseAwk.class.getResource ( URL url = AseAwk.class.getResource (
AseAwk.class.getName() + ".class"); AseAwk.class.getName() + ".class");
java.io.File file = new java.io.File (url.getFile()); if (url == null)
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"; // probably it is compiled with gcj
return path.substring(6);
} // TODO: ....
else if (osname.startsWith ("mac")) String osname = System.getProperty ("os.name").toLowerCase();
{ String aseBase = "..";
path = aseBase + "/lib/.libs/libaseawk_jni.dylib"; String path;
return path.substring(5);
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 else
{ {
path = aseBase + "/lib/.libs/libaseawk_jni.so"; java.io.File file = new java.io.File (url.getFile());
return path.substring(5);
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; String srcout = null;
int nsrcins = 0; int nsrcins = 0;
int nsrcouts = 0; int nsrcouts = 0;
ArrayList<String> params = new ArrayList<String> (); //ArrayList<String> params = new ArrayList<String> ();
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 (mode == 0)
{ {
if (arg.equals("-si")) mode = 1; if (arg.equals("-si")) mode = 1;
@ -239,7 +270,8 @@ public class AseAwk extends StdAwk
try try
{ {
awk.parse (srcin, srcout); 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) catch (ase.awk.Exception e)
{ {