This commit is contained in:
hyung-hwan 2008-02-13 01:57:21 +00:00
parent 8f01118529
commit f858485661
8 changed files with 53 additions and 57 deletions

View File

@ -924,20 +924,20 @@ const Awk::char_t* Awk::Run::getErrorMessage () const
void Awk::Run::setError (ErrorCode code)
{
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_setrunerror (this->run, (errnum_t)code, 0, ASE_NULL, 0);
ase_awk_setrunerror (this->run, code, 0, ASE_NULL, 0);
}
void Awk::Run::setError (ErrorCode code, size_t line)
{
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_setrunerror (this->run, (errnum_t)code, line, ASE_NULL, 0);
ase_awk_setrunerror (this->run, code, line, ASE_NULL, 0);
}
void Awk::Run::setError (ErrorCode code, size_t line, const char_t* arg)
{
ASE_ASSERT (this->run != ASE_NULL);
ase_cstr_t x = { arg, ase_strlen(arg) };
ase_awk_setrunerror (this->run, (errnum_t)code, line, &x, 1);
ase_awk_setrunerror (this->run, code, line, &x, 1);
}
void Awk::Run::setError (
@ -945,14 +945,14 @@ void Awk::Run::setError (
{
ASE_ASSERT (this->run != ASE_NULL);
ase_cstr_t x = { arg, len };
ase_awk_setrunerror (this->run, (errnum_t)code, line, &x, 1);
ase_awk_setrunerror (this->run, code, line, &x, 1);
}
void Awk::Run::setErrorWithMessage (
ErrorCode code, size_t line, const char_t* msg)
{
ASE_ASSERT (this->run != ASE_NULL);
ase_awk_setrunerrmsg (this->run, (errnum_t)code, line, msg);
ase_awk_setrunerrmsg (this->run, code, line, msg);
}
int Awk::Run::setGlobal (int id, long_t v)
@ -1075,7 +1075,7 @@ void Awk::setError (ErrorCode code, size_t line, const char_t* arg, size_t len)
if (awk != ASE_NULL)
{
ase_cstr_t x = { arg, len };
ase_awk_seterror (awk, (errnum_t)code, line, &x, 1);
ase_awk_seterror (awk, code, line, &x, 1);
retrieveError ();
}
else
@ -1092,7 +1092,7 @@ void Awk::setErrorWithMessage (ErrorCode code, size_t line, const char_t* msg)
{
if (awk != ASE_NULL)
{
ase_awk_seterrmsg (awk, (errnum_t)code, line, msg);
ase_awk_seterrmsg (awk, code, line, msg);
retrieveError ();
}
else
@ -1533,7 +1533,7 @@ void Awk::onRunStatement (Run& run, size_t line)
}
Awk::ssize_t Awk::sourceReader (
iocmd_t cmd, void* arg, char_t* data, size_t count)
int cmd, void* arg, char_t* data, size_t count)
{
Awk* awk = (Awk*)arg;
@ -1551,7 +1551,7 @@ Awk::ssize_t Awk::sourceReader (
}
Awk::ssize_t Awk::sourceWriter (
iocmd_t cmd, void* arg, char_t* data, size_t count)
int cmd, void* arg, char_t* data, size_t count)
{
Awk* awk = (Awk*)arg;
@ -1569,7 +1569,7 @@ Awk::ssize_t Awk::sourceWriter (
}
Awk::ssize_t Awk::pipeHandler (
iocmd_t cmd, void* arg, char_t* data, size_t count)
int cmd, void* arg, char_t* data, size_t count)
{
extio_t* extio = (extio_t*)arg;
Awk* awk = (Awk*)extio->custom_data;
@ -1601,7 +1601,7 @@ Awk::ssize_t Awk::pipeHandler (
}
Awk::ssize_t Awk::fileHandler (
iocmd_t cmd, void* arg, char_t* data, size_t count)
int cmd, void* arg, char_t* data, size_t count)
{
extio_t* extio = (extio_t*)arg;
Awk* awk = (Awk*)extio->custom_data;
@ -1633,7 +1633,7 @@ Awk::ssize_t Awk::fileHandler (
}
Awk::ssize_t Awk::consoleHandler (
iocmd_t cmd, void* arg, char_t* data, size_t count)
int cmd, void* arg, char_t* data, size_t count)
{
extio_t* extio = (extio_t*)arg;
Awk* awk = (Awk*)extio->custom_data;
@ -1693,13 +1693,13 @@ void Awk::onRunStart (run_t* run, void* custom)
r->awk->triggerOnRunStart (*r);
}
void Awk::onRunEnd (run_t* run, errnum_t errnum, void* custom)
void Awk::onRunEnd (run_t* run, int errnum, void* custom)
{
Run* r = (Run*)custom;
if (errnum == ERR_NOERR && r->callbackFailed)
{
ase_awk_setrunerrnum (r->run, (errnum_t)ERR_NOMEM);
ase_awk_setrunerrnum (r->run, ERR_NOMEM);
}
r->awk->onRunEnd (*r);

View File

@ -49,11 +49,6 @@ public:
/** Represents the underlying interpreter */
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.
* An instance of Awk::Source is passed to Awk::openSource,
@ -1044,23 +1039,23 @@ protected:
// static glue members for various handlers
static ssize_t sourceReader (
iocmd_t cmd, void* arg, char_t* data, size_t count);
int cmd, void* arg, char_t* data, size_t count);
static ssize_t sourceWriter (
iocmd_t cmd, void* arg, char_t* data, size_t count);
int cmd, void* arg, char_t* data, size_t count);
static ssize_t pipeHandler (
iocmd_t cmd, void* arg, char_t* data, size_t count);
int cmd, void* arg, char_t* data, size_t count);
static ssize_t fileHandler (
iocmd_t cmd, void* arg, char_t* data, size_t count);
int cmd, void* arg, char_t* data, size_t count);
static ssize_t consoleHandler (
iocmd_t cmd, void* arg, char_t* data, size_t count);
int cmd, void* arg, char_t* data, size_t count);
static int functionHandler (
run_t* run, const char_t* name, size_t len);
static void freeFunctionMapValue (void* owner, void* value);
static void onRunStart (run_t* run, void* custom);
static void onRunEnd (run_t* run, errnum_t errnum, void* custom);
static void onRunEnd (run_t* run, int errnum, void* custom);
static void onRunReturn (run_t* run, val_t* ret, void* custom);
static void onRunStatement (run_t* run, size_t line, void* custom);

