diff --git a/ase/awk/Awk.java b/ase/awk/Awk.java index d4d76e39..1c21a413 100644 --- a/ase/awk/Awk.java +++ b/ase/awk/Awk.java @@ -1,5 +1,5 @@ /* - * $Id: Awk.java,v 1.21 2007/10/15 16:10:09 bacon Exp $ + * $Id: Awk.java,v 1.22 2007/10/16 15:30:41 bacon Exp $ * * {License} */ @@ -47,11 +47,8 @@ public abstract class Awk public static final int OPTION_MAPTOVAR = (1 << 16); public static final int OPTION_PABLOCK = (1 << 17); - protected final static Reader stdin = - new BufferedReader (new InputStreamReader (System.in)); - - protected final static Writer stdout = - new BufferedWriter (new OutputStreamWriter (System.out)); + protected final static Reader stdin = new BufferedReader (new InputStreamReader (System.in)); + protected final static Writer stdout = new BufferedWriter (new OutputStreamWriter (System.out)); private long awkid; @@ -67,44 +64,31 @@ public abstract class Awk { if (this.awkid != 0) close (); super.finalize (); - } /* == native methods == */ - private native void open () throws Exception; - public native void close (); - public native void parse () throws Exception; - public native void run (String main, String[] args) throws Exception; - public native void stop (); - - private native int getmaxdepth (int id); - private native void setmaxdepth (int id, int depth); - - private native int getoption (); - private native void setoption (int opt); - - private native boolean getdebug (); - private native void setdebug (boolean debug); - - private native void setword (String ow, String nw); - - private native void addfunc ( - String name, int min_args, int max_args) throws Exception; - private native void delfunc (String name) throws Exception; - - native void setfilename ( - long runid, String name) throws Exception; - native void setofilename ( - long runid, String name) throws Exception; - - private native Object strtonum ( - long runid, String str) throws Exception; - private native String valtostr ( - long runid, Object obj) throws Exception; - - protected native String strftime (String fmt, long sec); - protected native String strfgmtime (String fmt, long sec); - protected native int system (String cmd); + private native void open () throws Exception; + public native void close (); + public native void parse () throws Exception; + public native void run (String main, String[] args) throws Exception; + public native void stop (); + native void stoprun (long runid); + private native int getmaxdepth (int id); + private native void setmaxdepth (int id, int depth); + private native int getoption (); + private native void setoption (int opt); + private native boolean getdebug (); + private native void setdebug (boolean debug); + private native void setword (String ow, String nw); + private native void addfunc (String name, int min_args, int max_args) throws Exception; + private native void delfunc (String name) throws Exception; + native void setfilename (long runid, String name) throws Exception; + native void setofilename (long runid, String name) throws Exception; + private native Object strtonum (long runid, String str) throws Exception; + private native String valtostr (long runid, Object obj) throws Exception; + protected native String strftime (String fmt, long sec); + protected native String strfgmtime (String fmt, long sec); + protected native int system (String cmd); /* == simpler run methods == */ public void run (String main) throws Exception diff --git a/ase/awk/Context.java b/ase/awk/Context.java index 5728a7a9..e8ccae2e 100644 --- a/ase/awk/Context.java +++ b/ase/awk/Context.java @@ -1,5 +1,5 @@ /* - * $Id: Context.java,v 1.4 2007/10/15 16:10:10 bacon Exp $ + * $Id: Context.java,v 1.5 2007/10/16 15:30:41 bacon Exp $ */ package ase.awk; @@ -47,6 +47,11 @@ public class Context awk.setofilename (this.runid, name); } + public void stop () + { + awk.stoprun (this.runid); + } + // TODO: // setGlobal // getGlobal diff --git a/ase/awk/jni-dmc.def b/ase/awk/jni-dmc.def index 93424532..d611cfda 100644 --- a/ase/awk/jni-dmc.def +++ b/ase/awk/jni-dmc.def @@ -7,6 +7,7 @@ EXPORTS Java_ase_awk_Awk_parse Java_ase_awk_Awk_run Java_ase_awk_Awk_stop + Java_ase_awk_Awk_stoprun Java_ase_awk_Awk_getmaxdepth Java_ase_awk_Awk_setmaxdepth Java_ase_awk_Awk_getoption diff --git a/ase/awk/jni.c b/ase/awk/jni.c index 6848528a..d2939b99 100644 --- a/ase/awk/jni.c +++ b/ase/awk/jni.c @@ -1,5 +1,5 @@ /* - * $Id: jni.c,v 1.25 2007/10/15 16:10:10 bacon Exp $ + * $Id: jni.c,v 1.26 2007/10/16 15:30:41 bacon Exp $ * * {License} */ @@ -976,6 +976,11 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_stop (JNIEnv* env, jobject obj) if (awk != NULL) ase_awk_stopall (awk); } +JNIEXPORT void JNICALL Java_ase_awk_Awk_stoprun (JNIEnv* env, jobject obj, jlong runid) +{ + ase_awk_stop ((ase_awk_run_t*)runid); +} + static ase_ssize_t java_open_source (JNIEnv* env, jobject obj, int mode) { jclass class; diff --git a/ase/awk/jni.def b/ase/awk/jni.def index d0ca8f48..eb5e8369 100644 --- a/ase/awk/jni.def +++ b/ase/awk/jni.def @@ -6,6 +6,7 @@ EXPORTS Java_ase_awk_Awk_parse Java_ase_awk_Awk_run Java_ase_awk_Awk_stop + Java_ase_awk_Awk_stoprun Java_ase_awk_Awk_getmaxdepth Java_ase_awk_Awk_setmaxdepth Java_ase_awk_Awk_getoption diff --git a/ase/awk/jni.h b/ase/awk/jni.h index 4435f443..948d1be5 100644 --- a/ase/awk/jni.h +++ b/ase/awk/jni.h @@ -1,5 +1,5 @@ /* - * $Id: jni.h,v 1.5 2007/09/23 16:48:55 bacon Exp $ + * $Id: jni.h,v 1.6 2007/10/16 15:30:41 bacon Exp $ * * {License} */ @@ -22,6 +22,9 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_close (JNIEnv* env, jobject obj); JNIEXPORT void JNICALL Java_ase_awk_Awk_parse (JNIEnv* env, jobject obj); JNIEXPORT void JNICALL Java_ase_awk_Awk_run ( JNIEnv* env, jobject obj, jstring mfn, jobjectArray args); +JNIEXPORT void JNICALL Java_ase_awk_Awk_stop (JNIEnv* env, jobject obj); +JNIEXPORT void JNICALL Java_ase_awk_Awk_stoprun ( + JNIEnv* env, jobject obj, jlong runid); JNIEXPORT void JNICALL Java_ase_awk_Awk_addfunc ( JNIEnv* env, jobject obj, jstring name, jint min_args, jint max_args);