Recovered from cvs revision 2007-10-17 14:38:00

This commit is contained in:
hyung-hwan 2007-10-17 23:38:00 +00:00
parent b7f520eb43
commit e46893f4d0
6 changed files with 43 additions and 44 deletions

View File

@ -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} * {License}
*/ */
@ -47,11 +47,8 @@ public abstract class Awk
public static final int OPTION_MAPTOVAR = (1 << 16); public static final int OPTION_MAPTOVAR = (1 << 16);
public static final int OPTION_PABLOCK = (1 << 17); public static final int OPTION_PABLOCK = (1 << 17);
protected final static Reader stdin = protected final static Reader stdin = new BufferedReader (new InputStreamReader (System.in));
new BufferedReader (new InputStreamReader (System.in)); protected final static Writer stdout = new BufferedWriter (new OutputStreamWriter (System.out));
protected final static Writer stdout =
new BufferedWriter (new OutputStreamWriter (System.out));
private long awkid; private long awkid;
@ -67,7 +64,6 @@ public abstract class Awk
{ {
if (this.awkid != 0) close (); if (this.awkid != 0) close ();
super.finalize (); super.finalize ();
} }
/* == native methods == */ /* == native methods == */
@ -76,32 +72,20 @@ public abstract class Awk
public native void parse () throws Exception; public native void parse () throws Exception;
public native void run (String main, String[] args) throws Exception; public native void run (String main, String[] args) throws Exception;
public native void stop (); public native void stop ();
native void stoprun (long runid);
private native int getmaxdepth (int id); private native int getmaxdepth (int id);
private native void setmaxdepth (int id, int depth); private native void setmaxdepth (int id, int depth);
private native int getoption (); private native int getoption ();
private native void setoption (int opt); private native void setoption (int opt);
private native boolean getdebug (); private native boolean getdebug ();
private native void setdebug (boolean debug); private native void setdebug (boolean debug);
private native void setword (String ow, String nw); 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 addfunc (
String name, int min_args, int max_args) throws Exception;
private native void delfunc (String name) throws Exception; private native void delfunc (String name) throws Exception;
native void setfilename (long runid, String name) throws Exception;
native void setfilename ( native void setofilename (long runid, String name) throws Exception;
long runid, String name) throws Exception; private native Object strtonum (long runid, String str) throws Exception;
native void setofilename ( private native String valtostr (long runid, Object obj) throws Exception;
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 strftime (String fmt, long sec);
protected native String strfgmtime (String fmt, long sec); protected native String strfgmtime (String fmt, long sec);
protected native int system (String cmd); protected native int system (String cmd);

View File

@ -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; package ase.awk;
@ -47,6 +47,11 @@ public class Context
awk.setofilename (this.runid, name); awk.setofilename (this.runid, name);
} }
public void stop ()
{
awk.stoprun (this.runid);
}
// TODO: // TODO:
// setGlobal // setGlobal
// getGlobal // getGlobal

View File

@ -7,6 +7,7 @@ EXPORTS
Java_ase_awk_Awk_parse Java_ase_awk_Awk_parse
Java_ase_awk_Awk_run Java_ase_awk_Awk_run
Java_ase_awk_Awk_stop Java_ase_awk_Awk_stop
Java_ase_awk_Awk_stoprun
Java_ase_awk_Awk_getmaxdepth Java_ase_awk_Awk_getmaxdepth
Java_ase_awk_Awk_setmaxdepth Java_ase_awk_Awk_setmaxdepth
Java_ase_awk_Awk_getoption Java_ase_awk_Awk_getoption

View File

@ -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} * {License}
*/ */
@ -976,6 +976,11 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_stop (JNIEnv* env, jobject obj)
if (awk != NULL) ase_awk_stopall (awk); 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) static ase_ssize_t java_open_source (JNIEnv* env, jobject obj, int mode)
{ {
jclass class; jclass class;

View File

@ -6,6 +6,7 @@ EXPORTS
Java_ase_awk_Awk_parse Java_ase_awk_Awk_parse
Java_ase_awk_Awk_run Java_ase_awk_Awk_run
Java_ase_awk_Awk_stop Java_ase_awk_Awk_stop
Java_ase_awk_Awk_stoprun
Java_ase_awk_Awk_getmaxdepth Java_ase_awk_Awk_getmaxdepth
Java_ase_awk_Awk_setmaxdepth Java_ase_awk_Awk_setmaxdepth
Java_ase_awk_Awk_getoption Java_ase_awk_Awk_getoption

View File

@ -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} * {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_parse (JNIEnv* env, jobject obj);
JNIEXPORT void JNICALL Java_ase_awk_Awk_run ( JNIEXPORT void JNICALL Java_ase_awk_Awk_run (
JNIEnv* env, jobject obj, jstring mfn, jobjectArray args); 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 ( JNIEXPORT void JNICALL Java_ase_awk_Awk_addfunc (
JNIEnv* env, jobject obj, jstring name, jint min_args, jint max_args); JNIEnv* env, jobject obj, jstring name, jint min_args, jint max_args);