Recovered from cvs revision 2007-10-23 15:18:00

This commit is contained in:
hyung-hwan 2007-10-24 00:18:00 +00:00
parent 2c5bbc7552
commit 4c0af4e075
21 changed files with 745 additions and 703 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: Argument.java,v 1.5 2007/10/19 15:02:33 bacon Exp $
* $Id: Argument.java,v 1.6 2007/10/21 13:58:47 bacon Exp $
*/
package ase.awk;
@ -9,6 +9,11 @@ public class Argument
protected long runid;
protected long valid;
/* An instance of the Argument class should not be used
* outside the context where it is availble. When it is
* referenced that way, the getXXX methods may cause
* JVM to crash */
Argument (long runid, long valid)
{
this.runid = runid;

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp,v 1.79 2007/10/20 15:06:26 bacon Exp $
* $Id: Awk.cpp,v 1.80 2007/10/21 13:58:47 bacon Exp $
*
* {License}
*/
@ -532,11 +532,7 @@ int Awk::Return::set (long_t v)
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_val_t* x = ase_awk_makeintval (this->run->run, v);
if (x == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x == ASE_NULL) return -1;
ase_awk_refdownval (this->run->run, this->val);
this->val = x;
@ -550,11 +546,7 @@ int Awk::Return::set (real_t v)
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_val_t* x = ase_awk_makerealval (this->run->run, v);
if (x == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x == ASE_NULL) return -1;
ase_awk_refdownval (this->run->run, this->val);
this->val = x;
@ -568,11 +560,7 @@ int Awk::Return::set (const char_t* ptr, size_t len)
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_val_t* x = ase_awk_makestrval (this->run->run, ptr, len);
if (x == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x == ASE_NULL) return -1;
ase_awk_refdownval (this->run->run, this->val);
this->val = x;
@ -601,18 +589,14 @@ int Awk::Return::setIndexed (const char_t* idx, size_t iln, long_t v)
if (ASE_AWK_VAL_TYPE(this->val) != ASE_AWK_VAL_MAP)
{
ase_awk_val_t* x = ase_awk_makemapval (this->run->run);
if (x == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x == ASE_NULL) return -1;
ase_awk_refupval (this->run->run, x);
ase_awk_val_t* x2 = ase_awk_makeintval (this->run->run, v);
if (x2 == ASE_NULL)
{
ase_awk_refdownval (this->run->run, x);
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -634,11 +618,7 @@ int Awk::Return::setIndexed (const char_t* idx, size_t iln, long_t v)
else
{
ase_awk_val_t* x2 = ase_awk_makeintval (this->run->run, v);
if (x2 == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x2 == ASE_NULL) return -1;
ase_awk_refupval (this->run->run, x2);
@ -670,18 +650,14 @@ int Awk::Return::setIndexed (const char_t* idx, size_t iln, real_t v)
if (ASE_AWK_VAL_TYPE(this->val) != ASE_AWK_VAL_MAP)
{
ase_awk_val_t* x = ase_awk_makemapval (this->run->run);
if (x == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x == ASE_NULL) return -1;
ase_awk_refupval (this->run->run, x);
ase_awk_val_t* x2 = ase_awk_makerealval (this->run->run, v);
if (x2 == ASE_NULL)
{
ase_awk_refdownval (this->run->run, x);
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -703,11 +679,7 @@ int Awk::Return::setIndexed (const char_t* idx, size_t iln, real_t v)
else
{
ase_awk_val_t* x2 = ase_awk_makerealval (this->run->run, v);
if (x2 == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x2 == ASE_NULL) return -1;
ase_awk_refupval (this->run->run, x2);
@ -739,18 +711,14 @@ int Awk::Return::setIndexed (const char_t* idx, size_t iln, const char_t* str, s
if (ASE_AWK_VAL_TYPE(this->val) != ASE_AWK_VAL_MAP)
{
ase_awk_val_t* x = ase_awk_makemapval (this->run->run);
if (x == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x == ASE_NULL) return -1;
ase_awk_refupval (this->run->run, x);
ase_awk_val_t* x2 = ase_awk_makestrval (this->run->run, str, sln);
if (x2 == ASE_NULL)
{
ase_awk_refdownval (this->run->run, x);
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -772,11 +740,7 @@ int Awk::Return::setIndexed (const char_t* idx, size_t iln, const char_t* str, s
else
{
ase_awk_val_t* x2 = ase_awk_makestrval (this->run->run, str, sln);
if (x2 == ASE_NULL)
{
this->run->setError (ERR_NOMEM, 0, ASE_NULL, 0);
return -1;
}
if (x2 == ASE_NULL) return -1;
ase_awk_refupval (this->run->run, x2);
@ -981,11 +945,7 @@ int Awk::Run::setGlobal (int id, long_t v)
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_val_t* tmp = ase_awk_makeintval (run, v);
if (tmp == ASE_NULL)
{
setError (ERR_NOMEM);
return -1;
}
if (tmp == ASE_NULL) return -1;
ase_awk_refupval (run, tmp);
int n = ase_awk_setglobal (this->run, id, tmp);
@ -998,11 +958,7 @@ int Awk::Run::setGlobal (int id, real_t v)
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_val_t* tmp = ase_awk_makerealval (run, v);
if (tmp == ASE_NULL)
{
setError (ERR_NOMEM);
return -1;
}
if (tmp == ASE_NULL) return -1;
ase_awk_refupval (run, tmp);
int n = ase_awk_setglobal (this->run, id, tmp);
@ -1015,11 +971,7 @@ int Awk::Run::setGlobal (int id, const char_t* ptr, size_t len)
ASE_ASSERT (run != ASE_NULL);
ase_awk_val_t* tmp = ase_awk_makestrval (run, ptr, len);
if (tmp == ASE_NULL)
{
setError (ERR_NOMEM);
return -1;
}
if (tmp == ASE_NULL) return -1;
ase_awk_refupval (run, tmp);
int n = ase_awk_setglobal (this->run, id, tmp);

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp,v 1.77 2007/10/15 16:10:09 bacon Exp $
* $Id: Awk.hpp,v 1.78 2007/10/21 07:59:35 bacon Exp $
*
* {License}
*/
@ -400,6 +400,7 @@ public:
enum ErrorCode
{
ERR_NOERR = ASE_AWK_ENOERR,
ERR_CUSTOM = ASE_AWK_ECUSTOM,
ERR_INVAL = ASE_AWK_EINVAL,
ERR_NOMEM = ASE_AWK_ENOMEM,
ERR_NOSUP = ASE_AWK_ENOSUP,

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.java,v 1.26 2007/10/19 03:50:32 bacon Exp $
* $Id: Awk.java,v 1.28 2007/10/21 13:58:47 bacon Exp $
*
* {License}
*/
@ -160,7 +160,7 @@ public abstract class Awk
}
protected Object handleFunction (
Context ctx, String name, Argument[] args) throws java.lang.Exception
Context ctx, String name, Argument[] args) throws Exception
{
String mn = (String)functionTable.get(name);
// name should always be found in this table.
@ -169,8 +169,33 @@ public abstract class Awk
Class c = this.getClass ();
Class[] a = { Context.class, String.class, Argument[].class };
Method m = c.getMethod (mn, a);
return m.invoke (this, /*new Object[] {*/ ctx, name, args/*}*/) ;
try
{
Method m = c.getMethod (mn, a);
return m.invoke (this, /*new Object[] {*/ ctx, name, args/*}*/) ;
}
catch (java.lang.reflect.InvocationTargetException e)
{
/* the underlying method has throw an exception */
Throwable t = e.getCause();
if (t == null)
{
throw new Exception (null, Exception.BFNIMPL);
}
else if (t instanceof Exception)
{
throw (Exception)t;
}
else
{
throw new Exception (
t.getMessage(), Exception.BFNIMPL);
}
}
catch (java.lang.Exception e)
{
throw new Exception (e.getMessage(), Exception.BFNIMPL);
}
}
/* == depth limiting == */

View File

@ -1,5 +1,5 @@
/*
* $Id: Exception.java,v 1.6 2007/10/10 07:03:56 bacon Exp $
* $Id: Exception.java,v 1.7 2007/10/21 07:59:35 bacon Exp $
*
* {License}
*/
@ -13,134 +13,135 @@ public class Exception extends java.lang.Exception
// generated by generrcode-java.awk
public static final int NOERR = 0;
public static final int INVAL = 1;
public static final int NOMEM = 2;
public static final int NOSUP = 3;
public static final int NOPER = 4;
public static final int NODEV = 5;
public static final int NOSPC = 6;
public static final int MFILE = 7;
public static final int MLINK = 8;
public static final int AGAIN = 9;
public static final int NOENT = 10;
public static final int EXIST = 11;
public static final int FTBIG = 12;
public static final int TBUSY = 13;
public static final int ISDIR = 14;
public static final int IOERR = 15;
public static final int OPEN = 16;
public static final int READ = 17;
public static final int WRITE = 18;
public static final int CLOSE = 19;
public static final int INTERN = 20;
public static final int RUNTIME = 21;
public static final int BLKNST = 22;
public static final int EXPRNST = 23;
public static final int SINOP = 24;
public static final int SINCL = 25;
public static final int SINRD = 26;
public static final int SOUTOP = 27;
public static final int SOUTCL = 28;
public static final int SOUTWR = 29;
public static final int LXCHR = 30;
public static final int LXDIG = 31;
public static final int LXUNG = 32;
public static final int ENDSRC = 33;
public static final int ENDCMT = 34;
public static final int ENDSTR = 35;
public static final int ENDREX = 36;
public static final int LBRACE = 37;
public static final int LPAREN = 38;
public static final int RPAREN = 39;
public static final int RBRACK = 40;
public static final int COMMA = 41;
public static final int SCOLON = 42;
public static final int COLON = 43;
public static final int STMEND = 44;
public static final int IN = 45;
public static final int NOTVAR = 46;
public static final int EXPRES = 47;
public static final int FUNC = 48;
public static final int WHILE = 49;
public static final int ASSIGN = 50;
public static final int IDENT = 51;
public static final int FNNAME = 52;
public static final int BLKBEG = 53;
public static final int BLKEND = 54;
public static final int DUPBEG = 55;
public static final int DUPEND = 56;
public static final int BFNRED = 57;
public static final int AFNRED = 58;
public static final int GBLRED = 59;
public static final int PARRED = 60;
public static final int DUPPAR = 61;
public static final int DUPGBL = 62;
public static final int DUPLCL = 63;
public static final int BADPAR = 64;
public static final int BADVAR = 65;
public static final int UNDEF = 66;
public static final int LVALUE = 67;
public static final int GBLTM = 68;
public static final int LCLTM = 69;
public static final int PARTM = 70;
public static final int DELETE = 71;
public static final int RESET = 72;
public static final int BREAK = 73;
public static final int CONTINUE = 74;
public static final int NEXTBEG = 75;
public static final int NEXTEND = 76;
public static final int NEXTFBEG = 77;
public static final int NEXTFEND = 78;
public static final int PRINTFARG = 79;
public static final int PREPST = 80;
public static final int GLNCPS = 81;
public static final int DIVBY0 = 82;
public static final int OPERAND = 83;
public static final int POSIDX = 84;
public static final int ARGTF = 85;
public static final int ARGTM = 86;
public static final int FNNONE = 87;
public static final int NOTIDX = 88;
public static final int NOTDEL = 89;
public static final int NOTMAP = 90;
public static final int NOTMAPIN = 91;
public static final int NOTMAPNILIN = 92;
public static final int NOTREF = 93;
public static final int NOTASS = 94;
public static final int IDXVALASSMAP = 95;
public static final int POSVALASSMAP = 96;
public static final int MAPTOSCALAR = 97;
public static final int SCALARTOMAP = 98;
public static final int MAPNOTALLOWED = 99;
public static final int VALTYPE = 100;
public static final int RDELETE = 101;
public static final int RRESET = 102;
public static final int RNEXTBEG = 103;
public static final int RNEXTEND = 104;
public static final int RNEXTFBEG = 105;
public static final int RNEXTFEND = 106;
public static final int BFNUSER = 107;
public static final int BFNIMPL = 108;
public static final int IOUSER = 109;
public static final int IONONE = 110;
public static final int IOIMPL = 111;
public static final int IONMEM = 112;
public static final int IONMNL = 113;
public static final int FMTARG = 114;
public static final int FMTCNV = 115;
public static final int CONVFMTCHR = 116;
public static final int OFMTCHR = 117;
public static final int REXRECUR = 118;
public static final int REXRPAREN = 119;
public static final int REXRBRACKET = 120;
public static final int REXRBRACE = 121;
public static final int REXUNBALPAR = 122;
public static final int REXCOLON = 123;
public static final int REXCRANGE = 124;
public static final int REXCCLASS = 125;
public static final int REXBRANGE = 126;
public static final int REXEND = 127;
public static final int REXGARBAGE = 128;
public static final int CUSTOM = 1;
public static final int INVAL = 2;
public static final int NOMEM = 3;
public static final int NOSUP = 4;
public static final int NOPER = 5;
public static final int NODEV = 6;
public static final int NOSPC = 7;
public static final int MFILE = 8;
public static final int MLINK = 9;
public static final int AGAIN = 10;
public static final int NOENT = 11;
public static final int EXIST = 12;
public static final int FTBIG = 13;
public static final int TBUSY = 14;
public static final int ISDIR = 15;
public static final int IOERR = 16;
public static final int OPEN = 17;
public static final int READ = 18;
public static final int WRITE = 19;
public static final int CLOSE = 20;
public static final int INTERN = 21;
public static final int RUNTIME = 22;
public static final int BLKNST = 23;
public static final int EXPRNST = 24;
public static final int SINOP = 25;
public static final int SINCL = 26;
public static final int SINRD = 27;
public static final int SOUTOP = 28;
public static final int SOUTCL = 29;
public static final int SOUTWR = 30;
public static final int LXCHR = 31;
public static final int LXDIG = 32;
public static final int LXUNG = 33;
public static final int ENDSRC = 34;
public static final int ENDCMT = 35;
public static final int ENDSTR = 36;
public static final int ENDREX = 37;
public static final int LBRACE = 38;
public static final int LPAREN = 39;
public static final int RPAREN = 40;
public static final int RBRACK = 41;
public static final int COMMA = 42;
public static final int SCOLON = 43;
public static final int COLON = 44;
public static final int STMEND = 45;
public static final int IN = 46;
public static final int NOTVAR = 47;
public static final int EXPRES = 48;
public static final int FUNC = 49;
public static final int WHILE = 50;
public static final int ASSIGN = 51;
public static final int IDENT = 52;
public static final int FNNAME = 53;
public static final int BLKBEG = 54;
public static final int BLKEND = 55;
public static final int DUPBEG = 56;
public static final int DUPEND = 57;
public static final int BFNRED = 58;
public static final int AFNRED = 59;
public static final int GBLRED = 60;
public static final int PARRED = 61;
public static final int DUPPAR = 62;
public static final int DUPGBL = 63;
public static final int DUPLCL = 64;
public static final int BADPAR = 65;
public static final int BADVAR = 66;
public static final int UNDEF = 67;
public static final int LVALUE = 68;
public static final int GBLTM = 69;
public static final int LCLTM = 70;
public static final int PARTM = 71;
public static final int DELETE = 72;
public static final int RESET = 73;
public static final int BREAK = 74;
public static final int CONTINUE = 75;
public static final int NEXTBEG = 76;
public static final int NEXTEND = 77;
public static final int NEXTFBEG = 78;
public static final int NEXTFEND = 79;
public static final int PRINTFARG = 80;
public static final int PREPST = 81;
public static final int GLNCPS = 82;
public static final int DIVBY0 = 83;
public static final int OPERAND = 84;
public static final int POSIDX = 85;
public static final int ARGTF = 86;
public static final int ARGTM = 87;
public static final int FNNONE = 88;
public static final int NOTIDX = 89;
public static final int NOTDEL = 90;
public static final int NOTMAP = 91;
public static final int NOTMAPIN = 92;
public static final int NOTMAPNILIN = 93;
public static final int NOTREF = 94;
public static final int NOTASS = 95;
public static final int IDXVALASSMAP = 96;
public static final int POSVALASSMAP = 97;
public static final int MAPTOSCALAR = 98;
public static final int SCALARTOMAP = 99;
public static final int MAPNOTALLOWED = 100;
public static final int VALTYPE = 101;
public static final int RDELETE = 102;
public static final int RRESET = 103;
public static final int RNEXTBEG = 104;
public static final int RNEXTEND = 105;
public static final int RNEXTFBEG = 106;
public static final int RNEXTFEND = 107;
public static final int BFNUSER = 108;
public static final int BFNIMPL = 109;
public static final int IOUSER = 110;
public static final int IONONE = 111;
public static final int IOIMPL = 112;
public static final int IONMEM = 113;
public static final int IONMNL = 114;
public static final int FMTARG = 115;
public static final int FMTCNV = 116;
public static final int CONVFMTCHR = 117;
public static final int OFMTCHR = 118;
public static final int REXRECUR = 119;
public static final int REXRPAREN = 120;
public static final int REXRBRACKET = 121;
public static final int REXRBRACE = 122;
public static final int REXUNBALPAR = 123;
public static final int REXCOLON = 124;
public static final int REXCRANGE = 125;
public static final int REXCCLASS = 126;
public static final int REXBRANGE = 127;
public static final int REXEND = 128;
public static final int REXGARBAGE = 129;
// end of error codes
public Exception ()
@ -153,7 +154,7 @@ public class Exception extends java.lang.Exception
public Exception (String msg)
{
super (msg);
this.code = NOERR;
this.code = CUSTOM;
this.line = 0;
}

View File

@ -1,9 +1,103 @@
/*
* $Id: Return.java,v 1.1 2007/10/15 16:10:10 bacon Exp $
* $Id: Return.java,v 1.2 2007/10/21 13:58:47 bacon Exp $
*/
package ase.awk;
public class Return
{
protected long runid;
protected long valid;
/* An instance of the Return class should not be used
* outside the context where it is availble. When it is
* referenced that way, the setXXX methods may cause
* JVM to crash */
Return (long runid, long valid)
{
this.runid = runid;
this.valid = valid;
}
public void setIntValue (long v)
{
setintval (this.runid, this.valid, v);
}
public void setIntValue (int v)
{
setintval (this.runid, this.valid, (long)v);
}
public void setIntValue (short v)
{
setintval (this.runid, this.valid, (long)v);
}
public void setIntValue (byte v)
{
setintval (this.runid, this.valid, (long)v);
}
public void setRealValue (double v)
{
setrealval (this.runid, this.valid, v);
}
public void setRealValue (float v)
{
setrealval (this.runid, this.valid, (double)v);
}
public void setStringValue (String v)
{
setstrval (this.runid, this.valid, v);
}
public void setIndexedIntValue (String index, long v)
{
setindexedintval (this.runid, this.valid, index, v);
}
public void setIndexedIntValue (String index, int v)
{
setindexedintval (this.runid, this.valid, index, (long)v);
}
public void setIndexedIntValue (String index, short v)
{
setindexedintval (this.runid, this.valid, index, (long)v);
}
public void setIndexedIntValue (String index, byte v)
{
setindexedintval (this.runid, this.valid, index, (long)v);
}
public void setIndexedRealValue (String index, double v)
{
setindexedrealval (this.runid, this.valid, index, v);
}
public void setIndexedRealValue (String index, float v)
{
setindexedrealval (this.runid, this.valid, index, (double)v);
}
public void setIndexedStringValue (String index, String v)
{
setindexedstrval (this.runid, this.valid, index, v);
}
protected native void setintval (long runid, long valid, long v);
protected native void setrealval (long runid, long valid, double v);
protected native void setstrval (long runid, long valid, String v);
protected native void setindexedintval (
long runid, long valid, String index, long v);
protected native void setindexedrealval (
long runid, long valid, String index, double v);
protected native void setindexedstrval (
long runid, long valid, String index, String v);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.java,v 1.17 2007/10/19 03:50:32 bacon Exp $
* $Id: StdAwk.java,v 1.18 2007/10/21 13:58:47 bacon Exp $
*
* {License}
*/
@ -331,49 +331,49 @@ public abstract class StdAwk extends Awk
}
/* == arithmetic built-in functions */
public Object sin (Context ctx, String name, Argument[] args) throws Exception
public Object sin (Context ctx, String name, Argument[] args)
{
return new Double (Math.sin(args[0].getRealValue()));
}
public Object cos (Context ctx, String name, Argument[] args) throws Exception
public Object cos (Context ctx, String name, Argument[] args)
{
return new Double (Math.cos(args[0].getRealValue()));
}
public Object tan (Context ctx, String name, Argument[] args) throws Exception
public Object tan (Context ctx, String name, Argument[] args)
{
return new Double (Math.tan(args[0].getRealValue()));
}
public Object atan (Context ctx, String name, Argument[] args) throws Exception
public Object atan (Context ctx, String name, Argument[] args)
{
return new Double (Math.atan(args[0].getRealValue()));
}
public Object atan2 (Context ctx, String name, Argument[] args) throws Exception
public Object atan2 (Context ctx, String name, Argument[] args)
{
double y = args[0].getRealValue();
double x = args[1].getRealValue();
return new Double (Math.atan2(y,x));
}
public Object log (Context ctx, String name, Argument[] args) throws Exception
public Object log (Context ctx, String name, Argument[] args)
{
return new Double (Math.log(args[0].getRealValue()));
}
public Object exp (Context ctx, String name, Argument[] args) throws Exception
public Object exp (Context ctx, String name, Argument[] args)
{
return new Double (Math.exp(args[0].getRealValue()));
}
public Object sqrt (Context ctx, String name, Argument[] args) throws Exception
public Object sqrt (Context ctx, String name, Argument[] args)
{
return new Double (Math.sqrt(args[0].getRealValue()));
}
public Object bfnint (Context ctx, String name, Argument[] args) throws Exception
public Object bfnint (Context ctx, String name, Argument[] args)
{
return new Long (args[0].getIntValue());
}
@ -383,7 +383,7 @@ public abstract class StdAwk extends Awk
return new Double (random.nextDouble ());
}
public Object srand (Context ctx, String name, Argument[] args) throws Exception
public Object srand (Context ctx, String name, Argument[] args)
{
long prev_seed = seed;

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h,v 1.20 2007/10/15 16:10:10 bacon Exp $
* $Id: awk.h,v 1.21 2007/10/21 07:59:35 bacon Exp $
*
* {License}
*/
@ -209,8 +209,9 @@ enum ase_awk_option_t
enum ase_awk_errnum_t
{
ASE_AWK_ENOERR, /* no error */
ASE_AWK_ECUSTOM, /* custom error */
ASE_AWK_EINVAL, /* invalid parameter */
ASE_AWK_EINVAL, /* invalid parameter or data */
ASE_AWK_ENOMEM, /* out of memory */
ASE_AWK_ENOSUP, /* not supported */
ASE_AWK_ENOPER, /* operation not allowed */

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c,v 1.9 2007/10/10 07:03:56 bacon Exp $
* $Id: err.c,v 1.10 2007/10/21 07:59:35 bacon Exp $
*
* {License}
*/
@ -11,8 +11,9 @@ static const ase_char_t* __geterrstr (int errnum)
static const ase_char_t* errstr[] =
{
ASE_T("no error"),
ASE_T("custom error"),
ASE_T("invalid parameter"),
ASE_T("invalid parameter or data"),
ASE_T("out of memory"),
ASE_T("not supported"),
ASE_T("operation not allowed"),

View File

@ -1,5 +1,5 @@
/*
* $Id: extio.c,v 1.4 2007/05/18 16:19:20 bacon Exp $
* $Id: extio.c,v 1.5 2007/10/21 13:58:47 bacon Exp $
*
* {License}
*/
@ -412,8 +412,7 @@ int ase_awk_readextio (
nr = ase_awk_makeintval (run, lv + 1);
if (nr == ASE_NULL)
{
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
ret = -1;
}
else

View File

@ -1,5 +1,5 @@
/*
* $Id: func.c,v 1.10 2007/09/25 11:25:48 bacon Exp $
* $Id: func.c,v 1.11 2007/10/21 13:58:47 bacon Exp $
*
* {License}
*/
@ -283,7 +283,7 @@ skip_close:
v = ase_awk_makeintval (run, (ase_long_t)n);
if (v == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -400,7 +400,7 @@ skip_flush:
a0 = ase_awk_makeintval (run, (ase_long_t)n);
if (a0 == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -463,7 +463,7 @@ static int bfn_index (
a0 = ase_awk_makeintval (run, idx);
if (a0 == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -498,7 +498,7 @@ static int bfn_length (
v = ase_awk_makeintval (run, len);
if (v == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -568,7 +568,7 @@ static int bfn_substr (
if (r == ASE_NULL)
{
if (a0->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -722,7 +722,7 @@ static int bfn_split (
ASE_AWK_FREE (run->awk, fs_free);
if (fs_rex_free != ASE_NULL)
ase_awk_freerex (run->awk, fs_rex_free);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -777,7 +777,7 @@ static int bfn_split (
ASE_AWK_FREE (run->awk, fs_free);
if (fs_rex_free != ASE_NULL)
ase_awk_freerex (run->awk, fs_rex_free);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -821,7 +821,7 @@ static int bfn_split (
t1 = ase_awk_makeintval (run, num);
if (t1 == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -860,7 +860,7 @@ static int bfn_tolower (
if (r == ASE_NULL)
{
if (a0->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -900,7 +900,7 @@ static int bfn_toupper (
if (r == ASE_NULL)
{
if (a0->type != ASE_AWK_VAL_STR) ASE_AWK_FREE (run->awk, str);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -1173,6 +1173,7 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count)
{
ase_str_close (&new);
FREE_A_PTRS (run->awk);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -1191,7 +1192,7 @@ static int __substitute (ase_awk_run_t* run, ase_long_t max_count)
v = ase_awk_makeintval (run, sub_count);
if (v == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -1292,7 +1293,7 @@ static int bfn_match (
a0 = ase_awk_makeintval (run, idx);
if (a0 == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -1303,7 +1304,7 @@ static int bfn_match (
if (a1 == ASE_NULL)
{
ase_awk_refdownval (run, a0);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}
@ -1387,7 +1388,7 @@ static int bfn_sprintf (
{
ase_str_close (&fbu);
ase_str_close (&out);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
/*ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);*/
return -1;
}

View File

@ -13,6 +13,7 @@ EXPORTS
Java_ase_awk_Awk_setoption
Java_ase_awk_Awk_getdebug
Java_ase_awk_Awk_setdebug
Java_ase_awk_Awk_setword
Java_ase_awk_Awk_addfunc
Java_ase_awk_Awk_delfunc
Java_ase_awk_Awk_setfilename

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.c,v 1.32 2007/10/20 15:06:26 bacon Exp $
* $Id: jni.c,v 1.35 2007/10/21 15:05:21 bacon Exp $
*
* {License}
*/
@ -42,6 +42,7 @@
#define CLASS_ARGUMENT "ase/awk/Argument"
#define FIELD_AWKID "awkid"
#define FIELD_RUNID "runid"
#define FIELD_VALID "valid"
#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER>=1400)
#pragma warning(disable:4996)
@ -264,7 +265,15 @@ void ase_assert_printf (const ase_char_t* fmt, ...)
{
va_list ap;
va_start (ap, fmt);
#ifdef _WIN32
{
TCHAR buf[512];
_vsntprintf (buf, ASE_COUNTOF(buf), fmt, ap);
MessageBox (NULL, buf, _T("ASSERTION FAILURE"), MB_OK | MB_ICONERROR);
}
#else
ase_vfprintf (stdout, fmt, ap);
#endif
va_end (ap);
}
#endif
@ -997,7 +1006,7 @@ static ase_ssize_t java_open_source (JNIEnv* env, jobject obj, int mode)
}
ret = (*env)->CallIntMethod (env, obj, mid, mode);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1034,7 +1043,7 @@ static ase_ssize_t java_close_source (JNIEnv* env, jobject obj, int mode)
}
ret = (*env)->CallIntMethod (env, obj, mid, mode);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1082,7 +1091,7 @@ static ase_ssize_t java_read_source (
}
ret = (*env)->CallIntMethod (env, obj, mid, array, size);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1140,7 +1149,7 @@ static ase_ssize_t java_write_source (
(*env)->ReleaseCharArrayElements (env, array, tmp, 0);
ret = (*env)->CallIntMethod (env, obj, mid, array, size);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1251,7 +1260,7 @@ static ase_ssize_t java_open_extio (
/* execute the method */
ret = (*env)->CallIntMethod (env, obj, mid, extio_object);
if ((*env)->ExceptionOccurred(env))
if ((*env)->ExceptionCheck(env))
{
/* clear the exception */
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
@ -1308,7 +1317,7 @@ static ase_ssize_t java_close_extio (
}
ret = (*env)->CallIntMethod (env, obj, mid, extio->handle);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1366,7 +1375,7 @@ static ase_ssize_t java_read_extio (
}
ret = (*env)->CallIntMethod (env, obj, mid, extio->handle, array, size);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1428,7 +1437,7 @@ static ase_ssize_t java_write_extio (
(*env)->ReleaseCharArrayElements (env, array, tmp, 0);
ret = (*env)->CallIntMethod (env, obj, mid, extio->handle, array, size);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1467,7 +1476,7 @@ static ase_ssize_t java_flush_extio (
}
ret = (*env)->CallIntMethod (env, obj, mid, extio->handle);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1503,7 +1512,7 @@ static ase_ssize_t java_next_extio (
}
ret = (*env)->CallIntMethod (env, obj, mid, extio->handle);
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -1694,7 +1703,7 @@ static int handle_bfn (
(*env)->DeleteLocalRef (env, name);
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
ase_awk_setrunerrnum (run, ASE_AWK_EBFNUSER);
ase_awk_setrunerrnum (run, ASE_AWK_EINTERN);
return -1;
}
@ -1716,10 +1725,9 @@ static int handle_bfn (
arg = (*env)->NewObject (env,
run_data->argument_class,
run_data->argument_init, (jlong)run, (jlong)v);
if (arg == NULL)
{
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk))
(*env)->ExceptionDescribe (env);
@ -1737,35 +1745,84 @@ static int handle_bfn (
ret = (*env)->CallObjectMethod (
env, obj, method, run_data->context_object, name, args);
throwable = (*env)->ExceptionOccurred (env);
throwable = (*env)->ExceptionOccurred(env);
if (throwable)
{
int code, line;
jint code;
jstring mesg;
ase_char_t* rptr;
const jchar* ptr;
jsize len;
jclass class;
OutputDebugStringA("0000\n");
code = (*env)->CallIntMethod (env, throwable, run_data->exception_get_code);
line = (*env)->CallIntMethod (env, throwable, run_data->exception_get_line);
mesg = (*env)->CallObjectMethod (env, throwable, run_data->exception_get_message);
OutputDebugStringA("222222\n");
if (is_debug(ase_awk_getrunawk(run)))
(*env)->ExceptionDescribe (env);
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
(*env)->DeleteLocalRef (env, args);
(*env)->DeleteLocalRef (env, name);
len = (*env)->GetStringLength (env, ret);
ptr = (*env)->GetStringChars (env, ret, JNI_FALSE);
class = (*env)->GetObjectClass (env, throwable);
if (!(*env)->IsSameObject(env,class,run_data->exception_class))
{
(*env)->DeleteLocalRef (env, class);
ase_awk_setrunerrnum (run, ASE_AWK_EBFNIMPL);
return -1;
}
(*env)->DeleteLocalRef (env, class);
ase_awk_setrunerrmsg (run, code, line, ptr);
code = (*env)->CallIntMethod (env, throwable, run_data->exception_get_code);
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
ase_awk_setrunerrnum (run, ASE_AWK_EBFNIMPL);
return -1;
}
if (code == ASE_AWK_ENOERR) code = ASE_AWK_EBFNIMPL;
/* the line information is not important in this context.
* it will be replaced by the underlying engine anyhow. */
/*line = (*env)->CallIntMethod (env, throwable, run_data->exception_get_line);*/
mesg = (*env)->CallObjectMethod (env, throwable, run_data->exception_get_message);
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
ase_awk_setrunerrnum (run, ASE_AWK_EBFNIMPL);
return -1;
}
if (mesg == NULL)
{
/* there is no message given */
ase_awk_setrunerrnum (run, code);
return -1;
}
len = (*env)->GetStringLength (env, mesg);
ptr = (*env)->GetStringChars (env, mesg, JNI_FALSE);
if (len > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t))
{
jsize x;
rptr = (ase_char_t*) ase_awk_malloc (awk, ASE_SIZEOF(ase_char_t)*len);
if (rptr == ASE_NULL)
{
/* ran out of memory in exception handling.
* it is freaking studid. */
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
goto error_in_exception_handler;
}
for (x = 0; x < len; x++) rptr[x] = (ase_char_t)ptr[x];
}
else rptr = (ase_char_t*)ptr;
ase_awk_setrunerrmsg (run, code, 0, rptr);
if (rptr != ptr) ase_awk_free (awk, rptr);
error_in_exception_handler:
(*env)->ReleaseStringChars (env, mesg, ptr);
(*env)->DeleteLocalRef (env, throwable);
(*env)->ReleaseStringChars (env, ret, ptr);
return -1;
}
@ -1785,7 +1842,6 @@ OutputDebugStringA("222222\n");
if (v == NULL)
{
(*env)->DeleteLocalRef (env, ret);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return -1;
}
@ -1801,7 +1857,6 @@ OutputDebugStringA("222222\n");
if (v == NULL)
{
(*env)->DeleteLocalRef (env, ret);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return -1;
}
@ -1817,7 +1872,6 @@ OutputDebugStringA("222222\n");
if (v == NULL)
{
(*env)->DeleteLocalRef (env, ret);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return -1;
}
@ -1832,7 +1886,6 @@ OutputDebugStringA("222222\n");
if (v == NULL)
{
(*env)->DeleteLocalRef (env, ret);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return -1;
}
@ -1847,7 +1900,6 @@ OutputDebugStringA("222222\n");
if (v == NULL)
{
(*env)->DeleteLocalRef (env, ret);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return -1;
}
@ -1894,7 +1946,6 @@ OutputDebugStringA("222222\n");
{
(*env)->ReleaseStringChars (env, ret, ptr);
(*env)->DeleteLocalRef (env, ret);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return -1;
}
@ -2444,8 +2495,7 @@ JNIEXPORT jlong JNICALL Java_ase_awk_Argument_getintval (JNIEnv* env, jobject ob
ase_long_t lv = 0;
ase_real_t rv = 0.0;
n = ase_awk_valtonum (
(ase_awk_run_t*)runid, (ase_awk_val_t*)valid, &lv, &rv);
n = ase_awk_valtonum (run, (ase_awk_val_t*)valid, &lv, &rv);
if (n == -1) THROW_RUN_EXCEPTION (env, run);
else if (n == 1) lv = (ase_long_t)rv;
@ -2459,8 +2509,7 @@ JNIEXPORT jdouble JNICALL Java_ase_awk_Argument_getrealval (JNIEnv* env, jobject
ase_long_t lv = 0;
ase_real_t rv = 0.0;
n = ase_awk_valtonum (
(ase_awk_run_t*)runid, (ase_awk_val_t*)valid, &lv, &rv);
n = ase_awk_valtonum (run, (ase_awk_val_t*)valid, &lv, &rv);
if (n == -1) THROW_RUN_EXCEPTION (env, run);
else if (n == 0) rv = (ase_real_t)lv;
@ -2510,7 +2559,7 @@ JNIEXPORT jstring JNICALL Java_ase_awk_Argument_getstrval (JNIEnv* env, jobject
if (ret == NULL)
{
nomem:
if ((*env)->ExceptionOccurred(env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -2575,7 +2624,7 @@ JNIEXPORT jobject JNICALL Java_ase_awk_Argument_getindexed (JNIEnv* env, jobject
return arg;
nomem:
if ((*env)->ExceptionOccurred (env))
if ((*env)->ExceptionCheck(env))
{
if (is_debug(awk)) (*env)->ExceptionDescribe (env);
(*env)->ExceptionClear (env);
@ -2585,3 +2634,94 @@ nomem:
return ASE_NULL;
}
JNIEXPORT void JNICALL Java_ase_awk_Return_setintval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jlong newval)
{
ase_awk_run_t* run = (ase_awk_run_t*)runid;
ase_awk_val_t* val = (ase_awk_val_t*)valid;
ase_awk_val_t* nv;
jclass class;
jfieldID field;
nv = ase_awk_makeintval (run, newval);
if (nv == NULL)
{
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refdownval (run, val);
class = (*env)->GetObjectClass(env, obj);
field = (*env)->GetFieldID (env, class, FIELD_VALID, "J");
(*env)->DeleteLocalRef (env, class);
if (field == NULL)
{
/* out of memory, field not found, etc */
return;
}
(*env)->SetLongField (env, obj, field, (jlong)nv);
ase_awk_refupval (run, nv); // should be refdowned when Return is invalidated....);
}
JNIEXPORT void JNICALL Java_ase_awk_Return_setrealval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jdouble newval)
{
ase_awk_run_t* run = (ase_awk_run_t*)runid;
ase_awk_val_t* val = (ase_awk_val_t*)valid;
ase_awk_val_t* nv;
jclass class;
jfieldID field;
nv = ase_awk_makerealval (run, newval);
if (nv == NULL)
{
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refdownval (run, val);
class = (*env)->GetObjectClass(env, obj);
field = (*env)->GetFieldID (env, class, FIELD_VALID, "J");
(*env)->DeleteLocalRef (env, class);
if (field == NULL)
{
/* out of memory, field not found, etc */
return;
}
(*env)->SetLongField (env, obj, field, (jlong)nv);
ase_awk_refupval (run, nv); // should be refdowned when Return is invalidated....);
}
JNIEXPORT void JNICALL Java_ase_awk_Return_setstrval (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring newval)
{
ase_awk_run_t* run = (ase_awk_run_t*)runid;
ase_awk_val_t* val = (ase_awk_val_t*)valid;
ase_awk_val_t* nv;
jclass class;
jfieldID field;
// TODO:....
nv = ase_awk_makerealval (run, newval);
if (nv == NULL)
{
THROW_RUN_EXCEPTION (env, run);
return;
}
ase_awk_refdownval (run, val);
class = (*env)->GetObjectClass(env, obj);
field = (*env)->GetFieldID (env, class, FIELD_VALID, "J");
(*env)->DeleteLocalRef (env, class);
if (field == NULL)
{
/* out of memory, field not found, etc */
return;
}
(*env)->SetLongField (env, obj, field, (jlong)nv);
ase_awk_refupval (run, nv); // should be refdowned when Return is invalidated....);
}

View File

@ -12,6 +12,7 @@ EXPORTS
Java_ase_awk_Awk_setoption
Java_ase_awk_Awk_getdebug
Java_ase_awk_Awk_setdebug
Java_ase_awk_Awk_setword
Java_ase_awk_Awk_addfunc
Java_ase_awk_Awk_delfunc
Java_ase_awk_Awk_setfilename

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.h,v 1.10 2007/10/19 15:02:33 bacon Exp $
* $Id: jni.h,v 1.12 2007/10/21 15:05:21 bacon Exp $
*
* {License}
*/
@ -67,6 +67,9 @@ 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 jobject JNICALL Java_ase_awk_Argument_getindexed (JNIEnv* env, jobject obj, jlong runid, jlong valid, jstring index);
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, jlong newval);
#ifdef __cplusplus
}
#endif

View File

@ -16,6 +16,9 @@ CFLAGS = /nologo /W3 -I..\..
CXXFLAGS = /nologo /W3 -I..\..
JAVACFLAGS = -classpath ..\.. -Xlint:unchecked
#LDFLAGS = /subsystem:console
LDFLAGS = /subsystem:windows
!IF "$(MODE)" == "debug"
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /MTd
CXXFLAGS = $(CXXFLAGS) -D_DEBUG -DDEBUG /MTd
@ -87,7 +90,7 @@ $(OUT_FILE_LIB_CXX): $(TMP_DIR_CXX) $(OUT_FILE_LIB) $(OBJ_FILES_LIB_CXX)
<<
$(OUT_FILE_JNI): $(OUT_FILE_LIB) $(OBJ_FILES_JNI)
$(LD) /dll /def:jni.def /subsystem:windows /release @<<
$(LD) /dll /def:jni.def $(LDFLAGS) /release @<<
/nologo /out:$(OUT_FILE_JNI) $(OBJ_FILES_JNI) /libpath:../$(MODE)/lib /implib:tmp.lib user32.lib $(OUT_FILE_LIB) asecmn.lib aseutl.lib
<<
del tmp.lib tmp.exp

View File

@ -1,5 +1,5 @@
/*
* $Id: rec.c,v 1.3 2007/04/30 05:47:33 bacon Exp $
* $Id: rec.c,v 1.4 2007/10/21 13:58:47 bacon Exp $
*
* {License}
*/
@ -41,8 +41,6 @@ int ase_awk_setrec (
if (v == ASE_NULL)
{
ase_awk_clrrec (run, ase_false);
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -73,7 +71,6 @@ int ase_awk_setrec (
if (v == ASE_NULL)
{
ase_awk_clrrec (run, ase_false);
ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -211,7 +208,6 @@ static int __split_record (ase_awk_run_t* run)
if (run->inrec.flds[run->inrec.nflds].val == ASE_NULL)
{
if (fs_free != ASE_NULL) ASE_AWK_FREE (run->awk, fs_free);
ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
@ -226,11 +222,7 @@ static int __split_record (ase_awk_run_t* run)
/* set the number of fields */
v = ase_awk_makeintval (run, (ase_long_t)nflds);
if (v == ASE_NULL)
{
ase_awk_setrunerror (run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
if (v == ASE_NULL) return -1;
if (ase_awk_setglobal (run, ASE_AWK_GLOBAL_NF, v) == -1) return -1;
@ -369,12 +361,7 @@ static int __recomp_record_fields (
}
tmp = ase_awk_makestrval (run, str,len);
if (tmp == ASE_NULL)
{
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
if (tmp == ASE_NULL) return -1;
if (i < nflds)
ase_awk_refdownval (run, run->inrec.flds[i].val);
@ -433,12 +420,7 @@ static int __recomp_record_fields (
if (((ase_awk_val_int_t*)v)->val != max)
{
v = ase_awk_makeintval (run, (ase_long_t)max);
if (v == ASE_NULL)
{
ase_awk_setrunerror (
run, ASE_AWK_ENOMEM, 0, ASE_NULL, 0);
return -1;
}
if (v == ASE_NULL) return -1;
if (ase_awk_setglobal (
run, ASE_AWK_GLOBAL_NF, v) == -1) return -1;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* $Id: val.c,v 1.9 2007/10/17 14:38:28 bacon Exp $
* $Id: val.c,v 1.10 2007/10/21 13:58:47 bacon Exp $
*
* {License}
*/
@ -77,7 +77,11 @@ ase_awk_val_t* ase_awk_makeintval (ase_awk_run_t* run, ase_long_t v)
{
val = (ase_awk_val_int_t*) ASE_AWK_MALLOC (
run->awk, ASE_SIZEOF(ase_awk_val_int_t));
if (val == ASE_NULL) return ASE_NULL;
if (val == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
}
val->type = ASE_AWK_VAL_INT;
@ -103,7 +107,11 @@ ase_awk_val_t* ase_awk_makerealval (ase_awk_run_t* run, ase_real_t v)
{
val = (ase_awk_val_real_t*) ASE_AWK_MALLOC (
run->awk, ASE_SIZEOF(ase_awk_val_real_t));
if (val == ASE_NULL) return ASE_NULL;
if (val == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
}
val->type = ASE_AWK_VAL_REAL;
@ -129,7 +137,11 @@ ase_awk_val_t* ase_awk_makestrval (
val = (ase_awk_val_str_t*) ASE_AWK_MALLOC (
run->awk, ASE_SIZEOF(ase_awk_val_str_t));
if (val == ASE_NULL) return ASE_NULL;
if (val == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
val->type = ASE_AWK_VAL_STR;
val->ref = 0;
@ -138,6 +150,7 @@ ase_awk_val_t* ase_awk_makestrval (
if (val->buf == ASE_NULL)
{
ASE_AWK_FREE (run->awk, val);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
@ -154,7 +167,11 @@ ase_awk_val_t* ase_awk_makestrval_nodup (
val = (ase_awk_val_str_t*) ASE_AWK_MALLOC (
run->awk, ASE_SIZEOF(ase_awk_val_str_t));
if (val == ASE_NULL) return ASE_NULL;
if (val == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
val->type = ASE_AWK_VAL_STR;
val->ref = 0;
@ -172,7 +189,11 @@ ase_awk_val_t* ase_awk_makestrval2 (
val = (ase_awk_val_str_t*) ASE_AWK_MALLOC (
run->awk, ASE_SIZEOF(ase_awk_val_str_t));
if (val == ASE_NULL) return ASE_NULL;
if (val == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
val->type = ASE_AWK_VAL_STR;
val->ref = 0;
@ -181,6 +202,7 @@ ase_awk_val_t* ase_awk_makestrval2 (
if (val->buf == ASE_NULL)
{
ASE_AWK_FREE (run->awk, val);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
@ -206,6 +228,7 @@ ase_awk_val_t* ase_awk_makerexval (
if (val->buf == ASE_NULL)
{
ASE_AWK_FREE (run->awk, val);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
@ -214,6 +237,7 @@ ase_awk_val_t* ase_awk_makerexval (
{
ASE_AWK_FREE (run->awk, val->buf);
ASE_AWK_FREE (run->awk, val);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
@ -238,7 +262,11 @@ ase_awk_val_t* ase_awk_makemapval (ase_awk_run_t* run)
val = (ase_awk_val_map_t*) ASE_AWK_MALLOC (
run->awk, ASE_SIZEOF(ase_awk_val_map_t));
if (val == ASE_NULL) return ASE_NULL;
if (val == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
val->type = ASE_AWK_VAL_MAP;
val->ref = 0;
@ -246,6 +274,7 @@ ase_awk_val_t* ase_awk_makemapval (ase_awk_run_t* run)
if (val->map == ASE_NULL)
{
ASE_AWK_FREE (run->awk, val);
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
@ -264,7 +293,11 @@ ase_awk_val_t* ase_awk_makerefval (ase_awk_run_t* run, int id, ase_awk_val_t** a
{
val = (ase_awk_val_ref_t*) ASE_AWK_MALLOC (
run->awk, ASE_SIZEOF(ase_awk_val_ref_t));
if (val == ASE_NULL) return ASE_NULL;
if (val == ASE_NULL)
{
ase_awk_setrunerrnum (run, ASE_AWK_ENOMEM);
return ASE_NULL;
}
}
val->type = ASE_AWK_VAL_REF;

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp,v 1.39 2007/10/10 13:22:12 bacon Exp $
* $Id: Awk.hpp,v 1.40 2007/10/21 07:59:35 bacon Exp $
*
* {License}
*/
@ -63,6 +63,7 @@ public:
enum class ERROR: int
{
NOERR = ASE::Awk::ERR_NOERR,
CUSTOM = ASE::Awk::ERR_CUSTOM,
INVAL = ASE::Awk::ERR_INVAL,
NOMEM = ASE::Awk::ERR_NOMEM,
NOSUP = ASE::Awk::ERR_NOSUP,

View File

@ -1,5 +1,5 @@
/*
* $Id: AseAwkPanel.java,v 1.6 2007/10/19 03:50:33 bacon Exp $
* $Id: AseAwkPanel.java,v 1.7 2007/10/21 13:58:47 bacon Exp $
*/
import java.awt.*;
@ -93,7 +93,7 @@ public class AseAwkPanel extends Panel
addFunction ("sleep", 1, 1);
}
public Object sleep (Context ctx, String name, Argument[] args) throws ase.awk.Exception
public Object sleep (Context ctx, String name, Argument[] args)
{
try { Thread.sleep (args[0].getIntValue() * 1000); }
catch (InterruptedException e) {}
@ -404,10 +404,11 @@ public class AseAwkPanel extends Panel
catch (ase.awk.Exception e)
{
int line = e.getLine();
int code = e.getCode();
if (line <= 0)
showMessage ("An exception occurred - " + e.getMessage());
showMessage ("An exception occurred - [" + code + "] " + e.getMessage());
else
showMessage ("An exception occurred - " + e.getMessage() + " at line " + line);
showMessage ("An exception occurred - [" + code + "] " + e.getMessage() + " at line " + line);
return;
}