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}
*/
@ -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

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

View File

@ -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

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}
*/
@ -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;

View File

@ -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

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}
*/
@ -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);