This commit is contained in:
parent
7a2266658b
commit
d177fe5398
@ -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;
|
||||||
|
@ -79,10 +79,37 @@ public class AseAwk extends StdAwk
|
|||||||
{
|
{
|
||||||
URL url = AseAwk.class.getResource (
|
URL url = AseAwk.class.getResource (
|
||||||
AseAwk.class.getName() + ".class");
|
AseAwk.class.getName() + ".class");
|
||||||
|
if (url == null)
|
||||||
|
{
|
||||||
|
// 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
|
||||||
|
{
|
||||||
java.io.File file = new java.io.File (url.getFile());
|
java.io.File file = new java.io.File (url.getFile());
|
||||||
|
|
||||||
String osname = System.getProperty ("os.name").toLowerCase();
|
String osname = System.getProperty ("os.name").toLowerCase();
|
||||||
String aseBase = file.getParentFile().getParentFile().getParent();
|
String aseBase = file.getParentFile().getParentFile().getParent();
|
||||||
|
|
||||||
String path;
|
String path;
|
||||||
|
|
||||||
if (osname.startsWith ("windows"))
|
if (osname.startsWith ("windows"))
|
||||||
@ -101,6 +128,7 @@ public class AseAwk extends StdAwk
|
|||||||
return path.substring(5);
|
return path.substring(5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void run_in_console (String[] args)
|
private static void run_in_console (String[] args)
|
||||||
{
|
{
|
||||||
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user