Recovered from cvs revision 2007-10-25 14:43:00

This commit is contained in:
hyung-hwan 2007-10-25 23:43:00 +00:00
parent 62ce250c12
commit 01c0434577
13 changed files with 507 additions and 146 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: Return.java,v 1.3 2007/10/24 04:58:35 bacon Exp $ * $Id: Return.java,v 1.4 2007/10/24 14:17:32 bacon Exp $
*/ */
package ase.awk; package ase.awk;
@ -20,6 +20,11 @@ public class Return
this.valid = valid; this.valid = valid;
} }
public boolean isIndexed ()
{
return isindexed (this.runid, this.valid);
}
public void setIntValue (long v) public void setIntValue (long v)
{ {
setintval (this.runid, this.valid, v); setintval (this.runid, this.valid, v);
@ -90,11 +95,49 @@ public class Return
setindexedstrval (this.runid, this.valid, index, v); setindexedstrval (this.runid, this.valid, index, v);
} }
public void setIndexedIntValue (long index, long v)
{
setindexedintval (this.runid, this.valid, Long.toString(index), v);
}
public void setIndexedIntValue (long index, int v)
{
setindexedintval (this.runid, this.valid, Long.toString(index), (long)v);
}
public void setIndexedIntValue (long index, short v)
{
setindexedintval (this.runid, this.valid, Long.toString(index), (long)v);
}
public void setIndexedIntValue (long index, byte v)
{
setindexedintval (this.runid, this.valid, Long.toString(index), (long)v);
}
public void setIndexedRealValue (long index, double v)
{
setindexedrealval (this.runid, this.valid, Long.toString(index), v);
}
public void setIndexedRealValue (long index, float v)
{
setindexedrealval (this.runid, this.valid, Long.toString(index), (double)v);
}
public void setIndexedStringValue (long index, String v)
{
setindexedstrval (this.runid, this.valid, Long.toString(index), v);
}
public void clear () public void clear ()
{ {
clearval (this.runid, this.valid); clearval (this.runid, this.valid);
} }
protected native boolean isindexed (long runid, long valid);
protected native void setintval (long runid, long valid, long v); protected native void setintval (long runid, long valid, long v);
protected native void setrealval (long runid, long valid, double v); protected native void setrealval (long runid, long valid, double v);
protected native void setstrval (long runid, long valid, String v); protected native void setstrval (long runid, long valid, String v);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.c,v 1.11 2007/10/10 13:22:12 bacon Exp $ * $Id: awk.c,v 1.13 2007/10/24 14:17:32 bacon Exp $
* *
* {License} * {License}
*/ */
@ -13,6 +13,7 @@
static void free_kw (void* awk, void* ptr); static void free_kw (void* awk, void* ptr);
static void free_afn (void* awk, void* afn); static void free_afn (void* awk, void* afn);
static void free_bfn (void* awk, void* afn);
ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data) ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
{ {
@ -136,7 +137,19 @@ ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
awk->src.shared.buf_len = 0; awk->src.shared.buf_len = 0;
awk->bfn.sys = ASE_NULL; awk->bfn.sys = ASE_NULL;
awk->bfn.user = ASE_NULL; /*awk->bfn.user = ASE_NULL;*/
awk->bfn.user = ase_awk_map_open (awk, 512, 70, free_bfn, awk);
if (awk->bfn.user == ASE_NULL)
{
ase_awk_tab_close (&awk->parse.params);
ase_awk_tab_close (&awk->parse.locals);
ase_awk_tab_close (&awk->parse.globals);
ase_awk_map_close (awk->tree.afns);
ase_awk_map_close (awk->kwtab);
ase_str_close (&awk->token.name);
ASE_AWK_FREE (awk, awk);
return ASE_NULL;
}
awk->parse.depth.cur.block = 0; awk->parse.depth.cur.block = 0;
awk->parse.depth.cur.loop = 0; awk->parse.depth.cur.loop = 0;
@ -153,6 +166,7 @@ ase_awk_t* ase_awk_open (const ase_awk_prmfns_t* prmfns, void* custom_data)
if (ase_awk_initglobals (awk) == -1) if (ase_awk_initglobals (awk) == -1)
{ {
ase_awk_map_close (awk->bfn.user);
ase_awk_tab_close (&awk->parse.params); ase_awk_tab_close (&awk->parse.params);
ase_awk_tab_close (&awk->parse.locals); ase_awk_tab_close (&awk->parse.locals);
ase_awk_tab_close (&awk->parse.globals); ase_awk_tab_close (&awk->parse.globals);
@ -182,12 +196,19 @@ static void free_afn (void* owner, void* afn)
ASE_AWK_FREE ((ase_awk_t*)owner, f); ASE_AWK_FREE ((ase_awk_t*)owner, f);
} }
static void free_bfn (void* owner, void* bfn)
{
ase_awk_bfn_t* f = (ase_awk_bfn_t*)bfn;
ASE_AWK_FREE ((ase_awk_t*)owner, f);
}
int ase_awk_close (ase_awk_t* awk) int ase_awk_close (ase_awk_t* awk)
{ {
ase_size_t i; ase_size_t i;
if (ase_awk_clear (awk) == -1) return -1; if (ase_awk_clear (awk) == -1) return -1;
ase_awk_clrbfn (awk); /*ase_awk_clrbfn (awk);*/
ase_awk_map_close (awk->bfn.user);
ase_awk_tab_close (&awk->parse.params); ase_awk_tab_close (&awk->parse.params);
ase_awk_tab_close (&awk->parse.locals); ase_awk_tab_close (&awk->parse.locals);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.h,v 1.21 2007/10/21 07:59:35 bacon Exp $ * $Id: awk.h,v 1.22 2007/10/24 09:57:45 bacon Exp $
* *
* {License} * {License}
*/ */
@ -466,6 +466,9 @@ void ase_awk_setoption (ase_awk_t* awk, int opt);
ase_size_t ase_awk_getmaxdepth (ase_awk_t* awk, int type); ase_size_t ase_awk_getmaxdepth (ase_awk_t* awk, int type);
void ase_awk_setmaxdepth (ase_awk_t* awk, int types, ase_size_t depth); void ase_awk_setmaxdepth (ase_awk_t* awk, int types, ase_size_t depth);
/*
* Enables replacement of a name of a keyword.
*/
int ase_awk_setword (ase_awk_t* awk, int ase_awk_setword (ase_awk_t* awk,
const ase_char_t* okw, ase_size_t olen, const ase_char_t* okw, ase_size_t olen,
const ase_char_t* nkw, ase_size_t nlen); const ase_char_t* nkw, ase_size_t nlen);

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk_i.h,v 1.8 2007/10/10 13:22:12 bacon Exp $ * $Id: awk_i.h,v 1.9 2007/10/24 09:57:45 bacon Exp $
* *
* {License} * {License}
*/ */
@ -160,7 +160,8 @@ struct ase_awk_t
struct struct
{ {
ase_awk_bfn_t* sys; ase_awk_bfn_t* sys;
ase_awk_bfn_t* user; /*ase_awk_bfn_t* user;*/
ase_awk_map_t* user;
} bfn; } bfn;
struct struct

View File

@ -1,5 +1,5 @@
/* /*
* $Id: err.c,v 1.10 2007/10/21 07:59:35 bacon Exp $ * $Id: err.c,v 1.11 2007/10/24 09:57:45 bacon Exp $
* *
* {License} * {License}
*/ */
@ -55,7 +55,7 @@ static const ase_char_t* __geterrstr (int errnum)
ASE_T("a comment not closed properly"), ASE_T("a comment not closed properly"),
ASE_T("a string not closed with a quote"), ASE_T("a string not closed with a quote"),
ASE_T("unexpected end of a regular expression"), ASE_T("unexpected end of a regular expression"),
ASE_T("a left brace expected n place of '%.*s'"), ASE_T("a left brace expected in place of '%.*s'"),
ASE_T("a left parenthesis expected in place of '%.*s'"), ASE_T("a left parenthesis expected in place of '%.*s'"),
ASE_T("a right parenthesis expected in place of '%.*s'"), ASE_T("a right parenthesis expected in place of '%.*s'"),
ASE_T("a right bracket expected in place of '%.*s'"), ASE_T("a right bracket expected in place of '%.*s'"),

View File

@ -1,5 +1,5 @@
/* /*
* $Id: func.c,v 1.11 2007/10/21 13:58:47 bacon Exp $ * $Id: func.c,v 1.12 2007/10/24 09:57:45 bacon Exp $
* *
* {License} * {License}
*/ */
@ -22,7 +22,7 @@ static int bfn_sprintf (ase_awk_run_t*, const ase_char_t*, ase_size_t);
#undef MAX #undef MAX
#define MAX ASE_TYPE_UNSIGNED_MAX(ase_size_t) #define MAX ASE_TYPE_UNSIGNED_MAX(ase_size_t)
static ase_awk_bfn_t __sys_bfn[] = static ase_awk_bfn_t sys_bfn[] =
{ {
/* io functions */ /* io functions */
{ {ASE_T("close"), 5}, ASE_AWK_EXTIO, {1, 1, ASE_NULL}, bfn_close}, { {ASE_T("close"), 5}, ASE_AWK_EXTIO, {1, 1, ASE_NULL}, bfn_close},
@ -49,9 +49,8 @@ void* ase_awk_addfunc (
const ase_char_t* arg_spec, const ase_char_t* arg_spec,
int (*handler)(ase_awk_run_t*,const ase_char_t*,ase_size_t)) int (*handler)(ase_awk_run_t*,const ase_char_t*,ase_size_t))
{ {
ase_awk_bfn_t* p; ase_awk_bfn_t* bfn;
ase_size_t spec_len;
/* TODO: make function table hash-accessable */
if (name_len <= 0) if (name_len <= 0)
{ {
@ -70,70 +69,52 @@ void* ase_awk_addfunc (
return ASE_NULL; return ASE_NULL;
} }
p = (ase_awk_bfn_t*) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_bfn_t)); spec_len = (arg_spec == ASE_NULL)? 0: ase_strlen(arg_spec);
if (p == ASE_NULL)
bfn = (ase_awk_bfn_t*) ASE_AWK_MALLOC (awk,
ASE_SIZEOF(ase_awk_bfn_t) +
(name_len+1) * ASE_SIZEOF(ase_char_t) +
(spec_len+1) * ASE_SIZEOF(ase_char_t));
if (bfn == ASE_NULL)
{ {
ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL, 0); ase_awk_seterrnum (awk, ASE_AWK_ENOMEM);
return ASE_NULL; return ASE_NULL;
} }
p->name.ptr = ase_strxdup (name, name_len, &awk->prmfns.mmgr); bfn->name.ptr = (ase_char_t*)(bfn + 1);
if (p->name.ptr == ASE_NULL) bfn->name.len = name_len;
{ ase_strxncpy (bfn->name.ptr, name_len+1, name, name_len);
ASE_AWK_FREE (awk, p);
ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL;
}
p->name.len = name_len; bfn->valid = when_valid;
p->valid = when_valid; bfn->arg.min = min_args;
p->arg.min = min_args; bfn->arg.max = max_args;
p->arg.max = max_args;
if (arg_spec == ASE_NULL) p->arg.spec = ASE_NULL; if (arg_spec == ASE_NULL) bfn->arg.spec = ASE_NULL;
else else
{ {
p->arg.spec = ase_strdup (arg_spec, &awk->prmfns.mmgr); bfn->arg.spec = bfn->name.ptr + bfn->name.len + 1;
if (p->arg.spec == ASE_NULL) ase_strxcpy (bfn->arg.spec, spec_len+1, arg_spec);
}
bfn->handler = handler;
if (ase_awk_map_put (awk->bfn.user, name, name_len, bfn) == ASE_NULL)
{ {
ASE_AWK_FREE (awk, p->name.ptr); ASE_AWK_FREE (awk, bfn);
ASE_AWK_FREE (awk, p); ase_awk_seterrnum (awk, ASE_AWK_ENOMEM);
ase_awk_seterror (awk, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return ASE_NULL; return ASE_NULL;
} }
}
p->handler = handler;
p->next = awk->bfn.user; return bfn;
awk->bfn.user = p;
return p;
} }
int ase_awk_delfunc ( int ase_awk_delfunc (
ase_awk_t* awk, const ase_char_t* name, ase_size_t name_len) ase_awk_t* awk, const ase_char_t* name, ase_size_t name_len)
{ {
ase_awk_bfn_t* p, * pp = ASE_NULL; if (ase_awk_map_remove (awk->bfn.user, name, name_len) == -1)
{
ase_cstr_t errarg; ase_cstr_t errarg;
for (p = awk->bfn.user; p != ASE_NULL; p = p->next)
{
if (ase_strxncmp (
p->name.ptr, p->name.len, name, name_len) == 0)
{
if (pp == ASE_NULL)
awk->bfn.user = p->next;
else pp->next = p->next;
if (p->arg.spec != ASE_NULL)
ASE_AWK_FREE (awk, p->arg.spec);
ASE_AWK_FREE (awk, p->name.ptr);
ASE_AWK_FREE (awk, p);
return 0;
}
pp = p;
}
errarg.ptr = name; errarg.ptr = name;
errarg.len = name_len; errarg.len = name_len;
@ -141,73 +122,55 @@ int ase_awk_delfunc (
return -1; return -1;
} }
void ase_awk_clrbfn (ase_awk_t* awk) return 0;
{
ase_awk_bfn_t* p, * np;
p = awk->bfn.user;
while (p != ASE_NULL)
{
np = p->next;
if (p->arg.spec != ASE_NULL)
ASE_AWK_FREE (awk, p->arg.spec);
ASE_AWK_FREE (awk, p->name.ptr);
ASE_AWK_FREE (awk, p);
p = np;
} }
awk->bfn.user = ASE_NULL; void ase_awk_clrbfn (ase_awk_t* awk)
{
ase_awk_map_clear (awk->bfn.user);
} }
ase_awk_bfn_t* ase_awk_getbfn ( ase_awk_bfn_t* ase_awk_getbfn (
ase_awk_t* awk, const ase_char_t* name, ase_size_t len) ase_awk_t* awk, const ase_char_t* name, ase_size_t len)
{ {
ase_awk_bfn_t* p; ase_awk_bfn_t* bfn;
ase_awk_pair_t* pair; ase_awk_pair_t* pair;
const ase_char_t* k; const ase_char_t* k;
ase_size_t l; ase_size_t l;
for (p = __sys_bfn; p->name.ptr != ASE_NULL; p++) /* search the system function table */
for (bfn = sys_bfn; bfn->name.ptr != ASE_NULL; bfn++)
{ {
if (p->valid != 0 && if (bfn->valid != 0 &&
(awk->option & p->valid) == 0) continue; (awk->option & bfn->valid) == 0) continue;
pair = ase_awk_map_get (awk->kwtab, p->name.ptr, p->name.len); pair = ase_awk_map_get (
awk->kwtab, bfn->name.ptr, bfn->name.len);
if (pair != ASE_NULL) if (pair != ASE_NULL)
{ {
/* found in the customized word table */
k = ((ase_cstr_t*)(pair->val))->ptr; k = ((ase_cstr_t*)(pair->val))->ptr;
l = ((ase_cstr_t*)(pair->val))->len; l = ((ase_cstr_t*)(pair->val))->len;
} }
else else
{ {
k = p->name.ptr; k = bfn->name.ptr;
l = p->name.len; l = bfn->name.len;
} }
if (ase_strxncmp (k, l, name, len) == 0) return p; if (ase_strxncmp (k, l, name, len) == 0) return bfn;
} }
for (p = awk->bfn.user; p != ASE_NULL; p = p->next) /* no setword related operation for user-defined instrinc function
{ * as the name can be decided by the user upon addition. */
if (p->valid != 0 &&
(awk->option & p->valid) == 0) continue;
pair = ase_awk_map_get (awk->kwtab, p->name.ptr, p->name.len); pair = ase_awk_map_get (awk->bfn.user, name, len);
if (pair != ASE_NULL) if (pair == ASE_NULL) return ASE_NULL;
{
k = ((ase_cstr_t*)(pair->val))->ptr;
l = ((ase_cstr_t*)(pair->val))->len;
}
else
{
k = p->name.ptr;
l = p->name.len;
}
if (ase_strxncmp (k, l, name, len) == 0) return p; bfn = (ase_awk_bfn_t*)pair->val;
} if (bfn->valid != 0 && (awk->option & bfn->valid) == 0) return ASE_NULL;
return ASE_NULL; return bfn;
} }
static int bfn_close ( static int bfn_close (

View File

@ -1,5 +1,5 @@
/* /*
* $Id: func.h,v 1.3 2007/04/30 05:47:33 bacon Exp $ * $Id: func.h,v 1.4 2007/10/24 09:57:45 bacon Exp $
* *
* {License} * {License}
*/ */
@ -32,7 +32,7 @@ struct ase_awk_bfn_t
int (*handler) (ase_awk_run_t*, const ase_char_t*, ase_size_t); int (*handler) (ase_awk_run_t*, const ase_char_t*, ase_size_t);
ase_awk_bfn_t* next; /*ase_awk_bfn_t* next;*/
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -27,7 +27,11 @@ EXPORTS
Java_ase_awk_Argument_getstrval Java_ase_awk_Argument_getstrval
Java_ase_awk_Argument_isindexed Java_ase_awk_Argument_isindexed
Java_ase_awk_Argument_getindexed Java_ase_awk_Argument_getindexed
Java_ase_awk_Return_isindexed
Java_ase_awk_Return_setintval Java_ase_awk_Return_setintval
Java_ase_awk_Return_setrealval Java_ase_awk_Return_setrealval
Java_ase_awk_Return_setstrval Java_ase_awk_Return_setstrval
Java_ase_awk_Return_setindexedintval
Java_ase_awk_Return_setindexedrealval
Java_ase_awk_Return_setindexedstrval
Java_ase_awk_Return_clearval Java_ase_awk_Return_clearval

View File

@ -1,5 +1,5 @@
/* /*
* $Id: jni.c,v 1.38 2007/10/24 04:58:35 bacon Exp $ * $Id: jni.c,v 1.40 2007/10/24 14:17:32 bacon Exp $
* *
* {License} * {License}
*/ */
@ -360,7 +360,7 @@ static void throw_exception (
} }
#define THROW_STATIC_EXCEPTION(env,errnum) \ #define THROW_STATIC_EXCEPTION(env,errnum) \
throw_exception (env, ase_awk_geterrstr(ASE_ASE_NULL, errnum), errnum, 0) throw_exception (env, ase_awk_geterrstr(ASE_NULL, errnum), errnum, 0)
#define EXCEPTION_ON_ASE_NULL_AWK(env,awk) \ #define EXCEPTION_ON_ASE_NULL_AWK(env,awk) \
if (awk == ASE_NULL) \ if (awk == ASE_NULL) \
@ -605,7 +605,7 @@ static ase_char_t* java_strxdup (ase_awk_t* awk, const jchar* str, jint len)
ase_size_t i; ase_size_t i;
tmp = (ase_char_t*) ase_awk_malloc (awk, (len+1) * ASE_SIZEOF(ase_char_t)); tmp = (ase_char_t*) ase_awk_malloc (awk, (len+1) * ASE_SIZEOF(ase_char_t));
if (tmp == ASE_ASE_NULL) return ASE_ASE_NULL; if (tmp == ASE_NULL) return ASE_NULL;
for (i = 0; i < (ase_size_t)len; i++) tmp[i] = (ase_char_t)str[i]; for (i = 0; i < (ase_size_t)len; i++) tmp[i] = (ase_char_t)str[i];
tmp[i] = ASE_T('\0'); tmp[i] = ASE_T('\0');
@ -617,7 +617,7 @@ static ase_char_t* java_strxdup (ase_awk_t* awk, const jchar* str, jint len)
ase_char_t* tmp; ase_char_t* tmp;
tmp = (ase_char_t*) ase_awk_malloc (awk, (len+1) * ASE_SIZEOF(ase_char_t)); tmp = (ase_char_t*) ase_awk_malloc (awk, (len+1) * ASE_SIZEOF(ase_char_t));
if (tmp == ASE_ASE_NULL) return ASE_ASE_NULL; if (tmp == ASE_NULL) return ASE_NULL;
ase_strncpy (tmp, (ase_char_t*)str, (ase_size_t)len); ase_strncpy (tmp, (ase_char_t*)str, (ase_size_t)len);
return tmp; return tmp;
@ -758,7 +758,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jlong awk
runio_data.obj = obj; runio_data.obj = obj;
runios.pipe = process_extio; runios.pipe = process_extio;
runios.coproc = ASE_ASE_NULL; runios.coproc = ASE_NULL;
runios.file = process_extio; runios.file = process_extio;
runios.console = process_extio; runios.console = process_extio;
runios.custom_data = &runio_data; runios.custom_data = &runio_data;
@ -792,7 +792,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jlong awk
} }
mmm = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*(len+1)); mmm = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*(len+1));
if (mmm == ASE_ASE_NULL) if (mmm == ASE_NULL)
{ {
(*env)->ReleaseStringChars (env, mfn, ptr); (*env)->ReleaseStringChars (env, mfn, ptr);
DELETE_CLASS_REFS (env, run_data); DELETE_CLASS_REFS (env, run_data);
@ -1764,7 +1764,7 @@ static int handle_bfn (
{ {
jsize x; jsize x;
rptr = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len); rptr = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len);
if (rptr == ASE_ASE_NULL) if (rptr == ASE_NULL)
{ {
/* ran out of memory in exception handling. /* ran out of memory in exception handling.
* it is freaking studid. */ * it is freaking studid. */
@ -1837,7 +1837,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_addfunc (
jsize x; jsize x;
ase_char_t* tmp = (ase_char_t*) ase_char_t* tmp = (ase_char_t*)
ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len); ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len);
if (tmp == ASE_ASE_NULL) if (tmp == ASE_NULL)
{ {
(*env)->ReleaseStringChars (env, name, ptr); (*env)->ReleaseStringChars (env, name, ptr);
THROW_NOMEM_EXCEPTION (env); THROW_NOMEM_EXCEPTION (env);
@ -1846,13 +1846,13 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_addfunc (
for (x = 0; x < len; x++) tmp[x] = (ase_char_t)ptr[x]; for (x = 0; x < len; x++) tmp[x] = (ase_char_t)ptr[x];
n = (ase_awk_addfunc (awk, tmp, len, 0, n = (ase_awk_addfunc (awk, tmp, len, 0,
min_args, max_args, ASE_ASE_NULL, handle_bfn) == ASE_NULL)? -1: 0; min_args, max_args, ASE_NULL, handle_bfn) == ASE_NULL)? -1: 0;
ase_awk_free (awk, tmp); ase_awk_free (awk, tmp);
} }
else else
{ {
n = (ase_awk_addfunc (awk, (ase_char_t*)ptr, len, 0, n = (ase_awk_addfunc (awk, (ase_char_t*)ptr, len, 0,
min_args, max_args, ASE_ASE_NULL, handle_bfn) == ASE_NULL)? -1: 0; min_args, max_args, ASE_NULL, handle_bfn) == ASE_NULL)? -1: 0;
} }
@ -1898,7 +1898,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_delfunc (
jsize x; jsize x;
ase_char_t* tmp = (ase_char_t*) ase_char_t* tmp = (ase_char_t*)
ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len); ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len);
if (tmp == ASE_ASE_NULL) if (tmp == ASE_NULL)
{ {
(*env)->ReleaseStringChars (env, name, ptr); (*env)->ReleaseStringChars (env, name, ptr);
THROW_NOMEM_EXCEPTION (env); THROW_NOMEM_EXCEPTION (env);
@ -2003,7 +2003,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setword (
{ {
jsize x; jsize x;
ox = (ase_char_t*)ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*ol); ox = (ase_char_t*)ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*ol);
if (ox == ASE_ASE_NULL) if (ox == ASE_NULL)
{ {
if (nw != ASE_NULL) (*env)->ReleaseStringChars (env, nw, np); if (nw != ASE_NULL) (*env)->ReleaseStringChars (env, nw, np);
if (ow != ASE_NULL) (*env)->ReleaseStringChars (env, ow, op); if (ow != ASE_NULL) (*env)->ReleaseStringChars (env, ow, op);
@ -2020,7 +2020,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setword (
{ {
jsize x; jsize x;
nx = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*nl); nx = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*nl);
if (nx == ASE_ASE_NULL) if (nx == ASE_NULL)
{ {
if (ox != (ase_char_t*)op) ase_awk_free (awk, ox); if (ox != (ase_char_t*)op) ase_awk_free (awk, ox);
@ -2070,7 +2070,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setfilename (
jsize x; jsize x;
ase_char_t* tmp = (ase_char_t*) ase_char_t* tmp = (ase_char_t*)
ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len); ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len);
if (tmp == ASE_ASE_NULL) if (tmp == ASE_NULL)
{ {
(*env)->ReleaseStringChars (env, name, ptr); (*env)->ReleaseStringChars (env, name, ptr);
THROW_NOMEM_EXCEPTION (env); THROW_NOMEM_EXCEPTION (env);
@ -2115,7 +2115,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_setofilename (
jsize x; jsize x;
ase_char_t* tmp = (ase_char_t*) ase_char_t* tmp = (ase_char_t*)
ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len); ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len);
if (tmp == ASE_ASE_NULL) if (tmp == ASE_NULL)
{ {
(*env)->ReleaseStringChars (env, name, ptr); (*env)->ReleaseStringChars (env, name, ptr);
THROW_NOMEM_EXCEPTION (env); THROW_NOMEM_EXCEPTION (env);
@ -2296,7 +2296,7 @@ JNIEXPORT jint JNICALL Java_ase_awk_Awk_system (
ret = _tsystem(tmp); ret = _tsystem(tmp);
#else #else
char* mbs = (char*)ase_awk_malloc (awk, len*5+1); char* mbs = (char*)ase_awk_malloc (awk, len*5+1);
if (mbs == ASE_ASE_NULL) if (mbs == ASE_NULL)
{ {
ase_awk_free (awk, tmp); ase_awk_free (awk, tmp);
return -1; return -1;
@ -2363,8 +2363,8 @@ JNIEXPORT jstring JNICALL Java_ase_awk_Argument_getstrval (JNIEnv* env, jobject
jstring ret = ASE_NULL; jstring ret = ASE_NULL;
str = ase_awk_valtostr ( str = ase_awk_valtostr (
run, val, ASE_AWK_VALTOSTR_CLEAR, ASE_ASE_NULL, &len); run, val, ASE_AWK_VALTOSTR_CLEAR, ASE_NULL, &len);
if (str == ASE_ASE_NULL) if (str == ASE_NULL)
{ {
THROW_RUN_EXCEPTION (env, run); THROW_RUN_EXCEPTION (env, run);
return ret; return ret;
@ -2426,7 +2426,7 @@ JNIEXPORT jobject JNICALL Java_ase_awk_Argument_getindexed (JNIEnv* env, jobject
ase_char_t* rptr; ase_char_t* rptr;
ase_size_t len; ase_size_t len;
if (ASE_AWK_VAL_TYPE(val) != ASE_AWK_VAL_MAP) return ASE_ASE_NULL; if (ASE_AWK_VAL_TYPE(val) != ASE_AWK_VAL_MAP) return ASE_NULL;
len = (*env)->GetStringLength (env, index); len = (*env)->GetStringLength (env, index);
ptr = (*env)->GetStringChars (env, index, JNI_FALSE); ptr = (*env)->GetStringChars (env, index, JNI_FALSE);
@ -2436,7 +2436,7 @@ JNIEXPORT jobject JNICALL Java_ase_awk_Argument_getindexed (JNIEnv* env, jobject
{ {
ase_size_t x; ase_size_t x;
rptr = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len); rptr = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len);
if (rptr == ASE_ASE_NULL) if (rptr == ASE_NULL)
{ {
(*env)->ReleaseStringChars (env, index, ptr); (*env)->ReleaseStringChars (env, index, ptr);
goto nomem; goto nomem;
@ -2450,7 +2450,7 @@ JNIEXPORT jobject JNICALL Java_ase_awk_Argument_getindexed (JNIEnv* env, jobject
(*env)->ReleaseStringChars (env, index, ptr); (*env)->ReleaseStringChars (env, index, ptr);
/* the key is not found. it is not an error. val is just nil */ /* the key is not found. it is not an error. val is just nil */
if (pair == ASE_ASE_NULL) return ASE_ASE_NULL;; if (pair == ASE_NULL) return ASE_NULL;;
arg = (*env)->NewObject (env, arg = (*env)->NewObject (env,
run_data->argument_class, run_data->argument_class,
@ -2467,7 +2467,15 @@ nomem:
} }
THROW_NOMEM_EXCEPTION (env); THROW_NOMEM_EXCEPTION (env);
return ASE_ASE_NULL; return ASE_NULL;
}
JNIEXPORT jboolean JNICALL Java_ase_awk_Return_isindexed (JNIEnv* env, jobject obj, jlong runid, jlong valid)
{
ase_awk_run_t* run = (ase_awk_run_t*)runid;
ase_awk_val_t* val = (ase_awk_val_t*)valid;
return (val != ASE_NULL && ASE_AWK_VAL_TYPE(val) == ASE_AWK_VAL_MAP)? JNI_TRUE: JNI_FALSE;
} }
JNIEXPORT void JNICALL Java_ase_awk_Return_setintval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jlong newval) JNIEXPORT void JNICALL Java_ase_awk_Return_setintval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jlong newval)
@ -2554,43 +2562,321 @@ JNIEXPORT void JNICALL Java_ase_awk_Return_setindexedintval (JNIEnv* env, jobjec
{ {
ase_awk_run_t* run = (ase_awk_run_t*)runid; ase_awk_run_t* run = (ase_awk_run_t*)runid;
ase_awk_val_t* val = (ase_awk_val_t*)valid; ase_awk_val_t* val = (ase_awk_val_t*)valid;
ase_awk_val_t* nv;
ase_awk_t* awk; ase_awk_t* awk;
run_data_t* run_data; run_data_t* run_data;
int opt;
const jchar* jptr;
ase_char_t* aptr;
jsize len;
awk = ase_awk_getrunawk (run); awk = ase_awk_getrunawk (run);
run_data = (run_data_t*)ase_awk_getruncustomdata (run); run_data = (run_data_t*)ase_awk_getruncustomdata (run);
nv = ase_awk_makeintval (run, newval); opt = ase_awk_getoption (awk);
if (nv == ASE_NULL) if ((opt & ASE_AWK_MAPTOVAR) != ASE_AWK_MAPTOVAR)
{
/* refer to run_return in run.c */
ase_awk_setrunerrnum (run, ASE_AWK_EMAPNOTALLOWED);
THROW_RUN_EXCEPTION (env, run);
return;
}
if (val == ASE_NULL || ASE_AWK_VAL_TYPE(val) != ASE_AWK_VAL_MAP)
{
ase_awk_val_t* x;
ase_awk_val_t* x2;
ase_awk_pair_t* pair;
x = ase_awk_makemapval (run);
if (x == ASE_NULL)
{ {
THROW_RUN_EXCEPTION (env, run); THROW_RUN_EXCEPTION (env, run);
return; return;
} }
if (val != ASE_NULL) ase_awk_refupval (run, x);
x2 = ase_awk_makeintval (run, newval);
if (x2 == ASE_NULL)
{ {
if (ASE_AWK_VAL_TYPE(val) != ASE_AWK_VAL_MAP) ase_awk_refdownval (run, x);
{
map = ase_awk_makemapval (run);
if (map == ASE_NULL)
{
ase_awk_refupval (run, nv);
ase_awk_refdownval (run, nv);
THROW_RUN_EXCEPTION (env, run); THROW_RUN_EXCEPTION (env, run);
return; return;
} }
ase_awk_refupval (run, x2);
if (get_str(env,awk,index,&jptr,&aptr,&len) == -1)
{
ase_awk_refdownval (run, x2);
ase_awk_refdownval (run, x);
THROW_NOMEM_EXCEPTION (env);
return;
}
pair = ase_awk_map_put (
((ase_awk_val_map_t*)x)->map, aptr, len, x2);
free_str (env, awk, index, jptr, aptr);
if (pair == ASE_NULL)
{
ase_awk_refdownval (run, x2);
ase_awk_refdownval (run, x);
THROW_RUN_EXCEPTION (env, run);
return;
}
if (val != ASE_NULL) ase_awk_refdownval (run, val);
(*env)->SetLongField (env, obj, run_data->return_valid, (jlong)x);
}
else
{
ase_awk_val_t* x2;
ase_awk_pair_t* pair;
x2 = ase_awk_makeintval (run, newval);
if (x2 == ASE_NULL)
{
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refupval (run, x2);
if (get_str(env,awk,index,&jptr,&aptr,&len) == -1)
{
ase_awk_refdownval (run, x2);
THROW_NOMEM_EXCEPTION (env);
return;
}
pair = ase_awk_map_put (
((ase_awk_val_map_t*)val)->map, aptr, len, x2);
free_str (env, awk, index, jptr, aptr);
if (pair == ASE_NULL)
{
ase_awk_refdownval (run, x2);
THROW_NOMEM_EXCEPTION (env);
return;
}
} }
} }
JNIEXPORT void JNICALL Java_ase_awk_Return_setindexedrealval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index, jdouble newval)
{
ase_awk_run_t* run = (ase_awk_run_t*)runid;
ase_awk_val_t* val = (ase_awk_val_t*)valid;
ase_awk_t* awk;
run_data_t* run_data;
int opt;
const jchar* jptr;
ase_char_t* aptr;
jsize len;
awk = ase_awk_getrunawk (run);
run_data = (run_data_t*)ase_awk_getruncustomdata (run);
opt = ase_awk_getoption (awk);
if ((opt & ASE_AWK_MAPTOVAR) != ASE_AWK_MAPTOVAR)
{
/* refer to run_return in run.c */
ase_awk_setrunerrnum (run, ASE_AWK_EMAPNOTALLOWED);
THROW_RUN_EXCEPTION (env, run);
return;
} }
JNIEXPORT void JNICALL Java_ase_awk_Return_setindexedintval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index, jdouble newval) if (val == ASE_NULL || ASE_AWK_VAL_TYPE(val) != ASE_AWK_VAL_MAP)
{ {
ase_awk_val_t* x;
ase_awk_val_t* x2;
ase_awk_pair_t* pair;
x = ase_awk_makemapval (run);
if (x == ASE_NULL)
{
THROW_RUN_EXCEPTION (env, run);
return;
} }
JNIEXPORT void JNICALL Java_ase_awk_Return_setindexedintval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index, jstring newval) ase_awk_refupval (run, x);
x2 = ase_awk_makerealval (run, newval);
if (x2 == ASE_NULL)
{ {
ase_awk_refdownval (run, x);
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refupval (run, x2);
if (get_str(env,awk,index,&jptr,&aptr,&len) == -1)
{
ase_awk_refdownval (run, x2);
ase_awk_refdownval (run, x);
THROW_NOMEM_EXCEPTION (env);
return;
}
pair = ase_awk_map_put (
((ase_awk_val_map_t*)x)->map, aptr, len, x2);
free_str (env, awk, index, jptr, aptr);
if (pair == ASE_NULL)
{
ase_awk_refdownval (run, x2);
ase_awk_refdownval (run, x);
THROW_RUN_EXCEPTION (env, run);
return;
}
if (val != ASE_NULL) ase_awk_refdownval (run, val);
(*env)->SetLongField (env, obj, run_data->return_valid, (jlong)x);
}
else
{
ase_awk_val_t* x2;
ase_awk_pair_t* pair;
x2 = ase_awk_makerealval (run, newval);
if (x2 == ASE_NULL)
{
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refupval (run, x2);
if (get_str(env,awk,index,&jptr,&aptr,&len) == -1)
{
ase_awk_refdownval (run, x2);
THROW_NOMEM_EXCEPTION (env);
return;
}
pair = ase_awk_map_put (
((ase_awk_val_map_t*)val)->map, aptr, len, x2);
free_str (env, awk, index, jptr, aptr);
if (pair == ASE_NULL)
{
ase_awk_refdownval (run, x2);
THROW_NOMEM_EXCEPTION (env);
return;
}
}
}
JNIEXPORT void JNICALL Java_ase_awk_Return_setindexedstrval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index, jstring newval)
{
ase_awk_run_t* run = (ase_awk_run_t*)runid;
ase_awk_val_t* val = (ase_awk_val_t*)valid;
ase_awk_t* awk;
run_data_t* run_data;
int opt;
const jchar* jptr;
ase_char_t* aptr;
jsize len;
awk = ase_awk_getrunawk (run);
run_data = (run_data_t*)ase_awk_getruncustomdata (run);
opt = ase_awk_getoption (awk);
if ((opt & ASE_AWK_MAPTOVAR) != ASE_AWK_MAPTOVAR)
{
/* refer to run_return in run.c */
ase_awk_setrunerrnum (run, ASE_AWK_EMAPNOTALLOWED);
THROW_RUN_EXCEPTION (env, run);
return;
}
if (val == ASE_NULL || ASE_AWK_VAL_TYPE(val) != ASE_AWK_VAL_MAP)
{
ase_awk_val_t* x;
ase_awk_val_t* x2;
ase_awk_pair_t* pair;
x = ase_awk_makemapval (run);
if (x == ASE_NULL)
{
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refupval (run, x);
if (get_str(env,awk,newval,&jptr,&aptr,&len) == -1)
{
ase_awk_refdownval (run, x);
THROW_NOMEM_EXCEPTION (env);
return;
}
x2 = ase_awk_makestrval (run, aptr, len);
free_str (env, awk, index, jptr, aptr);
if (x2 == ASE_NULL)
{
ase_awk_refdownval (run, x);
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refupval (run, x2);
if (get_str(env,awk,index,&jptr,&aptr,&len) == -1)
{
ase_awk_refdownval (run, x2);
ase_awk_refdownval (run, x);
THROW_NOMEM_EXCEPTION (env);
return;
}
pair = ase_awk_map_put (
((ase_awk_val_map_t*)x)->map, aptr, len, x2);
free_str (env, awk, index, jptr, aptr);
if (pair == ASE_NULL)
{
ase_awk_refdownval (run, x2);
ase_awk_refdownval (run, x);
THROW_RUN_EXCEPTION (env, run);
return;
}
if (val != ASE_NULL) ase_awk_refdownval (run, val);
(*env)->SetLongField (env, obj, run_data->return_valid, (jlong)x);
}
else
{
ase_awk_val_t* x2;
ase_awk_pair_t* pair;
if (get_str(env,awk,newval,&jptr,&aptr,&len) == -1)
{
THROW_NOMEM_EXCEPTION (env);
return;
}
x2 = ase_awk_makestrval (run, aptr, len);
free_str (env, awk, index, jptr, aptr);
if (x2 == ASE_NULL)
{
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refupval (run, x2);
if (get_str(env,awk,index,&jptr,&aptr,&len) == -1)
{
ase_awk_refdownval (run, x2);
THROW_NOMEM_EXCEPTION (env);
return;
}
pair = ase_awk_map_put (
((ase_awk_val_map_t*)val)->map, aptr, len, x2);
free_str (env, awk, index, jptr, aptr);
if (pair == ASE_NULL)
{
ase_awk_refdownval (run, x2);
THROW_NOMEM_EXCEPTION (env);
return;
}
}
} }

View File

@ -26,7 +26,11 @@ EXPORTS
Java_ase_awk_Argument_getstrval Java_ase_awk_Argument_getstrval
Java_ase_awk_Argument_isindexed Java_ase_awk_Argument_isindexed
Java_ase_awk_Argument_getindexed Java_ase_awk_Argument_getindexed
Java_ase_awk_Return_isindexed
Java_ase_awk_Return_setintval Java_ase_awk_Return_setintval
Java_ase_awk_Return_setrealval Java_ase_awk_Return_setrealval
Java_ase_awk_Return_setstrval Java_ase_awk_Return_setstrval
Java_ase_awk_Return_setindexedintval
Java_ase_awk_Return_setindexedrealval
Java_ase_awk_Return_setindexedstrval
Java_ase_awk_Return_clearval Java_ase_awk_Return_clearval

View File

@ -1,5 +1,5 @@
/* /*
* $Id: jni.h,v 1.14 2007/10/24 04:58:35 bacon Exp $ * $Id: jni.h,v 1.15 2007/10/24 14:17:32 bacon Exp $
* *
* {License} * {License}
*/ */
@ -67,9 +67,13 @@ JNIEXPORT jstring JNICALL Java_ase_awk_Argument_getstrval (JNIEnv* env, jobject
JNIEXPORT jboolean JNICALL Java_ase_awk_Argument_isindexed (JNIEnv* env, jobject obj, jlong runid, jlong valid); JNIEXPORT jboolean JNICALL Java_ase_awk_Argument_isindexed (JNIEnv* env, jobject obj, jlong runid, jlong valid);
JNIEXPORT jobject JNICALL Java_ase_awk_Argument_getindexed (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index); JNIEXPORT jobject JNICALL Java_ase_awk_Argument_getindexed (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index);
JNIEXPORT jboolean JNICALL Java_ase_awk_Return_isindexed (JNIEnv* env, jobject obj, jlong runid, jlong valid);
JNIEXPORT void JNICALL Java_ase_awk_Return_setintval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jlong newval); JNIEXPORT void JNICALL Java_ase_awk_Return_setintval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jlong newval);
JNIEXPORT void JNICALL Java_ase_awk_Return_setrealval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jdouble newval); JNIEXPORT void JNICALL Java_ase_awk_Return_setrealval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jdouble newval);
JNIEXPORT void JNICALL Java_ase_awk_Return_setstrval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring newval); JNIEXPORT void JNICALL Java_ase_awk_Return_setstrval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring newval);
JNIEXPORT void JNICALL Java_ase_awk_Return_setindexedintval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index, jlong newval);
JNIEXPORT void JNICALL Java_ase_awk_Return_setindexedrealval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index, jdouble newval);
JNIEXPORT void JNICALL Java_ase_awk_Return_setindexedstrval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index, jstring newval);
JNIEXPORT void JNICALL Java_ase_awk_Return_clearval (JNIEnv* env, jobject obj, jlong runid, jlong valid); JNIEXPORT void JNICALL Java_ase_awk_Return_clearval (JNIEnv* env, jobject obj, jlong runid, jlong valid);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
* $Id: parse.c,v 1.20 2007/10/10 07:03:56 bacon Exp $ * $Id: parse.c,v 1.22 2007/10/24 14:17:32 bacon Exp $
* *
* {License} * {License}
*/ */
@ -3027,6 +3027,26 @@ static ase_awk_nde_t* parse_primary_ident (ase_awk_t* awk, ase_size_t line)
} }
/* search the global variable list */ /* search the global variable list */
// TODO soemthing for setword
//ase_awk_pair_t* pair;
//const ase_char_t* k;
//ase_size_t l;
//check if name_dup and name_len is part of gtab....
//if it is so...
//pair = ase_awk_map_get (awk->kwtab, name_dup, name_len);
//if (pair != ASE_NULL)
//{
/* found in the customized word table */
// k = ((ase_cstr_t*)(pair->val))->ptr;
// l = ((ase_cstr_t*)(pair->val))->len;
//}
//else
//{
// k = name_dup;
// l = name_len;
//}
idxa = ase_awk_tab_rrfind ( idxa = ase_awk_tab_rrfind (
&awk->parse.globals, 0, name_dup, name_len); &awk->parse.globals, 0, name_dup, name_len);
if (idxa != (ase_size_t)-1) if (idxa != (ase_size_t)-1)
@ -3163,6 +3183,7 @@ static ase_awk_nde_t* parse_hashidx (
/* search the global variable list */ /* search the global variable list */
idxa = ase_awk_tab_rrfind(&awk->parse.globals, 0, name, name_len); idxa = ase_awk_tab_rrfind(&awk->parse.globals, 0, name, name_len);
// TODO soemthing for setword
if (idxa != (ase_size_t)-1) if (idxa != (ase_size_t)-1)
{ {
nde->type = ASE_AWK_NDE_GLOBALIDX; nde->type = ASE_AWK_NDE_GLOBALIDX;

View File

@ -1,5 +1,5 @@
/* /*
* $Id: AseAwkPanel.java,v 1.8 2007/10/24 03:46:51 bacon Exp $ * $Id: AseAwkPanel.java,v 1.10 2007/10/24 14:17:32 bacon Exp $
*/ */
import java.awt.*; import java.awt.*;
@ -92,13 +92,24 @@ public class AseAwkPanel extends Panel
this.awkPanel = awkPanel; this.awkPanel = awkPanel;
addFunction ("sleep", 1, 1); addFunction ("sleep", 1, 1);
setWord ("sin", "cain");
setWord ("length", "len");
setWord ("OFMT", "ofmt");
setOption (getOption() | StdAwk.OPTION_MAPTOVAR);
} }
public void sleep (Context ctx, String name, Return ret, Argument[] args) public void sleep (Context ctx, String name, Return ret, Argument[] args)
{ {
try { Thread.sleep (args[0].getIntValue() * 1000); } try { Thread.sleep (args[0].getIntValue() * 1000); }
catch (InterruptedException e) {} catch (InterruptedException e) {}
ret.setIntValue (0); //ret.setIntValue (0);
//
ret.setIndexedRealValue (1, 111.23);
ret.setIndexedStringValue (2, "kdk2kd");
ret.setIndexedStringValue (3, "3dk3kd");
ret.setIndexedIntValue (4, 444);
ret.setIndexedIntValue (5, 55555);
} }
protected int openSource (int mode) protected int openSource (int mode)