diff --git a/ase/awk/Awk.java b/ase/awk/Awk.java new file mode 100644 index 00000000..53bedcd1 --- /dev/null +++ b/ase/awk/Awk.java @@ -0,0 +1,51 @@ +/* + * $Id: Awk.java,v 1.1 2006-10-24 04:57:29 bacon Exp $ + */ + +package ase.awk; + +import java.io.*; + +public abstract class Awk +{ + // mode for open_source & close_source + public static final int SOURCE_READ = 1; + public static final int SOURCE_WRITE = 2; + + static + { + System.load ("c://projects//ase/awk/aseawk.dll"); + } + + private long __awk; + + public Awk () throws AwkException + { + open (); + } + + public native void close (); + public native void parse () throws AwkException; + public native void run () throws AwkException; + private native void open () throws AwkException; + + /* + protected native void set_extio (long extio, Object obj); + protected native Object get_extio (long extio); + */ + + /* abstrace methods */ + protected abstract int open_source (int mode); + protected abstract int close_source (int mode); + protected abstract int read_source (char[] buf, int len); + protected abstract int write_source (char[] buf, int len); + + protected abstract int open_console (); + protected abstract int close_console (); + protected abstract int read_console (char[] buf, int len); + protected abstract int write_console (char[] buf, int len); + protected abstract int next_console (char[] buf, int len); + + protected abstract int open_file (Extio extio); + protected abstract int close_file (String name); +} diff --git a/ase/awk/jni.c b/ase/awk/jni.c index bf48e8cb..d195279f 100644 --- a/ase/awk/jni.c +++ b/ase/awk/jni.c @@ -1,5 +1,5 @@ /* - * $Id: jni.c,v 1.15 2006-10-24 04:10:12 bacon Exp $ + * $Id: jni.c,v 1.16 2006-10-24 04:57:29 bacon Exp $ */ #include @@ -377,7 +377,7 @@ static ase_ssize_t __call_java_open_extio ( jmethodID extio_cons; jobject extio_object; - extio_class = (*env)->FindClass (env, "ssekit/ssej/awk/Extio"); + extio_class = (*env)->FindClass (env, "ase/awk/Extio"); if (extio_class == NULL) return -1; extio_cons = (*env)->GetMethodID ( @@ -385,7 +385,7 @@ static ase_ssize_t __call_java_open_extio ( if (extio_cons == NULL) return -1; mid = (*env)->GetMethodID ( - env, class, meth, "(Lssekit/ssej/awk/Extio;)I"); + env, class, meth, "(Lase/awk/Extio;)I"); if (mid == NULL) return -1; extio_object = (*env)->NewObject ( diff --git a/ase/awk/jni.def b/ase/awk/jni.def index d1aba8eb..1f257fd8 100644 --- a/ase/awk/jni.def +++ b/ase/awk/jni.def @@ -1,10 +1,10 @@ -LIBRARY "sseawk.dll" +LIBRARY "aseawk.dll" EXPORTS - Java_sse_awk_Awk_open - Java_sse_awk_Awk_close - Java_sse_awk_Awk_parse - Java_sse_awk_Awk_run - Java_sse_awk_Awk_get_1extio - Java_sse_awk_Awk_set_1extio + Java_ase_awk_Awk_open + Java_ase_awk_Awk_close + Java_ase_awk_Awk_parse + Java_ase_awk_Awk_run + Java_ase_awk_Awk_get_1extio + Java_ase_awk_Awk_set_1extio diff --git a/ase/awk/makefile.cl b/ase/awk/makefile.cl index 14a70e66..c4dc124c 100644 --- a/ase/awk/makefile.cl +++ b/ase/awk/makefile.cl @@ -26,9 +26,16 @@ dll: $(OBJS) jni: $(OBJS) jni.obj $(LD) /dll /def:jni.def /subsystem:console /version:0.1 /release @<< -/nologo /out:$(OUT).dll $(OBJS) jni.obj ..\bas\xpbas.lib +/nologo /out:$(OUT).dll $(OBJS) jni.obj << +java: + javac -classpath ../.. Awk.java TestAwk.java Extio.java AwkException.java + +jrun: + java -classpath ../.. ase.awk.TestAwk + + clean: del $(OBJS) $(OUT) *.obj