*** empty log message ***
This commit is contained in:
parent
d67859e12d
commit
cf179c7151
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.h,v 1.195 2007-03-02 11:47:52 bacon Exp $
|
* $Id: awk.h,v 1.196 2007-03-02 14:41:30 bacon Exp $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -102,6 +102,9 @@ struct ase_awk_runcbs_t
|
|||||||
void (*on_start) (
|
void (*on_start) (
|
||||||
ase_awk_run_t* run, void* custom_data);
|
ase_awk_run_t* run, void* custom_data);
|
||||||
|
|
||||||
|
void (*on_statement) (
|
||||||
|
ase_awk_run_t* run, ase_size_t line, void* custom_data);
|
||||||
|
|
||||||
void (*on_return) (
|
void (*on_return) (
|
||||||
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);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk_i.h,v 1.106 2007-03-02 11:14:33 bacon Exp $
|
* $Id: awk_i.h,v 1.107 2007-03-02 14:41:30 bacon Exp $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -317,17 +317,14 @@ struct ase_awk_run_t
|
|||||||
} max;
|
} max;
|
||||||
} depth;
|
} depth;
|
||||||
|
|
||||||
ase_size_t runlin; /* line no. of the node being executed currently */
|
|
||||||
|
|
||||||
int errnum;
|
int errnum;
|
||||||
ase_size_t errlin;
|
ase_size_t errlin;
|
||||||
ase_char_t errmsg[256];
|
ase_char_t errmsg[256];
|
||||||
|
|
||||||
void* custom_data;
|
void* custom_data;
|
||||||
ase_awk_t* awk;
|
|
||||||
|
|
||||||
ase_awk_run_t* prev;
|
ase_awk_t* awk;
|
||||||
ase_awk_run_t* next;
|
ase_awk_runcbs_t* cbs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,7 +32,7 @@ LIBS = import32.lib cw32mt.lib
|
|||||||
JNI_LDFLAGS = $(LDFLAGS) -L..\cmn -L..\utl
|
JNI_LDFLAGS = $(LDFLAGS) -L..\cmn -L..\utl
|
||||||
JNI_LIBS = $(LIBS) $(OUT).lib asecmn.lib aseutl.lib
|
JNI_LIBS = $(LIBS) $(OUT).lib asecmn.lib aseutl.lib
|
||||||
|
|
||||||
all: lib jni
|
all: lib
|
||||||
|
|
||||||
lib: $(C_OBJS)
|
lib: $(C_OBJS)
|
||||||
$(AR) $(OUT).lib @&&!
|
$(AR) $(OUT).lib @&&!
|
||||||
|
@ -21,7 +21,7 @@ JAVAC = javac
|
|||||||
CFLAGS = /nologo /O2 /MT /W3 /GR- -I../.. $(JNI_INC)
|
CFLAGS = /nologo /O2 /MT /W3 /GR- -I../.. $(JNI_INC)
|
||||||
JAVACFLAGS = -classpath ../.. -Xlint:unchecked
|
JAVACFLAGS = -classpath ../.. -Xlint:unchecked
|
||||||
|
|
||||||
all: lib jni
|
all: lib
|
||||||
|
|
||||||
lib: $(C_OBJS)
|
lib: $(C_OBJS)
|
||||||
$(LD) /lib @<<
|
$(LD) /lib @<<
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: run.c,v 1.335 2007-03-02 11:47:52 bacon Exp $
|
* $Id: run.c,v 1.336 2007-03-02 14:41:30 bacon Exp $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -67,7 +67,7 @@ static int __set_globals_to_default (ase_awk_run_t* run);
|
|||||||
|
|
||||||
static int run_main (
|
static int run_main (
|
||||||
ase_awk_run_t* run, const ase_char_t* main,
|
ase_awk_run_t* run, const ase_char_t* main,
|
||||||
ase_awk_runcbs_t* runcbs, ase_awk_runarg_t* runarg);
|
ase_awk_runarg_t* runarg);
|
||||||
|
|
||||||
static int __run_pattern_blocks (ase_awk_run_t* run);
|
static int __run_pattern_blocks (ase_awk_run_t* run);
|
||||||
static int __run_pattern_block_chain (
|
static int __run_pattern_block_chain (
|
||||||
@ -628,6 +628,8 @@ int ase_awk_run (ase_awk_t* awk,
|
|||||||
run->errlin = 0;
|
run->errlin = 0;
|
||||||
run->errmsg[0] = ASE_T('\0');
|
run->errmsg[0] = ASE_T('\0');
|
||||||
|
|
||||||
|
run->cbs = runcbs;
|
||||||
|
|
||||||
/* execute the start callback if it exists */
|
/* execute the start callback if it exists */
|
||||||
if (runcbs != ASE_NULL && runcbs->on_start != ASE_NULL)
|
if (runcbs != ASE_NULL && runcbs->on_start != ASE_NULL)
|
||||||
{
|
{
|
||||||
@ -635,7 +637,7 @@ int ase_awk_run (ase_awk_t* awk,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* enter the main run loop */
|
/* enter the main run loop */
|
||||||
n = run_main (run, main, runcbs, runarg);
|
n = run_main (run, main, runarg);
|
||||||
if (n == -1)
|
if (n == -1)
|
||||||
{
|
{
|
||||||
/* if no callback is specified, awk's error number
|
/* if no callback is specified, awk's error number
|
||||||
@ -1119,7 +1121,7 @@ static int __set_globals_to_default (ase_awk_run_t* run)
|
|||||||
|
|
||||||
static int run_main (
|
static int run_main (
|
||||||
ase_awk_run_t* run, const ase_char_t* main,
|
ase_awk_run_t* run, const ase_char_t* main,
|
||||||
ase_awk_runcbs_t* runcbs, ase_awk_runarg_t* runarg)
|
ase_awk_runarg_t* runarg)
|
||||||
{
|
{
|
||||||
ase_size_t nglobals, nargs, nrunargs, i;
|
ase_size_t nglobals, nargs, nrunargs, i;
|
||||||
ase_size_t saved_stack_top;
|
ase_size_t saved_stack_top;
|
||||||
@ -1262,9 +1264,9 @@ static int run_main (
|
|||||||
{
|
{
|
||||||
ase_awk_refupval (run, v);
|
ase_awk_refupval (run, v);
|
||||||
|
|
||||||
if (runcbs != ASE_NULL && runcbs->on_return != ASE_NULL)
|
if (run->cbs != ASE_NULL && run->cbs->on_return != ASE_NULL)
|
||||||
{
|
{
|
||||||
runcbs->on_return (run, v, runcbs->custom_data);
|
run->cbs->on_return (run, v, run->cbs->custom_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
ase_awk_refdownval (run, v);
|
ase_awk_refdownval (run, v);
|
||||||
@ -1380,9 +1382,9 @@ static int run_main (
|
|||||||
v = STACK_RETVAL(run);
|
v = STACK_RETVAL(run);
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
{
|
{
|
||||||
if (runcbs != ASE_NULL && runcbs->on_return != ASE_NULL)
|
if (run->cbs != ASE_NULL && run->cbs->on_return != ASE_NULL)
|
||||||
{
|
{
|
||||||
runcbs->on_return (run, v, runcbs->custom_data);
|
run->cbs->on_return (run, v, run->cbs->custom_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* end the life of the global return value */
|
/* end the life of the global return value */
|
||||||
@ -1652,11 +1654,6 @@ static int __run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde)
|
|||||||
|
|
||||||
while (p != ASE_NULL && run->exit_level == EXIT_NONE)
|
while (p != ASE_NULL && run->exit_level == EXIT_NONE)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_RUN
|
|
||||||
ase_dprintf (ASE_T("running a statement of type %d at line %d\n"),
|
|
||||||
(int)p->type, (int)p->line);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (__run_statement (run, p) == -1)
|
if (__run_statement (run, p) == -1)
|
||||||
{
|
{
|
||||||
n = -1;
|
n = -1;
|
||||||
@ -1682,6 +1679,11 @@ static int __run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde)
|
|||||||
|
|
||||||
static int __run_statement (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
static int __run_statement (ase_awk_run_t* run, ase_awk_nde_t* nde)
|
||||||
{
|
{
|
||||||
|
if (run->cbs != ASE_NULL && run->cbs->on_statement != ASE_NULL)
|
||||||
|
{
|
||||||
|
run->cbs->on_statement (run, nde->line, run->custom_data);
|
||||||
|
}
|
||||||
|
|
||||||
switch (nde->type)
|
switch (nde->type)
|
||||||
{
|
{
|
||||||
case ASE_AWK_NDE_NULL:
|
case ASE_AWK_NDE_NULL:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c,v 1.180 2007-03-02 11:14:35 bacon Exp $
|
* $Id: awk.c,v 1.181 2007-03-02 14:42:04 bacon Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ase/awk/awk.h>
|
#include <ase/awk/awk.h>
|
||||||
@ -636,7 +636,7 @@ static BOOL WINAPI stop_run (DWORD ctrl_type)
|
|||||||
if (ctrl_type == CTRL_C_EVENT ||
|
if (ctrl_type == CTRL_C_EVENT ||
|
||||||
ctrl_type == CTRL_CLOSE_EVENT)
|
ctrl_type == CTRL_CLOSE_EVENT)
|
||||||
{
|
{
|
||||||
ase_awk_stop (ase_awk_getrunawk(app_run), app_run);
|
ase_awk_stop (app_run);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,11 +666,15 @@ static int print_awk_value (ase_awk_pair_t* pair, void* arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void on_run_statement (
|
||||||
|
ase_awk_run_t* run, ase_size_t line, void* custom)
|
||||||
|
{
|
||||||
|
dprintf (L"running %d\n", (int)line);
|
||||||
|
}
|
||||||
|
|
||||||
static void on_run_return (
|
static void on_run_return (
|
||||||
ase_awk_run_t* run, ase_awk_val_t* ret, void* custom)
|
ase_awk_run_t* run, ase_awk_val_t* ret, void* custom)
|
||||||
{
|
{
|
||||||
app_run = run;
|
|
||||||
|
|
||||||
dprintf (ASE_T("[RETURN] - "));
|
dprintf (ASE_T("[RETURN] - "));
|
||||||
ase_awk_dprintval (run, ret);
|
ase_awk_dprintval (run, ret);
|
||||||
dprintf (ASE_T("\n"));
|
dprintf (ASE_T("\n"));
|
||||||
@ -908,6 +912,7 @@ static int awk_main (int argc, ase_char_t* argv[])
|
|||||||
runios.console = awk_extio_console;
|
runios.console = awk_extio_console;
|
||||||
|
|
||||||
runcbs.on_start = on_run_start;
|
runcbs.on_start = on_run_start;
|
||||||
|
runcbs.on_statement = on_run_statement;
|
||||||
runcbs.on_return = on_run_return;
|
runcbs.on_return = on_run_return;
|
||||||
runcbs.on_end = on_run_end;
|
runcbs.on_end = on_run_end;
|
||||||
runcbs.custom_data = ASE_NULL;
|
runcbs.custom_data = ASE_NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user