View File

@ -31,9 +31,6 @@ typedef struct ase_awk_runcbs_t ase_awk_runcbs_t;
typedef struct ase_awk_runarg_t ase_awk_runarg_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 int (*ase_awk_sprintf_t) (
void* custom, ase_char_t* buf, ase_size_t size,
@ -41,7 +38,7 @@ typedef int (*ase_awk_sprintf_t) (
typedef void (*ase_awk_dprintf_t) (void* custom, const ase_char_t* fmt, ...);
typedef ase_ssize_t (*ase_awk_io_t) (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count);
int cmd, void* arg, ase_char_t* data, ase_size_t count);
struct ase_awk_extio_t
{
@ -117,7 +114,7 @@ struct ase_awk_runcbs_t
ase_awk_run_t* run, ase_awk_val_t* ret, void* custom_data);
void (*on_end) (
ase_awk_run_t* run, ase_awk_errnum_t errnum, void* custom_data);
ase_awk_run_t* run, int errnum, void* custom_data);
void* custom_data;
};
@ -475,16 +472,16 @@ int ase_awk_geterrnum (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);
void ase_awk_seterrnum (ase_awk_t* awk, ase_awk_errnum_t errnum);
void ase_awk_seterrnum (ase_awk_t* awk, int errnum);
void ase_awk_seterrmsg (ase_awk_t* awk,
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg);
int errnum, ase_size_t errlin, const ase_char_t* errmsg);
void ase_awk_geterror (
ase_awk_t* awk, int* errnum,
ase_size_t* errlin, const ase_char_t** errmsg);
void ase_awk_seterror (
ase_awk_t* awk, ase_awk_errnum_t errnum, ase_size_t errlin,
ase_awk_t* awk, int errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt);
int ase_awk_getoption (ase_awk_t* awk);
@ -624,16 +621,16 @@ ase_map_t* ase_awk_getrunnamedvarmap (ase_awk_run_t* awk);
int ase_awk_getrunerrnum (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);
void ase_awk_setrunerrnum (ase_awk_run_t* run, ase_awk_errnum_t errnum);
void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum);
void ase_awk_setrunerrmsg (ase_awk_run_t* run,
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg);
int errnum, ase_size_t errlin, const ase_char_t* errmsg);
void ase_awk_getrunerror (
ase_awk_run_t* run, int* errnum,
ase_size_t* errlin, const ase_char_t** errmsg);
void ase_awk_setrunerror (
ase_awk_run_t* run, ase_awk_errnum_t errnum, ase_size_t errlin,
ase_awk_run_t* run, int errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt);
/* functions to manipulate intrinsic functions */

