*** empty log message ***

This commit is contained in:
hyung-hwan 2006-12-02 16:26:29 +00:00
parent 253a005ed0
commit adb8a8bb5c
12 changed files with 370 additions and 70 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.java,v 1.14 2006-11-29 14:52:06 bacon Exp $
* $Id: Awk.java,v 1.15 2006-12-02 16:26:03 bacon Exp $
*/
package ase.awk;
@ -20,7 +20,10 @@ public abstract class Awk
{
public Object run ()
{
System.load ("c://projects//ase/awk/aseawk.dll");
String dll = ase.awk.Awk.class.getResource("aseawk.dll").getFile();
System.load (dll);
//System.load ("c://projects//ase/awk/aseawk.dll");
//System.loadLibrary ("aseawk");
return null;
}
});
@ -48,8 +51,11 @@ public abstract class Awk
private native int addbfn (String name, int min_args, int max_args);
private native int delbfn (String name);
private native int setfilename (long run_id, String name);
private native int setofilename (long run_id, String name);
private native int setfilename (long runid, String name);
private native int setofilename (long runid, String name);
private native Object strtonum (long runid, String str);
private native String valtostr (long runid, Object obj);
/* == builtin functions == */
public void addBuiltinFunction (
@ -71,13 +77,96 @@ public abstract class Awk
}
}
public long builtinFunctionArgumentToLong (long runid, Object obj)
{
long n;
if (obj == null) n = 0;
else
{
if (obj instanceof String)
obj = strtonum (runid, (String)obj);
if (obj instanceof Long)
{
n = ((Long)obj).longValue ();
}
else if (obj instanceof Double)
{
n = ((Double)obj).longValue ();
}
else if (obj instanceof Integer)
{
n = ((Integer)obj).longValue ();
}
else if (obj instanceof Short)
{
n = ((Short)obj).longValue ();
}
else if (obj instanceof Float)
{
n = ((Float)obj).longValue ();
}
else n = 0;
}
return n;
}
public double builtinFunctionArgumentToDouble (long runid, Object obj)
{
double n;
if (obj == null) n = 0.0;
else
{
if (obj instanceof String)
obj = strtonum (runid, (String)obj);
if (obj instanceof Long)
{
n = ((Long)obj).doubleValue ();
}
else if (obj instanceof Double)
{
n = ((Double)obj).doubleValue ();
}
else if (obj instanceof Integer)
{
n = ((Integer)obj).doubleValue ();
}
else if (obj instanceof Short)
{
n = ((Short)obj).doubleValue ();
}
else if (obj instanceof Float)
{
n = ((Float)obj).doubleValue ();
}
else n = 0.0;
}
return n;
}
public String builtinFunctionArgumentToString (long runid, Object obj)
{
String str;
if (obj == null) str = "";
else if (obj instanceof String) str = (String)obj;
else str = valtostr (runid, obj);
return str;
}
/* == console name setters == */
public void setInputConsoleName (Extio extio, String name) //throws Exception
{
/* TODO: setconsolename is not safe. for example, it can
* crash the program if run_id is invalid. so this wrapper
* crash the program if runid is invalid. so this wrapper
* needs to do some sanity check. */
//if (setconsolename (run_id, name) == -1)
//if (setconsolename (runid, name) == -1)
// throw new Exception ("cannot set the consle name");
setfilename (extio.getRunId(), name);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.java,v 1.7 2006-11-28 15:09:53 bacon Exp $
* $Id: StdAwk.java,v 1.8 2006-12-02 16:26:03 bacon Exp $
*/
package ase.awk;
@ -20,9 +20,15 @@ public abstract class StdAwk extends Awk
private String[] cout = null;
private int cout_no = 0;
private long seed;
private java.util.Random random;
public StdAwk () throws Exception
{
super ();
seed = System.currentTimeMillis();
random = new java.util.Random (seed);
}
/* == major methods == */
@ -601,4 +607,95 @@ public abstract class StdAwk extends Awk
return -1;
}
/* == arithmetic built-in functions */
public Object sin (long runid, Object[] args)
{
double x = builtinFunctionArgumentToDouble (runid, args[0]);
return new Double (Math.sin(x));
}
public Object cos (long runid, Object[] args)
{
double x = builtinFunctionArgumentToDouble (runid, args[0]);
return new Double (Math.cos(x));
}
public Object tan (long runid, Object[] args)
{
double x = builtinFunctionArgumentToDouble (runid, args[0]);
return new Double (Math.tan(x));
}
public Object atan2 (long runid, Object[] args)
{
double y = builtinFunctionArgumentToDouble (runid, args[0]);
double x = builtinFunctionArgumentToDouble (runid, args[1]);
return new Double (Math.atan2(y,x));
}
public Object log (long runid, Object[] args)
{
double x = builtinFunctionArgumentToDouble (runid, args[0]);
return new Double (Math.log(x));
}
public Object exp (long runid, Object[] args)
{
double x = builtinFunctionArgumentToDouble (runid, args[0]);
return new Double (Math.exp(x));
}
public Object sqrt (long runid, Object[] args)
{
double x = builtinFunctionArgumentToDouble (runid, args[0]);
return new Double (Math.sqrt(x));
}
public Object rand (long runid, Object[] args)
{
return new Double (random.nextDouble ());
}
public Object srand (long runid, Object[] args)
{
long prev_seed = seed;
seed = (args == null || args.length == 0)?
System.currentTimeMillis ():
builtinFunctionArgumentToLong (runid, args[0]);
random.setSeed (seed);
return new Long (prev_seed);
}
/* miscellaneous built-in functions */
public Object system (long runid, Object[] args)
{
String str = builtinFunctionArgumentToString (runid, args[0]);
Process proc = null;
int n = 0;
str = builtinFunctionArgumentToString (runid, args[0]);
try { proc = Runtime.getRuntime().exec (str); }
catch (IOException e) { n = -1; }
System.out.println ("EXECUTED....\n");
if (proc != null)
{
System.out.println ("WAITING....\n");
/*
try { n = proc.waitFor (); }
catch (InterruptedException e)
{
proc.destroy ();
n = -1;
}
*/
System.out.println ("DONE WAITING....\n");
}
return new Long (n);
}
}

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h,v 1.157 2006-11-29 14:52:06 bacon Exp $
* $Id: awk.h,v 1.158 2006-12-02 16:26:03 bacon Exp $
*/
#ifndef _ASE_AWK_AWK_H_
@ -296,6 +296,7 @@ enum
ASE_AWK_ENEXTFILECALL, /* nextfile called from BEGIN or END */
ASE_AWK_EIOIMPL, /* wrong user io handler implementation */
ASE_AWK_EBFNIMPL, /* wrong builtin function implementation */
ASE_AWK_EBFNFAIL, /* builtin function handler failed */
ASE_AWK_ENOSUCHIO, /* no such io name found */
ASE_AWK_EIOHANDLER, /* io handler has returned an error */
ASE_AWK_EFMTARG, /* arguments to format string not sufficient */

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c,v 1.56 2006-11-29 14:52:06 bacon Exp $
* $Id: err.c,v 1.57 2006-12-02 16:26:03 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -107,6 +107,7 @@ const ase_char_t* ase_awk_geterrstr (int errnum)
ASE_T("nextfile cannot be called from the BEGIN or END block"),
ASE_T("wrong implementation of user-defined io handler"),
ASE_T("wrong implementation of built-in function handler"),
ASE_T("built-in function handler returned an error"),
ASE_T("no such io name found"),
ASE_T("io handler has returned an error"),
ASE_T("not sufficient arguments to formatting sequence"),

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.c,v 1.34 2006-11-29 14:52:06 bacon Exp $
* $Id: jni.c,v 1.35 2006-12-02 16:26:03 bacon Exp $
*/
#include <ase/awk/jni.h>
@ -1000,7 +1000,7 @@ static int __handle_bfn (
class = (*env)->GetObjectClass(env, obj);
method = (*env)->GetMethodID (
env, class, name_utf,
"([Ljava/lang/Object;)Ljava/lang/Object;");
"(J[Ljava/lang/Object;)Ljava/lang/Object;");
(*env)->DeleteLocalRef (env, class);
(*env)->ReleaseStringUTFChars (env, name, name_utf);
(*env)->DeleteLocalRef (env, name);
@ -1064,14 +1064,17 @@ static int __handle_bfn (
if (arg != NULL) (*env)->DeleteLocalRef (env, arg);
}
ret = (*env)->CallObjectMethod (env, obj, method, args);
ret = (*env)->CallObjectMethod (env, obj, method, (jlong)run, args);
thrown = (*env)->ExceptionOccurred (env);
if (thrown)
{
(*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
(*env)->DeleteLocalRef (env, args);
ase_awk_setrunerrnum (run, ASE_AWK_EBFNIMPL);
ase_awk_setrunerrnum (run, ASE_AWK_EBFNFAIL);
// TODO:
//ase_awk_setrunerror (run, ASE_AWK_EBFNFAIL, "EXCEPTION:....");
return -1;
}
@ -1210,7 +1213,7 @@ JNIEXPORT jint JNICALL Java_ase_awk_Awk_addbfn (
class = (*env)->GetObjectClass(env, obj);
handle = (*env)->GetFieldID (env, class, FIELD_HANDLE, "J");
(*env)->DeleteLocalRef (env, class);
if (handle == NULL) return;
if (handle == NULL) return -1;
awk = (ase_awk_t*) (*env)->GetLongField (env, obj, handle);
@ -1254,13 +1257,14 @@ JNIEXPORT jint JNICALL Java_ase_awk_Awk_setfilename (
JNIEnv* env, jobject obj, jlong run_id, jstring name)
{
ase_awk_run_t* run = (ase_awk_run_t*)run_id;
const jchar* str;
jint len, n;
const jchar* ptr;
jsize len;
jint n;
str = (*env)->GetStringChars (env, name, JNI_FALSE);
ptr = (*env)->GetStringChars (env, name, JNI_FALSE);
len = (*env)->GetStringLength (env, name);
n = ase_awk_setfilename (run, str, len);
(*env)->ReleaseStringChars (env, name, str);
n = ase_awk_setfilename (run, ptr, len);
(*env)->ReleaseStringChars (env, name, ptr);
return n;
}
@ -1268,13 +1272,57 @@ JNIEXPORT jint JNICALL Java_ase_awk_Awk_setofilename (
JNIEnv* env, jobject obj, jlong run_id, jstring name)
{
ase_awk_run_t* run = (ase_awk_run_t*)run_id;
const jchar* str;
jint len, n;
const jchar* ptr;
jsize len;
jint n;
str = (*env)->GetStringChars (env, name, JNI_FALSE);
ptr = (*env)->GetStringChars (env, name, JNI_FALSE);
len = (*env)->GetStringLength (env, name);
n = ase_awk_setofilename (run, str, len);
(*env)->ReleaseStringChars (env, name, str);
n = ase_awk_setofilename (run, ptr, len);
(*env)->ReleaseStringChars (env, name, ptr);
return n;
}
JNIEXPORT jobject JNICALL Java_ase_awk_Awk_strtonum (
JNIEnv* env, jobject obj, jlong runid, jstring str)
{
const jchar* ptr;
jsize len;
jint n;
ase_long_t lv;
ase_real_t rv;
jobject ret;
run_data_t* run_data;
ptr = (*env)->GetStringChars (env, str, JNI_FALSE);
len = (*env)->GetStringLength (env, str);
n = ase_awk_strtonum ((ase_awk_run_t*)runid, ptr, len, &lv, &rv);
(*env)->ReleaseStringChars (env, str, ptr);
run_data = ase_awk_getruncustomdata ((ase_awk_run_t*)runid);
if (n == 0)
{
ret = (*env)->NewObject (env,
run_data->long_class,
run_data->long_init, (jlong)lv);
}
else
{
ret = (*env)->NewObject (env,
run_data->double_class,
run_data->double_init, (jdouble)rv);
}
/*
{
jthrowable except;
except = (*env)->FindClass (env, CLASS_EXCEPTION);
if (except == NULL) return;
(*env)->ThrowNew (env, except, "cannot create awk");
(*env)->DeleteLocalRef (env, except);
}
*/
return ret;
}

View File

@ -9,4 +9,5 @@ EXPORTS
Java_ase_awk_Awk_delbfn
Java_ase_awk_Awk_setfilename
Java_ase_awk_Awk_setofilename
Java_ase_awk_Awk_strtonum

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.h,v 1.13 2006-11-29 14:52:06 bacon Exp $
* $Id: jni.h,v 1.14 2006-12-02 16:26:03 bacon Exp $
*/
#ifndef _ASE_AWK_JNI_H_
@ -22,9 +22,11 @@ JNIEXPORT jint JNICALL Java_ase_awk_Awk_delbfn (
JNIEnv* env, jobject obj, jstring name);
JNIEXPORT jint JNICALL Java_ase_awk_Awk_setfilename (
JNIEnv* env, jobject obj, jlong run_id, jstring name);
JNIEnv* env, jobject obj, jlong runid, jstring name);
JNIEXPORT jint JNICALL Java_ase_awk_Awk_setofilename (
JNIEnv* env, jobject obj, jlong run_id, jstring name);
JNIEnv* env, jobject obj, jlong runid, jstring name);
JNIEXPORT jobject JNICALL Java_ase_awk_Awk_strtonum (
JNIEnv* env, jobject obj, jlong runid, jstring str);
#ifdef __cplusplus
}

