diff --git a/ase/awk/awk.c b/ase/awk/awk.c index 10be4087..1336a07a 100644 --- a/ase/awk/awk.c +++ b/ase/awk/awk.c @@ -1,5 +1,5 @@ /* - * $Id: awk.c,v 1.96 2006-12-04 12:58:23 bacon Exp $ + * $Id: awk.c,v 1.97 2006-12-12 05:16:29 bacon Exp $ */ #if defined(__BORLANDC__) @@ -194,6 +194,7 @@ int ase_awk_clear (ase_awk_t* awk) awk->parse.depth.cur.expr = 0; /* clear parse trees */ + awk->tree.ok = 0; awk->tree.nbglobals = 0; awk->tree.nglobals = 0; ase_awk_map_clear (&awk->tree.afns); diff --git a/ase/awk/awk.h b/ase/awk/awk.h index ff066619..a95d5995 100644 --- a/ase/awk/awk.h +++ b/ase/awk/awk.h @@ -1,5 +1,5 @@ /* - * $Id: awk.h,v 1.162 2006-12-11 14:58:25 bacon Exp $ + * $Id: awk.h,v 1.163 2006-12-12 05:16:29 bacon Exp $ */ #ifndef _ASE_AWK_AWK_H_ @@ -203,6 +203,7 @@ enum ASE_AWK_EINVAL, /* invalid parameter */ ASE_AWK_EEXIST, /* existing data found */ ASE_AWK_ENOENT, /* no such data entry found */ + ASE_AWK_EACCES, /* access denied */ ASE_AWK_ERUNTIME, /* run-time error */ ASE_AWK_ERUNNING, /* there are running instances */ ASE_AWK_ETOOMANYRUNS, /* too many running instances */ diff --git a/ase/awk/awk_i.h b/ase/awk/awk_i.h index 222712cb..6b4f22d0 100644 --- a/ase/awk/awk_i.h +++ b/ase/awk/awk_i.h @@ -1,5 +1,5 @@ /* - * $Id: awk_i.h,v 1.88 2006-12-04 12:58:23 bacon Exp $ + * $Id: awk_i.h,v 1.89 2006-12-12 05:16:29 bacon Exp $ */ #ifndef _ASE_AWK_AWKI_H_ @@ -91,6 +91,7 @@ struct ase_awk_tree_t ase_awk_chain_t* chain; ase_awk_chain_t* chain_tail; ase_size_t chain_size; /* number of nodes in the chain */ + int ok; }; struct ase_awk_t @@ -102,7 +103,6 @@ struct ase_awk_t /* parse tree */ ase_awk_tree_t tree; - int state; /* temporary information that the parser needs */ struct diff --git a/ase/awk/err.c b/ase/awk/err.c index 8127cfdb..103e882f 100644 --- a/ase/awk/err.c +++ b/ase/awk/err.c @@ -1,5 +1,5 @@ /* - * $Id: err.c,v 1.57 2006-12-02 16:26:03 bacon Exp $ + * $Id: err.c,v 1.58 2006-12-12 05:16:29 bacon Exp $ */ #include @@ -18,6 +18,7 @@ const ase_char_t* ase_awk_geterrstr (int errnum) ASE_T("invalid parameter"), ASE_T("existing data found"), ASE_T("no such data entry found"), + ASE_T("permission denied"), ASE_T("general run-time error"), ASE_T("one or more running instances"), ASE_T("too many running instances"), diff --git a/ase/awk/makefile.bcc b/ase/awk/makefile.bcc index e06b94ad..d51b2d4a 100644 --- a/ase/awk/makefile.bcc +++ b/ase/awk/makefile.bcc @@ -2,7 +2,7 @@ OUT = aseawk C_SRCS = awk.c err.c tree.c str.c tab.c map.c parse.c \ run.c rec.c val.c func.c misc.c extio.c rex.c -JNI_SRCS = $(C_SRCS) jni.c +JNI_SRCS = jni.c JAVA_SRCS = Exception.java Extio.java Awk.java StdAwk.java C_OBJS = $(C_SRCS:.c=.obj) @@ -29,17 +29,18 @@ JAVACFLAGS = -classpath ../.. LDFLAGS = -Tpd -ap -Gn -c -q $(BDS_LIBPATH) STARTUP = c0d32w.obj LIBS = import32.lib cw32mt.lib +JNI_LIBS = $(LIBS) $(OUT).lib all: lib jni lib: $(C_OBJS) - $(AR) aseawk.lib @&&! + $(AR) $(OUT).lib @&&! +-$(**: = &^ +-) ! -jni: $(JNI_OBJS) $(JAVA_OBJS) - $(LD) $(LDFLAGS) $(STARTUP) $(JNI_OBJS),$(OUT).dll,,$(LIBS),jni.def, +jni: lib $(JNI_OBJS) $(JAVA_OBJS) + $(LD) $(LDFLAGS) $(STARTUP) $(JNI_OBJS),$(OUT).dll,,$(JNI_LIBS),jni.def, ada: gnatmake -I.. ase-awk diff --git a/ase/awk/makefile.cl b/ase/awk/makefile.cl index a8065006..d6ea0e1d 100644 --- a/ase/awk/makefile.cl +++ b/ase/awk/makefile.cl @@ -2,7 +2,7 @@ OUT = aseawk C_SRCS = awk.c err.c tree.c str.c tab.c map.c parse.c \ run.c rec.c val.c func.c misc.c extio.c rex.c -JNI_SRCS = $(C_SRCS) jni.c +JNI_SRCS = jni.c JAVA_SRCS = Awk.java Exception.java Extio.java C_OBJS = $(C_SRCS:.c=.obj) @@ -28,10 +28,11 @@ lib: $(C_OBJS) /nologo /out:$(OUT).lib $(C_OBJS) << -jni: $(JNI_OBJS) $(JAVA_OBJS) +jni: lib $(JNI_OBJS) $(JAVA_OBJS) $(LD) /dll /def:jni.def /subsystem:windows /version:0.1 /release @<< -/nologo /out:$(OUT).dll $(JNI_OBJS) user32.lib +/nologo /out:$(OUT).dll $(JNI_OBJS) /implib:tmp.lib user32.lib $(OUT).lib << + del tmp.lib tmp.exp clean: del $(OBJS) $(OUT).lib $(OUT).dll *.obj *.class diff --git a/ase/awk/parse.c b/ase/awk/parse.c index adc58beb..8486561c 100644 --- a/ase/awk/parse.c +++ b/ase/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c,v 1.220 2006-12-11 08:44:52 bacon Exp $ + * $Id: parse.c,v 1.221 2006-12-12 05:16:30 bacon Exp $ */ #include @@ -360,7 +360,6 @@ int ase_awk_parse (ase_awk_t* awk, ase_awk_srcios_t* srcios) ASE_AWK_ASSERT (awk, awk->parse.depth.cur.loop == 0); ASE_AWK_ASSERT (awk, awk->parse.depth.cur.expr == 0); - if (n == -1) ase_awk_clear (awk); return n; } @@ -444,6 +443,8 @@ exit_parse: } if (n == -1) ase_awk_clear (awk); + else awk->tree.ok = 1; + return n; } @@ -4401,7 +4402,7 @@ static int __deparse (ase_awk_t* awk) if (awk->tree.nglobals > awk->tree.nbglobals) { - ase_size_t i, len; + ase_size_t i/*, len*/; ASE_AWK_ASSERT (awk, awk->tree.nglobals > 0); if (ase_awk_putsrcstr (awk, ASE_T("global ")) == -1) diff --git a/ase/awk/run.c b/ase/awk/run.c index e76b09de..15862b6f 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.296 2006-12-11 08:44:52 bacon Exp $ + * $Id: run.c,v 1.297 2006-12-12 05:16:30 bacon Exp $ */ #include @@ -568,8 +568,9 @@ int ase_awk_run (ase_awk_t* awk, awk->tree.chain_size == 0 && ase_awk_map_getsize(&awk->tree.afns) == 0) { - /* no code to execute */ - return 0; + /* the code has not been parsed. deny the run */ + awk->errnum = ASE_AWK_EACCES; + return -1; } run = (ase_awk_run_t*) ASE_AWK_MALLOC (awk, ASE_SIZEOF(ase_awk_run_t)); diff --git a/ase/awk/tree.c b/ase/awk/tree.c index 9baf285d..a2ae24ef 100644 --- a/ase/awk/tree.c +++ b/ase/awk/tree.c @@ -1,5 +1,5 @@ /* - * $Id: tree.c,v 1.95 2006-12-11 08:44:52 bacon Exp $ + * $Id: tree.c,v 1.96 2006-12-12 05:16:30 bacon Exp $ */ #include @@ -374,8 +374,8 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) case ASE_AWK_NDE_GLOBAL: { - ase_char_t tmp[ASE_SIZEOF(ase_long_t)*8+2]; - ase_size_t n; + /*ase_char_t tmp[ASE_SIZEOF(ase_long_t)*8+2]; + ase_size_t n;*/ ase_awk_nde_var_t* px = (ase_awk_nde_var_t*)nde; if (px->id.idxa != (ase_size_t)-1) @@ -399,8 +399,8 @@ static int __print_expression (ase_awk_t* awk, ase_awk_nde_t* nde) case ASE_AWK_NDE_GLOBALIDX: { - ase_char_t tmp[ASE_SIZEOF(ase_long_t)*8+2]; - ase_size_t n; + /*ase_char_t tmp[ASE_SIZEOF(ase_long_t)*8+2]; + ase_size_t n;*/ ase_awk_nde_var_t* px = (ase_awk_nde_var_t*)nde; if (px->id.idxa != (ase_size_t)-1)