View File

@ -218,7 +218,7 @@ struct ase_awk_t
} tmp;
/* housekeeping */
ase_awk_errnum_t errnum;
int errnum;
ase_size_t errlin;
ase_char_t errmsg[256];
ase_char_t* errstr[ASE_AWK_NUMERRNUM];
@ -355,7 +355,7 @@ struct ase_awk_run_t
} max;
} depth;
ase_awk_errnum_t errnum;
int errnum;
ase_size_t errlin;
ase_char_t errmsg[256];

View File

@ -6,7 +6,7 @@
#include <ase/awk/awk_i.h>
static const ase_char_t* __geterrstr (ase_awk_errnum_t errnum)
static const ase_char_t* __geterrstr (int errnum)
{
static const ase_char_t* errstr[] =
{
@ -217,7 +217,7 @@ void ase_awk_geterror (
}
}
void ase_awk_seterrnum (ase_awk_t* awk, ase_awk_errnum_t errnum)
void ase_awk_seterrnum (ase_awk_t* awk, int errnum)
{
awk->errnum = errnum;
awk->errlin = 0;
@ -225,7 +225,7 @@ void ase_awk_seterrnum (ase_awk_t* awk, ase_awk_errnum_t errnum)
}
void ase_awk_seterrmsg (ase_awk_t* awk,
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg)
int errnum, ase_size_t errlin, const ase_char_t* errmsg)
{
awk->errnum = errnum;
awk->errlin = errlin;
@ -233,7 +233,7 @@ void ase_awk_seterrmsg (ase_awk_t* awk,
}
void ase_awk_seterror (
ase_awk_t* awk, ase_awk_errnum_t errnum, ase_size_t errlin,
ase_awk_t* awk, int errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt)
{
const ase_char_t* errfmt;
@ -352,7 +352,7 @@ const ase_char_t* ase_awk_getrunerrmsg (ase_awk_run_t* run)
return run->errmsg;
}
void ase_awk_setrunerrnum (ase_awk_run_t* run, ase_awk_errnum_t errnum)
void ase_awk_setrunerrnum (ase_awk_run_t* run, int errnum)
{
run->errnum = errnum;
run->errlin = 0;
@ -360,7 +360,7 @@ void ase_awk_setrunerrnum (ase_awk_run_t* run, ase_awk_errnum_t errnum)
}
void ase_awk_setrunerrmsg (ase_awk_run_t* run,
ase_awk_errnum_t errnum, ase_size_t errlin, const ase_char_t* errmsg)
int errnum, ase_size_t errlin, const ase_char_t* errmsg)
{
run->errnum = errnum;
run->errlin = errlin;
@ -383,7 +383,7 @@ void ase_awk_getrunerror (
}
void ase_awk_setrunerror (
ase_awk_run_t* run, ase_awk_errnum_t errnum, ase_size_t errlin,
ase_awk_run_t* run, int errnum, ase_size_t errlin,
const ase_cstr_t* errarg, ase_size_t argcnt)
{
const ase_char_t* errfmt;

View File

@ -61,11 +61,11 @@ enum
};
static ase_ssize_t read_source (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count);
int cmd, void* arg, ase_char_t* data, ase_size_t count);
static ase_ssize_t write_source (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count);
int cmd, void* arg, ase_char_t* data, ase_size_t count);
static ase_ssize_t process_extio (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count);
int cmd, void* arg, ase_char_t* data, ase_size_t count);
static ase_char_t* dup_str (
ase_awk_t* awk, const jchar* str, ase_size_t len);
@ -110,7 +110,7 @@ struct run_data_t
jobject obj;
ase_size_t errlin;
ase_awk_errnum_t errnum;
int errnum;
ase_char_t errmsg[256];
jclass exception_class;
@ -1453,7 +1453,7 @@ static ase_ssize_t java_next_extio (
}
static ase_ssize_t read_source (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count)
int cmd, void* arg, ase_char_t* data, ase_size_t count)
{
srcio_data_t* srcio_data = (srcio_data_t*)arg;
@ -1477,7 +1477,7 @@ static ase_ssize_t read_source (
}
static ase_ssize_t write_source (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t count)
int cmd, void* arg, ase_char_t* data, ase_size_t count)
{
srcio_data_t* srcio_data = (srcio_data_t*)arg;
@ -1501,7 +1501,7 @@ static ase_ssize_t write_source (
}
static ase_ssize_t process_extio (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
runio_data_t* runio_data = (runio_data_t*)epa->custom_data;

View File

@ -21,6 +21,7 @@ TMP_DIR = $(MODE)
OBJ_FILES = \
$(TMP_DIR)/mem.o \
$(TMP_DIR)/str.o \
$(TMP_DIR)/map.o \
$(TMP_DIR)/misc.o
lib: $(OUT_FILE)
@ -35,6 +36,9 @@ $(TMP_DIR)/mem.o: mem.c
$(TMP_DIR)/str.o: str.c
$(CC) $(CFLAGS) -o $@ -c str.c
$(TMP_DIR)/map.o: map.c
$(CC) $(CFLAGS) -o $@ -c map.c
$(TMP_DIR)/misc.o: misc.c
$(CC) $(CFLAGS) -o $@ -c misc.c

View File

@ -217,7 +217,7 @@ static int custom_awk_sprintf (
static ase_ssize_t awk_srcio_in (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
struct awk_src_io* src_io = (struct awk_src_io*)arg;
ase_cint_t c;
@ -256,7 +256,7 @@ static ase_ssize_t awk_srcio_in (
}
static ase_ssize_t awk_srcio_out (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
/*struct awk_src_io* src_io = (struct awk_src_io*)arg;*/
@ -293,7 +293,7 @@ static ase_ssize_t awk_srcio_out (
}
static ase_ssize_t awk_extio_pipe (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
@ -417,7 +417,7 @@ static ase_ssize_t awk_extio_pipe (
}
static ase_ssize_t awk_extio_file (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;
@ -557,7 +557,7 @@ static ase_ssize_t getdata (ase_char_t* data, ase_size_t size, FILE* fp)
}
static ase_ssize_t awk_extio_console (
ase_awk_iocmd_t cmd, void* arg, ase_char_t* data, ase_size_t size)
int cmd, void* arg, ase_char_t* data, ase_size_t size)
{
ase_awk_extio_t* epa = (ase_awk_extio_t*)arg;