View File

@ -1,9 +1,10 @@
/*
* $Id: rex.c,v 1.48 2006-11-29 02:54:16 bacon Exp $
* $Id: rex.c,v 1.49 2006-12-02 16:26:03 bacon Exp $
*/
#include <ase/awk/awk_i.h>
//#define DEBUG_REX
enum
{
CT_EOF,
@ -717,9 +718,10 @@ static int __build_charset (__builder_t* builder, struct __code_t* cmd)
else
{
/* invalid range */
#ifdef DEBUG_REX
xp_printf (ASE_T("__build_charset: invalid character set range\n"));
#endif
#ifdef DEBUG_REX
builder->awk->syscas.dprintf (
ASE_T("__build_charset: invalid character set range\n"));
#endif
builder->errnum = ASE_AWK_EREXCRANGE;
return -1;
}
@ -749,9 +751,10 @@ static int __build_cclass (__builder_t* builder, ase_char_t* cc)
if (ccp->name == ASE_NULL)
{
/* wrong class name */
#ifdef DEBUG_REX
xp_printf (ASE_T("__build_cclass: wrong class name\n"));*/
#endif
#ifdef DEBUG_REX
builder->awk->syscas.dprintf (
ASE_T("__build_cclass: wrong class name\n"));
#endif
builder->errnum = ASE_AWK_EREXCCLASS;
return -1;
}
@ -762,9 +765,10 @@ xp_printf (ASE_T("__build_cclass: wrong class name\n"));*/
if (builder->ptn.curc.type != CT_NORMAL ||
builder->ptn.curc.value != ASE_T(':'))
{
#ifdef BUILD_REX
xp_printf (ASE_T("__build_cclass: a colon(:) expected\n"));
#endif
#ifdef BUILD_REX
builder->awk->syscas.dprintf (
ASE_T("__build_cclass: a colon(:) expected\n"));
#endif
builder->errnum = ASE_AWK_EREXCOLON;
return -1;
}
@ -775,9 +779,10 @@ xp_printf (ASE_T("__build_cclass: a colon(:) expected\n"));
if (builder->ptn.curc.type != CT_SPECIAL ||
builder->ptn.curc.value != ASE_T(']'))
{
#ifdef DEBUG_REX
xp_printf (ASE_T("__build_cclass: ] expected\n"));
#endif
#ifdef DEBUG_REX
builder->awk->syscas.dprintf (
ASE_T("__build_cclass: ] expected\n"));
#endif
builder->errnum = ASE_AWK_EREXRBRACKET;
return -1;
}
@ -1023,7 +1028,9 @@ static const ase_byte_t* __match_pattern (
el = *(ase_size_t*)p; p += ASE_SIZEOF(el);
#ifdef BUILD_REX
xp_printf (ASE_T("__match_pattern: NB = %u, EL = %u\n"), (unsigned)nb, (unsigned)el);
matcher->awk->syscas.dprintf (
ASE_T("__match_pattern: NB = %u, EL = %u\n"),
(unsigned)nb, (unsigned)el);
#endif
mat->matched = ase_false;
mat->match_len = 0;
@ -1209,7 +1216,8 @@ static const ase_byte_t* __match_any_char (
}
#ifdef BUILD_REX
xp_printf (ASE_T("__match_any_char: lbound = %u, ubound = %u\n"),
matcher->awk->syscas.dprintf (
ASE_T("__match_any_char: lbound = %u, ubound = %u\n"),
(unsigned int)lbound, (unsigned int)ubound);
#endif
@ -1221,7 +1229,8 @@ xp_printf (ASE_T("__match_any_char: lbound = %u, ubound = %u\n"),
}
#ifdef BUILD_REX
xp_printf (ASE_T("__match_any_char: max si = %d\n"), si);
matcher->awk->syscas.dprintf (
ASE_T("__match_any_char: max si = %u\n"), (unsigned)si);
#endif
if (si >= lbound && si <= ubound)
{
@ -1279,8 +1288,9 @@ static const ase_byte_t* __match_ord_char (
}
#ifdef BUILD_REX
xp_printf (ASE_T("__match_ord_char: lbound = %u, ubound = %u\n"),
(unsigned int)lbound, (unsigned int)ubound);*/
matcher->awk->syscas.dprintf (
ASE_T("__match_ord_char: lbound = %u, ubound = %u\n"),
(unsigned int)lbound, (unsigned int)ubound);
#endif
mat->matched = ase_false;
@ -1301,13 +1311,19 @@ xp_printf (ASE_T("__match_ord_char: lbound = %u, ubound = %u\n"),
while (si < ubound)
{
if (&mat->match_ptr[si] >= matcher->match.str.end) break;
#ifdef DEBUG_REX
matcher->awk->syscas.dprintf (
ASE_T("__match_ord_char: %c %c\n"), cc, mat->match_ptr[si]);
#endif
if (cc != mat->match_ptr[si]) break;
si++;
}
}
#ifdef DEBUG_REX
xp_printf (ASE_T("__match_ord_char: max si = %d, lbound = %u, ubound = %u\n"), si, lbound, ubound);
matcher->awk->syscas.dprintf (
ASE_T("__match_ord_char: max si=%u, lbound=%u, ubound=%u\n"),
(unsigned)si, (unsigned)lbound, (unsigned)ubound);
#endif
if (si >= lbound && si <= ubound)
@ -1336,6 +1352,12 @@ static const ase_byte_t* __match_charset (
csc = *(ase_size_t*)p; p += ASE_SIZEOF(csc);
csl = *(ase_size_t*)p; p += ASE_SIZEOF(csl);
#ifdef BUILD_REX
matcher->awk->syscas.dprintf (
ASE_T("__match_charset: lbound = %u, ubound = %u\n"),
(unsigned int)lbound, (unsigned int)ubound);
#endif
mat->matched = ase_false;
mat->match_len = 0;
@ -1355,6 +1377,11 @@ static const ase_byte_t* __match_charset (
p = p + csl - (ASE_SIZEOF(csc) + ASE_SIZEOF(csl));
#ifdef DEBUG_REX
matcher->awk->syscas.dprintf (
ASE_T("__match_charset: max si=%u, lbound=%u, ubound=%u\n"),
(unsigned)si, (unsigned)lbound, (unsigned)ubound);
#endif
if (si >= lbound && si <= ubound)
{
p = __match_occurrences (matcher, si, p, lbound, ubound, mat);
@ -1463,9 +1490,11 @@ static const ase_byte_t* __match_group (
mat2.branch = mat->branch;
mat2.branch_end = mat->branch_end;
#ifdef DEBUG_REX
xp_printf (ASE_T("__match_group: GROUP si = %d [%s]\n"), si, mat->match_ptr);
#endif
#ifdef DEBUG_REX
matcher->awk->syscas.dprintf (
ASE_T("__match_group: GROUP si=%d [%s]\n"),
(unsigned)si, mat->match_ptr);
#endif
tmp = __match_branch_body (matcher, p, &mat2);
if (tmp == ASE_NULL)
{
@ -1562,9 +1591,11 @@ static const ase_byte_t* __match_occurrences (
mat2.branch = mat->branch;
mat2.branch_end = mat->branch_end;
#ifdef DEBUG_REX
xp_printf (ASE_T("__match occurrences: si = %d [%s]\n"), si, mat->match_ptr);
#endif
#ifdef DEBUG_REX
matcher->awk->syscas.dprintf (
ASE_T("__match occurrences: si=%u [%s]\n"),
(unsigned)si, mat->match_ptr);
#endif
tmp = __match_branch_body (matcher, p, &mat2);
if (mat2.matched)
@ -1696,10 +1727,10 @@ static ase_bool_t __cc_isxdigit (ase_awk_t* awk, ase_char_t c)
#ifdef DEBUG_REX
void ase_awk_printrex (void* rex)
void ase_awk_printrex (ase_awk_t* awk, void* rex)
{
__print_pattern (rex);
xp_printf (ASE_T("\n"));
awk->syscas.dprintf (ASE_T("\n"));
}
static const ase_byte_t* __print_pattern (const ase_byte_t* p)
@ -1708,6 +1739,7 @@ static const ase_byte_t* __print_pattern (const ase_byte_t* p)
nb = *(ase_size_t*)p; p += ASE_SIZEOF(nb);
el = *(ase_size_t*)p; p += ASE_SIZEOF(el);
#ifdef DEBUG_REX
xp_printf (ASE_T("__print_pattern: NB = %u, EL = %u\n"), (unsigned int)nb, (unsigned int)el);
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.h,v 1.24 2006-11-29 02:54:16 bacon Exp $
* $Id: rex.h,v 1.25 2006-12-02 16:26:03 bacon Exp $
**/
#ifndef _ASE_AWK_REX_H_
@ -65,7 +65,7 @@ void ase_awk_freerex (ase_awk_t* awk, void* code);
ase_bool_t ase_awk_isemptyrex (ase_awk_t* awk, void* code);
#ifdef DEBUG_REX
void ase_awk_printrex (void* rex);
void ase_awk_printrex (ase_awk_t* awk, void* rex);
#endif
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/*
* $Id: val.c,v 1.94 2006-11-29 02:39:10 bacon Exp $
* $Id: val.c,v 1.95 2006-12-02 16:26:03 bacon Exp $
*/
#include <ase/awk/awk_i.h>
@ -682,6 +682,11 @@ int ase_awk_valtonum (
if (v->type == ASE_AWK_VAL_STR)
{
return ase_awk_strtonum (run,
((ase_awk_val_str_t*)v)->buf,
((ase_awk_val_str_t*)v)->len, l, r);
#if 0
const ase_char_t* endptr;
*l = ase_awk_strxtolong (run->awk,
@ -699,16 +704,39 @@ int ase_awk_valtonum (
}
/* TODO: do should i handle strings ending with invalid number characters like "123xx" or "dkdkdkd"? */
return 0; /* long */
#endif
}
#ifdef _DEBUG
run->awk->syscas.dprintf (
ASE_T("ERROR: WRONG VALUE TYPE [%d] in ase_awk_valtonum\n"),
v->type);
#endif
run->errnum = ASE_AWK_EVALTYPE;
return -1; /* error */
}
int ase_awk_strtonum (
ase_awk_run_t* run, const ase_awk_str_t* ptr, ase_size_t len,
ase_long_t* l, ase_real_t* r)
{
const ase_char_t* endptr;
*l = ase_awk_strxtolong (run->awk, ptr, len, 0, &endptr);
if (*endptr == ASE_T('.') ||
*endptr == ASE_T('E') ||
*endptr == ASE_T('e'))
{
*r = ase_awk_strxtoreal (run->awk, ptr, len, ASE_NULL);
/* TODO: need to check if it is a valid number using endptr for strxtoreal? */
return 1; /* real */
}
/* TODO: do should i handle strings ending with invalid number characters like "123xx" or "dkdkdkd"? */
return 0; /* long */
}
#define __DPRINTF run->awk->syscas.dprintf
static int __print_pair (ase_awk_pair_t* pair, void* arg)

View File

@ -1,5 +1,5 @@
/*
* $Id: val.h,v 1.54 2006-11-23 14:28:30 bacon Exp $
* $Id: val.h,v 1.55 2006-12-02 16:26:03 bacon Exp $
*/
#ifndef _ASE_AWK_VAL_H_
@ -177,6 +177,9 @@ ase_char_t* ase_awk_valtostr (
int ase_awk_valtonum (
ase_awk_run_t* run, ase_awk_val_t* v, ase_long_t* l, ase_real_t* r);
int ase_awk_strtonum (
ase_awk_run_t* run, const ase_awk_str_t* ptr, ase_size_t len,
ase_long_t* l, ase_real_t* r);
void ase_awk_dprintval (ase_awk_run_t* run, ase_awk_val_t* val);

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.java,v 1.17 2006-11-29 14:52:36 bacon Exp $
* $Id: Awk.java,v 1.18 2006-12-02 16:26:29 bacon Exp $
*/
package ase.test.awk;
@ -10,21 +10,19 @@ public class Awk extends ase.awk.StdAwk
{
super ();
addBuiltinFunction ("sin", 1, 10);
addBuiltinFunction ("xxx", 1, 1);
addBuiltinFunction ("sin", 1, 1);
addBuiltinFunction ("cos", 1, 1);
addBuiltinFunction ("tan", 1, 1);
addBuiltinFunction ("system", 1, 1);
addBuiltinFunction ("xxx", 1, 10);
//addBuiltinFunction ("xxx", 1, 1);
//deleteBuiltinFunction ("sin");
//deleteBuiltinFunction ("sin");
}
public Object xxx (Object[] args)
{
System.out.println ("BFN_XXX");
return null;
}
public Object sin (Object[] args)
public Object xxx (long runid, Object[] args)
{
System.out.println ("<<BFN_SIN>>");
for (int i = 0; i < args.length; i++)