diff --git a/ase/awk/jni.c b/ase/awk/jni.c index 23400adc..484102ee 100644 --- a/ase/awk/jni.c +++ b/ase/awk/jni.c @@ -1,5 +1,5 @@ /* - * $Id: jni.c,v 1.68 2007-02-23 08:28:39 bacon Exp $ + * $Id: jni.c,v 1.69 2007-02-23 08:53:35 bacon Exp $ * * {License} */ @@ -267,7 +267,6 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj) awk = ase_awk_open (&prmfns, awk_data, &errnum); if (awk == NULL) { - free (prmfns.custom_data); throw_exception ( env, ase_awk_geterrstr(errnum), @@ -399,7 +398,7 @@ static ase_char_t* java_strxdup (jchar* str, jint len) tmp = (ase_char_t*) malloc ((len+1) * ASE_SIZEOF(ase_char_t)); if (tmp == ASE_NULL) return ASE_NULL; - ase_awk_strncpy (tmp, (ase_char_t*)str, (ase_size_t)len); + ase_strncpy (tmp, (ase_char_t*)str, (ase_size_t)len); return tmp; } } @@ -512,7 +511,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jstring m len = (*env)->GetStringLength (env, mfn); - if (len > 0 && ASE_SIZEOF(jchar) != ASE_SIZEOF(ase_char_t)) + if (len > 0) { ase_size_t i; @@ -562,12 +561,11 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jstring m } else { - mmm = (ase_char_t*)mfn; + mmm = NULL; ptr = NULL; } } - if (args != NULL) { /* compose arguments */ @@ -577,7 +575,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jstring m runarg = malloc (sizeof(ase_awk_runarg_t) * (len+1)); if (runarg == NULL) { - if (mmm != NULL && mmm != mfn) free (mmm); + if (mmm != NULL) free (mmm); if (ptr != NULL) (*env)->ReleaseStringChars (env, mfn, ptr); DELETE_CLASS_REFS (env, run_data); @@ -606,7 +604,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jstring m (*env)->DeleteLocalRef (env, obj); - if (mmm != NULL && mmm != mfn) free (mmm); + if (mmm != NULL && mmm) free (mmm); if (ptr != NULL) (*env)->ReleaseStringChars (env, mfn, ptr); DELETE_CLASS_REFS (env, run_data); @@ -630,7 +628,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jstring m (*env)->ReleaseStringChars (env, obj, tmp); (*env)->DeleteLocalRef (env, obj); - if (mmm != NULL && mmm != mfn) free (mmm); + if (mmm != NULL) free (mmm); if (ptr != NULL) (*env)->ReleaseStringChars (env, mfn, ptr); DELETE_CLASS_REFS (env, run_data); @@ -660,7 +658,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jstring m free (runarg); } - if (mmm != NULL && mmm != mfn) free (mmm); + if (mmm != NULL) free (mmm); if (ptr != NULL) (*env)->ReleaseStringChars (env, mfn, ptr); DELETE_CLASS_REFS (env, run_data); @@ -678,7 +676,7 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_run (JNIEnv* env, jobject obj, jstring m free (runarg); } - if (mmm != NULL && mmm != mfn) free (mmm); + if (mmm != NULL) free (mmm); if (ptr != NULL) (*env)->ReleaseStringChars (env, mfn, ptr); DELETE_CLASS_REFS (env, run_data); } diff --git a/ase/awk/makefile.msw.bcc b/ase/awk/makefile.msw.bcc index caa62527..7e710d04 100644 --- a/ase/awk/makefile.msw.bcc +++ b/ase/awk/makefile.msw.bcc @@ -1,6 +1,6 @@ OUT = aseawk -C_SRCS = awk.c err.c tree.c str.c tab.c map.c parse.c \ +C_SRCS = awk.c err.c tree.c tab.c map.c parse.c \ run.c rec.c val.c func.c misc.c extio.c rex.c JNI_SRCS = jni.c JAVA_SRCS = Exception.java Extio.java Awk.java StdAwk.java @@ -28,7 +28,9 @@ JAVACFLAGS = -classpath ../.. LDFLAGS = -Tpd -ap -Gn -c -q STARTUP = c0d32w.obj LIBS = import32.lib cw32mt.lib -JNI_LIBS = $(LIBS) $(OUT).lib + +JNI_LDFLAGS = $(LDFLAGS) -L..\cmn -L..\utl +JNI_LIBS = $(LIBS) $(OUT).lib asecmn.lib aseutl.lib all: lib jni @@ -39,7 +41,7 @@ lib: $(C_OBJS) ! jni: lib $(JNI_OBJS) $(JAVA_OBJS) - $(LD) $(LDFLAGS) $(STARTUP) $(JNI_OBJS),$(OUT)_jni.dll,,$(JNI_LIBS),jni.def, + $(LD) $(JNI_LDFLAGS) $(STARTUP) $(JNI_OBJS),$(OUT)_jni.dll,,$(JNI_LIBS),jni.def, clean: -del $(OBJS) $(OUT).lib $(OUT)_jni.dll *.obj *.class diff --git a/ase/test/awk/Awk.java b/ase/test/awk/Awk.java index f44265d3..54d96be3 100644 --- a/ase/test/awk/Awk.java +++ b/ase/test/awk/Awk.java @@ -1,5 +1,5 @@ /* - * $Id: Awk.java,v 1.26 2007-02-01 07:23:59 bacon Exp $ + * $Id: Awk.java,v 1.27 2007-02-23 08:54:03 bacon Exp $ */ package ase.test.awk; @@ -102,6 +102,7 @@ public class Awk extends ase.awk.StdAwk awk.parse (); + System.out.println ("about to run"); String[] aaa = new String[3]; aaa[0] = "abcdefg"; aaa[1] = "qwerty"; diff --git a/ase/test/awk/awk.c b/ase/test/awk/awk.c index f6bafe9b..9fc66991 100644 --- a/ase/test/awk/awk.c +++ b/ase/test/awk/awk.c @@ -1,5 +1,5 @@ /* - * $Id: awk.c,v 1.176 2007-02-23 08:21:35 bacon Exp $ + * $Id: awk.c,v 1.177 2007-02-23 08:54:03 bacon Exp $ */ #include @@ -612,16 +612,6 @@ static void awk_free (ase_mmgr_t* mmgr, void* ptr) #endif } -static void* awk_memcpy (void* dst, const void* src, ase_size_t n) -{ - return memcpy (dst, src, n); -} - -static void* awk_memset (void* dst, int val, ase_size_t n) -{ - return memset (dst, val, n); -} - static void print_usage (const ase_char_t* argv0) { ase_printf (ASE_T("Usage: %s [-m] [-d] [-a argument]* -f source-file [data-file]*\n"), argv0); diff --git a/ase/test/awk/makefile.msw.bcc b/ase/test/awk/makefile.msw.bcc index 19511f74..9dec9ca8 100644 --- a/ase/test/awk/makefile.msw.bcc +++ b/ase/test/awk/makefile.msw.bcc @@ -10,8 +10,8 @@ CC = bcc32 LD = ilink32 CFLAGS = -O2 -WM -WU -RT- -w -I..\..\.. -LDFLAGS = -ap -Tpe -Gn -c -L..\..\awk -L..\..\utl -LIBS = import32.lib cw32mt.lib aseawk.lib aseutl.lib +LDFLAGS = -ap -Tpe -Gn -c -L..\..\awk -L..\..\cmn -L..\..\utl +LIBS = import32.lib cw32mt.lib aseawk.lib asecmn.lib aseutl.lib STARTUP = c0x32w.obj all: aseawk