diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/javasci/src/jni | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/javasci/src/jni')
16 files changed, 3673 insertions, 0 deletions
diff --git a/modules/javasci/src/jni/.deps/.dirstamp b/modules/javasci/src/jni/.deps/.dirstamp new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/modules/javasci/src/jni/.deps/.dirstamp diff --git a/modules/javasci/src/jni/.deps/libjavasci2_la-call_scilab_wrap.Plo b/modules/javasci/src/jni/.deps/libjavasci2_la-call_scilab_wrap.Plo new file mode 100755 index 000000000..4c903fe29 --- /dev/null +++ b/modules/javasci/src/jni/.deps/libjavasci2_la-call_scilab_wrap.Plo @@ -0,0 +1,321 @@ +src/jni/libjavasci2_la-call_scilab_wrap.lo: src/jni/call_scilab_wrap.c \ + /usr/include/stdc-predef.h \ + /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h /usr/include/stdio.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \ + /usr/include/x86_64-linux-gnu/bits/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/stdio2.h \ + /usr/lib/jvm/java-8-openjdk-amd64/include/linux/jni_md.h \ + /usr/include/stdlib.h /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h /usr/include/string.h \ + /usr/include/xlocale.h /usr/include/x86_64-linux-gnu/bits/string.h \ + /usr/include/x86_64-linux-gnu/bits/string2.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + ../../modules/core/includes/BOOL.h src/c/javasci2_helper.h \ + ../../modules/core/includes/sci_types.h \ + ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h \ + src/jni/../../../call_scilab/includes/call_scilab.h \ + ../../modules/core/includes/stack-c.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h \ + ../../modules/core/includes/machine.h \ + src/jni/../../../call_scilab/includes/fromjava.h \ + src/jni/../../../call_scilab/includes/dynlib_call_scilab.h \ + src/jni/../../../api_scilab/includes/api_scilab.h \ + src/jni/../../../api_scilab/includes/api_common.h \ + src/jni/../../../api_scilab/includes/api_scilab.h \ + src/jni/../../../api_scilab/includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h \ + src/jni/../../../api_scilab/includes/api_string.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h \ + src/jni/../../../api_scilab/includes/api_int.h \ + src/jni/../../../api_scilab/includes/api_poly.h \ + src/jni/../../../api_scilab/includes/api_sparse.h \ + src/jni/../../../api_scilab/includes/api_boolean.h \ + src/jni/../../../api_scilab/includes/api_boolean_sparse.h \ + src/jni/../../../api_scilab/includes/api_pointer.h \ + src/jni/../../../api_scilab/includes/api_list.h \ + src/jni/../../../api_scilab/includes/api_error.h \ + src/jni/../../../api_scilab/includes/api_handle.h \ + src/jni/../../../api_scilab/includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h \ + src/jni/../../../api_scilab/includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + src/jni/../../../output_stream/includes/lasterror.h \ + src/jni/../../../output_stream/includes/dynlib_output_stream.h \ + ../../modules/core/includes/../../../modules/graphic_objects/includes/FigureList.h \ + ../../modules/core/includes/../../../modules/graphic_objects/includes/dynlib_graphic_objects.h \ + src/jni/../../../core/includes/sci_types.h + +/usr/include/stdc-predef.h: + +/usr/lib/jvm/java-8-openjdk-amd64/include/jni.h: + +/usr/include/stdio.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h: + +/usr/include/x86_64-linux-gnu/bits/stdio.h: + +/usr/include/x86_64-linux-gnu/bits/stdio2.h: + +/usr/lib/jvm/java-8-openjdk-amd64/include/linux/jni_md.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +/usr/include/string.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string.h: + +/usr/include/x86_64-linux-gnu/bits/string2.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +../../modules/core/includes/BOOL.h: + +src/c/javasci2_helper.h: + +../../modules/core/includes/sci_types.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: + +src/jni/../../../call_scilab/includes/call_scilab.h: + +../../modules/core/includes/stack-c.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +../../modules/core/includes/machine.h: + +src/jni/../../../call_scilab/includes/fromjava.h: + +src/jni/../../../call_scilab/includes/dynlib_call_scilab.h: + +src/jni/../../../api_scilab/includes/api_scilab.h: + +src/jni/../../../api_scilab/includes/api_common.h: + +src/jni/../../../api_scilab/includes/api_scilab.h: + +src/jni/../../../api_scilab/includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +src/jni/../../../api_scilab/includes/api_string.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +src/jni/../../../api_scilab/includes/api_int.h: + +src/jni/../../../api_scilab/includes/api_poly.h: + +src/jni/../../../api_scilab/includes/api_sparse.h: + +src/jni/../../../api_scilab/includes/api_boolean.h: + +src/jni/../../../api_scilab/includes/api_boolean_sparse.h: + +src/jni/../../../api_scilab/includes/api_pointer.h: + +src/jni/../../../api_scilab/includes/api_list.h: + +src/jni/../../../api_scilab/includes/api_error.h: + +src/jni/../../../api_scilab/includes/api_handle.h: + +src/jni/../../../api_scilab/includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +src/jni/../../../api_scilab/includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +src/jni/../../../output_stream/includes/lasterror.h: + +src/jni/../../../output_stream/includes/dynlib_output_stream.h: + +../../modules/core/includes/../../../modules/graphic_objects/includes/FigureList.h: + +../../modules/core/includes/../../../modules/graphic_objects/includes/dynlib_graphic_objects.h: + +src/jni/../../../core/includes/sci_types.h: diff --git a/modules/javasci/src/jni/.deps/libjavasci2_la-putLists.Plo b/modules/javasci/src/jni/.deps/libjavasci2_la-putLists.Plo new file mode 100755 index 000000000..8f22555d6 --- /dev/null +++ b/modules/javasci/src/jni/.deps/libjavasci2_la-putLists.Plo @@ -0,0 +1,292 @@ +src/jni/libjavasci2_la-putLists.lo: src/jni/putLists.c \ + /usr/include/stdc-predef.h /usr/include/string.h /usr/include/features.h \ + /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/string.h \ + /usr/include/x86_64-linux-gnu/bits/string2.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h \ + /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h /usr/include/stdio.h \ + /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \ + /usr/include/x86_64-linux-gnu/bits/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/stdio2.h \ + /usr/lib/jvm/java-8-openjdk-amd64/include/linux/jni_md.h \ + ../../modules/api_scilab/includes/api_scilab.h \ + ../../modules/core/includes/stack-c.h \ + ../../modules/core/includes/core_math.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h \ + /usr/include/limits.h /usr/include/x86_64-linux-gnu/bits/posix1_lim.h \ + /usr/include/x86_64-linux-gnu/bits/local_lim.h \ + /usr/include/linux/limits.h \ + /usr/include/x86_64-linux-gnu/bits/posix2_lim.h /usr/include/math.h \ + /usr/include/x86_64-linux-gnu/bits/math-vector.h \ + /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \ + /usr/include/x86_64-linux-gnu/bits/huge_val.h \ + /usr/include/x86_64-linux-gnu/bits/huge_valf.h \ + /usr/include/x86_64-linux-gnu/bits/huge_vall.h \ + /usr/include/x86_64-linux-gnu/bits/inf.h \ + /usr/include/x86_64-linux-gnu/bits/nan.h \ + /usr/include/x86_64-linux-gnu/bits/mathdef.h \ + /usr/include/x86_64-linux-gnu/bits/mathcalls.h \ + /usr/include/x86_64-linux-gnu/bits/mathinline.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h \ + /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + ../../modules/core/includes/stack-def.h \ + ../../modules/core/includes/machine.h \ + ../../modules/core/includes/stackTypeVariable.h \ + ../../modules/core/includes/BOOL.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/core/includes/stack1.h \ + ../../modules/core/includes/scisparse.h \ + ../../modules/core/includes/stack2.h \ + ../../modules/core/includes/stack3.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/core/includes/sci_types.h \ + ../../modules/api_scilab/includes/api_common.h \ + ../../modules/api_scilab/includes/api_scilab.h \ + ../../modules/api_scilab/includes/api_double.h \ + ../../modules/core/includes/doublecomplex.h \ + ../../modules/api_scilab/includes/api_string.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h \ + ../../modules/api_scilab/includes/api_int.h \ + ../../modules/api_scilab/includes/api_poly.h \ + ../../modules/api_scilab/includes/api_sparse.h \ + ../../modules/api_scilab/includes/api_boolean.h \ + ../../modules/api_scilab/includes/api_boolean_sparse.h \ + ../../modules/api_scilab/includes/api_pointer.h \ + ../../modules/api_scilab/includes/api_list.h \ + ../../modules/api_scilab/includes/api_error.h \ + ../../modules/api_scilab/includes/api_handle.h \ + ../../modules/api_scilab/includes/api_optional.h \ + ../../modules/core/includes/stack-optional.h \ + ../../modules/api_scilab/includes/api_hypermat.h \ + ../../modules/core/includes/core_math.h \ + ../../modules/core/includes/sci_types.h \ + ../../modules/core/includes/MALLOC.h \ + ../../modules/core/includes/sci_mem_alloc.h \ + ../../modules/core/includes/BOOL.h + +/usr/include/stdc-predef.h: + +/usr/include/string.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/string.h: + +/usr/include/x86_64-linux-gnu/bits/string2.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +/usr/lib/jvm/java-8-openjdk-amd64/include/jni.h: + +/usr/include/stdio.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h: + +/usr/include/x86_64-linux-gnu/bits/stdio.h: + +/usr/include/x86_64-linux-gnu/bits/stdio2.h: + +/usr/lib/jvm/java-8-openjdk-amd64/include/linux/jni_md.h: + +../../modules/api_scilab/includes/api_scilab.h: + +../../modules/core/includes/stack-c.h: + +../../modules/core/includes/core_math.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/limits.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/syslimits.h: + +/usr/include/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix1_lim.h: + +/usr/include/x86_64-linux-gnu/bits/local_lim.h: + +/usr/include/linux/limits.h: + +/usr/include/x86_64-linux-gnu/bits/posix2_lim.h: + +/usr/include/math.h: + +/usr/include/x86_64-linux-gnu/bits/math-vector.h: + +/usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h: + +/usr/include/x86_64-linux-gnu/bits/huge_val.h: + +/usr/include/x86_64-linux-gnu/bits/huge_valf.h: + +/usr/include/x86_64-linux-gnu/bits/huge_vall.h: + +/usr/include/x86_64-linux-gnu/bits/inf.h: + +/usr/include/x86_64-linux-gnu/bits/nan.h: + +/usr/include/x86_64-linux-gnu/bits/mathdef.h: + +/usr/include/x86_64-linux-gnu/bits/mathcalls.h: + +/usr/include/x86_64-linux-gnu/bits/mathinline.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +../../modules/core/includes/stack-def.h: + +../../modules/core/includes/machine.h: + +../../modules/core/includes/stackTypeVariable.h: + +../../modules/core/includes/BOOL.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/core/includes/stack1.h: + +../../modules/core/includes/scisparse.h: + +../../modules/core/includes/stack2.h: + +../../modules/core/includes/stack3.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/core/includes/sci_types.h: + +../../modules/api_scilab/includes/api_common.h: + +../../modules/api_scilab/includes/api_scilab.h: + +../../modules/api_scilab/includes/api_double.h: + +../../modules/core/includes/doublecomplex.h: + +../../modules/api_scilab/includes/api_string.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +../../modules/api_scilab/includes/api_int.h: + +../../modules/api_scilab/includes/api_poly.h: + +../../modules/api_scilab/includes/api_sparse.h: + +../../modules/api_scilab/includes/api_boolean.h: + +../../modules/api_scilab/includes/api_boolean_sparse.h: + +../../modules/api_scilab/includes/api_pointer.h: + +../../modules/api_scilab/includes/api_list.h: + +../../modules/api_scilab/includes/api_error.h: + +../../modules/api_scilab/includes/api_handle.h: + +../../modules/api_scilab/includes/api_optional.h: + +../../modules/core/includes/stack-optional.h: + +../../modules/api_scilab/includes/api_hypermat.h: + +../../modules/core/includes/core_math.h: + +../../modules/core/includes/sci_types.h: + +../../modules/core/includes/MALLOC.h: + +../../modules/core/includes/sci_mem_alloc.h: + +../../modules/core/includes/BOOL.h: diff --git a/modules/javasci/src/jni/.dirstamp b/modules/javasci/src/jni/.dirstamp new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/modules/javasci/src/jni/.dirstamp diff --git a/modules/javasci/src/jni/.libs/libjavasci2_la-call_scilab_wrap.o b/modules/javasci/src/jni/.libs/libjavasci2_la-call_scilab_wrap.o Binary files differnew file mode 100755 index 000000000..d8872168b --- /dev/null +++ b/modules/javasci/src/jni/.libs/libjavasci2_la-call_scilab_wrap.o diff --git a/modules/javasci/src/jni/.libs/libjavasci2_la-putLists.o b/modules/javasci/src/jni/.libs/libjavasci2_la-putLists.o Binary files differnew file mode 100755 index 000000000..38cc962c2 --- /dev/null +++ b/modules/javasci/src/jni/.libs/libjavasci2_la-putLists.o diff --git a/modules/javasci/src/jni/call_scilab.i b/modules/javasci/src/jni/call_scilab.i new file mode 100755 index 000000000..aa2faeaae --- /dev/null +++ b/modules/javasci/src/jni/call_scilab.i @@ -0,0 +1,189 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * Copyright (C) 2011 - Scilab Enterprises - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +/* Call_Scilab.i */ +/** + * Windows: swig -java -package org.scilab.modules.javasci -outdir ../java/org/scilab/modules/javasci/ call_scilab.i + * Other: Use the option --enable-build-swig to the configure +*/ + +//%rename(ScilabTypeEnum) sci_types; + +%module Call_Scilab +%{ +#include "BOOL.h" +#define ENABLE_HELPERS +#include "javasci2_helper.h" +#include "MALLOC.h" +#include "../../../call_scilab/includes/call_scilab.h" +#include "../../../call_scilab/includes/fromjava.h" +#include "../../../api_scilab/includes/api_scilab.h" +#include "../../../output_stream/includes/lasterror.h" +#include "../../../modules/graphic_objects/includes/FigureList.h" +#include "../../../core/includes/sci_types.h" +%} +%include "../../../jvm/src/jni/scilab_typemaps.i" + +%import "../../../types/src/jni/sci_types.i" + +#ifdef SWIGJAVA + +/* JavaDoc for Call_ScilabJNI class */ +%pragma(java) jniclassclassmodifiers=%{ +/* It is generated code. Disable checkstyle */ +//CHECKSTYLE:OFF + /** + * Connector for Javasci v2. + * This class should <b>not</b> be used directly + * @see org.scilab.modules.javasci.Scilab + * @author DIGITEO - Sylvestre LEDRU + */ +class%} + +/* Constructor for Call_ScilabJNI class */ +%pragma(java) jniclasscode=" + /** + * Constructor + */ + protected Call_ScilabJNI() { + throw new UnsupportedOperationException(); + }"; + +/* static load of library */ +%pragma(java) jniclasscode=%{ + static { + try { + if (System.getProperty("os.name").toLowerCase().contains("windows")) { + System.loadLibrary("javasci"); + } else { + System.loadLibrary("javasci2"); + } + } catch (SecurityException e) { + System.err.println("A security manager exists and does not allow the loading of the specified dynamic library :"); + e.printStackTrace(System.err); + } catch (UnsatisfiedLinkError e) { + System.err.println("The native library javasci does not exist or cannot be found."); + e.printStackTrace(System.err); + } + } + + public final static native int putList(String varNmae, Object list, char type); +%} + +/* JavaDoc for Call_Scilab class */ +%pragma(java) moduleclassmodifiers=" +import org.scilab.modules.types.ScilabTypeEnum; +import org.scilab.modules.types.ScilabIntegerTypeEnum; + + /** + * Connector for Javasci v2. + * This class should <b>not</b> be used directly + * @see org.scilab.modules.javasci.Scilab + * @author DIGITEO - Sylvestre LEDRU + */ +public class"; + +/* Constructor for Call_Scilab class */ +%pragma(java) modulecode=" + /** + * Constructor + */ + protected Call_Scilab() { + throw new UnsupportedOperationException(); + }"; + +#endif + + +int Call_ScilabOpen(char* SCIpath, BOOL advancedMode, char *ScilabStartup, int Stacksize); + +BOOL TerminateScilab(char *ScilabQuit); + +int SendScilabJob(char *job); + +int SendScilabJobs(char **jobs,int numberjobs); + +// Direct access to the Scilab function (no helper) +void SetFromJavaToON(void); + +// Direct access to the Scilab function (no helper) +%rename(isGraphicOpened) sciHasFigures; +BOOL sciHasFigures( void ); + +// Direct access to the Scilab function (no helper) +%rename(GetLastErrorCode) getLastErrorValue; +int getLastErrorValue(void); + +BOOL isExistingVariable(char* varname); + +%rename(getLastErrorMessage) getLastErrorMessageSingle; +const char* getLastErrorMessageSingle(); + +sci_types getVariableType(char *varname); + +sci_int_types getIntegerPrecision(char* varname); + +%rename(isComplex) isComplexVar; +BOOL isComplexVar(char* varname); + +%include "call_scilab_java_typemaps_string.i" +// string +int putString(char* variableName, char **variable, int nbRow, int nbCol); + +// This position matters. It will apply only to the following lines +%include "call_scilab_java_typemaps.i" + +int putDoubleComplex(char * variableName, double variable[], int nbRow, int nbCol, double imag[], int nbRowI, int nbColI); + +// double (default Scilab type) +int putDouble(char * variableName, double variable[], int nbRow, int nbCol); + +// boolean (%t / %f) +int putBoolean(char * variableName, BOOL variable[], int nbRow, int nbCol); + +// byte/char = int8 +int putByte(char * variableName, byte variable[], int nbRow, int nbCol); + +int putUnsignedByte(char * variableName, byte variable[], int nbRow, int nbCol); + +// short = int16 +int putShort(char * variableName, short variable[], int nbRow, int nbCol); + +int putUnsignedShort(char * variableName, unsigned short variable[], int nbRow, int nbCol); + +// int = int32 +int putInt(char * variableName, int variable[], int nbRow, int nbCol); + +int putUnsignedInt(char * variableName, unsigned int variable[], int nbRow, int nbCol); + +#ifdef __SCILAB_INT64__ +// long = int64 +int putLong(char * variableName, long variable[], int nbRow, int nbCol); + +int putUnsignedLong(char * variableName, unsigned long variable[], int nbRow, int nbCol); +#endif + +// This position matters. It will apply only to the following lines +%include "call_scilab_java_typemaps_sparse.i" + +int putSparse(char * variableName, int nbRow, int nbCol, int * nbRowItem, int nbRowItemL, int * colPos, int colPosL, double * data, int dataL); + +int putComplexSparse(char * variableName, int nbRow, int nbCol, int * nbRowItem, int nbRowItemL, int * colPos, int colPosL, double * data, int dataL, double * imag, int imagL); + +int putBooleanSparse(char * variableName, int nbRow, int nbCol, int * nbRowItem, int nbRowItemL, int * colPos, int colPosL); + +// This position matters. It will apply only to the following lines +%include "call_scilab_java_typemaps_poly.i" + +int putPolynomial(char * variableName, char * polyVarName, double ** data, int nbRow, int nbCol, int * nbCoef); +int putComplexPolynomial(char * variableName, char * polyVarName, double ** data, int nbRow, int nbCol, int * nbCoef, double ** imag, int nbRowI, int nbColI, int * nbCoefI); diff --git a/modules/javasci/src/jni/call_scilab_java_typemaps.i b/modules/javasci/src/jni/call_scilab_java_typemaps.i new file mode 100755 index 000000000..f37cc2b47 --- /dev/null +++ b/modules/javasci/src/jni/call_scilab_java_typemaps.i @@ -0,0 +1,111 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + + +////////////////////////////////////////////// + + + +////////////////////////////////////////////// + +%define JAVASCI_ARRAYS_IMPL(CTYPE, JNITYPE, JAVATYPE, JAVAPRIMITIVETYPE) + +%typemap(jni) (CTYPE *) "jobjectArray" +%typemap(jtype) (CTYPE *) "JAVAPRIMITIVETYPE[][]" +%typemap(jstype) (CTYPE *) "JAVAPRIMITIVETYPE[][]" +%typemap(javain) CTYPE *OUTVALUE "$javainput" +%typemap(javaout) (CTYPE *) { + return $jnicall; +} + + +%typemap(javain) CTYPE[ANY], CTYPE[] "$javainput" + +////////////////////////// + +//%include "arrays_java.i" + +/* Transform the input datatype CTYPE[] to JAVAPRIMITIVETYPE[][] to facilitate the +matching in Java */ +%typemap(jni) CTYPE[] "jobjectArray" +%typemap(jtype) CTYPE[] "JAVAPRIMITIVETYPE[][]" +%typemap(jstype) CTYPE[] "JAVAPRIMITIVETYPE[][]" + + +%typemap(argout) (CTYPE variable[], int nbRow, int nbCol) { +// Specific target because it was freeing the wrong argument + free($1); +} + + +%typemap(in) (CTYPE variable[], int nbRow, int nbCol) { +// Convert the CTYPE[][] => CTYPE * + int i = 0, j = 0; + $2 = (*jenv)->GetArrayLength(jenv, $input); + $3 = 0; + $1 = NULL; + + + for (; i < $2; i++) + { + jboolean isCopy = JNI_FALSE; + ##JNITYPE##* element = NULL; + ##JNITYPE##Array oneDim = (##JNITYPE##Array)(*jenv)->GetObjectArrayElement(jenv, $input, i); + if ($3 == 0) + { + /* First time we are here, init + create the array where we store the data */ + $3 = (*jenv)->GetArrayLength(jenv, oneDim); + $1 = (CTYPE*)malloc(sizeof(CTYPE) * $2 * $3); + } + isCopy = JNI_FALSE; + element = (##JNITYPE##*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < $3; j++) + { + $1[j * $2 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } +} + +%typemap(in) (CTYPE imag[], int nbRowI, int nbColI) = (CTYPE variable[], int nbRow, int nbCol); +%typemap(argout) (CTYPE imag[], int nbRowI, int nbColI) = (CTYPE variable[], int nbRow, int nbCol); +%enddef + +// See SWIG documentation for the full list: +// http://www.swig.org/Doc1.3/Java.html#default_primitive_type_mappings + +// Scilab: int8 +JAVASCI_ARRAYS_IMPL(byte, jbyte, Byte, byte) /* signed char[] */ +JAVASCI_ARRAYS_IMPL(unsigned char, jshort, Short, jshort) /* unsigned char */ + +// Scilab: int16 + +JAVASCI_ARRAYS_IMPL(short, jshort, Short, short) /* short[] */ +JAVASCI_ARRAYS_IMPL(unsigned short, jchar, Char, short) /* unsigned short[] */ + +// Scilab: int32 +JAVASCI_ARRAYS_IMPL(int, jint, Int, int) /* int[] */ +JAVASCI_ARRAYS_IMPL(unsigned int, jint, Int, int) /* unsigned int[] */ + +#ifdef __SCILAB_INT64__ +// Scilab: int64 +JAVASCI_ARRAYS_IMPL(long, jint, int, long) /* long[] */ +JAVASCI_ARRAYS_IMPL(unsigned long, jlong, Long, long) /* unsigned long[] */ +#endif + +//JAVASCI_ARRAYS_IMPL(float, jfloat, Float, float, ) /* float[] */ +// Scilab: double +JAVASCI_ARRAYS_IMPL(double, jdouble, Double, double) /* double[] */ +// Scilab: boolean +JAVASCI_ARRAYS_IMPL(BOOL, jboolean, Boolean, boolean) /* double[] */ diff --git a/modules/javasci/src/jni/call_scilab_java_typemaps_complex.i b/modules/javasci/src/jni/call_scilab_java_typemaps_complex.i new file mode 100755 index 000000000..15de13ac6 --- /dev/null +++ b/modules/javasci/src/jni/call_scilab_java_typemaps_complex.i @@ -0,0 +1,53 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + + +%define JAVASCI_COMPLEX_ARRAYS_IMPL(CTYPE, JNITYPE, JAVATYPE, JAVAPRIMITIVETYPE, JNICODE) + +/* Transform the input datatype CTYPE[] to JAVAPRIMITIVETYPE[][] to facilitate the +matching in Java */ +%typemap(jni) CTYPE[] "jobjectArray" +%typemap(jtype) CTYPE[] "JAVAPRIMITIVETYPE[]" +%typemap(jstype) CTYPE[] "JAVAPRIMITIVETYPE[]" + +%typemap(argout) (CTYPE variable[], int nbRow, int nbCol) { +// Specific target because it was freeing the wrong argument +} + +%typemap(in) (CTYPE variable[], int nbRow, int nbCol) { +// Convert the CTYPE[][] => CTYPE * + $2 = (*jenv)->GetArrayLength(jenv, $input); + $3 = 0; + $1 = NULL; + int i=0, j=0; + ##JNITYPE## *element = NULL; + + for(i=0; i<$2; i++) { + ##JNITYPE##Array oneDim=(##JNITYPE##Array)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if ($3==0) { + /* First time we are here, init + create the array where we store the data */ + $3 = (*jenv)->GetArrayLength(jenv, oneDim); + $1 = (CTYPE*)malloc(sizeof(##CTYPE##)*arg3*arg4); + } + element = (*jenv)->Get##JAVATYPE##ArrayElements(jenv, oneDim, 0); + + for(j=0; j<$3; j++) { + $1[j*$2+i]=element[j]; + } + } + +} +%enddef + + + +JAVASCI_COMPLEX_ARRAYS_IMPL(double, jdouble, Double, double, "[D") /* double[] */ diff --git a/modules/javasci/src/jni/call_scilab_java_typemaps_poly.i b/modules/javasci/src/jni/call_scilab_java_typemaps_poly.i new file mode 100755 index 000000000..6c2c57b22 --- /dev/null +++ b/modules/javasci/src/jni/call_scilab_java_typemaps_poly.i @@ -0,0 +1,82 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + + +////////////////////////////////////////////// + + + +////////////////////////////////////////////// + +%define JAVASCI_POLY_ARRAYS_IMPL(CTYPE, JNITYPE, JAVATYPE, JAVAPRIMITIVETYPE) + +%typemap(jni) (CTYPE **) "jobjectArray" +%typemap(jtype) (CTYPE **) "JAVAPRIMITIVETYPE[][][]" +%typemap(jstype) (CTYPE **) "JAVAPRIMITIVETYPE[][][]" +%typemap(javain) (CTYPE **) "$javainput" +%typemap(javaout) CTYPE** { + return $jnicall; +} + +////////////////////////// + +%typemap(argout) (CTYPE ** data, int nbRow, int nbCol, int * nbCoef) { +// Specific target because it was freeing the wrong argument + int i = 0; + for (; i < $2 * $3; i++) + { + FREE($1[i]); + } + FREE($1); + FREE($4); +} + + +%typemap(in) (CTYPE ** data, int nbRow, int nbCol, int * nbCoef) { +// Convert the CTYPE[][] => CTYPE * + int i = 0, j = 0, k = 0; + $2 = (*jenv)->GetArrayLength(jenv, $input); + $3 = 0; + $1 = NULL; + + for (; i < $2; i++) { + jobjectArray dblDim = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, $input, i); + if ($3 == 0) { + /* First time we are here, init + create the array where we store the data */ + $3 = (*jenv)->GetArrayLength(jenv, dblDim); + $1 = (CTYPE**)malloc(sizeof(##CTYPE##*) * $2 * $3); + $4 = (int*)malloc(sizeof(int) * $2 * $3); + } + for (j = 0; j < $3; j++) + { + ##JNITYPE##Array oneDim = (##JNITYPE##Array)(*jenv)->GetObjectArrayElement(jenv, dblDim, j); + jboolean isCopy = JNI_FALSE; + ##JNITYPE##* element = NULL; + $4[j * $2 + i] = (*jenv)->GetArrayLength(jenv, oneDim); + $1[j * $2 + i] = (##CTYPE##*)MALLOC(sizeof(##JNITYPE##) * $4[j * $2 + i]); + isCopy = JNI_FALSE; + element = (##JNITYPE##*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + memcpy($1[j * $2 + i], element, sizeof(##JNITYPE##) * $4[j * $2 + i]); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, 0); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, dblDim); + } + } + +%typemap(argout) (CTYPE ** imag, int nbRowI, int nbColI, int * nbCoefI) = (CTYPE ** data, int nbRow, int nbCol, int * nbCoef); +%typemap(in) (CTYPE ** imag, int nbRowI, int nbColI, int * nbCoefI) = (CTYPE ** data, int nbRow, int nbCol, int * nbCoef); + +%enddef + +JAVASCI_POLY_ARRAYS_IMPL(double, jdouble, Double, double) /* double[] */ + diff --git a/modules/javasci/src/jni/call_scilab_java_typemaps_sparse.i b/modules/javasci/src/jni/call_scilab_java_typemaps_sparse.i new file mode 100755 index 000000000..986ede081 --- /dev/null +++ b/modules/javasci/src/jni/call_scilab_java_typemaps_sparse.i @@ -0,0 +1,63 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + + +////////////////////////////////////////////// + + + +////////////////////////////////////////////// + +%define JAVASCI_SPARSE_ARRAYS_IMPL(CTYPE, JNITYPE, JAVATYPE, JAVAPRIMITIVETYPE) + +%typemap(jni) (CTYPE *) "jobjectArray" +%typemap(jtype) (CTYPE *) "JAVAPRIMITIVETYPE[]" +%typemap(jstype) (CTYPE *) "JAVAPRIMITIVETYPE[]" +%typemap(javain) (CTYPE *) "$javainput" +%typemap(javaout) (CTYPE *) { + return $jnicall; +} + +////////////////////////// + +%typemap(argout) (CTYPE * nbRowItem, int nbRowItemL) { +// Specific target because it was freeing the wrong argument + FREE($1); +} + + +%typemap(in) (CTYPE * nbRowItem, int nbRowItemL) { + jboolean isCopy = JNI_FALSE; + ##JNITYPE##* element = NULL; +// Convert the CTYPE[][] => CTYPE * + $2 = (*jenv)->GetArrayLength(jenv, $input); + $1 = (CTYPE*)MALLOC(sizeof(##CTYPE##) * $2); + + isCopy = JNI_FALSE; + element = (##JNITYPE##*)(*jenv)->GetPrimitiveArrayCritical(jenv, $input, &isCopy); + memcpy($1, element, sizeof(##CTYPE##) * $2); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, $input, element, 0); + } + +%typemap(in) (CTYPE * colPos, int colPosL) = (CTYPE * nbRowItem, int nbRowItemL); +%typemap(argout) (CTYPE * colPos, int colPosL) = (CTYPE * nbRowItem, int nbRowItemL); +%typemap(in) (CTYPE * data, int dataL) = (CTYPE * nbRowItem, int nbRowItemL); +%typemap(argout) (CTYPE * data, int dataL) = (CTYPE * nbRowItem, int nbRowItemL); +%typemap(in) (CTYPE * imag, int imagL) = (CTYPE * nbRowItem, int nbRowItemL); +%typemap(argout) (CTYPE * imag, int imagL) = (CTYPE * nbRowItem, int nbRowItemL); +%enddef + +// See SWIG documentation for the full list: +// http://www.swig.org/Doc1.3/Java.html#default_primitive_type_mappings + +JAVASCI_SPARSE_ARRAYS_IMPL(double, jdouble, Double, double) /* double[] */ +JAVASCI_SPARSE_ARRAYS_IMPL(int, jint, Int, int) /* int[] */ diff --git a/modules/javasci/src/jni/call_scilab_java_typemaps_string.i b/modules/javasci/src/jni/call_scilab_java_typemaps_string.i new file mode 100755 index 000000000..fd4235af2 --- /dev/null +++ b/modules/javasci/src/jni/call_scilab_java_typemaps_string.i @@ -0,0 +1,110 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +%typemap(in) (char* variableName, int *nbRow, int *nbCol) { + $2 = &nbRow; + $3 = &nbCol; + $1 = 0; + if ($input) { + $1 = (char *)(*jenv)->GetStringUTFChars(jenv, $input, 0); + if (!$1) return 0; + } +} + +// retrieve from the native code a char ** => String[][] (java) +%typemap(out) (char **) (int nbRow, int nbCol) { + const jclass clazz = (*jenv)->FindClass(jenv, "java/lang/Object"); + int i = 0, j = 0; + + jresult = (*jenv)->NewObjectArray(jenv, nbRow,clazz, NULL); + + for (; i < nbRow; i++) + { + jobjectArray jarray = (*jenv)->NewObjectArray(jenv, nbCol, clazz, NULL); + if (jarray == NULL) + { + printf("Could not allocate\n"); + fflush(NULL); + } + + for (j = 0; j < nbCol; j++) { + /* Scilab is storing matrice cols by cols while Java is doing it + row by row. Therefor, we need to convert it */ + jstring temp_string = (*jenv)->NewStringUTF(jenv, (const char *)result[nbRow*j+i]); + (*jenv)->SetObjectArrayElement(jenv, jarray, j, temp_string); + (*jenv)->DeleteLocalRef(jenv, temp_string); + } + + (*jenv)->SetObjectArrayElement(jenv, jresult, i, jarray); + (*jenv)->DeleteLocalRef(jenv, jarray); + } + + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + free(result); +} + +/* Transform the input datatype char[] to char[][] to facilitate the +matching in Java */ +%typemap(jni) (char **) "jobjectArray" +%typemap(jtype) (char **) "String[][]" +%typemap(jstype) (char **) "String[][]" + +%typemap(argout) (char **variable, int nbRow, int nbCol) { +// Specific target because it was freeing the wrong argument + int i = 0; + for (; i < $2 * $3; i++) + { + FREE($1[i]); + } + FREE($1); +} + +%typemap(in) (char **variable, int nbRow, int nbCol) { + int i=0, j=0; + // Convert the String[][] => char * + $2 = (*jenv)->GetArrayLength(jenv, $input); + $3 = 0; + $1 = NULL; + + for (; i < $2; i++) + { + jobjectArray oneDim = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, $input, i); + if ($3 == 0) + { + /* First time we are here, init + create the array where we store the data */ + $3 = (*jenv)->GetArrayLength(jenv, oneDim); + $1 = (char**)malloc(sizeof(char*) * $2 * $3); + } + for (j = 0; j < $3; j++) + { + jstring j_string = (jstring)(*jenv)->GetObjectArrayElement(jenv, oneDim, j); + jboolean isCopy = JNI_FALSE; + char *str = (char *)(*jenv)->GetStringUTFChars(jenv, j_string, &isCopy); + $1[j * $2 + i] = (char*)MALLOC(sizeof(char)*(strlen(str) + 1)); + strcpy($1[j * $2 + i], str); + if (isCopy) + { + (*jenv)->ReleaseStringUTFChars(jenv, j_string, (const char *)str); + } + (*jenv)->DeleteLocalRef(jenv, j_string); + } + (*jenv)->DeleteLocalRef(jenv, oneDim); + } +} + +%typemap(javain) char[ANY], char[] "$javainput" + +%typemap(jtype) (char* variableName, int *nbRow, int *nbCol) "String" +%typemap(jstype) (char* variableName, int *nbRow, int *nbCol) "String" + + + diff --git a/modules/javasci/src/jni/call_scilab_wrap.c b/modules/javasci/src/jni/call_scilab_wrap.c new file mode 100755 index 000000000..820256049 --- /dev/null +++ b/modules/javasci/src/jni/call_scilab_wrap.c @@ -0,0 +1,1480 @@ +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.7 + * + * This file is not intended to be easily readable and contains a number of + * coding conventions designed to improve portability and efficiency. Do not make + * changes to this file unless you know what you are doing--modify the SWIG + * interface file instead. + * ----------------------------------------------------------------------------- */ + +#define SWIGJAVA + +/* ----------------------------------------------------------------------------- + * This section contains generic SWIG labels for method/variable + * declarations/attributes, and other compiler dependent labels. + * ----------------------------------------------------------------------------- */ + +/* template workaround for compilers that cannot correctly implement the C++ standard */ +#ifndef SWIGTEMPLATEDISAMBIGUATOR +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif +#endif + +/* inline attribute */ +#ifndef SWIGINLINE +# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) +# define SWIGINLINE inline +# else +# define SWIGINLINE +# endif +#endif + +/* attribute recognised by some compilers to avoid 'unused' warnings */ +#ifndef SWIGUNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +# elif defined(__ICC) +# define SWIGUNUSED __attribute__ ((__unused__)) +# else +# define SWIGUNUSED +# endif +#endif + +#ifndef SWIG_MSC_UNSUPPRESS_4505 +# if defined(_MSC_VER) +# pragma warning(disable : 4505) /* unreferenced local function has been removed */ +# endif +#endif + +#ifndef SWIGUNUSEDPARM +# ifdef __cplusplus +# define SWIGUNUSEDPARM(p) +# else +# define SWIGUNUSEDPARM(p) p SWIGUNUSED +# endif +#endif + +/* internal SWIG method */ +#ifndef SWIGINTERN +# define SWIGINTERN static SWIGUNUSED +#endif + +/* internal inline SWIG method */ +#ifndef SWIGINTERNINLINE +# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE +#endif + +/* exporting methods */ +#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# ifndef GCC_HASCLASSVISIBILITY +# define GCC_HASCLASSVISIBILITY +# endif +#endif + +#ifndef SWIGEXPORT +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define SWIGEXPORT +# else +# define SWIGEXPORT __declspec(dllexport) +# endif +# else +# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY) +# define SWIGEXPORT __attribute__ ((visibility("default"))) +# else +# define SWIGEXPORT +# endif +# endif +#endif + +/* calling conventions for Windows */ +#ifndef SWIGSTDCALL +# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +# define SWIGSTDCALL __stdcall +# else +# define SWIGSTDCALL +# endif +#endif + +/* Deal with Microsoft's attempt at deprecating C standard runtime functions */ +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +# define _CRT_SECURE_NO_DEPRECATE +#endif + +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + + +/* Fix for jlong on some versions of gcc on Windows */ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) + typedef long long __int64; +#endif + +/* Fix for jlong on 64-bit x86 Solaris */ +#if defined(__x86_64) +# ifdef _LP64 +# undef _LP64 +# endif +#endif + +#include <jni.h> +#include <stdlib.h> +#include <string.h> + + +/* Support for throwing Java exceptions */ +typedef enum { + SWIG_JavaOutOfMemoryError = 1, + SWIG_JavaIOException, + SWIG_JavaRuntimeException, + SWIG_JavaIndexOutOfBoundsException, + SWIG_JavaArithmeticException, + SWIG_JavaIllegalArgumentException, + SWIG_JavaNullPointerException, + SWIG_JavaDirectorPureVirtual, + SWIG_JavaUnknownError +} SWIG_JavaExceptionCodes; + +typedef struct { + SWIG_JavaExceptionCodes code; + const char *java_exception; +} SWIG_JavaExceptions_t; + + +static void SWIGUNUSED SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) { + jclass excep; + static const SWIG_JavaExceptions_t java_exceptions[] = { + { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" }, + { SWIG_JavaIOException, "java/io/IOException" }, + { SWIG_JavaRuntimeException, "java/lang/RuntimeException" }, + { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" }, + { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" }, + { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" }, + { SWIG_JavaNullPointerException, "java/lang/NullPointerException" }, + { SWIG_JavaDirectorPureVirtual, "java/lang/RuntimeException" }, + { SWIG_JavaUnknownError, "java/lang/UnknownError" }, + { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } + }; + const SWIG_JavaExceptions_t *except_ptr = java_exceptions; + + while (except_ptr->code != code && except_ptr->code) + except_ptr++; + + (*jenv)->ExceptionClear(jenv); + excep = (*jenv)->FindClass(jenv, except_ptr->java_exception); + if (excep) + (*jenv)->ThrowNew(jenv, excep, msg); +} + + +/* Contract support */ + +#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_JavaThrowException(jenv, SWIG_JavaIllegalArgumentException, msg); return nullreturn; } else + + +#include "BOOL.h" +#define ENABLE_HELPERS +#include "javasci2_helper.h" +#include "MALLOC.h" +#include "../../../call_scilab/includes/call_scilab.h" +#include "../../../call_scilab/includes/fromjava.h" +#include "../../../api_scilab/includes/api_scilab.h" +#include "../../../output_stream/includes/lasterror.h" +#include "../../../modules/graphic_objects/includes/FigureList.h" +#include "../../../core/includes/sci_types.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_Call_1ScilabOpen(JNIEnv *jenv, jclass jcls, jstring jarg1, jboolean jarg2, jstring jarg3, jint jarg4) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + BOOL arg2 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + if (jarg2 == JNI_TRUE) arg2 = TRUE; + else arg2 = FALSE; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg3, 0); + if (!arg3) return 0; + } + arg4 = (int)jarg4; + result = (int)Call_ScilabOpen(arg1,arg2,arg3,arg4); + jresult = (jint)result; + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + if (arg3) (*jenv)->ReleaseStringUTFChars(jenv, jarg3, (const char *)arg3); + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_TerminateScilab(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jboolean jresult = 0 ; + char *arg1 = (char *) 0 ; + BOOL result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + result = TerminateScilab(arg1); + { + if (result) jresult = JNI_TRUE ; + else jresult = JNI_FALSE ; + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_SendScilabJob(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + result = (int)SendScilabJob(arg1); + jresult = (jint)result; + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_SendScilabJobs(JNIEnv *jenv, jclass jcls, jobjectArray jarg1, jint jarg2) { + jint jresult = 0 ; + char **arg1 = (char **) 0 ; + int arg2 ; + jint size1 ; + int result; + + (void)jenv; + (void)jcls; + { + int i = 0; + size1 = (*jenv)->GetArrayLength(jenv, jarg1); + arg1 = (char **) MALLOC((size1+1)*sizeof(char *)); + /* make a copy of each string */ + for (i = 0; i<size1; i++) { + jstring j_string = (jstring)(*jenv)->GetObjectArrayElement(jenv, jarg1, i); + const char * c_string = (*jenv)->GetStringUTFChars(jenv, j_string, 0); + arg1[i] = MALLOC((strlen(c_string)+1)*sizeof(const char *)); + strcpy(arg1[i], c_string); + (*jenv)->ReleaseStringUTFChars(jenv, j_string, c_string); + (*jenv)->DeleteLocalRef(jenv, j_string); + } + arg1[i] = 0; + } + arg2 = (int)jarg2; + result = (int)SendScilabJobs(arg1,arg2); + jresult = (jint)result; + { + int i; + for (i=0; i<size1-1; i++) { + FREE(arg1[i]); + arg1[i] = NULL; + } + FREE(arg1); + arg1 = NULL; + } + return jresult; +} + + +SWIGEXPORT void JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_SetFromJavaToON(JNIEnv *jenv, jclass jcls) { + (void)jenv; + (void)jcls; + SetFromJavaToON(); +} + + +SWIGEXPORT jboolean JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_isGraphicOpened(JNIEnv *jenv, jclass jcls) { + jboolean jresult = 0 ; + BOOL result; + + (void)jenv; + (void)jcls; + result = sciHasFigures(); + { + if (result) jresult = JNI_TRUE ; + else jresult = JNI_FALSE ; + } + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_GetLastErrorCode(JNIEnv *jenv, jclass jcls) { + jint jresult = 0 ; + int result; + + (void)jenv; + (void)jcls; + result = (int)getLastErrorValue(); + jresult = (jint)result; + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_isExistingVariable(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jboolean jresult = 0 ; + char *arg1 = (char *) 0 ; + BOOL result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + result = isExistingVariable(arg1); + { + if (result) jresult = JNI_TRUE ; + else jresult = JNI_FALSE ; + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jstring JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_getLastErrorMessage(JNIEnv *jenv, jclass jcls) { + jstring jresult = 0 ; + char *result = 0 ; + + (void)jenv; + (void)jcls; + result = (char *)getLastErrorMessageSingle(); + { + if (result != NULL) + { + jresult = (*jenv)->NewStringUTF(jenv, (const char *)result); + FREE(result); + result = NULL; + } + } + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_getVariableType(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + sci_types result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + result = (sci_types)getVariableType(arg1); + jresult = (jint)result; + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_getIntegerPrecision(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + sci_int_types result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + result = (sci_int_types)getIntegerPrecision(arg1); + jresult = (jint)result; + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jboolean JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_isComplex(JNIEnv *jenv, jclass jcls, jstring jarg1) { + jboolean jresult = 0 ; + char *arg1 = (char *) 0 ; + BOOL result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + result = isComplexVar(arg1); + { + if (result) jresult = JNI_TRUE ; + else jresult = JNI_FALSE ; + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putString(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + char **arg2 = (char **) 0 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + int i=0, j=0; + // Convert the String[][] => char * + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + for (; i < arg3; i++) + { + jobjectArray oneDim = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (char**)malloc(sizeof(char*) * arg3 * arg4); + } + for (j = 0; j < arg4; j++) + { + jstring j_string = (jstring)(*jenv)->GetObjectArrayElement(jenv, oneDim, j); + jboolean isCopy = JNI_FALSE; + char *str = (char *)(*jenv)->GetStringUTFChars(jenv, j_string, &isCopy); + arg2[j * arg3 + i] = (char*)MALLOC(sizeof(char)*(strlen(str) + 1)); + strcpy(arg2[j * arg3 + i], str); + if (isCopy) + { + (*jenv)->ReleaseStringUTFChars(jenv, j_string, (const char *)str); + } + (*jenv)->DeleteLocalRef(jenv, j_string); + } + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putString(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + int i = 0; + for (; i < arg3 * arg4; i++) + { + FREE(arg2[i]); + } + FREE(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putDoubleComplex(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2, jobjectArray jarg5) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + double *arg2 ; + int arg3 ; + int arg4 ; + double *arg5 ; + int arg6 ; + int arg7 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the double[][] => double * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (double*)malloc(sizeof(double) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + { + // Convert the double[][] => double * + int i = 0, j = 0; + arg6 = (*jenv)->GetArrayLength(jenv, jarg5); + arg7 = 0; + arg5 = NULL; + + + for (; i < arg6; i++) + { + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, jarg5, i); + if (arg7 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg7 = (*jenv)->GetArrayLength(jenv, oneDim); + arg5 = (double*)malloc(sizeof(double) * arg6 * arg7); + } + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg7; j++) + { + arg5[j * arg6 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putDoubleComplex(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + { + // Specific target because it was freeing the wrong argument + free(arg5); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putDouble(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + double *arg2 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the double[][] => double * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (double*)malloc(sizeof(double) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putDouble(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putBoolean(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + BOOL *arg2 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the BOOL[][] => BOOL * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jboolean* element = NULL; + jbooleanArray oneDim = (jbooleanArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (BOOL*)malloc(sizeof(BOOL) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jboolean*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putBoolean(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putByte(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + byte *arg2 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the byte[][] => byte * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jbyte* element = NULL; + jbyteArray oneDim = (jbyteArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (byte*)malloc(sizeof(byte) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jbyte*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putByte(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putUnsignedByte(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + byte *arg2 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the byte[][] => byte * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jbyte* element = NULL; + jbyteArray oneDim = (jbyteArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (byte*)malloc(sizeof(byte) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jbyte*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putUnsignedByte(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putShort(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + short *arg2 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the short[][] => short * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jshort* element = NULL; + jshortArray oneDim = (jshortArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (short*)malloc(sizeof(short) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jshort*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putShort(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putUnsignedShort(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + unsigned short *arg2 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the unsigned short[][] => unsigned short * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jchar* element = NULL; + jcharArray oneDim = (jcharArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (unsigned short*)malloc(sizeof(unsigned short) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jchar*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putUnsignedShort(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putInt(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + int *arg2 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the int[][] => int * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jint* element = NULL; + jintArray oneDim = (jintArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (int*)malloc(sizeof(int) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putInt(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putUnsignedInt(JNIEnv *jenv, jclass jcls, jstring jarg1, jobjectArray jarg2) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + unsigned int *arg2 ; + int arg3 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + { + // Convert the unsigned int[][] => unsigned int * + int i = 0, j = 0; + arg3 = (*jenv)->GetArrayLength(jenv, jarg2); + arg4 = 0; + arg2 = NULL; + + + for (; i < arg3; i++) + { + jboolean isCopy = JNI_FALSE; + jint* element = NULL; + jintArray oneDim = (jintArray)(*jenv)->GetObjectArrayElement(jenv, jarg2, i); + if (arg4 == 0) + { + /* First time we are here, init + create the array where we store the data */ + arg4 = (*jenv)->GetArrayLength(jenv, oneDim); + arg2 = (unsigned int*)malloc(sizeof(unsigned int) * arg3 * arg4); + } + isCopy = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + + for (j = 0; j < arg4; j++) + { + arg2[j * arg3 + i] = element[j]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + } + result = (int)putUnsignedInt(arg1,arg2,arg3,arg4); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + free(arg2); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putSparse(JNIEnv *jenv, jclass jcls, jstring jarg1, jint jarg2, jint jarg3, jobjectArray jarg4, jobjectArray jarg6, jobjectArray jarg8) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + int arg2 ; + int arg3 ; + int *arg4 = (int *) 0 ; + int arg5 ; + int *arg6 = (int *) 0 ; + int arg7 ; + double *arg8 = (double *) 0 ; + int arg9 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + arg2 = (int)jarg2; + arg3 = (int)jarg3; + { + jboolean isCopy = JNI_FALSE; + jint* element = NULL; + // Convert the int[][] => int * + arg5 = (*jenv)->GetArrayLength(jenv, jarg4); + arg4 = (int*)MALLOC(sizeof(int) * arg5); + + isCopy = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg4, &isCopy); + memcpy(arg4, element, sizeof(int) * arg5); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg4, element, 0); + } + { + jboolean isCopy = JNI_FALSE; + jint* element = NULL; + // Convert the int[][] => int * + arg7 = (*jenv)->GetArrayLength(jenv, jarg6); + arg6 = (int*)MALLOC(sizeof(int) * arg7); + + isCopy = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg6, &isCopy); + memcpy(arg6, element, sizeof(int) * arg7); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg6, element, 0); + } + { + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + // Convert the double[][] => double * + arg9 = (*jenv)->GetArrayLength(jenv, jarg8); + arg8 = (double*)MALLOC(sizeof(double) * arg9); + + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg8, &isCopy); + memcpy(arg8, element, sizeof(double) * arg9); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg8, element, 0); + } + result = (int)putSparse(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + FREE(arg4); + } + { + // Specific target because it was freeing the wrong argument + FREE(arg6); + } + { + // Specific target because it was freeing the wrong argument + FREE(arg8); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putComplexSparse(JNIEnv *jenv, jclass jcls, jstring jarg1, jint jarg2, jint jarg3, jobjectArray jarg4, jobjectArray jarg6, jobjectArray jarg8, jobjectArray jarg10) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + int arg2 ; + int arg3 ; + int *arg4 = (int *) 0 ; + int arg5 ; + int *arg6 = (int *) 0 ; + int arg7 ; + double *arg8 = (double *) 0 ; + int arg9 ; + double *arg10 = (double *) 0 ; + int arg11 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + arg2 = (int)jarg2; + arg3 = (int)jarg3; + { + jboolean isCopy = JNI_FALSE; + jint* element = NULL; + // Convert the int[][] => int * + arg5 = (*jenv)->GetArrayLength(jenv, jarg4); + arg4 = (int*)MALLOC(sizeof(int) * arg5); + + isCopy = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg4, &isCopy); + memcpy(arg4, element, sizeof(int) * arg5); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg4, element, 0); + } + { + jboolean isCopy = JNI_FALSE; + jint* element = NULL; + // Convert the int[][] => int * + arg7 = (*jenv)->GetArrayLength(jenv, jarg6); + arg6 = (int*)MALLOC(sizeof(int) * arg7); + + isCopy = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg6, &isCopy); + memcpy(arg6, element, sizeof(int) * arg7); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg6, element, 0); + } + { + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + // Convert the double[][] => double * + arg9 = (*jenv)->GetArrayLength(jenv, jarg8); + arg8 = (double*)MALLOC(sizeof(double) * arg9); + + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg8, &isCopy); + memcpy(arg8, element, sizeof(double) * arg9); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg8, element, 0); + } + { + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + // Convert the double[][] => double * + arg11 = (*jenv)->GetArrayLength(jenv, jarg10); + arg10 = (double*)MALLOC(sizeof(double) * arg11); + + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg10, &isCopy); + memcpy(arg10, element, sizeof(double) * arg11); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg10, element, 0); + } + result = (int)putComplexSparse(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + FREE(arg4); + } + { + // Specific target because it was freeing the wrong argument + FREE(arg6); + } + { + // Specific target because it was freeing the wrong argument + FREE(arg8); + } + { + // Specific target because it was freeing the wrong argument + FREE(arg10); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putBooleanSparse(JNIEnv *jenv, jclass jcls, jstring jarg1, jint jarg2, jint jarg3, jobjectArray jarg4, jobjectArray jarg6) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + int arg2 ; + int arg3 ; + int *arg4 = (int *) 0 ; + int arg5 ; + int *arg6 = (int *) 0 ; + int arg7 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + arg2 = (int)jarg2; + arg3 = (int)jarg3; + { + jboolean isCopy = JNI_FALSE; + jint* element = NULL; + // Convert the int[][] => int * + arg5 = (*jenv)->GetArrayLength(jenv, jarg4); + arg4 = (int*)MALLOC(sizeof(int) * arg5); + + isCopy = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg4, &isCopy); + memcpy(arg4, element, sizeof(int) * arg5); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg4, element, 0); + } + { + jboolean isCopy = JNI_FALSE; + jint* element = NULL; + // Convert the int[][] => int * + arg7 = (*jenv)->GetArrayLength(jenv, jarg6); + arg6 = (int*)MALLOC(sizeof(int) * arg7); + + isCopy = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, jarg6, &isCopy); + memcpy(arg6, element, sizeof(int) * arg7); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jarg6, element, 0); + } + result = (int)putBooleanSparse(arg1,arg2,arg3,arg4,arg5,arg6,arg7); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + FREE(arg4); + } + { + // Specific target because it was freeing the wrong argument + FREE(arg6); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putPolynomial(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jobjectArray jarg3) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + double **arg3 = (double **) 0 ; + int arg4 ; + int arg5 ; + int *arg6 = (int *) 0 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + arg2 = 0; + if (jarg2) { + arg2 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg2, 0); + if (!arg2) return 0; + } + { + // Convert the double[][] => double * + int i = 0, j = 0, k = 0; + arg4 = (*jenv)->GetArrayLength(jenv, jarg3); + arg5 = 0; + arg3 = NULL; + + for (; i < arg4; i++) { + jobjectArray dblDim = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, jarg3, i); + if (arg5 == 0) { + /* First time we are here, init + create the array where we store the data */ + arg5 = (*jenv)->GetArrayLength(jenv, dblDim); + arg3 = (double**)malloc(sizeof(double*) * arg4 * arg5); + arg6 = (int*)malloc(sizeof(int) * arg4 * arg5); + } + for (j = 0; j < arg5; j++) + { + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, dblDim, j); + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + arg6[j * arg4 + i] = (*jenv)->GetArrayLength(jenv, oneDim); + arg3[j * arg4 + i] = (double*)MALLOC(sizeof(jdouble) * arg6[j * arg4 + i]); + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + memcpy(arg3[j * arg4 + i], element, sizeof(jdouble) * arg6[j * arg4 + i]); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, 0); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, dblDim); + } + } + result = (int)putPolynomial(arg1,arg2,arg3,arg4,arg5,arg6); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + int i = 0; + for (; i < arg4 * arg5; i++) + { + FREE(arg3[i]); + } + FREE(arg3); + FREE(arg6); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + if (arg2) (*jenv)->ReleaseStringUTFChars(jenv, jarg2, (const char *)arg2); + return jresult; +} + + +SWIGEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putComplexPolynomial(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jobjectArray jarg3, jobjectArray jarg7) { + jint jresult = 0 ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + double **arg3 = (double **) 0 ; + int arg4 ; + int arg5 ; + int *arg6 = (int *) 0 ; + double **arg7 = (double **) 0 ; + int arg8 ; + int arg9 ; + int *arg10 = (int *) 0 ; + int result; + + (void)jenv; + (void)jcls; + arg1 = 0; + if (jarg1) { + arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0); + if (!arg1) return 0; + } + arg2 = 0; + if (jarg2) { + arg2 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg2, 0); + if (!arg2) return 0; + } + { + // Convert the double[][] => double * + int i = 0, j = 0, k = 0; + arg4 = (*jenv)->GetArrayLength(jenv, jarg3); + arg5 = 0; + arg3 = NULL; + + for (; i < arg4; i++) { + jobjectArray dblDim = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, jarg3, i); + if (arg5 == 0) { + /* First time we are here, init + create the array where we store the data */ + arg5 = (*jenv)->GetArrayLength(jenv, dblDim); + arg3 = (double**)malloc(sizeof(double*) * arg4 * arg5); + arg6 = (int*)malloc(sizeof(int) * arg4 * arg5); + } + for (j = 0; j < arg5; j++) + { + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, dblDim, j); + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + arg6[j * arg4 + i] = (*jenv)->GetArrayLength(jenv, oneDim); + arg3[j * arg4 + i] = (double*)MALLOC(sizeof(jdouble) * arg6[j * arg4 + i]); + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + memcpy(arg3[j * arg4 + i], element, sizeof(jdouble) * arg6[j * arg4 + i]); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, 0); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, dblDim); + } + } + { + // Convert the double[][] => double * + int i = 0, j = 0, k = 0; + arg8 = (*jenv)->GetArrayLength(jenv, jarg7); + arg9 = 0; + arg7 = NULL; + + for (; i < arg8; i++) { + jobjectArray dblDim = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, jarg7, i); + if (arg9 == 0) { + /* First time we are here, init + create the array where we store the data */ + arg9 = (*jenv)->GetArrayLength(jenv, dblDim); + arg7 = (double**)malloc(sizeof(double*) * arg8 * arg9); + arg10 = (int*)malloc(sizeof(int) * arg8 * arg9); + } + for (j = 0; j < arg9; j++) + { + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, dblDim, j); + jboolean isCopy = JNI_FALSE; + jdouble* element = NULL; + arg10[j * arg8 + i] = (*jenv)->GetArrayLength(jenv, oneDim); + arg7[j * arg8 + i] = (double*)MALLOC(sizeof(jdouble) * arg10[j * arg8 + i]); + isCopy = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy); + memcpy(arg7[j * arg8 + i], element, sizeof(jdouble) * arg10[j * arg8 + i]); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, 0); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, dblDim); + } + } + result = (int)putComplexPolynomial(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10); + jresult = (jint)result; + { + // Specific target because it was freeing the wrong argument + int i = 0; + for (; i < arg4 * arg5; i++) + { + FREE(arg3[i]); + } + FREE(arg3); + FREE(arg6); + } + { + // Specific target because it was freeing the wrong argument + int i = 0; + for (; i < arg8 * arg9; i++) + { + FREE(arg7[i]); + } + FREE(arg7); + FREE(arg10); + } + if (arg1) (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1); + if (arg2) (*jenv)->ReleaseStringUTFChars(jenv, jarg2, (const char *)arg2); + return jresult; +} + + +#ifdef __cplusplus +} +#endif + diff --git a/modules/javasci/src/jni/libjavasci2_la-call_scilab_wrap.lo b/modules/javasci/src/jni/libjavasci2_la-call_scilab_wrap.lo new file mode 100755 index 000000000..ecc3ecee8 --- /dev/null +++ b/modules/javasci/src/jni/libjavasci2_la-call_scilab_wrap.lo @@ -0,0 +1,12 @@ +# src/jni/libjavasci2_la-call_scilab_wrap.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libjavasci2_la-call_scilab_wrap.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/javasci/src/jni/libjavasci2_la-putLists.lo b/modules/javasci/src/jni/libjavasci2_la-putLists.lo new file mode 100755 index 000000000..37b498302 --- /dev/null +++ b/modules/javasci/src/jni/libjavasci2_la-putLists.lo @@ -0,0 +1,12 @@ +# src/jni/libjavasci2_la-putLists.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libjavasci2_la-putLists.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/javasci/src/jni/putLists.c b/modules/javasci/src/jni/putLists.c new file mode 100755 index 000000000..dc11de084 --- /dev/null +++ b/modules/javasci/src/jni/putLists.c @@ -0,0 +1,948 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ +/*--------------------------------------------------------------------------*/ +#include <string.h> +#include <jni.h> +#include "api_scilab.h" +#include "stack-c.h" +#include "sci_types.h" +#include "MALLOC.h" +#include "BOOL.h" + +#ifdef __cplusplus +extern "C" { +#endif + + /*--------------------------------------------------------------------------*/ + SciErr sendList(JNIEnv * jenv, jobject list, int * parentList, int pos, char * varName, char listType); + JNIEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putList(JNIEnv *jenv, jclass cl, jstring jvarName, jobject list, jchar type); + /*--------------------------------------------------------------------------*/ + + JNIEXPORT jint JNICALL Java_org_scilab_modules_javasci_Call_1ScilabJNI_putList(JNIEnv *jenv, jclass cl, jstring jvarName, jobject list, jchar type) + { + char * varName = (char*)(*jenv)->GetStringUTFChars(jenv, jvarName, 0); + SciErr sciErr = sendList(jenv, list, 0, 0, varName, (char)type); + (*jenv)->ReleaseStringUTFChars(jenv, jvarName, (const char *)varName); + + if (sciErr.iErr) + { + return -1; + } + + return 0; + } + + SciErr sendList(JNIEnv * jenv, jobject list, int * parentList, int pos, char * varName, char listType) + { + int listLen = (*jenv)->GetArrayLength(jenv, list); + jboolean isCopy = JNI_FALSE; + jintArray jtypes = (jintArray)(*jenv)->GetObjectArrayElement(jenv, list, 0); + jint * types = (*jenv)->GetIntArrayElements(jenv, jtypes, &isCopy); + int i = 0; + SciErr sciErr; + int * currentList = 0; + if (parentList) + { + switch (listType) + { + case 'l' : + sciErr = createListInNamedList(pvApiCtx, varName, parentList, pos, listLen - 1, ¤tList); + break; + case 't' : + sciErr = createTListInNamedList(pvApiCtx, varName, parentList, pos, listLen - 1, ¤tList); + break; + case 'm' : + sciErr = createMListInNamedList(pvApiCtx, varName, parentList, pos, listLen - 1, ¤tList); + break; + } + } + else + { + //cleanStackListAddress(); + switch (listType) + { + case 'l' : + sciErr = createNamedList(pvApiCtx, varName, listLen - 1, ¤tList); + break; + case 't' : + sciErr = createNamedTList(pvApiCtx, varName, listLen - 1, ¤tList); + break; + case 'm' : + sciErr = createNamedMList(pvApiCtx, varName, listLen - 1, ¤tList); + break; + } + } + + if (sciErr.iErr) + { + (*jenv)->ReleaseIntArrayElements(jenv, jtypes, types, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, jtypes); + return sciErr; + } + + //pushListAddress(currentList); + + for (; i < listLen - 1; i++) + { + switch (types[i]) + { + case sci_matrix : + { + int nbCol = 0; + int j = 0, k = 0; + double * real = 0; + double * imag = 0; + int nbRow = 0; + + jobjectArray infos = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, list, i + 1); + int isReal = (*jenv)->GetArrayLength(jenv, infos) == 1; + jobjectArray data = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, infos, 0); + + if (!data) + { + // empty matrix + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + (*jenv)->DeleteLocalRef(jenv, infos); + break; + } + + nbRow = (*jenv)->GetArrayLength(jenv, data); + + if (isReal) + { + // Get the matrix rowsw + for (; j < nbRow; j++) + { + jboolean isCopy1 = JNI_FALSE; + jdouble* element = NULL; + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, data, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + real = (double*)MALLOC(sizeof(double) * nbRow * nbCol); + } + + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + real[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, data); + + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, real); + FREE(real); + } + else + { + jobject imagData = (jobject)(*jenv)->GetObjectArrayElement(jenv, infos, 1); + // Get the matrix rows + for (; j < nbRow; j++) + { + jboolean isCopy1 = JNI_FALSE; + jdouble* elementR = NULL; + jdouble* elementI = NULL; + jdoubleArray oneDimR = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, data, j); + jdoubleArray oneDimI = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, imagData, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDimR); + real = (double*)MALLOC(sizeof(double) * nbRow * nbCol); + imag = (double*)MALLOC(sizeof(double) * nbRow * nbCol); + } + + elementR = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDimR, &isCopy1); + isCopy1 = JNI_FALSE; + elementI = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDimI, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + real[k * nbRow + j] = elementR[k]; + imag[k * nbRow + j] = elementI[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDimR, elementR, JNI_ABORT); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDimI, elementI, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDimR); + (*jenv)->DeleteLocalRef(jenv, oneDimI); + } + (*jenv)->DeleteLocalRef(jenv, data); + (*jenv)->DeleteLocalRef(jenv, imagData); + + sciErr = createComplexMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, real, imag); + FREE(real); + FREE(imag); + } + (*jenv)->DeleteLocalRef(jenv, infos); + break; + } + case sci_poly : + { + jobjectArray infos = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, list, i + 1); + jobject data = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, data); + int isReal = 0; + jstring js; + char * polyVarName = NULL; + int nbCol = 0; + int j = 0, k = 0; + double ** real = NULL; + double ** imag = NULL; + int * nbCoef = NULL; + + if (!data || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!data) + { + (*jenv)->DeleteLocalRef(jenv, data); + } + (*jenv)->DeleteLocalRef(jenv, infos); + break; + } + + isReal = (*jenv)->GetArrayLength(jenv, infos) == 2; + js = (jstring)(*jenv)->GetObjectArrayElement(jenv, infos, 0); + polyVarName = (char*)(*jenv)->GetStringUTFChars(jenv, js, 0); + + if (isReal) + { + // Get the matrix rows + for (; j < nbRow; j++) + { + jobjectArray dblDim = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, data, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, dblDim); + real = (double**)MALLOC(sizeof(double*) * nbRow * nbCol); + nbCoef = (int*)MALLOC(sizeof(int) * nbRow * nbCol); + } + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + jboolean isCopy1 = JNI_FALSE; + jdouble* element = NULL; + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, dblDim, k); + int len = (*jenv)->GetArrayLength(jenv, oneDim); + nbCoef[k * nbRow + j] = len; + real[k * nbRow + j] = (double*)MALLOC(sizeof(double) * len); + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + memcpy(real[k * nbRow + j], element, sizeof(double) * len); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, 0); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, dblDim); + } + (*jenv)->DeleteLocalRef(jenv, data); + + sciErr = createMatrixOfPolyInNamedList(pvApiCtx, varName, currentList, i + 1, polyVarName, nbRow, nbCol, nbCoef, (const double * const*)real); + for (j = 0; j < nbRow * nbCol; j++) + { + FREE(real[j]); + } + FREE(real); + FREE(nbCoef); + } + else + { + jobject imagData = (*jenv)->GetObjectArrayElement(jenv, infos, 2); + // Get the matrix rows + for (; j < nbRow; j++) + { + jobjectArray dblDimR = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, data, j); + jobjectArray dblDimI = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, imagData, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, dblDimR); + real = (double**)MALLOC(sizeof(double*) * nbRow * nbCol); + imag = (double**)MALLOC(sizeof(double*) * nbRow * nbCol); + nbCoef = (int*)MALLOC(sizeof(int) * nbRow * nbCol); + } + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + jboolean isCopy1 = JNI_FALSE; + jdouble* element = NULL; + jdoubleArray oneDimR = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, dblDimR, k); + jdoubleArray oneDimI = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, dblDimI, k); + int len = (*jenv)->GetArrayLength(jenv, oneDimR); + nbCoef[k * nbRow + j] = len; + real[k * nbRow + j] = (double*)MALLOC(sizeof(double) * len); + imag[k * nbRow + j] = (double*)MALLOC(sizeof(double) * len); + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDimR, &isCopy1); + memcpy(real[k * nbRow + j], element, sizeof(double) * len); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDimR, element, 0); + (*jenv)->DeleteLocalRef(jenv, oneDimR); + isCopy1 = JNI_FALSE; + element = (jdouble*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDimI, &isCopy1); + memcpy(imag[k * nbRow + j], element, sizeof(double) * len); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDimI, element, 0); + (*jenv)->DeleteLocalRef(jenv, oneDimI); + } + (*jenv)->DeleteLocalRef(jenv, dblDimR); + (*jenv)->DeleteLocalRef(jenv, dblDimI); + } + (*jenv)->DeleteLocalRef(jenv, data); + (*jenv)->DeleteLocalRef(jenv, imagData); + + sciErr = createComplexMatrixOfPolyInNamedList(pvApiCtx, varName, currentList, i + 1, polyVarName, nbRow, nbCol, nbCoef, (const double * const*)real, (const double * const*)imag); + for (j = 0; j < nbRow * nbCol; j++) + { + FREE(real[j]); + FREE(imag[j]); + } + FREE(real); + FREE(imag); + FREE(nbCoef); + } + + (*jenv)->ReleaseStringUTFChars(jenv, js, polyVarName); + (*jenv)->DeleteLocalRef(jenv, js); + (*jenv)->DeleteLocalRef(jenv, infos); + break; + } + case sci_boolean : + { + jobject data = (*jenv)->GetObjectArrayElement(jenv, list, i + 1); + int nbRow = (*jenv)->GetArrayLength(jenv, data); + int nbCol = 0; + int j = 0, k; + int * b = 0; + + if (!data || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!data) + { + (*jenv)->DeleteLocalRef(jenv, data); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jboolean isCopy1 = JNI_FALSE; + jboolean* element = NULL; + jdoubleArray oneDim = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, data, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + b = (int*)MALLOC(sizeof(int) * nbRow * nbCol); + } + + element = (jboolean*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + b[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, data); + + sciErr = createMatrixOfBooleanInNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, (const int *)b); + FREE(b); + break; + } + case sci_sparse : + { + jboolean isCopy1 = JNI_FALSE; + int* dims = NULL; + int* nbItemRow = NULL; + int* colPos = NULL; + double* data = NULL; + double * imagData = NULL; + jobjectArray infos = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, list, i + 1); + int isReal = (*jenv)->GetArrayLength(jenv, infos) == 4; + jintArray jdims = (jintArray)(*jenv)->GetObjectArrayElement(jenv, infos, 0); + jintArray jnbItemRow = (jintArray)(*jenv)->GetObjectArrayElement(jenv, infos, 1); + jintArray jcolPos = (jintArray)(*jenv)->GetObjectArrayElement(jenv, infos, 2); + jint nbNonNull = (*jenv)->GetArrayLength(jenv, jcolPos); + jdoubleArray jdata = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, infos, 3); + jdoubleArray jimagData; + + if (!isReal) + { + jimagData = (jdoubleArray)(*jenv)->GetObjectArrayElement(jenv, infos, 4); + } + + dims = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, jdims, &isCopy1); + isCopy1 = JNI_FALSE; + nbItemRow = (int*)(*jenv)->GetPrimitiveArrayCritical(jenv, jnbItemRow, &isCopy1); + isCopy1 = JNI_FALSE; + colPos = (int*)(*jenv)->GetPrimitiveArrayCritical(jenv, jcolPos, &isCopy1); + isCopy1 = JNI_FALSE; + data = (double*)(*jenv)->GetPrimitiveArrayCritical(jenv, jdata, &isCopy1); + isCopy1 = JNI_FALSE; + + if (!isReal) + { + imagData = (double*)(*jenv)->GetPrimitiveArrayCritical(jenv, jimagData, &isCopy1); + } + + if (isReal) + { + sciErr = createSparseMatrixInNamedList(pvApiCtx, varName, currentList, i + 1, dims[0], dims[1], nbNonNull, nbItemRow, colPos, data); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jdata, data, JNI_ABORT); + } + else + { + sciErr = createComplexSparseMatrixInNamedList(pvApiCtx, varName, currentList, i + 1, dims[0], dims[1], nbNonNull, nbItemRow, colPos, data, imagData); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jimagData, imagData, JNI_ABORT); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jdata, data, JNI_ABORT); + } + + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jcolPos, colPos, JNI_ABORT); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jnbItemRow, nbItemRow, JNI_ABORT); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jdims, dims, JNI_ABORT); + + if (!isReal) + { + (*jenv)->DeleteLocalRef(jenv, jimagData); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + (*jenv)->DeleteLocalRef(jenv, jcolPos); + (*jenv)->DeleteLocalRef(jenv, jnbItemRow); + (*jenv)->DeleteLocalRef(jenv, jdims); + (*jenv)->DeleteLocalRef(jenv, infos); + + break; + } + case sci_boolean_sparse : + { + jobjectArray infos = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, list, i + 1); + jintArray jdims = (jintArray)(*jenv)->GetObjectArrayElement(jenv, infos, 0); + jintArray jnbItemRow = (jintArray)(*jenv)->GetObjectArrayElement(jenv, infos, 1); + jintArray jcolPos = (jintArray)(*jenv)->GetObjectArrayElement(jenv, infos, 2); + jint nbNonNull = (*jenv)->GetArrayLength(jenv, jcolPos); + int* nbItemRow = NULL; + int* dims = NULL; + int* colPos = NULL; + + jboolean isCopy1 = JNI_FALSE; + + dims = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, jdims, &isCopy1); + isCopy1 = JNI_FALSE; + nbItemRow = (int*)(*jenv)->GetPrimitiveArrayCritical(jenv, jnbItemRow, &isCopy1); + isCopy1 = JNI_FALSE; + colPos = (int*)(*jenv)->GetPrimitiveArrayCritical(jenv, jcolPos, &isCopy1); + + sciErr = createBooleanSparseMatrixInNamedList(pvApiCtx, varName, currentList, i + 1, dims[0], dims[1], nbNonNull, nbItemRow, colPos); + + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jcolPos, colPos, JNI_ABORT); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jnbItemRow, nbItemRow, JNI_ABORT); + (*jenv)->ReleasePrimitiveArrayCritical(jenv, jdims, dims, JNI_ABORT); + + (*jenv)->DeleteLocalRef(jenv, jcolPos); + (*jenv)->DeleteLocalRef(jenv, jnbItemRow); + (*jenv)->DeleteLocalRef(jenv, jdims); + (*jenv)->DeleteLocalRef(jenv, infos); + + break; + } + case sci_ints : + { + jobjectArray infos = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, list, i + 1); + jintArray jtype = (jintArray)(*jenv)->GetObjectArrayElement(jenv, infos, 0); + jint * typep = (*jenv)->GetIntArrayElements(jenv, jtype, 0); + int type = *typep; + + (*jenv)->ReleaseIntArrayElements(jenv, jtype, typep, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, jtype); + + switch (type) + { + case sci_int8 : + { + jobject jdata = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, jdata); + int nbCol = 0; + int j = 0, k; + char * data = 0; + + if (!jdata || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!jdata) + { + (*jenv)->DeleteLocalRef(jenv, jdata); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jboolean isCopy1 = JNI_FALSE; + jbyte* element = NULL; + jbyteArray oneDim = (jbyteArray)(*jenv)->GetObjectArrayElement(jenv, jdata, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + data = (char*)MALLOC(sizeof(char) * nbRow * nbCol); + } + isCopy1 = JNI_FALSE; + element = (jbyte*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + data[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + + sciErr = createMatrixOfInteger8InNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, data); + FREE(data); + break; + } + case sci_uint8 : + { + jobject jdata = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, jdata); + int nbCol = 0; + int j = 0, k; + unsigned char * data = 0; + + if (!jdata || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!jdata) + { + (*jenv)->DeleteLocalRef(jenv, jdata); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jbyte* element = NULL; + jboolean isCopy1 = JNI_FALSE; + jbyteArray oneDim = (jbyteArray)(*jenv)->GetObjectArrayElement(jenv, jdata, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + data = (unsigned char*)MALLOC(sizeof(unsigned char) * nbRow * nbCol); + } + + element = (jbyte*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + data[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + + sciErr = createMatrixOfUnsignedInteger8InNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, data); + FREE(data); + + break; + } + case sci_int16 : + { + jobject jdata = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, jdata); + int nbCol = 0; + int j = 0, k; + short * data = 0; + + if (!jdata || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!jdata) + { + (*jenv)->DeleteLocalRef(jenv, jdata); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jboolean isCopy1 = JNI_FALSE; + jshort* element = NULL; + jshortArray oneDim = (jshortArray)(*jenv)->GetObjectArrayElement(jenv, jdata, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + data = (short*)MALLOC(sizeof(short) * nbRow * nbCol); + } + + element = (jshort*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + data[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + + sciErr = createMatrixOfInteger16InNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, data); + FREE(data); + + break; + } + case sci_uint16 : + { + jobject jdata = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, jdata); + int nbCol = 0; + int j = 0, k; + unsigned short * data = 0; + + if (!jdata || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!jdata) + { + (*jenv)->DeleteLocalRef(jenv, jdata); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jboolean isCopy1 = JNI_FALSE; + jshort* element = NULL; + jshortArray oneDim = (jshortArray)(*jenv)->GetObjectArrayElement(jenv, jdata, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + data = (unsigned short*)MALLOC(sizeof(unsigned short) * nbRow * nbCol); + } + isCopy1 = JNI_FALSE; + element = (jshort*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + data[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + + sciErr = createMatrixOfUnsignedInteger16InNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, data); + FREE(data); + + break; + } + case sci_int32 : + { + jobject jdata = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, jdata); + int nbCol = 0; + int j = 0, k; + int * data = 0; + + if (!jdata || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!jdata) + { + (*jenv)->DeleteLocalRef(jenv, jdata); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jboolean isCopy1 = JNI_FALSE; + jint* element = NULL; + jintArray oneDim = (jintArray)(*jenv)->GetObjectArrayElement(jenv, jdata, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + data = (int*)MALLOC(sizeof(int) * nbRow * nbCol); + } + isCopy1 = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + data[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + + sciErr = createMatrixOfInteger32InNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, data); + FREE(data); + + break; + } + case sci_uint32 : + { + jobject jdata = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, jdata); + int nbCol = 0; + int j = 0, k; + unsigned int * data = 0; + + if (!jdata || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!jdata) + { + (*jenv)->DeleteLocalRef(jenv, jdata); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jboolean isCopy1 = JNI_FALSE; + jint* element = NULL; + jintArray oneDim = (jintArray)(*jenv)->GetObjectArrayElement(jenv, jdata, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + data = (unsigned int*)MALLOC(sizeof(unsigned int) * nbRow * nbCol); + } + isCopy1 = JNI_FALSE; + element = (jint*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + data[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + + sciErr = createMatrixOfUnsignedInteger32InNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, data); + FREE(data); + + break; + } +#ifdef __SCILAB_INT64__ + case sci_int64 : + { + jobject jdata = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, jdata); + int nbCol = 0; + int j = 0, k; + long * data = 0; + + if (!jdata || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!jdata) + { + (*jenv)->DeleteLocalRef(jenv, jdata); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jlongArray oneDim = (jlongArray)(*jenv)->GetObjectArrayElement(jenv, jdata, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + data = (long*)MALLOC(sizeof(long) * nbRow * nbCol); + } + jboolean isCopy1 = JNI_FALSE; + jlong* element = (jlong*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + data[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + + sciErr = createMatrixOfInteger64InNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, data); + FREE(data); + + break; + } + case sci_uint64 : + { + jobject jdata = (*jenv)->GetObjectArrayElement(jenv, infos, 1); + int nbRow = (*jenv)->GetArrayLength(jenv, jdata); + int nbCol = 0; + int j = 0, k; + unsigned long * data = 0; + + if (!jdata || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!jdata) + { + (*jenv)->DeleteLocalRef(jenv, jdata); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jlongArray oneDim = (jlongArray)(*jenv)->GetObjectArrayElement(jenv, jdata, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + data = (unsigned long*)MALLOC(sizeof(unsigned long) * nbRow * nbCol); + } + jboolean isCopy1 = JNI_FALSE; + jlong* element = (jlong*)(*jenv)->GetPrimitiveArrayCritical(jenv, oneDim, &isCopy1); + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + data[k * nbRow + j] = element[k]; + } + (*jenv)->ReleasePrimitiveArrayCritical(jenv, oneDim, element, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, jdata); + + sciErr = createMatrixOfUnsignedInteger64InNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, data); + FREE(data); + break; + } +#endif + } + (*jenv)->DeleteLocalRef(jenv, infos); + break; + } + case sci_strings : + { + jobject data = (*jenv)->GetObjectArrayElement(jenv, list, i + 1); + int nbRow = (*jenv)->GetArrayLength(jenv, data); + int nbCol = 0; + int j = 0, k; + char ** strings = 0; + + if (!data || nbRow == 0) + { + sciErr = createMatrixOfDoubleInNamedList(pvApiCtx, varName, currentList, i + 1, 0, 0, 0); + if (!data) + { + (*jenv)->DeleteLocalRef(jenv, data); + } + break; + } + + // Get the matrix rows + for (; j < nbRow; j++) + { + jobjectArray oneDim = (jobjectArray)(*jenv)->GetObjectArrayElement(jenv, data, j); + if (nbCol == 0) + { + nbCol = (*jenv)->GetArrayLength(jenv, oneDim); + strings = (char**)MALLOC(sizeof(char*) * nbRow * nbCol); + } + + // Get the matrix element + for (k = 0; k < nbCol; k++) + { + jstring j_string = (jstring)(*jenv)->GetObjectArrayElement(jenv, oneDim, k); + jboolean isCopy1 = JNI_FALSE; + char *str = (char *)(*jenv)->GetStringUTFChars(jenv, j_string, &isCopy1); + strings[k * nbRow + j] = (char*)MALLOC(sizeof(char) * (strlen(str) + 1)); + strcpy(strings[k * nbRow + j], str); + if (isCopy1) + { + (*jenv)->ReleaseStringUTFChars(jenv, j_string, (const char *)str); + } + (*jenv)->DeleteLocalRef(jenv, j_string); + } + (*jenv)->DeleteLocalRef(jenv, oneDim); + } + (*jenv)->DeleteLocalRef(jenv, data); + + sciErr = createMatrixOfStringInNamedList(pvApiCtx, varName, currentList, i + 1, nbRow, nbCol, (const char * const*)strings); + for (j = 0; j < nbRow * nbCol; j++) + { + FREE(strings[j]); + } + FREE(strings); + break; + } + case sci_list : + { + jobject data = (*jenv)->GetObjectArrayElement(jenv, list, i + 1); + sciErr = sendList(jenv, data, currentList, i + 1, varName, 'l'); + (*jenv)->DeleteLocalRef(jenv, data); + break; + } + case sci_tlist : + { + jobject data = (*jenv)->GetObjectArrayElement(jenv, list, i + 1); + sciErr = sendList(jenv, data, currentList, i + 1, varName, 't'); + (*jenv)->DeleteLocalRef(jenv, data); + break; + } + case sci_mlist : + { + jobject data = (*jenv)->GetObjectArrayElement(jenv, list, i + 1); + sciErr = sendList(jenv, data, currentList, i + 1, varName, 'm'); + (*jenv)->DeleteLocalRef(jenv, data); + break; + } + } + + if (sciErr.iErr) + { + break; + } + } + + (*jenv)->ReleaseIntArrayElements(jenv, jtypes, types, JNI_ABORT); + (*jenv)->DeleteLocalRef(jenv, jtypes); + + //popListAddress(); + + if (!parentList) + { + //pushVariable(varName); + //cleanStackListAddress(); + } + + return sciErr; + } + +#ifdef __cplusplus +} +#endif |