This commit is contained in:
parent
04c12f891b
commit
c17dc12bbd
@ -924,20 +924,20 @@ const Awk::char_t* Awk::Run::getErrorMessage () const
|
|||||||
void Awk::Run::setError (ErrorCode code)
|
void Awk::Run::setError (ErrorCode code)
|
||||||
{
|
{
|
||||||
ASE_ASSERT (this->run != ASE_NULL);
|
ASE_ASSERT (this->run != ASE_NULL);
|
||||||
ase_awk_setrunerror (this->run, code, 0, ASE_NULL, 0);
|
ase_awk_setrunerror (this->run, (errnum_t)code, 0, ASE_NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::Run::setError (ErrorCode code, size_t line)
|
void Awk::Run::setError (ErrorCode code, size_t line)
|
||||||
{
|
{
|
||||||
ASE_ASSERT (this->run != ASE_NULL);
|
ASE_ASSERT (this->run != ASE_NULL);
|
||||||
ase_awk_setrunerror (this->run, code, line, ASE_NULL, 0);
|
ase_awk_setrunerror (this->run, (errnum_t)code, line, ASE_NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::Run::setError (ErrorCode code, size_t line, const char_t* arg)
|
void Awk::Run::setError (ErrorCode code, size_t line, const char_t* arg)
|
||||||
{
|
{
|
||||||
ASE_ASSERT (this->run != ASE_NULL);
|
ASE_ASSERT (this->run != ASE_NULL);
|
||||||
ase_cstr_t x = { arg, ase_strlen(arg) };
|
ase_cstr_t x = { arg, ase_strlen(arg) };
|
||||||
ase_awk_setrunerror (this->run, code, line, &x, 1);
|
ase_awk_setrunerror (this->run, (errnum_t)code, line, &x, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::Run::setError (
|
void Awk::Run::setError (
|
||||||
@ -945,14 +945,14 @@ void Awk::Run::setError (
|
|||||||
{
|
{
|
||||||
ASE_ASSERT (this->run != ASE_NULL);
|
ASE_ASSERT (this->run != ASE_NULL);
|
||||||
ase_cstr_t x = { arg, len };
|
ase_cstr_t x = { arg, len };
|
||||||
ase_awk_setrunerror (this->run, code, line, &x, 1);
|
ase_awk_setrunerror (this->run, (errnum_t)code, line, &x, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::Run::setErrorWithMessage (
|
void Awk::Run::setErrorWithMessage (
|
||||||
ErrorCode code, size_t line, const char_t* msg)
|
ErrorCode code, size_t line, const char_t* msg)
|
||||||
{
|
{
|
||||||
ASE_ASSERT (this->run != ASE_NULL);
|
ASE_ASSERT (this->run != ASE_NULL);
|
||||||
ase_awk_setrunerrmsg (this->run, code, line, msg);
|
ase_awk_setrunerrmsg (this->run, (errnum_t)code, line, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Awk::Run::setGlobal (int id, long_t v)
|
int Awk::Run::setGlobal (int id, long_t v)
|
||||||
@ -1023,9 +1023,9 @@ void* Awk::Run::getCustom () const
|
|||||||
// Awk
|
// Awk
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Awk::Awk (): awk (ASE_NULL), functionMap (ASE_NULL),
|
Awk::Awk (): /*awk (ASE_NULL), functionMap (ASE_NULL), */
|
||||||
sourceIn (Source::READ), sourceOut (Source::WRITE),
|
sourceIn (Source::READ), sourceOut (Source::WRITE)/*,
|
||||||
errnum (ERR_NOERR), errlin (0), runCallback (false)
|
errnum (ERR_NOERR), errlin (0), runCallback (false)*/
|
||||||
|
|
||||||
{
|
{
|
||||||
this->errmsg[0] = ASE_T('\0');
|
this->errmsg[0] = ASE_T('\0');
|
||||||
@ -1075,7 +1075,7 @@ void Awk::setError (ErrorCode code, size_t line, const char_t* arg, size_t len)
|
|||||||
if (awk != ASE_NULL)
|
if (awk != ASE_NULL)
|
||||||
{
|
{
|
||||||
ase_cstr_t x = { arg, len };
|
ase_cstr_t x = { arg, len };
|
||||||
ase_awk_seterror (awk, code, line, &x, 1);
|
ase_awk_seterror (awk, (errnum_t)code, line, &x, 1);
|
||||||
retrieveError ();
|
retrieveError ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1092,7 +1092,7 @@ void Awk::setErrorWithMessage (ErrorCode code, size_t line, const char_t* msg)
|
|||||||
{
|
{
|
||||||
if (awk != ASE_NULL)
|
if (awk != ASE_NULL)
|
||||||
{
|
{
|
||||||
ase_awk_seterrmsg (awk, code, line, msg);
|
ase_awk_seterrmsg (awk, (errnum_t)code, line, msg);
|
||||||
retrieveError ();
|
retrieveError ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1692,13 +1692,13 @@ void Awk::onRunStart (run_t* run, void* custom)
|
|||||||
r->awk->triggerOnRunStart (*r);
|
r->awk->triggerOnRunStart (*r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Awk::onRunEnd (run_t* run, int errnum, void* custom)
|
void Awk::onRunEnd (run_t* run, errnum_t errnum, void* custom)
|
||||||
{
|
{
|
||||||
Run* r = (Run*)custom;
|
Run* r = (Run*)custom;
|
||||||
|
|
||||||
if (errnum == ERR_NOERR && r->callbackFailed)
|
if (errnum == ERR_NOERR && r->callbackFailed)
|
||||||
{
|
{
|
||||||
ase_awk_setrunerrnum (r->run, ERR_NOMEM);
|
ase_awk_setrunerrnum (r->run, (errnum_t)ERR_NOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
r->awk->onRunEnd (*r);
|
r->awk->onRunEnd (*r);
|
||||||
|
@ -41,8 +41,6 @@ public:
|
|||||||
typedef ase_awk_map_t map_t;
|
typedef ase_awk_map_t map_t;
|
||||||
/** Represents a key/value pair */
|
/** Represents a key/value pair */
|
||||||
typedef ase_awk_pair_t pair_t;
|
typedef ase_awk_pair_t pair_t;
|
||||||
/** Represents the IO command */
|
|
||||||
typedef ase_awk_iocmd_t iocmd_t;
|
|
||||||
/** Represents the external I/O context */
|
/** Represents the external I/O context */
|
||||||
typedef ase_awk_extio_t extio_t;
|
typedef ase_awk_extio_t extio_t;
|
||||||
/** Represents the run-time context */
|
/** Represents the run-time context */
|
||||||
@ -50,6 +48,11 @@ public:
|
|||||||
/** Represents the underlying interpreter */
|
/** Represents the underlying interpreter */
|
||||||
typedef ase_awk_t awk_t;
|
typedef ase_awk_t awk_t;
|
||||||
|
|
||||||
|
/** Represents IO command */
|
||||||
|
typedef ase_awk_iocmd_t iocmd_t;
|
||||||
|
/** Represents the error number */
|
||||||
|
typedef ase_awk_errnum_t errnum_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the source code I/O context for Awk::parse.
|
* Represents the source code I/O context for Awk::parse.
|
||||||
* An instance of Awk::Source is passed to Awk::openSource,
|
* An instance of Awk::Source is passed to Awk::openSource,
|
||||||
@ -1056,7 +1059,7 @@ protected:
|
|||||||
static void freeFunctionMapValue (void* owner, void* value);
|
static void freeFunctionMapValue (void* owner, void* value);
|
||||||
|
|
||||||
static void onRunStart (run_t* run, void* custom);
|
static void onRunStart (run_t* run, void* custom);
|
||||||
static void onRunEnd (run_t* run, int errnum, void* custom);
|
static void onRunEnd (run_t* run, errnum_t errnum, void* custom);
|
||||||
static void onRunReturn (run_t* run, val_t* ret, void* custom);
|
static void onRunReturn (run_t* run, val_t* ret, void* custom);
|
||||||
static void onRunStatement (run_t* run, size_t line, void* custom);
|
static void onRunStatement (run_t* run, size_t line, void* custom);
|
||||||
|
|
||||||
|
@ -31,13 +31,15 @@ typedef struct ase_awk_runcbs_t ase_awk_runcbs_t;
|
|||||||
typedef struct ase_awk_runarg_t ase_awk_runarg_t;
|
typedef struct ase_awk_runarg_t ase_awk_runarg_t;
|
||||||
typedef struct ase_awk_rexfns_t ase_awk_rexfns_t;
|
typedef struct ase_awk_rexfns_t ase_awk_rexfns_t;
|
||||||
|
|
||||||
|
typedef enum ase_awk_iocmd_t ase_awk_iocmd_t;
|
||||||
|
typedef enum ase_awk_errnum_t ase_awk_errnum_t;
|
||||||
|
|
||||||
typedef ase_real_t (*ase_awk_pow_t) (void* custom, ase_real_t x, ase_real_t y);
|
typedef ase_real_t (*ase_awk_pow_t) (void* custom, ase_real_t x, ase_real_t y);
|
||||||
typedef int (*ase_awk_sprintf_t) (
|
typedef int (*ase_awk_sprintf_t) (
|
||||||
void* custom, ase_char_t* buf, ase_size_t size,
|
void* custom, ase_char_t* buf, ase_size_t size,
|
||||||
const ase_char_t* fmt, ...);
|
const ase_char_t* fmt, ...);
|
||||||
typedef void (*ase_awk_dprintf_t) (void* custom, const ase_char_t* fmt, ...);
|
typedef void (*ase_awk_dprintf_t) (void* custom, const ase_char_t* fmt, ...);
|
||||||
|
|
||||||
typedef enum ase_awk_iocmd_t ase_awk_iocmd_t;
|
|
||||||
typedef ase_ssize_t (*ase_awk_io_t) (
|
typedef ase_ssize_t (*ase_awk_io_t) (
|
||||||
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count);
|
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count);
|
||||||
|
|
||||||
@ -115,7 +117,7 @@ struct ase_awk_runcbs_t
|
|||||||
ase_awk_run_t* run, ase_awk_val_t* ret, void* custom_data);
|
ase_awk_run_t* run, ase_awk_val_t* ret, void* custom_data);
|
||||||
|
|
||||||
void (*on_end) (
|
void (*on_end) (
|
||||||
ase_awk_run_t* run, int errnum, void* custom_data);
|
ase_awk_run_t* run, ase_awk_errnum_t errnum, void* custom_data);
|
||||||
|
|
||||||
void* custom_data;
|
void* custom_data;
|
||||||
};
|
};
|
||||||
@ -472,16 +474,16 @@ int ase_awk_geterrnum (ase_awk_t* awk);
|
|||||||
ase_size_t ase_awk_geterrlin (ase_awk_t* awk);
|
ase_size_t ase_awk_geterrlin (ase_awk_t* awk);
|
||||||
const ase_char_t* ase_awk_geterrmsg (ase_awk_t* awk);
|
const ase_char_t* ase_awk_geterrmsg (ase_awk_t* awk);
|
||||||
|
|
||||||
void ase_awk_seterrnum (ase_awk_t* awk, int errnum);
|
void ase_awk_seterrnum (ase_awk_t* awk, ase_awk_errnum_t errnum);
|
||||||
void ase_awk_seterrmsg (ase_awk_t* awk,
|
void ase_awk_seterrmsg (ase_awk_t* awk,
|
||||||
int errnum, ase_size_t errlin, const ase_char_t* errmsg);
|
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg);
|
||||||
|
|
||||||
void ase_awk_geterror (
|
void ase_awk_geterror (
|
||||||
ase_awk_t* awk, int* errnum,
|
ase_awk_t* awk, int* errnum,
|
||||||
ase_size_t* errlin, const ase_char_t** errmsg);
|
ase_size_t* errlin, const ase_char_t** errmsg);
|
||||||
|
|
||||||
void ase_awk_seterror (
|
void ase_awk_seterror (
|
||||||
ase_awk_t* awk, int errnum, ase_size_t errlin,
|
ase_awk_t* awk, ase_awk_errnum_t errnum, ase_size_t errlin,
|
||||||
const ase_cstr_t* errarg, ase_size_t argcnt);
|
const ase_cstr_t* errarg, ase_size_t argcnt);
|
||||||
|
|
||||||
int ase_awk_getoption (ase_awk_t* awk);
|
int ase_awk_getoption (ase_awk_t* awk);
|
||||||
@ -621,16 +623,16 @@ ase_awk_map_t* ase_awk_getrunnamedvarmap (ase_awk_run_t* awk);
|
|||||||
int ase_awk_getrunerrnum (ase_awk_run_t* run);
|
int ase_awk_getrunerrnum (ase_awk_run_t* run);
|
||||||
ase_size_t ase_awk_getrunerrlin (ase_awk_run_t* run);
|
ase_size_t ase_awk_getrunerrlin (ase_awk_run_t* run);
|
||||||
const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run);
|
const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run);
|
||||||
void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum);
|
void ase_awk_setrunerrnum (ase_awk_run_t* run, ase_awk_errnum_t errnum);
|
||||||
void ase_awk_setrunerrmsg (ase_awk_run_t* run,
|
void ase_awk_setrunerrmsg (ase_awk_run_t* run,
|
||||||
int errnum, ase_size_t errlin, const ase_char_t* errmsg);
|
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg);
|
||||||
|
|
||||||
void ase_awk_getrunerror (
|
void ase_awk_getrunerror (
|
||||||
ase_awk_run_t* run, int* errnum,
|
ase_awk_run_t* run, int* errnum,
|
||||||
ase_size_t* errlin, const ase_char_t** errmsg);
|
ase_size_t* errlin, const ase_char_t** errmsg);
|
||||||
|
|
||||||
void ase_awk_setrunerror (
|
void ase_awk_setrunerror (
|
||||||
ase_awk_run_t* run, int errnum, ase_size_t errlin,
|
ase_awk_run_t* run, ase_awk_errnum_t errnum, ase_size_t errlin,
|
||||||
const ase_cstr_t* errarg, ase_size_t argcnt);
|
const ase_cstr_t* errarg, ase_size_t argcnt);
|
||||||
|
|
||||||
/* functions to manipulate intrinsic functions */
|
/* functions to manipulate intrinsic functions */
|
||||||
|
@ -218,7 +218,7 @@ struct ase_awk_t
|
|||||||
} tmp;
|
} tmp;
|
||||||
|
|
||||||
/* housekeeping */
|
/* housekeeping */
|
||||||
int errnum;
|
ase_awk_errnum_t errnum;
|
||||||
ase_size_t errlin;
|
ase_size_t errlin;
|
||||||
ase_char_t errmsg[256];
|
ase_char_t errmsg[256];
|
||||||
ase_char_t* errstr[ASE_AWK_NUMERRNUM];
|
ase_char_t* errstr[ASE_AWK_NUMERRNUM];
|
||||||
@ -355,7 +355,7 @@ struct ase_awk_run_t
|
|||||||
} max;
|
} max;
|
||||||
} depth;
|
} depth;
|
||||||
|
|
||||||
int errnum;
|
ase_awk_errnum_t errnum;
|
||||||
ase_size_t errlin;
|
ase_size_t errlin;
|
||||||
ase_char_t errmsg[256];
|
ase_char_t errmsg[256];
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <ase/awk/awk_i.h>
|
#include <ase/awk/awk_i.h>
|
||||||
|
|
||||||
static const ase_char_t* __geterrstr (int errnum)
|
static const ase_char_t* __geterrstr (ase_awk_errnum_t errnum)
|
||||||
{
|
{
|
||||||
static const ase_char_t* errstr[] =
|
static const ase_char_t* errstr[] =
|
||||||
{
|
{
|
||||||
@ -217,7 +217,7 @@ void ase_awk_geterror (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ase_awk_seterrnum (ase_awk_t* awk, int errnum)
|
void ase_awk_seterrnum (ase_awk_t* awk, ase_awk_errnum_t errnum)
|
||||||
{
|
{
|
||||||
awk->errnum = errnum;
|
awk->errnum = errnum;
|
||||||
awk->errlin = 0;
|
awk->errlin = 0;
|
||||||
@ -225,7 +225,7 @@ void ase_awk_seterrnum (ase_awk_t* awk, int errnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ase_awk_seterrmsg (ase_awk_t* awk,
|
void ase_awk_seterrmsg (ase_awk_t* awk,
|
||||||
int errnum, ase_size_t errlin, const ase_char_t* errmsg)
|
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg)
|
||||||
{
|
{
|
||||||
awk->errnum = errnum;
|
awk->errnum = errnum;
|
||||||
awk->errlin = errlin;
|
awk->errlin = errlin;
|
||||||
@ -233,7 +233,7 @@ void ase_awk_seterrmsg (ase_awk_t* awk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ase_awk_seterror (
|
void ase_awk_seterror (
|
||||||
ase_awk_t* awk, int errnum, ase_size_t errlin,
|
ase_awk_t* awk, ase_awk_errnum_t errnum, ase_size_t errlin,
|
||||||
const ase_cstr_t* errarg, ase_size_t argcnt)
|
const ase_cstr_t* errarg, ase_size_t argcnt)
|
||||||
{
|
{
|
||||||
const ase_char_t* errfmt;
|
const ase_char_t* errfmt;
|
||||||
@ -352,7 +352,7 @@ const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run)
|
|||||||
return run->errmsg;
|
return run->errmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum)
|
void ase_awk_setrunerrnum (ase_awk_run_t* run, ase_awk_errnum_t errnum)
|
||||||
{
|
{
|
||||||
run->errnum = errnum;
|
run->errnum = errnum;
|
||||||
run->errlin = 0;
|
run->errlin = 0;
|
||||||
@ -360,7 +360,7 @@ void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ase_awk_setrunerrmsg (ase_awk_run_t* run,
|
void ase_awk_setrunerrmsg (ase_awk_run_t* run,
|
||||||
int errnum, ase_size_t errlin, const ase_char_t* errmsg)
|
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg)
|
||||||
{
|
{
|
||||||
run->errnum = errnum;
|
run->errnum = errnum;
|
||||||
run->errlin = errlin;
|
run->errlin = errlin;
|
||||||
@ -383,7 +383,7 @@ void ase_awk_getrunerror (
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ase_awk_setrunerror (
|
void ase_awk_setrunerror (
|
||||||
ase_awk_run_t* run, int errnum, ase_size_t errlin,
|
ase_awk_run_t* run, ase_awk_errnum_t errnum, ase_size_t errlin,
|
||||||
const ase_cstr_t* errarg, ase_size_t argcnt)
|
const ase_cstr_t* errarg, ase_size_t argcnt)
|
||||||
{
|
{
|
||||||
const ase_char_t* errfmt;
|
const ase_char_t* errfmt;
|
||||||
|
@ -110,7 +110,7 @@ struct run_data_t
|
|||||||
jobject obj;
|
jobject obj;
|
||||||
|
|
||||||
ase_size_t errlin;
|
ase_size_t errlin;
|
||||||
int errnum;
|
ase_awk_errnum_t errnum;
|
||||||
ase_char_t errmsg[256];
|
ase_char_t errmsg[256];
|
||||||
|
|
||||||
jclass exception_class;
|
jclass exception_class;
|
||||||
|
@ -15,8 +15,21 @@ AR = tlib
|
|||||||
JAVAC = javac
|
JAVAC = javac
|
||||||
JAR = jar
|
JAR = jar
|
||||||
|
|
||||||
CFLAGS = -O2 -WM -WU -RT- -w -q -I..\..
|
|
||||||
CXXFLAGS = -O2 -WM -WU -RT- -w -q -I..\..
|
CFLAGS = -WM -WU -RT- -w -q -I..\..
|
||||||
|
CXXFLAGS = -WM -WU -RT- -w -q -I..\..
|
||||||
|
|
||||||
|
!IF "$(MODE)" == "debug"
|
||||||
|
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG
|
||||||
|
CXXFLAGS = $(CXXFLAGS) -D_DEBUG -DDEBUG
|
||||||
|
!ELSEIF "$(MODE)" == "release"
|
||||||
|
CFLAGS = $(CFLAGS) -DNDEBUG -O2
|
||||||
|
CXXFLAGS = $(CXXFLAGS) -DNDEBUG -O2
|
||||||
|
!ELSE
|
||||||
|
CFLAGS = $(CFLAGS)
|
||||||
|
CXXFLAGS = $(CXXFLAGS)
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
JAVACFLAGS = -classpath ..\.. -Xlint:unchecked
|
JAVACFLAGS = -classpath ..\.. -Xlint:unchecked
|
||||||
|
|
||||||
LDFLAGS = -Tpd -ap -Gn -c -q -L..\$(MODE)\lib
|
LDFLAGS = -Tpd -ap -Gn -c -q -L..\$(MODE)\lib
|
||||||
@ -26,7 +39,7 @@ LIBS = import32.lib cw32mt.lib asecmn.lib aseutl.lib $(NAME).lib
|
|||||||
OUT_DIR = ..\$(MODE)\lib
|
OUT_DIR = ..\$(MODE)\lib
|
||||||
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
||||||
OUT_FILE_JNI = $(OUT_DIR)\$(NAME)_jni.dll
|
OUT_FILE_JNI = $(OUT_DIR)\$(NAME)_jni.dll
|
||||||
OUT_FILE_LIB_CXX = $(OUT_DIR)\$(NAME)++.lib
|
OUT_FILE_LIB_CXX = "$(OUT_DIR)\$(NAME)++.lib"
|
||||||
OUT_FILE_JAR = $(OUT_DIR)\$(NAME).jar
|
OUT_FILE_JAR = $(OUT_DIR)\$(NAME).jar
|
||||||
|
|
||||||
TMP_DIR = $(MODE)
|
TMP_DIR = $(MODE)
|
||||||
@ -67,7 +80,13 @@ OBJ_FILES_JAR = \
|
|||||||
$(TMP_DIR)\ase\awk\Pipe.class \
|
$(TMP_DIR)\ase\awk\Pipe.class \
|
||||||
$(TMP_DIR)\ase\awk\Exception.class
|
$(TMP_DIR)\ase\awk\Exception.class
|
||||||
|
|
||||||
all: lib
|
TARGETS = lib
|
||||||
|
!if "$(JAVA_HOME)" != ""
|
||||||
|
TARGETS = $(TARGETS) jnidll jar
|
||||||
|
JNI_INC = -I"$(JAVA_HOME)\include" -I"$(JAVA_HOME)\include\win32"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
all: $(TARGETS)
|
||||||
|
|
||||||
lib: $(TMP_DIR) $(OUT_DIR) $(OUT_DIR_CXX) $(OUT_FILE_LIB) $(OUT_FILE_LIB_CXX)
|
lib: $(TMP_DIR) $(OUT_DIR) $(OUT_DIR_CXX) $(OUT_FILE_LIB) $(OUT_FILE_LIB_CXX)
|
||||||
|
|
||||||
@ -82,7 +101,7 @@ $(OUT_FILE_LIB): $(OBJ_FILES_LIB)
|
|||||||
!
|
!
|
||||||
|
|
||||||
$(OUT_FILE_LIB_CXX): $(OBJ_FILES_LIB_CXX)
|
$(OUT_FILE_LIB_CXX): $(OBJ_FILES_LIB_CXX)
|
||||||
$(AR) "$(OUT_FILE_LIB_CXX)" @&&!
|
$(AR) $(OUT_FILE_LIB_CXX) @&&!
|
||||||
+-$(**: = &^
|
+-$(**: = &^
|
||||||
+-)
|
+-)
|
||||||
!
|
!
|
||||||
|
@ -21,6 +21,11 @@ enum
|
|||||||
TOKEN_IDIV_ASSIGN,
|
TOKEN_IDIV_ASSIGN,
|
||||||
TOKEN_MOD_ASSIGN,
|
TOKEN_MOD_ASSIGN,
|
||||||
TOKEN_EXP_ASSIGN,
|
TOKEN_EXP_ASSIGN,
|
||||||
|
TOKEN_RSHIFT_ASSIGN,
|
||||||
|
TOKEN_LSHIFT_ASSIGN,
|
||||||
|
TOKEN_BAND_ASSIGN,
|
||||||
|
TOKEN_BXOR_ASSIGN,
|
||||||
|
TOKEN_BOR_ASSIGN,
|
||||||
|
|
||||||
TOKEN_EQ,
|
TOKEN_EQ,
|
||||||
TOKEN_NE,
|
TOKEN_NE,
|
||||||
@ -29,7 +34,7 @@ enum
|
|||||||
TOKEN_GE,
|
TOKEN_GE,
|
||||||
TOKEN_GT,
|
TOKEN_GT,
|
||||||
TOKEN_NM, /* not match */
|
TOKEN_NM, /* not match */
|
||||||
TOKEN_NOT,
|
TOKEN_LNOT, /* logical negation ! */
|
||||||
TOKEN_PLUS,
|
TOKEN_PLUS,
|
||||||
TOKEN_PLUSPLUS,
|
TOKEN_PLUSPLUS,
|
||||||
TOKEN_MINUS,
|
TOKEN_MINUS,
|
||||||
@ -2526,7 +2531,7 @@ static ase_awk_nde_t* parse_unary (ase_awk_t* awk, ase_size_t line)
|
|||||||
|
|
||||||
opcode = (MATCH(awk,TOKEN_PLUS))? ASE_AWK_UNROP_PLUS:
|
opcode = (MATCH(awk,TOKEN_PLUS))? ASE_AWK_UNROP_PLUS:
|
||||||
(MATCH(awk,TOKEN_MINUS))? ASE_AWK_UNROP_MINUS:
|
(MATCH(awk,TOKEN_MINUS))? ASE_AWK_UNROP_MINUS:
|
||||||
(MATCH(awk,TOKEN_NOT))? ASE_AWK_UNROP_NOT:
|
(MATCH(awk,TOKEN_LNOT))? ASE_AWK_UNROP_LNOT:
|
||||||
(MATCH(awk,TOKEN_TILDE))? ASE_AWK_UNROP_BNOT: -1;
|
(MATCH(awk,TOKEN_TILDE))? ASE_AWK_UNROP_BNOT: -1;
|
||||||
|
|
||||||
/*if (opcode == -1) return parse_increment (awk);*/
|
/*if (opcode == -1) return parse_increment (awk);*/
|
||||||
@ -2584,7 +2589,7 @@ static ase_awk_nde_t* parse_unary_exp (ase_awk_t* awk, ase_size_t line)
|
|||||||
|
|
||||||
opcode = (MATCH(awk,TOKEN_PLUS))? ASE_AWK_UNROP_PLUS:
|
opcode = (MATCH(awk,TOKEN_PLUS))? ASE_AWK_UNROP_PLUS:
|
||||||
(MATCH(awk,TOKEN_MINUS))? ASE_AWK_UNROP_MINUS:
|
(MATCH(awk,TOKEN_MINUS))? ASE_AWK_UNROP_MINUS:
|
||||||
(MATCH(awk,TOKEN_NOT))? ASE_AWK_UNROP_NOT:
|
(MATCH(awk,TOKEN_LNOT))? ASE_AWK_UNROP_LNOT:
|
||||||
(MATCH(awk,TOKEN_TILDE))? ASE_AWK_UNROP_BNOT: -1;
|
(MATCH(awk,TOKEN_TILDE))? ASE_AWK_UNROP_BNOT: -1;
|
||||||
|
|
||||||
if (opcode == -1) return parse_increment (awk, line);
|
if (opcode == -1) return parse_increment (awk, line);
|
||||||
@ -4605,7 +4610,7 @@ static int get_token (ase_awk_t* awk)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_NOT);
|
SET_TOKEN_TYPE (awk, TOKEN_LNOT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c == ASE_T('>'))
|
else if (c == ASE_T('>'))
|
||||||
@ -4614,10 +4619,19 @@ static int get_token (ase_awk_t* awk)
|
|||||||
GET_CHAR_TO (awk, c);
|
GET_CHAR_TO (awk, c);
|
||||||
if (c == ASE_T('>'))
|
if (c == ASE_T('>'))
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_RSHIFT);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
|
GET_CHAR_TO (awk, c);
|
||||||
|
if ((awk->option & ASE_AWK_SHIFT) && c == ASE_T('='))
|
||||||
|
{
|
||||||
|
SET_TOKEN_TYPE (awk, TOKEN_RSHIFT_ASSIGN);
|
||||||
ADD_TOKEN_CHAR (awk, c);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
GET_CHAR (awk);
|
GET_CHAR (awk);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SET_TOKEN_TYPE (awk, TOKEN_RSHIFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (c == ASE_T('='))
|
else if (c == ASE_T('='))
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_GE);
|
SET_TOKEN_TYPE (awk, TOKEN_GE);
|
||||||
@ -4636,10 +4650,19 @@ static int get_token (ase_awk_t* awk)
|
|||||||
|
|
||||||
if ((awk->option & ASE_AWK_SHIFT) && c == ASE_T('<'))
|
if ((awk->option & ASE_AWK_SHIFT) && c == ASE_T('<'))
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_LSHIFT);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
|
GET_CHAR_TO (awk, c);
|
||||||
|
if (c == ASE_T('='))
|
||||||
|
{
|
||||||
|
SET_TOKEN_TYPE (awk, TOKEN_LSHIFT_ASSIGN);
|
||||||
ADD_TOKEN_CHAR (awk, c);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
GET_CHAR (awk);
|
GET_CHAR (awk);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SET_TOKEN_TYPE (awk, TOKEN_LSHIFT);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (c == ASE_T('='))
|
else if (c == ASE_T('='))
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_LE);
|
SET_TOKEN_TYPE (awk, TOKEN_LE);
|
||||||
@ -4667,6 +4690,12 @@ static int get_token (ase_awk_t* awk)
|
|||||||
ADD_TOKEN_CHAR (awk, c);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
GET_CHAR (awk);
|
GET_CHAR (awk);
|
||||||
}
|
}
|
||||||
|
else if (c == ASE_T('='))
|
||||||
|
{
|
||||||
|
SET_TOKEN_TYPE (awk, TOKEN_BOR_ASSIGN);
|
||||||
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
|
GET_CHAR (awk);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_BOR);
|
SET_TOKEN_TYPE (awk, TOKEN_BOR);
|
||||||
@ -4682,20 +4711,36 @@ static int get_token (ase_awk_t* awk)
|
|||||||
ADD_TOKEN_CHAR (awk, c);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
GET_CHAR (awk);
|
GET_CHAR (awk);
|
||||||
}
|
}
|
||||||
|
else if (c == ASE_T('='))
|
||||||
|
{
|
||||||
|
SET_TOKEN_TYPE (awk, TOKEN_BAND_ASSIGN);
|
||||||
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
|
GET_CHAR (awk);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_BAND);
|
SET_TOKEN_TYPE (awk, TOKEN_BAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (c == ASE_T('~'))
|
else if (c == ASE_T('^'))
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_TILDE);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
|
GET_CHAR_TO (awk, c);
|
||||||
|
|
||||||
|
if (c == ASE_T('='))
|
||||||
|
{
|
||||||
|
SET_TOKEN_TYPE (awk, TOKEN_BXOR_ASSIGN);
|
||||||
ADD_TOKEN_CHAR (awk, c);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
GET_CHAR (awk);
|
GET_CHAR (awk);
|
||||||
}
|
}
|
||||||
else if (c == ASE_T('^'))
|
else
|
||||||
{
|
{
|
||||||
SET_TOKEN_TYPE (awk, TOKEN_BXOR);
|
SET_TOKEN_TYPE (awk, TOKEN_BXOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c == ASE_T('~'))
|
||||||
|
{
|
||||||
|
SET_TOKEN_TYPE (awk, TOKEN_TILDE);
|
||||||
ADD_TOKEN_CHAR (awk, c);
|
ADD_TOKEN_CHAR (awk, c);
|
||||||
GET_CHAR (awk);
|
GET_CHAR (awk);
|
||||||
}
|
}
|
||||||
@ -5370,6 +5415,7 @@ static int classify_ident (
|
|||||||
|
|
||||||
static int assign_to_opcode (ase_awk_t* awk)
|
static int assign_to_opcode (ase_awk_t* awk)
|
||||||
{
|
{
|
||||||
|
/* synchronize it with ase_awk_assop_type_t in run.h */
|
||||||
static int assop[] =
|
static int assop[] =
|
||||||
{
|
{
|
||||||
ASE_AWK_ASSOP_NONE,
|
ASE_AWK_ASSOP_NONE,
|
||||||
@ -5379,11 +5425,16 @@ static int assign_to_opcode (ase_awk_t* awk)
|
|||||||
ASE_AWK_ASSOP_DIV,
|
ASE_AWK_ASSOP_DIV,
|
||||||
ASE_AWK_ASSOP_IDIV,
|
ASE_AWK_ASSOP_IDIV,
|
||||||
ASE_AWK_ASSOP_MOD,
|
ASE_AWK_ASSOP_MOD,
|
||||||
ASE_AWK_ASSOP_EXP
|
ASE_AWK_ASSOP_EXP,
|
||||||
|
ASE_AWK_ASSOP_RSHIFT,
|
||||||
|
ASE_AWK_ASSOP_LSHIFT,
|
||||||
|
ASE_AWK_ASSOP_BAND,
|
||||||
|
ASE_AWK_ASSOP_BXOR,
|
||||||
|
ASE_AWK_ASSOP_BOR
|
||||||
};
|
};
|
||||||
|
|
||||||
if (awk->token.type >= TOKEN_ASSIGN &&
|
if (awk->token.type >= TOKEN_ASSIGN &&
|
||||||
awk->token.type <= TOKEN_EXP_ASSIGN)
|
awk->token.type <= TOKEN_BOR_ASSIGN)
|
||||||
{
|
{
|
||||||
return assop[awk->token.type - TOKEN_ASSIGN];
|
return assop[awk->token.type - TOKEN_ASSIGN];
|
||||||
}
|
}
|
||||||
|
@ -3204,7 +3204,7 @@ static ase_awk_val_t* eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
|||||||
if (ass->opcode != ASE_AWK_ASSOP_NONE)
|
if (ass->opcode != ASE_AWK_ASSOP_NONE)
|
||||||
{
|
{
|
||||||
ase_awk_val_t* val2, * tmp;
|
ase_awk_val_t* val2, * tmp;
|
||||||
static binop_func_t __binop_func[] =
|
static binop_func_t binop_func[] =
|
||||||
{
|
{
|
||||||
ASE_NULL, /* ASE_AWK_ASSOP_NONE */
|
ASE_NULL, /* ASE_AWK_ASSOP_NONE */
|
||||||
eval_binop_plus,
|
eval_binop_plus,
|
||||||
@ -3213,7 +3213,12 @@ static ase_awk_val_t* eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
|||||||
eval_binop_div,
|
eval_binop_div,
|
||||||
eval_binop_idiv,
|
eval_binop_idiv,
|
||||||
eval_binop_mod,
|
eval_binop_mod,
|
||||||
eval_binop_exp
|
eval_binop_exp,
|
||||||
|
eval_binop_rshift,
|
||||||
|
eval_binop_lshift,
|
||||||
|
eval_binop_band,
|
||||||
|
eval_binop_bxor,
|
||||||
|
eval_binop_bor
|
||||||
};
|
};
|
||||||
|
|
||||||
ASE_ASSERT (ass->left->next == ASE_NULL);
|
ASE_ASSERT (ass->left->next == ASE_NULL);
|
||||||
@ -3227,10 +3232,10 @@ static ase_awk_val_t* eval_assignment (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
|||||||
ase_awk_refupval (run, val2);
|
ase_awk_refupval (run, val2);
|
||||||
|
|
||||||
ASE_ASSERT (ass->opcode >= 0);
|
ASE_ASSERT (ass->opcode >= 0);
|
||||||
ASE_ASSERT (ass->opcode < ASE_COUNTOF(__binop_func));
|
ASE_ASSERT (ass->opcode < ASE_COUNTOF(binop_func));
|
||||||
ASE_ASSERT (__binop_func[ass->opcode] != ASE_NULL);
|
ASE_ASSERT (binop_func[ass->opcode] != ASE_NULL);
|
||||||
|
|
||||||
tmp = __binop_func[ass->opcode] (run, val2, val);
|
tmp = binop_func[ass->opcode] (run, val2, val);
|
||||||
if (tmp == ASE_NULL)
|
if (tmp == ASE_NULL)
|
||||||
{
|
{
|
||||||
ase_awk_refdownval (run, val2);
|
ase_awk_refdownval (run, val2);
|
||||||
@ -3597,7 +3602,7 @@ static ase_awk_val_t* do_assignment_pos (
|
|||||||
|
|
||||||
static ase_awk_val_t* eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
static ase_awk_val_t* eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||||
{
|
{
|
||||||
static binop_func_t __binop_func[] =
|
static binop_func_t binop_func[] =
|
||||||
{
|
{
|
||||||
/* the order of the functions should be inline with
|
/* the order of the functions should be inline with
|
||||||
* the operator declaration in run.h */
|
* the operator declaration in run.h */
|
||||||
@ -3678,10 +3683,10 @@ static ase_awk_val_t* eval_binary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
|||||||
ase_awk_refupval (run, right);
|
ase_awk_refupval (run, right);
|
||||||
|
|
||||||
ASE_ASSERT (exp->opcode >= 0 &&
|
ASE_ASSERT (exp->opcode >= 0 &&
|
||||||
exp->opcode < ASE_COUNTOF(__binop_func));
|
exp->opcode < ASE_COUNTOF(binop_func));
|
||||||
ASE_ASSERT (__binop_func[exp->opcode] != ASE_NULL);
|
ASE_ASSERT (binop_func[exp->opcode] != ASE_NULL);
|
||||||
|
|
||||||
res = __binop_func[exp->opcode] (run, left, right);
|
res = binop_func[exp->opcode] (run, left, right);
|
||||||
if (res == ASE_NULL)
|
if (res == ASE_NULL)
|
||||||
{
|
{
|
||||||
/* change the error line */
|
/* change the error line */
|
||||||
@ -4832,7 +4837,7 @@ static ase_awk_val_t* eval_unary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
|||||||
ASE_ASSERT (
|
ASE_ASSERT (
|
||||||
exp->opcode == ASE_AWK_UNROP_PLUS ||
|
exp->opcode == ASE_AWK_UNROP_PLUS ||
|
||||||
exp->opcode == ASE_AWK_UNROP_MINUS ||
|
exp->opcode == ASE_AWK_UNROP_MINUS ||
|
||||||
exp->opcode == ASE_AWK_UNROP_NOT ||
|
exp->opcode == ASE_AWK_UNROP_LNOT ||
|
||||||
exp->opcode == ASE_AWK_UNROP_BNOT);
|
exp->opcode == ASE_AWK_UNROP_BNOT);
|
||||||
|
|
||||||
ASE_ASSERT (exp->left->next == ASE_NULL);
|
ASE_ASSERT (exp->left->next == ASE_NULL);
|
||||||
@ -4849,7 +4854,7 @@ static ase_awk_val_t* eval_unary (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
|||||||
res = (n == 0)? ase_awk_makeintval (run, -l):
|
res = (n == 0)? ase_awk_makeintval (run, -l):
|
||||||
ase_awk_makerealval (run, -r);
|
ase_awk_makerealval (run, -r);
|
||||||
}
|
}
|
||||||
else if (exp->opcode == ASE_AWK_UNROP_NOT)
|
else if (exp->opcode == ASE_AWK_UNROP_LNOT)
|
||||||
{
|
{
|
||||||
if (left->type == ASE_AWK_VAL_STR)
|
if (left->type == ASE_AWK_VAL_STR)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
|
|
||||||
enum ase_awk_assop_type_t
|
enum ase_awk_assop_type_t
|
||||||
{
|
{
|
||||||
/* if you change this, you have to change __assop_str in tree.c */
|
/* if you change this, you have to change assop_str in tree.c.
|
||||||
|
* synchronize it with binop_func of eval_assignment in run.c */
|
||||||
ASE_AWK_ASSOP_NONE,
|
ASE_AWK_ASSOP_NONE,
|
||||||
ASE_AWK_ASSOP_PLUS, /* += */
|
ASE_AWK_ASSOP_PLUS, /* += */
|
||||||
ASE_AWK_ASSOP_MINUS, /* -= */
|
ASE_AWK_ASSOP_MINUS, /* -= */
|
||||||
@ -21,13 +22,18 @@ enum ase_awk_assop_type_t
|
|||||||
ASE_AWK_ASSOP_DIV, /* /= */
|
ASE_AWK_ASSOP_DIV, /* /= */
|
||||||
ASE_AWK_ASSOP_IDIV, /* //= */
|
ASE_AWK_ASSOP_IDIV, /* //= */
|
||||||
ASE_AWK_ASSOP_MOD, /* %= */
|
ASE_AWK_ASSOP_MOD, /* %= */
|
||||||
ASE_AWK_ASSOP_EXP /* **= */
|
ASE_AWK_ASSOP_EXP, /* **= */
|
||||||
|
ASE_AWK_ASSOP_RSHIFT, /* >>= */
|
||||||
|
ASE_AWK_ASSOP_LSHIFT, /* <<= */
|
||||||
|
ASE_AWK_ASSOP_BAND, /* &= */
|
||||||
|
ASE_AWK_ASSOP_BXOR, /* ^= */
|
||||||
|
ASE_AWK_ASSOP_BOR /* |= */
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ase_awk_binop_type_t
|
enum ase_awk_binop_type_t
|
||||||
{
|
{
|
||||||
/* if you change this, you have to change
|
/* if you change this, you have to change
|
||||||
* __binop_str in tree.c and __binop_func in run.c accordingly. */
|
* binop_str in tree.c and binop_func in run.c accordingly. */
|
||||||
ASE_AWK_BINOP_LOR,
|
ASE_AWK_BINOP_LOR,
|
||||||
ASE_AWK_BINOP_LAND,
|
ASE_AWK_BINOP_LAND,
|
||||||
ASE_AWK_BINOP_IN,
|
ASE_AWK_BINOP_IN,
|
||||||
@ -65,7 +71,7 @@ enum ase_awk_unrop_type_t
|
|||||||
* __unrop_str in tree.c accordingly. */
|
* __unrop_str in tree.c accordingly. */
|
||||||
ASE_AWK_UNROP_PLUS,
|
ASE_AWK_UNROP_PLUS,
|
||||||
ASE_AWK_UNROP_MINUS,
|
ASE_AWK_UNROP_MINUS,
|
||||||
ASE_AWK_UNROP_NOT,
|
ASE_AWK_UNROP_LNOT,
|
||||||
ASE_AWK_UNROP_BNOT
|
ASE_AWK_UNROP_BNOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,7 +15,12 @@ static const ase_char_t* assop_str[] =
|
|||||||
ASE_T("/="),
|
ASE_T("/="),
|
||||||
ASE_T("//="),
|
ASE_T("//="),
|
||||||
ASE_T("%="),
|
ASE_T("%="),
|
||||||
ASE_T("**=")
|
ASE_T("**="),
|
||||||
|
ASE_T(">>="),
|
||||||
|
ASE_T("<<="),
|
||||||
|
ASE_T("&="),
|
||||||
|
ASE_T("^="),
|
||||||
|
ASE_T("|=")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ase_char_t* binop_str[][2] =
|
static const ase_char_t* binop_str[][2] =
|
||||||
|
@ -34,10 +34,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
* redefined the variable scope
|
* redefined the variable scope
|
||||||
* removed ASE_AWK_UNIQUEFN and ASE_AWK_SHADING
|
* removed ASE_AWK_UNIQUEFN and ASE_AWK_SHADING by refining the scoping rule
|
||||||
* fixed a bug in handle >> when ASE_AWK_SHIFT is off
|
* fixed a bug in handling >> when ASE_AWK_SHIFT is off
|
||||||
|
|
||||||
* added ASE_AWK_EVARRED
|
* added ASE_AWK_EVARRED
|
||||||
|
* added five operators - <<=, >>=, &=, ^=, |=
|
||||||
|
|
||||||
[0.3.2]
|
[0.3.2]
|
||||||
|
|
||||||
|
@ -8,7 +8,15 @@ CC = bcc32
|
|||||||
LD = ilink32
|
LD = ilink32
|
||||||
AR = tlib
|
AR = tlib
|
||||||
|
|
||||||
CFLAGS = -O2 -WM -WU -RT- -w -q -I..\..
|
CFLAGS = -WM -WU -RT- -w -q -I..\..
|
||||||
|
|
||||||
|
!IF "$(MODE)" == "debug"
|
||||||
|
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG
|
||||||
|
!ELSEIF "$(MODE)" == "release"
|
||||||
|
CFLAGS = $(CFLAGS) -DNDEBUG -O2
|
||||||
|
!ELSE
|
||||||
|
CFLAGS = $(CFLAGS)
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
OUT_DIR = ..\$(MODE)\lib
|
OUT_DIR = ..\$(MODE)\lib
|
||||||
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
||||||
|
@ -688,9 +688,10 @@ static void print_usage (const ase_char_t* argv0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int awk_main (int argc, ase_char_t* argv[])
|
static int awk_main (int argc, ase_char_t* argv[])
|
||||||
{
|
{
|
||||||
TestAwk awk;
|
TestAwk awk;
|
||||||
|
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
const ase_char_t* mainfn = NULL;
|
const ase_char_t* mainfn = NULL;
|
||||||
const ase_char_t* srcin = ASE_T("");
|
const ase_char_t* srcin = ASE_T("");
|
||||||
@ -887,7 +888,6 @@ int awk_main (int argc, ase_char_t* argv[])
|
|||||||
|
|
||||||
extern "C" int ase_main (int argc, ase_achar_t* argv[])
|
extern "C" int ase_main (int argc, ase_achar_t* argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
#if defined(__linux) && defined(_DEBUG)
|
#if defined(__linux) && defined(_DEBUG)
|
||||||
|
@ -196,7 +196,6 @@ static ase_cint_t custom_awk_tolower (void* custom, ase_cint_t c)
|
|||||||
|
|
||||||
|
|
||||||
/* custom miscellaneous functions */
|
/* custom miscellaneous functions */
|
||||||
|
|
||||||
static ase_real_t custom_awk_pow (void* custom, ase_real_t x, ase_real_t y)
|
static ase_real_t custom_awk_pow (void* custom, ase_real_t x, ase_real_t y)
|
||||||
{
|
{
|
||||||
return pow (x, y);
|
return pow (x, y);
|
||||||
@ -219,7 +218,7 @@ static int custom_awk_sprintf (
|
|||||||
|
|
||||||
|
|
||||||
static ase_ssize_t awk_srcio_in (
|
static ase_ssize_t awk_srcio_in (
|
||||||
int cmd, void* arg, ase_char_t* data, ase_size_t size)
|
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
|
||||||
{
|
{
|
||||||
struct awk_src_io* src_io = (struct awk_src_io*)arg;
|
struct awk_src_io* src_io = (struct awk_src_io*)arg;
|
||||||
ase_cint_t c;
|
ase_cint_t c;
|
||||||
@ -258,7 +257,7 @@ static ase_ssize_t awk_srcio_in (
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ase_ssize_t awk_srcio_out (
|
static ase_ssize_t awk_srcio_out (
|
||||||
int cmd, void* arg, ase_char_t* data, ase_size_t size)
|
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
|
||||||
{
|
{
|
||||||
/*struct awk_src_io* src_io = (struct awk_src_io*)arg;*/
|
/*struct awk_src_io* src_io = (struct awk_src_io*)arg;*/
|
||||||
|
|
||||||
@ -295,7 +294,7 @@ static ase_ssize_t awk_srcio_out (
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ase_ssize_t awk_extio_pipe (
|
static ase_ssize_t awk_extio_pipe (
|
||||||
int cmd, void* arg, ase_char_t* data, ase_size_t size)
|
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
|
||||||
{
|
{
|
||||||
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
|
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
|
||||||
|
|
||||||
@ -419,7 +418,7 @@ static ase_ssize_t awk_extio_pipe (
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ase_ssize_t awk_extio_file (
|
static ase_ssize_t awk_extio_file (
|
||||||
int cmd, void* arg, ase_char_t* data, ase_size_t size)
|
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
|
||||||
{
|
{
|
||||||
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
|
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
|
||||||
|
|
||||||
@ -559,7 +558,7 @@ static ase_ssize_t getdata (ase_char_t* data, ase_size_t size, FILE* fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ase_ssize_t awk_extio_console (
|
static ase_ssize_t awk_extio_console (
|
||||||
int cmd, void* arg, ase_char_t* data, ase_size_t size)
|
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
|
||||||
{
|
{
|
||||||
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
|
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#
|
#
|
||||||
# -Tpe
|
# -Tpe
|
||||||
# -Tpd /dll
|
# -Tpd /dll
|
||||||
|
NAME = aseawk
|
||||||
|
|
||||||
!ifndef MODE
|
!ifndef MODE
|
||||||
MODE = release
|
MODE = release
|
||||||
@ -14,27 +15,101 @@ MODE = release
|
|||||||
CC = bcc32
|
CC = bcc32
|
||||||
CXX = bcc32
|
CXX = bcc32
|
||||||
LD = ilink32
|
LD = ilink32
|
||||||
CFLAGS = -O2 -WM -WU -RT- -w -q -I..\..\..
|
JAVAC = javac
|
||||||
CXXFLAGS = -O2 -WM -WU -RT- -w -q -I..\..\..
|
JAR = jar
|
||||||
LDFLAGS = -ap -Tpe -Gn -c -q -L..\..\awk -L..\..\cmn -L..\..\utl
|
|
||||||
LIBS = import32.lib cw32mt.lib aseawk.lib asecmn.lib aseutl.lib
|
CFLAGS = -WM -WU -RT- -w -q -I..\..\..
|
||||||
|
CXXFLAGS = -WM -WU -RT- -w -q -I..\..\..
|
||||||
|
LDFLAGS = -ap -Tpe -Gn -c -q -L..\..\$(MODE)\lib -L\progra~1\borland\bds\4.0\lib
|
||||||
|
LIBS = asecmn.lib aseawk.lib aseutl.lib import32.lib cw32mt.lib
|
||||||
|
LIBS_CXX = $(LIBS) "aseawk++.lib"
|
||||||
STARTUP = c0x32w.obj
|
STARTUP = c0x32w.obj
|
||||||
|
|
||||||
all: aseawk
|
JAVACFLAGS = -classpath ..\..\$(MODE)\lib\aseawk.jar;. -Xlint:unchecked
|
||||||
|
|
||||||
aseawk: awk.obj
|
OUT_DIR = ..\..\$(MODE)\bin
|
||||||
$(LD) $(LDFLAGS) $(STARTUP) awk.obj,$@.exe,,$(LIBS),,
|
OUT_FILE_BIN = $(OUT_DIR)\$(NAME).exe
|
||||||
|
OUT_FILE_BIN_CXX = "$(OUT_DIR)\$(NAME)++.exe"
|
||||||
|
OUT_FILE_JAR = $(OUT_DIR)\$(NAME).jar
|
||||||
|
|
||||||
java:
|
TMP_DIR = $(MODE)
|
||||||
javac -classpath ../../.. Awk.java AwkApplet.java
|
TMP_DIR_CXX = $(TMP_DIR)\cxx
|
||||||
|
TMP_DIR_JAR = $(TMP_DIR)\java
|
||||||
|
|
||||||
jrun:
|
OBJ_FILES_BIN = $(TMP_DIR)\awk.obj
|
||||||
java -Xms1m -Xmx2m -classpath ../../.. ase.test.awk.Awk
|
OBJ_FILES_BIN_CXX = $(TMP_DIR_CXX)\Awk.obj
|
||||||
|
|
||||||
|
OBJ_FILES_JAR = \
|
||||||
|
$(TMP_DIR_JAR)\AseAwk.class \
|
||||||
|
$(TMP_DIR_JAR)\AseAwkPanel.class \
|
||||||
|
$(TMP_DIR_JAR)\AseAwkApplet.class
|
||||||
|
|
||||||
|
TARGETS = bin
|
||||||
|
|
||||||
|
!if "$(JAVA_HOME)" != ""
|
||||||
|
TARGETS = $(TARGETS) jar
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!IF "$(MODE)" == "debug"
|
||||||
|
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG
|
||||||
|
CXXFLAGS = $(CXXFLAGS) -D_DEBUG -DDEBUG
|
||||||
|
!ELSEIF "$(MODE)" == "release"
|
||||||
|
CFLAGS = $(CFLAGS) -DNDEBUG -O2
|
||||||
|
CXXFLAGS = $(CXXFLAGS) -DNDEBUG -O2
|
||||||
|
!ELSE
|
||||||
|
CFLAGS = $(CFLAGS)
|
||||||
|
CXXFLAGS = $(CXXFLAGS)
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
|
all: $(TARGETS)
|
||||||
|
|
||||||
|
bin: $(OUT_FILE_BIN) $(OUT_FILE_BIN_CXX)
|
||||||
|
|
||||||
|
jar: $(OUT_FILE_JAR)
|
||||||
|
|
||||||
|
$(OUT_FILE_BIN): $(TMP_DIR) $(OUT_DIR) $(OBJ_FILES_BIN)
|
||||||
|
$(LD) $(LDFLAGS) $(STARTUP) $(OBJ_FILES_BIN),$@,,$(LIBS),,
|
||||||
|
|
||||||
|
$(OUT_FILE_BIN_CXX): $(TMP_DIR_CXX) $(OUT_FILE_BIN) $(OBJ_FILES_BIN_CXX)
|
||||||
|
$(LD) $(LDFLAGS) $(STARTUP) $(OBJ_FILES_BIN_CXX),$@,,$(LIBS_CXX),,
|
||||||
|
|
||||||
|
$(OUT_FILE_JAR): $(TMP_DIR_JAR) $(OBJ_FILES_JAR)
|
||||||
|
$(JAR) -xvf ..\..\$(MODE)\lib\aseawk.jar
|
||||||
|
$(JAR) -cvfm $(OUT_FILE_JAR) manifest ase -C $(TMP_DIR_JAR) .
|
||||||
|
|
||||||
|
$(TMP_DIR)\awk.obj: awk.c
|
||||||
|
$(CC) $(CFLAGS) -o$@ -c awk.c
|
||||||
|
|
||||||
|
$(TMP_DIR_CXX)\Awk.obj: Awk.cpp
|
||||||
|
$(CC) $(CXXFLAGS) -o$@ -c Awk.cpp
|
||||||
|
|
||||||
|
$(TMP_DIR_JAR)\AseAwk.class: AseAwk.java
|
||||||
|
$(JAVAC) $(JAVACFLAGS) -d $(TMP_DIR_JAR) AseAwk.java
|
||||||
|
|
||||||
|
$(TMP_DIR_JAR)\AseAwkApplet.class: AseAwkApplet.java
|
||||||
|
$(JAVAC) $(JAVACFLAGS) -d $(TMP_DIR_JAR) AseAwkApplet.java
|
||||||
|
|
||||||
|
$(TMP_DIR_JAR)\AseAwkPanel.class: AseAwkPanel.java
|
||||||
|
$(JAVAC) $(JAVACFLAGS) -d $(TMP_DIR_JAR) AseAwkPanel.java
|
||||||
|
|
||||||
|
$(OUT_DIR):
|
||||||
|
-md $(OUT_DIR)
|
||||||
|
|
||||||
|
$(TMP_DIR):
|
||||||
|
-md $(TMP_DIR)
|
||||||
|
|
||||||
|
$(TMP_DIR_CXX): $(TMP_DIR)
|
||||||
|
-md $(TMP_DIR_CXX)
|
||||||
|
|
||||||
|
$(TMP_DIR_JAR): $(TMP_DIR)
|
||||||
|
-md $(TMP_DIR_JAR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
del $(OBJS) *.obj *.class aseawk.exe
|
-del $(OUT_FILE_BIN)
|
||||||
|
-del $(OUT_FILE_BIN_CXX)
|
||||||
.SUFFIXES: .c .obj
|
-del $(OBJ_FILES_BIN)
|
||||||
.c.obj:
|
-del $(OBJ_FILES_BIN_CXX)
|
||||||
$(CC) $(CFLAGS) -c $<
|
-del $(OUT_FILE_JAR)
|
||||||
|
-del $(OBJ_FILES_JAR)
|
||||||
|
-del $(TMP_DIR)\*.class
|
||||||
|
|
||||||
|
@ -19,8 +19,6 @@ int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]))
|
|||||||
|
|
||||||
#elif defined(ASE_CHAR_IS_WCHAR)
|
#elif defined(ASE_CHAR_IS_WCHAR)
|
||||||
|
|
||||||
#include <wchar.h>
|
|
||||||
|
|
||||||
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]))
|
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]))
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
@ -8,7 +8,15 @@ CC = bcc32
|
|||||||
LD = ilink32
|
LD = ilink32
|
||||||
AR = tlib
|
AR = tlib
|
||||||
|
|
||||||
CFLAGS = -O2 -WM -WU -RT- -w -q -I..\..
|
CFLAGS = -WM -WU -RT- -w -q -I..\..
|
||||||
|
|
||||||
|
!IF "$(MODE)" == "debug"
|
||||||
|
CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG
|
||||||
|
!ELSEIF "$(MODE)" == "release"
|
||||||
|
CFLAGS = $(CFLAGS) -DNDEBUG -O2
|
||||||
|
!ELSE
|
||||||
|
CFLAGS = $(CFLAGS)
|
||||||
|
!ENDIF
|
||||||
|
|
||||||
OUT_DIR = ..\$(MODE)\lib
|
OUT_DIR = ..\$(MODE)\lib
|
||||||
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
OUT_FILE_LIB = $(OUT_DIR)\$(NAME).lib
|
||||||
|
@ -41,6 +41,10 @@
|
|||||||
#define ase_clearerr(s) clearerr(s)
|
#define ase_clearerr(s) clearerr(s)
|
||||||
#define ase_fflush(s) fflush(s)
|
#define ase_fflush(s) fflush(s)
|
||||||
|
|
||||||
|
#define ASE_STDIN stdin
|
||||||
|
#define ASE_STDOUT stdout
|
||||||
|
#define ASE_STDERR stderr
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user