diff --git a/ase/awk/jni.c b/ase/awk/jni.c index 10995b69..f16aaf5e 100644 --- a/ase/awk/jni.c +++ b/ase/awk/jni.c @@ -1,5 +1,5 @@ /* - * $Id: jni.c,v 1.59 2007-01-28 11:28:26 bacon Exp $ + * $Id: jni.c,v 1.60 2007-01-30 10:55:27 bacon Exp $ */ #include @@ -1108,14 +1108,17 @@ static ase_ssize_t __process_extio ( ase_awk_extio_t* epa = (ase_awk_extio_t*)arg; runio_data_t* runio_data = (runio_data_t*)epa->custom_data; +printf ("__process_extio...\n"); if (cmd == ASE_AWK_IO_OPEN) { +printf ("__process_extio open...\n"); return __java_open_extio ( runio_data->env, runio_data->obj, "openExtio", epa); } else if (cmd == ASE_AWK_IO_CLOSE) { +printf ("__process_extio close...\n"); return __java_close_extio ( runio_data->env, runio_data->obj, "closeExtio", epa); @@ -1128,6 +1131,7 @@ static ase_ssize_t __process_extio ( } else if (cmd == ASE_AWK_IO_WRITE) { +printf ("__process_extio write...\n"); return __java_write_extio ( runio_data->env, runio_data->obj, "writeExtio", epa, data, size); @@ -2072,7 +2076,7 @@ JNIEXPORT jstring JNICALL Java_ase_awk_Awk_valtostr ( } else { - ret = (*env)->NewString (env, str, len); + ret = (*env)->NewString (env, (jchar*)str, len); } ase_awk_free (awk, str); diff --git a/ase/awk/jni.h b/ase/awk/jni.h index efdb7651..1bcb2d83 100644 --- a/ase/awk/jni.h +++ b/ase/awk/jni.h @@ -1,11 +1,15 @@ /* - * $Id: jni.h,v 1.18 2007-01-28 11:12:30 bacon Exp $ + * $Id: jni.h,v 1.19 2007-01-30 10:55:27 bacon Exp $ */ #ifndef _ASE_AWK_JNI_H_ #define _ASE_AWK_JNI_H_ +#if defined(__APPLE__) && defined(__MACH__) +#include +#else #include +#endif #ifdef __cplusplus extern "C" { diff --git a/ase/awk/makefile.mac.gcc b/ase/awk/makefile.mac.gcc new file mode 100644 index 00000000..0c6605b3 --- /dev/null +++ b/ase/awk/makefile.mac.gcc @@ -0,0 +1,41 @@ +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 = jni.c +JAVA_SRCS = Exception.java Extio.java Awk.java StdAwk.java + +C_OBJS = $(C_SRCS:.c=.o) +JNI_OBJS = $(JNI_SRCS:.c=.o) +JAVA_OBJS = $(JAVA_SRCS:.java=.class) + +CC = gcc +AR = ar +LD = ld +RANLIB = ranlib +CFLAGS = -Wall -O2 -D_REENTRANT -D_THREAD_SAFE -I../.. +LDFLAGS = +LIBS = + +JAVAC = javac +JAVACFLAGS = -classpath ../.. + +all: lib jni + +lib: $(C_OBJS) + $(AR) cr lib$(OUT).a $(C_OBJS) + ranlib lib$(OUT).a + +jni: lib $(JNI_OBJS) $(JAVA_OBJS) + $(CC) -bundle -o $(OUT)_jni.so $(JNI_OBJS) -lm -L. -l$(OUT) + +clean: + rm -rf $(C_OBJS) $(JNI_OBJS) $(JAVA_OBJS) lib$(OUT).a lib$(OUT).so *.o + +.SUFFIXES: .c .o .java .class +.c.o: + $(CC) $(CFLAGS) -c $< + +.java.class: + $(JAVAC) $(JAVACFLAGS) $< + diff --git a/ase/awk/run.c b/ase/awk/run.c index 8d6290e1..809033f6 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.321 2007-01-23 14:23:18 bacon Exp $ + * $Id: run.c,v 1.322 2007-01-30 10:55:27 bacon Exp $ */ #include @@ -1713,8 +1713,6 @@ static int __run_block0 (ase_awk_run_t* run, ase_awk_nde_blk_t* nde) /* blockless pattern - execute print $0*/ ase_awk_refupval (run, run->inrec.d0); - /*n = ase_awk_writeextio_val (run, - ASE_AWK_OUT_CONSOLE, ASE_T(""), run->inrec.d0);*/ n = ase_awk_writeextio_str (run, ASE_AWK_OUT_CONSOLE, ASE_T(""), ASE_AWK_STR_BUF(&run->inrec.line),