summaryrefslogtreecommitdiffstats
path: root/scilab/modules/javasci
diff options
context:
space:
mode:
authorVincent COUVERT <vincent.couvert@scilab.org>2009-10-02 16:47:38 +0200
committerVincent COUVERT <vincent.couvert@scilab.org>2009-10-02 16:47:38 +0200
commit39cd52feb2c9436c005aebc5175f4ef6cf9ee882 (patch)
treea967ba029e1747fdf1cec7a43d8987e66aeb41a0 /scilab/modules/javasci
parent16d6bb91817b39470a6d2a72af789049748ffe6c (diff)
parent0d8f1f9c3a5ea2f5da09df6006c6783a960b2516 (diff)
downloadscilab-39cd52feb2c9436c005aebc5175f4ef6cf9ee882.zip
scilab-39cd52feb2c9436c005aebc5175f4ef6cf9ee882.tar.gz
Merge commit 'origin/master' into xcos
Conflicts: scilab/configure scilab/modules/hdf5/sci_gateway/cpp/sci_export_to_hdf5.cpp scilab/modules/hdf5/sci_gateway/cpp/sci_import_from_hdf5.cpp scilab/modules/hdf5/src/c/h5_readDataFromFile.c scilab/modules/hdf5/src/c/h5_writeDataToFile.c
Diffstat (limited to 'scilab/modules/javasci')
-rw-r--r--scilab/modules/javasci/Makefile.am12
-rw-r--r--scilab/modules/javasci/Makefile.in60
-rw-r--r--scilab/modules/javasci/javasci.iss2
-rw-r--r--scilab/modules/javasci/src/c/javasci_SciAbstractArray.c75
-rw-r--r--scilab/modules/javasci/src/c/javasci_SciBooleanArray.c16
-rw-r--r--scilab/modules/javasci/src/c/javasci_SciComplexArray.c21
-rw-r--r--scilab/modules/javasci/src/c/javasci_SciDoubleArray.c12
-rw-r--r--scilab/modules/javasci/src/c/javasci_SciIntegerArray.c12
-rw-r--r--scilab/modules/javasci/src/c/javasci_SciStringArray.c16
-rw-r--r--scilab/modules/javasci/src/c/javasci_Scilab.c13
-rw-r--r--scilab/modules/javasci/src/c/javasci_Scilab2.c66
11 files changed, 175 insertions, 130 deletions
diff --git a/scilab/modules/javasci/Makefile.am b/scilab/modules/javasci/Makefile.am
index f789af8..29979e4 100644
--- a/scilab/modules/javasci/Makefile.am
+++ b/scilab/modules/javasci/Makefile.am
@@ -64,18 +64,6 @@ libjavasci_la_LIBADD = \
64 $(top_builddir)/modules/api_scilab/libsciapi_scilab.la \ 64 $(top_builddir)/modules/api_scilab/libsciapi_scilab.la \
65 $(top_builddir)/modules/libscilab.la 65 $(top_builddir)/modules/libscilab.la
66 66
67#### javasci : include files ####
68libjavasci_la_includedir=$(pkgincludedir)
69libjavasci_la_include_HEADERS = includes/javasci_Scilab.h \
70includes/javasci_Scilab2.h \
71includes/javasci_globals.h \
72includes/javasci_SciStringArray.h \
73includes/javasci_SciComplexArray.h \
74includes/javasci_SciDoubleArray.h \
75includes/javasci_SciBooleanArray.h \
76includes/javasci_SciIntegerArray.h \
77includes/javasci_SciAbstractArray.h
78
79### javasci : images ### 67### javasci : images ###
80libsciscipad_la_imagesdir = $(mydatadir)/help/images/ 68libsciscipad_la_imagesdir = $(mydatadir)/help/images/
81libsciscipad_la_images_DATA = help/images/ScilabClass.gif \ 69libsciscipad_la_images_DATA = help/images/ScilabClass.gif \
diff --git a/scilab/modules/javasci/Makefile.in b/scilab/modules/javasci/Makefile.in
index bf76743..2bf6923 100644
--- a/scilab/modules/javasci/Makefile.in
+++ b/scilab/modules/javasci/Makefile.in
@@ -44,7 +44,6 @@
44########## 44##########
45 45
46 46
47
48VPATH = @srcdir@ 47VPATH = @srcdir@
49pkgdatadir = $(datadir)/@PACKAGE@ 48pkgdatadir = $(datadir)/@PACKAGE@
50pkgincludedir = $(includedir)/@PACKAGE@ 49pkgincludedir = $(includedir)/@PACKAGE@
@@ -64,8 +63,7 @@ PRE_UNINSTALL = :
64POST_UNINSTALL = : 63POST_UNINSTALL = :
65build_triplet = @build@ 64build_triplet = @build@
66host_triplet = @host@ 65host_triplet = @host@
67DIST_COMMON = $(am__libjavasci_la_include_HEADERS_DIST) \ 66DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
68 $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
69 $(top_srcdir)/Makefile.incl.am 67 $(top_srcdir)/Makefile.incl.am
70@JAVASCI_TRUE@@NEED_JAVA_TRUE@am__append_1 = java 68@JAVASCI_TRUE@@NEED_JAVA_TRUE@am__append_1 = java
71subdir = modules/javasci 69subdir = modules/javasci
@@ -114,8 +112,7 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" \
114 "$(DESTDIR)$(libjavasci_la_etcdir)" \ 112 "$(DESTDIR)$(libjavasci_la_etcdir)" \
115 "$(DESTDIR)$(libjavasci_la_rootdir)" \ 113 "$(DESTDIR)$(libjavasci_la_rootdir)" \
116 "$(DESTDIR)$(libsciscipad_la_imagesdir)" \ 114 "$(DESTDIR)$(libsciscipad_la_imagesdir)" \
117 "$(DESTDIR)$(libsciscipad_la_specialtestdir)" \ 115 "$(DESTDIR)$(libsciscipad_la_specialtestdir)"
118 "$(DESTDIR)$(libjavasci_la_includedir)"
119LTLIBRARIES = $(pkglib_LTLIBRARIES) 116LTLIBRARIES = $(pkglib_LTLIBRARIES)
120@JAVASCI_TRUE@libjavasci_la_DEPENDENCIES = \ 117@JAVASCI_TRUE@libjavasci_la_DEPENDENCIES = \
121@JAVASCI_TRUE@ $(top_builddir)/libs/MALLOC/libscimalloc.la \ 118@JAVASCI_TRUE@ $(top_builddir)/libs/MALLOC/libscimalloc.la \
@@ -161,15 +158,6 @@ DIST_SOURCES = $(am__libjavasci_la_SOURCES_DIST)
161DATA = $(libjavasci_la_etc_DATA) $(libjavasci_la_root_DATA) \ 158DATA = $(libjavasci_la_etc_DATA) $(libjavasci_la_root_DATA) \
162 $(libsciscipad_la_images_DATA) \ 159 $(libsciscipad_la_images_DATA) \
163 $(libsciscipad_la_specialtest_DATA) 160 $(libsciscipad_la_specialtest_DATA)
164am__libjavasci_la_include_HEADERS_DIST = includes/javasci_Scilab.h \
165 includes/javasci_Scilab2.h includes/javasci_globals.h \
166 includes/javasci_SciStringArray.h \
167 includes/javasci_SciComplexArray.h \
168 includes/javasci_SciDoubleArray.h \
169 includes/javasci_SciBooleanArray.h \
170 includes/javasci_SciIntegerArray.h \
171 includes/javasci_SciAbstractArray.h
172HEADERS = $(libjavasci_la_include_HEADERS)
173ETAGS = etags 161ETAGS = etags
174CTAGS = ctags 162CTAGS = ctags
175DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 163DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -454,19 +442,6 @@ libjavasci_la_etc_DATA = etc/javasci.quit etc/javasci.start
454@JAVASCI_TRUE@ $(top_builddir)/modules/libscilab.la 442@JAVASCI_TRUE@ $(top_builddir)/modules/libscilab.la
455 443
456 444
457#### javasci : include files ####
458@JAVASCI_TRUE@libjavasci_la_includedir = $(pkgincludedir)
459@JAVASCI_TRUE@libjavasci_la_include_HEADERS = includes/javasci_Scilab.h \
460@JAVASCI_TRUE@includes/javasci_Scilab2.h \
461@JAVASCI_TRUE@includes/javasci_globals.h \
462@JAVASCI_TRUE@includes/javasci_SciStringArray.h \
463@JAVASCI_TRUE@includes/javasci_SciComplexArray.h \
464@JAVASCI_TRUE@includes/javasci_SciDoubleArray.h \
465@JAVASCI_TRUE@includes/javasci_SciBooleanArray.h \
466@JAVASCI_TRUE@includes/javasci_SciIntegerArray.h \
467@JAVASCI_TRUE@includes/javasci_SciAbstractArray.h
468
469
470### javasci : images ### 445### javasci : images ###
471@JAVASCI_TRUE@libsciscipad_la_imagesdir = $(mydatadir)/help/images/ 446@JAVASCI_TRUE@libsciscipad_la_imagesdir = $(mydatadir)/help/images/
472@JAVASCI_TRUE@libsciscipad_la_images_DATA = help/images/ScilabClass.gif \ 447@JAVASCI_TRUE@libsciscipad_la_images_DATA = help/images/ScilabClass.gif \
@@ -832,26 +807,6 @@ uninstall-libsciscipad_la_specialtestDATA:
832 test -n "$$files" || exit 0; \ 807 test -n "$$files" || exit 0; \
833 echo " ( cd '$(DESTDIR)$(libsciscipad_la_specialtestdir)' && rm -f" $$files ")"; \ 808 echo " ( cd '$(DESTDIR)$(libsciscipad_la_specialtestdir)' && rm -f" $$files ")"; \
834 cd "$(DESTDIR)$(libsciscipad_la_specialtestdir)" && rm -f $$files 809 cd "$(DESTDIR)$(libsciscipad_la_specialtestdir)" && rm -f $$files
835install-libjavasci_la_includeHEADERS: $(libjavasci_la_include_HEADERS)
836 @$(NORMAL_INSTALL)
837 test -z "$(libjavasci_la_includedir)" || $(MKDIR_P) "$(DESTDIR)$(libjavasci_la_includedir)"
838 @list='$(libjavasci_la_include_HEADERS)'; test -n "$(libjavasci_la_includedir)" || list=; \
839 for p in $$list; do \
840 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
841 echo "$$d$$p"; \
842 done | $(am__base_list) | \
843 while read files; do \
844 echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libjavasci_la_includedir)'"; \
845 $(INSTALL_HEADER) $$files "$(DESTDIR)$(libjavasci_la_includedir)" || exit $$?; \
846 done
847
848uninstall-libjavasci_la_includeHEADERS:
849 @$(NORMAL_UNINSTALL)
850 @list='$(libjavasci_la_include_HEADERS)'; test -n "$(libjavasci_la_includedir)" || list=; \
851 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
852 test -n "$$files" || exit 0; \
853 echo " ( cd '$(DESTDIR)$(libjavasci_la_includedir)' && rm -f" $$files ")"; \
854 cd "$(DESTDIR)$(libjavasci_la_includedir)" && rm -f $$files
855 810
856ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 811ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
857 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 812 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -940,9 +895,9 @@ check-am: all-am
940 $(MAKE) $(AM_MAKEFLAGS) check-local 895 $(MAKE) $(AM_MAKEFLAGS) check-local
941check: check-am 896check: check-am
942@JAVASCI_FALSE@all-local: 897@JAVASCI_FALSE@all-local:
943all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) all-local 898all-am: Makefile $(LTLIBRARIES) $(DATA) all-local
944installdirs: 899installdirs:
945 for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(libjavasci_la_etcdir)" "$(DESTDIR)$(libjavasci_la_rootdir)" "$(DESTDIR)$(libsciscipad_la_imagesdir)" "$(DESTDIR)$(libsciscipad_la_specialtestdir)" "$(DESTDIR)$(libjavasci_la_includedir)"; do \ 900 for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(libjavasci_la_etcdir)" "$(DESTDIR)$(libjavasci_la_rootdir)" "$(DESTDIR)$(libsciscipad_la_imagesdir)" "$(DESTDIR)$(libsciscipad_la_specialtestdir)"; do \
946 test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 901 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
947 done 902 done
948install: install-am 903install: install-am
@@ -998,7 +953,6 @@ info: info-am
998info-am: 953info-am:
999 954
1000install-data-am: install-data-local install-libjavasci_la_etcDATA \ 955install-data-am: install-data-local install-libjavasci_la_etcDATA \
1001 install-libjavasci_la_includeHEADERS \
1002 install-libjavasci_la_rootDATA \ 956 install-libjavasci_la_rootDATA \
1003 install-libsciscipad_la_imagesDATA \ 957 install-libsciscipad_la_imagesDATA \
1004 install-libsciscipad_la_specialtestDATA 958 install-libsciscipad_la_specialtestDATA
@@ -1048,7 +1002,6 @@ ps: ps-am
1048ps-am: 1002ps-am:
1049 1003
1050uninstall-am: uninstall-libjavasci_la_etcDATA \ 1004uninstall-am: uninstall-libjavasci_la_etcDATA \
1051 uninstall-libjavasci_la_includeHEADERS \
1052 uninstall-libjavasci_la_rootDATA \ 1005 uninstall-libjavasci_la_rootDATA \
1053 uninstall-libsciscipad_la_imagesDATA \ 1006 uninstall-libsciscipad_la_imagesDATA \
1054 uninstall-libsciscipad_la_specialtestDATA \ 1007 uninstall-libsciscipad_la_specialtestDATA \
@@ -1065,9 +1018,7 @@ uninstall-am: uninstall-libjavasci_la_etcDATA \
1065 install-data-local install-dvi install-dvi-am install-exec \ 1018 install-data-local install-dvi install-dvi-am install-exec \
1066 install-exec-am install-html install-html-am \ 1019 install-exec-am install-html install-html-am \
1067 install-html-local install-info install-info-am \ 1020 install-html-local install-info install-info-am \
1068 install-libjavasci_la_etcDATA \ 1021 install-libjavasci_la_etcDATA install-libjavasci_la_rootDATA \
1069 install-libjavasci_la_includeHEADERS \
1070 install-libjavasci_la_rootDATA \
1071 install-libsciscipad_la_imagesDATA \ 1022 install-libsciscipad_la_imagesDATA \
1072 install-libsciscipad_la_specialtestDATA install-man \ 1023 install-libsciscipad_la_specialtestDATA install-man \
1073 install-pdf install-pdf-am install-pkglibLTLIBRARIES \ 1024 install-pdf install-pdf-am install-pkglibLTLIBRARIES \
@@ -1076,7 +1027,6 @@ uninstall-am: uninstall-libjavasci_la_etcDATA \
1076 maintainer-clean-generic mostlyclean mostlyclean-compile \ 1027 maintainer-clean-generic mostlyclean mostlyclean-compile \
1077 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 1028 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
1078 tags uninstall uninstall-am uninstall-libjavasci_la_etcDATA \ 1029 tags uninstall uninstall-am uninstall-libjavasci_la_etcDATA \
1079 uninstall-libjavasci_la_includeHEADERS \
1080 uninstall-libjavasci_la_rootDATA \ 1030 uninstall-libjavasci_la_rootDATA \
1081 uninstall-libsciscipad_la_imagesDATA \ 1031 uninstall-libsciscipad_la_imagesDATA \
1082 uninstall-libsciscipad_la_specialtestDATA \ 1032 uninstall-libsciscipad_la_specialtestDATA \
diff --git a/scilab/modules/javasci/javasci.iss b/scilab/modules/javasci/javasci.iss
index 3e6ddd9..4f2cfe2 100644
--- a/scilab/modules/javasci/javasci.iss
+++ b/scilab/modules/javasci/javasci.iss
@@ -31,7 +31,7 @@ Source: modules\{#JAVASCI}\macros\cleanmacros.bat; DestDir: {app}\modules\{#JAVA
31;Source: modules\{#JAVASCI}\macros\lib; DestDir: {app}\modules\{#JAVASCI}\macros; Components: {#COMPN_JAVASCI} 31;Source: modules\{#JAVASCI}\macros\lib; DestDir: {app}\modules\{#JAVASCI}\macros; Components: {#COMPN_JAVASCI}
32;Source: modules\{#JAVASCI}\macros\names; DestDir: {app}\modules\{#JAVASCI}\macros; Components: {#COMPN_JAVASCI} 32;Source: modules\{#JAVASCI}\macros\names; DestDir: {app}\modules\{#JAVASCI}\macros; Components: {#COMPN_JAVASCI}
33; 33;
34Source: modules\{#JAVASCI}\includes\*.h; DestDir: {app}\modules\{#JAVASCI}\includes; Components: {#COMPN_JAVASCI} 34;Source: modules\{#JAVASCI}\includes\*.h; DestDir: {app}\modules\{#JAVASCI}\includes; Components: {#COMPN_JAVASCI}
35; 35;
36Source: modules\{#JAVASCI}\src\java\javasci\*.*; DestDir: {app}\modules\{#JAVASCI}\src\java\javasci; Components: {#COMPN_JAVASCI} 36Source: modules\{#JAVASCI}\src\java\javasci\*.*; DestDir: {app}\modules\{#JAVASCI}\src\java\javasci; Components: {#COMPN_JAVASCI}
37; 37;
diff --git a/scilab/modules/javasci/src/c/javasci_SciAbstractArray.c b/scilab/modules/javasci/src/c/javasci_SciAbstractArray.c
index 92eeaf5..a355285 100644
--- a/scilab/modules/javasci/src/c/javasci_SciAbstractArray.c
+++ b/scilab/modules/javasci/src/c/javasci_SciAbstractArray.c
@@ -15,11 +15,7 @@
15#include "javasci_SciAbstractArray.h" 15#include "javasci_SciAbstractArray.h"
16#include "javasci_globals.h" 16#include "javasci_globals.h"
17#include "call_scilab.h" 17#include "call_scilab.h"
18#include "api_common.h" 18#include "api_scilab.h"
19#include "api_string.h"
20#include "api_double.h"
21#include "api_int.h"
22#include "api_boolean.h"
23#include "freeArrayOfString.h" 19#include "freeArrayOfString.h"
24#ifdef _MSC_VER 20#ifdef _MSC_VER
25#include "strdup_windows.h" 21#include "strdup_windows.h"
@@ -56,14 +52,17 @@ JNIEXPORT void JNICALL Java_javasci_SciAbstractArray_Initialize (JNIEnv *env, jc
56*/ 52*/
57JNIEXPORT jint JNICALL Java_javasci_SciAbstractArray_getNumberOfRowsFromScilab(JNIEnv *env, jobject obj_this, jstring name) 53JNIEXPORT jint JNICALL Java_javasci_SciAbstractArray_getNumberOfRowsFromScilab(JNIEnv *env, jobject obj_this, jstring name)
58{ 54{
55 StrErr strErr;
59 const char *cname = NULL; 56 const char *cname = NULL;
60 jint row = -1; 57 jint row = -1;
61 int dimension[2]; 58 int dimension[2];
62 59
63 cname = (*env)->GetStringUTFChars(env, name, NULL); 60 cname = (*env)->GetStringUTFChars(env, name, NULL);
64 61
65 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 62 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
63 if(strErr.iErr)
66 { 64 {
65 fprintf(stderr,"%s", getErrorMessage(strErr));
67 (*env)->ReleaseStringUTFChars(env, name , cname); 66 (*env)->ReleaseStringUTFChars(env, name , cname);
68 fprintf(stderr,"Error in Java_javasci_SciAbstractArray_Get (1).\n"); 67 fprintf(stderr,"Error in Java_javasci_SciAbstractArray_Get (1).\n");
69 return -1; 68 return -1;
@@ -83,14 +82,17 @@ JNIEXPORT jint JNICALL Java_javasci_SciAbstractArray_getNumberOfRowsFromScilab(J
83*/ 82*/
84JNIEXPORT jint JNICALL Java_javasci_SciAbstractArray_getNumberOfColsFromScilab(JNIEnv *env, jobject obj_this, jstring name) 83JNIEXPORT jint JNICALL Java_javasci_SciAbstractArray_getNumberOfColsFromScilab(JNIEnv *env, jobject obj_this, jstring name)
85{ 84{
85 StrErr strErr;
86 const char *cname = NULL; 86 const char *cname = NULL;
87 jint col = -1; 87 jint col = -1;
88 int dimension[2]; 88 int dimension[2];
89 89
90 cname = (*env)->GetStringUTFChars(env, name, NULL); 90 cname = (*env)->GetStringUTFChars(env, name, NULL);
91 91
92 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 92 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
93 if(strErr.iErr)
93 { 94 {
95 fprintf(stderr,"%s", getErrorMessage(strErr));
94 (*env)->ReleaseStringUTFChars(env, name , cname); 96 (*env)->ReleaseStringUTFChars(env, name , cname);
95 fprintf(stderr,"Error in Java_javasci_SciAbstractArray_Get (1).\n"); 97 fprintf(stderr,"Error in Java_javasci_SciAbstractArray_Get (1).\n");
96 return -1; 98 return -1;
@@ -143,6 +145,7 @@ JNIEXPORT jboolean JNICALL Java_javasci_SciAbstractArray_Job(JNIEnv *env, jobjec
143*/ 145*/
144JNIEXPORT void JNICALL Java_javasci_SciAbstractArray_Get(JNIEnv *env, jobject obj_this) 146JNIEXPORT void JNICALL Java_javasci_SciAbstractArray_Get(JNIEnv *env, jobject obj_this)
145{ 147{
148 StrErr strErr;
146 char *signatureType = detectSignatureTypeFromObjectName(env, obj_this); 149 char *signatureType = detectSignatureTypeFromObjectName(env, obj_this);
147 150
148 jclass class_Mine = (*env)->GetObjectClass(env, obj_this); 151 jclass class_Mine = (*env)->GetObjectClass(env, obj_this);
@@ -157,8 +160,10 @@ JNIEXPORT void JNICALL Java_javasci_SciAbstractArray_Get(JNIEnv *env, jobject ob
157 160
158 int dimension[2]; 161 int dimension[2];
159 162
160 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 163 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
164 if(strErr.iErr)
161 { 165 {
166 fprintf(stderr,"%s", getErrorMessage(strErr));
162 (*env)->ReleaseStringUTFChars(env, jname , cname); 167 (*env)->ReleaseStringUTFChars(env, jname , cname);
163 fprintf(stderr,"Error in Java_javasci_SciAbstractArray_Get (1).\n"); 168 fprintf(stderr,"Error in Java_javasci_SciAbstractArray_Get (1).\n");
164 return; 169 return;
@@ -287,6 +292,7 @@ JNIEXPORT void JNICALL Java_javasci_SciAbstractArray_Send(JNIEnv *env, jobject o
287/*--------------------------------------------------------------------------*/ 292/*--------------------------------------------------------------------------*/
288static int JNI_getMatrixOfInteger(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name) 293static int JNI_getMatrixOfInteger(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name)
289{ 294{
295 StrErr strErr;
290 int i = 0; 296 int i = 0;
291 int cm = 0, cn = 0; 297 int cm = 0, cn = 0;
292 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[I"); 298 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[I");
@@ -303,8 +309,10 @@ static int JNI_getMatrixOfInteger(JNIEnv *env, jobject obj_this, jclass class_th
303 309
304 for (i = 0; i < (Rows * Cols); i++) icx[i] = (int)cx[i]; 310 for (i = 0; i < (Rows * Cols); i++) icx[i] = (int)cx[i];
305 311
306 if (readNamedMatrixOfInteger32(name, &cm, &cn, icx)) 312 strErr = readNamedMatrixOfInteger32(name, &cm, &cn, icx);
313 if(strErr.iErr)
307 { 314 {
315 fprintf(stderr,"%s", getErrorMessage(strErr));
308 FREE(icx); icx = NULL; 316 FREE(icx); icx = NULL;
309 fprintf(stderr,"Error in JNI_getMatrixOfInteger (2).\n"); 317 fprintf(stderr,"Error in JNI_getMatrixOfInteger (2).\n");
310 (*env)->ReleaseIntArrayElements(env, jx, cx, 0); 318 (*env)->ReleaseIntArrayElements(env, jx, cx, 0);
@@ -319,13 +327,16 @@ static int JNI_getMatrixOfInteger(JNIEnv *env, jobject obj_this, jclass class_th
319/*--------------------------------------------------------------------------*/ 327/*--------------------------------------------------------------------------*/
320static int JNI_getMatrixOfDouble(JNIEnv *env, jobject obj_this, jclass class_this, char *name) 328static int JNI_getMatrixOfDouble(JNIEnv *env, jobject obj_this, jclass class_this, char *name)
321{ 329{
330 StrErr strErr;
322 int cm = 0, cn = 0; 331 int cm = 0, cn = 0;
323 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[D"); 332 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[D");
324 jdoubleArray jx = (*env)->GetObjectField(env, obj_this, id_x); 333 jdoubleArray jx = (*env)->GetObjectField(env, obj_this, id_x);
325 double *cx = (*env)->GetDoubleArrayElements(env, jx, NULL); 334 double *cx = (*env)->GetDoubleArrayElements(env, jx, NULL);
326 335
327 if (readNamedMatrixOfDouble(name, &cm, &cn, cx)) 336 strErr = readNamedMatrixOfDouble(name, &cm, &cn, cx);
337 if(strErr.iErr)
328 { 338 {
339 fprintf(stderr,"%s", getErrorMessage(strErr));
329 fprintf(stderr,"Error in JNI_getMatrixOfDouble.\n"); 340 fprintf(stderr,"Error in JNI_getMatrixOfDouble.\n");
330 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0); 341 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0);
331 return 1; 342 return 1;
@@ -337,6 +348,7 @@ static int JNI_getMatrixOfDouble(JNIEnv *env, jobject obj_this, jclass class_thi
337/*--------------------------------------------------------------------------*/ 348/*--------------------------------------------------------------------------*/
338static int JNI_getMatrixOfComplex(JNIEnv *env, jobject obj_this, jclass class_this, char *name) 349static int JNI_getMatrixOfComplex(JNIEnv *env, jobject obj_this, jclass class_this, char *name)
339{ 350{
351 StrErr strErr;
340 int cm = 0, cn = 0; 352 int cm = 0, cn = 0;
341 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[D"); 353 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[D");
342 jfieldID id_y = (*env)->GetFieldID(env, class_this, "y", "[D"); 354 jfieldID id_y = (*env)->GetFieldID(env, class_this, "y", "[D");
@@ -348,8 +360,10 @@ static int JNI_getMatrixOfComplex(JNIEnv *env, jobject obj_this, jclass class_th
348 double *cx = (*env)->GetDoubleArrayElements(env, jx, NULL); 360 double *cx = (*env)->GetDoubleArrayElements(env, jx, NULL);
349 double *cy = (*env)->GetDoubleArrayElements(env, jy, NULL); 361 double *cy = (*env)->GetDoubleArrayElements(env, jy, NULL);
350 362
351 if (readNamedComplexMatrixOfDouble(name, &cm, &cn, cx, cy)) 363 strErr = readNamedComplexMatrixOfDouble(name, &cm, &cn, cx, cy);
364 if(strErr.iErr)
352 { 365 {
366 fprintf(stderr,"%s", getErrorMessage(strErr));
353 fprintf(stderr,"Error in JNI_getMatrixOfComplex.\n"); 367 fprintf(stderr,"Error in JNI_getMatrixOfComplex.\n");
354 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0); 368 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0);
355 (*env)->ReleaseDoubleArrayElements(env, jy ,cy, 0); 369 (*env)->ReleaseDoubleArrayElements(env, jy ,cy, 0);
@@ -363,6 +377,7 @@ static int JNI_getMatrixOfComplex(JNIEnv *env, jobject obj_this, jclass class_th
363/*--------------------------------------------------------------------------*/ 377/*--------------------------------------------------------------------------*/
364static int JNI_getMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name) 378static int JNI_getMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name)
365{ 379{
380 StrErr strErr;
366 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[Ljava/lang/String;"); 381 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[Ljava/lang/String;");
367 jobjectArray jx = (*env)->GetObjectField(env, obj_this, id_x); 382 jobjectArray jx = (*env)->GetObjectField(env, obj_this, id_x);
368 383
@@ -378,8 +393,10 @@ static int JNI_getMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_thi
378 return 1; 393 return 1;
379 } 394 }
380 395
381 if ( readNamedMatrixOfString(name, &cm, &cn, pLength, pStrings) ) 396 strErr = readNamedMatrixOfString(name, &cm, &cn, pLength, pStrings);
397 if(strErr.iErr)
382 { 398 {
399 fprintf(stderr,"%s", getErrorMessage(strErr));
383 fprintf(stderr,"Error in JNI_getMatrixOfString (2).\n"); 400 fprintf(stderr,"Error in JNI_getMatrixOfString (2).\n");
384 return 1; 401 return 1;
385 } 402 }
@@ -403,8 +420,10 @@ static int JNI_getMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_thi
403 } 420 }
404 } 421 }
405 422
406 if ( readNamedMatrixOfString(name, &cm, &cn, pLength, pStrings) ) 423 strErr = readNamedMatrixOfString(name, &cm, &cn, pLength, pStrings);
424 if(strErr.iErr)
407 { 425 {
426 fprintf(stderr,"%s", getErrorMessage(strErr));
408 if (pLength) {FREE(pLength); pLength = NULL;} 427 if (pLength) {FREE(pLength); pLength = NULL;}
409 fprintf(stderr,"Error in JNI_getMatrixOfString (5).\n"); 428 fprintf(stderr,"Error in JNI_getMatrixOfString (5).\n");
410 return 1; 429 return 1;
@@ -425,6 +444,7 @@ static int JNI_getMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_thi
425/*--------------------------------------------------------------------------*/ 444/*--------------------------------------------------------------------------*/
426static int JNI_getMatrixOfBoolean(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name) 445static int JNI_getMatrixOfBoolean(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name)
427{ 446{
447 StrErr strErr;
428 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[Z"); 448 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[Z");
429 jbooleanArray jx = (*env)->GetObjectField(env, obj_this, id_x); 449 jbooleanArray jx = (*env)->GetObjectField(env, obj_this, id_x);
430 jboolean *cx = (*env)->GetBooleanArrayElements(env, jx, NULL); 450 jboolean *cx = (*env)->GetBooleanArrayElements(env, jx, NULL);
@@ -439,8 +459,10 @@ static int JNI_getMatrixOfBoolean(JNIEnv *env, jobject obj_this, jclass class_th
439 return 1; 459 return 1;
440 } 460 }
441 461
442 if (readNamedMatrixOfBoolean(name, &cm, &cn, CX)) 462 strErr = readNamedMatrixOfBoolean(name, &cm, &cn, CX);
463 if(strErr.iErr)
443 { 464 {
465 fprintf(stderr,"%s", getErrorMessage(strErr));
444 fprintf(stderr,"Error in JNI_getMatrixOfBoolean (2).\n"); 466 fprintf(stderr,"Error in JNI_getMatrixOfBoolean (2).\n");
445 (*env)->ReleaseBooleanArrayElements(env, jx, cx, 0); 467 (*env)->ReleaseBooleanArrayElements(env, jx, cx, 0);
446 return 1; 468 return 1;
@@ -459,6 +481,7 @@ static int JNI_getMatrixOfBoolean(JNIEnv *env, jobject obj_this, jclass class_th
459/*--------------------------------------------------------------------------*/ 481/*--------------------------------------------------------------------------*/
460static int JNI_setMatrixOfInteger(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name) 482static int JNI_setMatrixOfInteger(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name)
461{ 483{
484 StrErr strErr;
462 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[I"); 485 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[I");
463 jintArray jx = (*env)->GetObjectField(env, obj_this, id_x); 486 jintArray jx = (*env)->GetObjectField(env, obj_this, id_x);
464 jint *cx = (*env)->GetIntArrayElements(env, jx, NULL); 487 jint *cx = (*env)->GetIntArrayElements(env, jx, NULL);
@@ -477,8 +500,10 @@ static int JNI_setMatrixOfInteger(JNIEnv *env, jobject obj_this, jclass class_th
477 500
478 for (i = 0; i < (Rows * Cols); i++) icx[i] = (int)cx[i]; 501 for (i = 0; i < (Rows * Cols); i++) icx[i] = (int)cx[i];
479 502
480 if (createNamedMatrixOfInteger32(name, Rows, Cols, icx)) 503 strErr = createNamedMatrixOfInteger32(name, Rows, Cols, icx);
504 if(strErr.iErr)
481 { 505 {
506 fprintf(stderr,"%s", getErrorMessage(strErr));
482 FREE(icx); icx = NULL; 507 FREE(icx); icx = NULL;
483 fprintf(stderr,"Error in JNI_setMatrixOfInteger (2).\n"); 508 fprintf(stderr,"Error in JNI_setMatrixOfInteger (2).\n");
484 (*env)->ReleaseIntArrayElements(env, jx ,cx, 0); 509 (*env)->ReleaseIntArrayElements(env, jx ,cx, 0);
@@ -493,12 +518,15 @@ static int JNI_setMatrixOfInteger(JNIEnv *env, jobject obj_this, jclass class_th
493/*--------------------------------------------------------------------------*/ 518/*--------------------------------------------------------------------------*/
494static int JNI_setMatrixOfDouble(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name) 519static int JNI_setMatrixOfDouble(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name)
495{ 520{
521 StrErr strErr;
496 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[D"); 522 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[D");
497 jdoubleArray jx = (*env)->GetObjectField(env, obj_this, id_x); 523 jdoubleArray jx = (*env)->GetObjectField(env, obj_this, id_x);
498 double *cx = (*env)->GetDoubleArrayElements(env, jx, NULL); 524 double *cx = (*env)->GetDoubleArrayElements(env, jx, NULL);
499 525
500 if (createNamedMatrixOfDouble(name, Rows, Cols, cx)) 526 strErr = createNamedMatrixOfDouble(name, Rows, Cols, cx);
527 if(strErr.iErr)
501 { 528 {
529 fprintf(stderr,"%s", getErrorMessage(strErr));
502 fprintf(stderr,"Error in JNI_setMatrixOfDouble.\n"); 530 fprintf(stderr,"Error in JNI_setMatrixOfDouble.\n");
503 (*env)->ReleaseDoubleArrayElements(env, jx ,cx, 0); 531 (*env)->ReleaseDoubleArrayElements(env, jx ,cx, 0);
504 return 1; 532 return 1;
@@ -510,6 +538,7 @@ static int JNI_setMatrixOfDouble(JNIEnv *env, jobject obj_this, jclass class_thi
510/*--------------------------------------------------------------------------*/ 538/*--------------------------------------------------------------------------*/
511static int JNI_setMatrixOfComplex(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name) 539static int JNI_setMatrixOfComplex(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name)
512{ 540{
541 StrErr strErr;
513 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[D"); 542 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[D");
514 jfieldID id_y = (*env)->GetFieldID(env, class_this, "y", "[D"); 543 jfieldID id_y = (*env)->GetFieldID(env, class_this, "y", "[D");
515 544
@@ -519,8 +548,10 @@ static int JNI_setMatrixOfComplex(JNIEnv *env, jobject obj_this, jclass class_th
519 double *cx = (*env)->GetDoubleArrayElements(env, jx, NULL); 548 double *cx = (*env)->GetDoubleArrayElements(env, jx, NULL);
520 double *cy = (*env)->GetDoubleArrayElements(env, jy, NULL); 549 double *cy = (*env)->GetDoubleArrayElements(env, jy, NULL);
521 550
522 if (createNamedComplexMatrixOfDouble(name, Rows, Cols, cx, cy)) 551 strErr = createNamedComplexMatrixOfDouble(name, Rows, Cols, cx, cy);
552 if(strErr.iErr)
523 { 553 {
554 fprintf(stderr,"%s", getErrorMessage(strErr));
524 fprintf(stderr,"Error in JNI_setMatrixOfComplex.\n"); 555 fprintf(stderr,"Error in JNI_setMatrixOfComplex.\n");
525 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0); 556 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0);
526 (*env)->ReleaseDoubleArrayElements(env, jy, cy, 0); 557 (*env)->ReleaseDoubleArrayElements(env, jy, cy, 0);
@@ -534,6 +565,7 @@ static int JNI_setMatrixOfComplex(JNIEnv *env, jobject obj_this, jclass class_th
534/*--------------------------------------------------------------------------*/ 565/*--------------------------------------------------------------------------*/
535static int JNI_setMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name) 566static int JNI_setMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name)
536{ 567{
568 StrErr strErr;
537 int i = 0; 569 int i = 0;
538 char **pStrings = NULL; 570 char **pStrings = NULL;
539 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[Ljava/lang/String;" ); 571 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[Ljava/lang/String;" );
@@ -554,8 +586,10 @@ static int JNI_setMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_thi
554 (*env)->ReleaseStringUTFChars(env, jelement, element); 586 (*env)->ReleaseStringUTFChars(env, jelement, element);
555 } 587 }
556 588
557 if (createNamedMatrixOfString(name, Rows, Cols, pStrings)) 589 strErr = createNamedMatrixOfString(name, Rows, Cols, pStrings);
590 if(strErr.iErr)
558 { 591 {
592 fprintf(stderr,"%s", getErrorMessage(strErr));
559 freeArrayOfString(pStrings, Rows * Cols); 593 freeArrayOfString(pStrings, Rows * Cols);
560 fprintf(stderr,"Error in JNI_setMatrixOfString (2).\n"); 594 fprintf(stderr,"Error in JNI_setMatrixOfString (2).\n");
561 return 1; 595 return 1;
@@ -567,6 +601,7 @@ static int JNI_setMatrixOfString(JNIEnv *env, jobject obj_this, jclass class_thi
567/*--------------------------------------------------------------------------*/ 601/*--------------------------------------------------------------------------*/
568static int JNI_setMatrixOfBoolean(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name) 602static int JNI_setMatrixOfBoolean(JNIEnv *env, jobject obj_this, jclass class_this, int Rows, int Cols, char *name)
569{ 603{
604 StrErr strErr;
570 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[Z"); 605 jfieldID id_x = (*env)->GetFieldID(env, class_this, "x", "[Z");
571 jbooleanArray jx = (*env)->GetObjectField(env, obj_this, id_x); 606 jbooleanArray jx = (*env)->GetObjectField(env, obj_this, id_x);
572 jboolean *cx = (*env)->GetBooleanArrayElements(env, jx, NULL); 607 jboolean *cx = (*env)->GetBooleanArrayElements(env, jx, NULL);
@@ -586,8 +621,10 @@ static int JNI_setMatrixOfBoolean(JNIEnv *env, jobject obj_this, jclass class_th
586 CX[i] = (int)cx[i]; 621 CX[i] = (int)cx[i];
587 } 622 }
588 623
589 if (createNamedMatrixOfBoolean(name, Rows, Cols, CX)) 624 strErr = createNamedMatrixOfBoolean(name, Rows, Cols, CX);
625 if(strErr.iErr)
590 { 626 {
627 fprintf(stderr,"%s", getErrorMessage(strErr));
591 fprintf(stderr,"Error in JNI_setMatrixOfBoolean (2).\n"); 628 fprintf(stderr,"Error in JNI_setMatrixOfBoolean (2).\n");
592 (*env)->ReleaseBooleanArrayElements(env, jx, (jboolean*)cx, 0); 629 (*env)->ReleaseBooleanArrayElements(env, jx, (jboolean*)cx, 0);
593 return 1; 630 return 1;
diff --git a/scilab/modules/javasci/src/c/javasci_SciBooleanArray.c b/scilab/modules/javasci/src/c/javasci_SciBooleanArray.c
index cb6afdc..d3ee3b0 100644
--- a/scilab/modules/javasci/src/c/javasci_SciBooleanArray.c
+++ b/scilab/modules/javasci/src/c/javasci_SciBooleanArray.c
@@ -13,14 +13,14 @@
13 */ 13 */
14/*--------------------------------------------------------------------------*/ 14/*--------------------------------------------------------------------------*/
15#include "javasci_SciBooleanArray.h" 15#include "javasci_SciBooleanArray.h"
16#include "api_common.h" 16#include "api_scilab.h"
17#include "api_boolean.h"
18/*--------------------------------------------------------------------------*/ 17/*--------------------------------------------------------------------------*/
19JNIEXPORT jboolean JNICALL Java_javasci_SciBooleanArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg); 18JNIEXPORT jboolean JNICALL Java_javasci_SciBooleanArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg);
20/*--------------------------------------------------------------------------*/ 19/*--------------------------------------------------------------------------*/
21/*! public native boolean GetElement(int indr, int indc); */ 20/*! public native boolean GetElement(int indr, int indc); */
22JNIEXPORT jboolean JNICALL Java_javasci_SciBooleanArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg) 21JNIEXPORT jboolean JNICALL Java_javasci_SciBooleanArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg)
23{ 22{
23 StrErr strErr;
24 jboolean Value = JNI_FALSE; 24 jboolean Value = JNI_FALSE;
25 int *CX = NULL; 25 int *CX = NULL;
26 26
@@ -43,8 +43,10 @@ JNIEXPORT jboolean JNICALL Java_javasci_SciBooleanArray_GetElement(JNIEnv *env ,
43 int i = 0; 43 int i = 0;
44 int cm = 0, cn = 0; 44 int cm = 0, cn = 0;
45 45
46 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 46 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
47 { 47 if(strErr.iErr)
48 {
49 fprintf(stderr,"%s", getErrorMessage(strErr));
48 (*env)->ReleaseStringUTFChars(env, jname , cname); 50 (*env)->ReleaseStringUTFChars(env, jname , cname);
49 fprintf(stderr,"Error in Java_javasci_SciBooleanArray_GetElement (1).\n"); 51 fprintf(stderr,"Error in Java_javasci_SciBooleanArray_GetElement (1).\n");
50 return Value; 52 return Value;
@@ -77,8 +79,10 @@ JNIEXPORT jboolean JNICALL Java_javasci_SciBooleanArray_GetElement(JNIEnv *env ,
77 return 1; 79 return 1;
78 } 80 }
79 81
80 if (readNamedMatrixOfBoolean((char*)cname, &cm, &cn, CX)) 82 strErr = readNamedMatrixOfBoolean((char*)cname, &cm, &cn, CX);
81 { 83 if(strErr.iErr)
84 {
85 fprintf(stderr,"%s", getErrorMessage(strErr));
82 fprintf(stderr,"Error in Java_javasci_SciBooleanArray_GetElement (5).\n"); 86 fprintf(stderr,"Error in Java_javasci_SciBooleanArray_GetElement (5).\n");
83 (*env)->ReleaseBooleanArrayElements(env, jx, cx, 0); 87 (*env)->ReleaseBooleanArrayElements(env, jx, cx, 0);
84 return 1; 88 return 1;
diff --git a/scilab/modules/javasci/src/c/javasci_SciComplexArray.c b/scilab/modules/javasci/src/c/javasci_SciComplexArray.c
index e15f673..2920b1f 100644
--- a/scilab/modules/javasci/src/c/javasci_SciComplexArray.c
+++ b/scilab/modules/javasci/src/c/javasci_SciComplexArray.c
@@ -13,14 +13,14 @@
13 */ 13 */
14/*--------------------------------------------------------------------------*/ 14/*--------------------------------------------------------------------------*/
15#include "javasci_SciComplexArray.h" 15#include "javasci_SciComplexArray.h"
16#include "api_common.h" 16#include "api_scilab.h"
17#include "api_double.h"
18/*--------------------------------------------------------------------------*/ 17/*--------------------------------------------------------------------------*/
19JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetRealPartElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg); 18JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetRealPartElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg);
20JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetImaginaryPartElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg); 19JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetImaginaryPartElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg);
21/*--------------------------------------------------------------------------*/ 20/*--------------------------------------------------------------------------*/
22JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetRealPartElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg) 21JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetRealPartElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg)
23{ 22{
23 StrErr strErr;
24 double Value = 0.0; 24 double Value = 0.0;
25 25
26 jclass class_Mine = (*env)->GetObjectClass(env, obj_this); 26 jclass class_Mine = (*env)->GetObjectClass(env, obj_this);
@@ -45,8 +45,10 @@ JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetRealPartElement(JNIEnv
45 45
46 int cm = 0, cn = 0; 46 int cm = 0, cn = 0;
47 47
48 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 48 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
49 if(strErr.iErr)
49 { 50 {
51 fprintf(stderr,"%s", getErrorMessage(strErr));
50 (*env)->ReleaseStringUTFChars(env, jname , cname); 52 (*env)->ReleaseStringUTFChars(env, jname , cname);
51 fprintf(stderr,"Error in Java_javasci_SciComplexArray_GetRealPartElement (1).\n"); 53 fprintf(stderr,"Error in Java_javasci_SciComplexArray_GetRealPartElement (1).\n");
52 return Value; 54 return Value;
@@ -74,8 +76,10 @@ JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetRealPartElement(JNIEnv
74 jy = (*env)->GetObjectField(env, obj_this, id_y); 76 jy = (*env)->GetObjectField(env, obj_this, id_y);
75 cy = (*env)->GetDoubleArrayElements(env, jy, NULL); 77 cy = (*env)->GetDoubleArrayElements(env, jy, NULL);
76 78
77 if (readNamedComplexMatrixOfDouble((char*)cname, &cm, &cn, cx, cy)) 79 strErr = readNamedComplexMatrixOfDouble((char*)cname, &cm, &cn, cx, cy);
80 if(strErr.iErr)
78 { 81 {
82 fprintf(stderr,"%s", getErrorMessage(strErr));
79 fprintf(stderr,"Error in Java_javasci_SciComplexArray_GetRealPartElement (4).\n"); 83 fprintf(stderr,"Error in Java_javasci_SciComplexArray_GetRealPartElement (4).\n");
80 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0); 84 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0);
81 (*env)->ReleaseDoubleArrayElements(env, jy, cy, 0); 85 (*env)->ReleaseDoubleArrayElements(env, jy, cy, 0);
@@ -113,6 +117,7 @@ JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetRealPartElement(JNIEnv
113/*! public native double GetImaginaryPartElement(int indr,int indc); */ 117/*! public native double GetImaginaryPartElement(int indr,int indc); */
114JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetImaginaryPartElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg) 118JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetImaginaryPartElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg)
115{ 119{
120 StrErr strErr;
116 double Value = 0.0; 121 double Value = 0.0;
117 122
118 jclass class_Mine = (*env)->GetObjectClass(env, obj_this); 123 jclass class_Mine = (*env)->GetObjectClass(env, obj_this);
@@ -137,8 +142,10 @@ JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetImaginaryPartElement(J
137 142
138 int cm = 0, cn = 0; 143 int cm = 0, cn = 0;
139 144
140 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 145 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
146 if(strErr.iErr)
141 { 147 {
148 fprintf(stderr,"%s", getErrorMessage(strErr));
142 (*env)->ReleaseStringUTFChars(env, jname , cname); 149 (*env)->ReleaseStringUTFChars(env, jname , cname);
143 fprintf(stderr,"Error in Java_javasci_SciComplexArray_GetRealPartElement (1).\n"); 150 fprintf(stderr,"Error in Java_javasci_SciComplexArray_GetRealPartElement (1).\n");
144 return Value; 151 return Value;
@@ -166,8 +173,10 @@ JNIEXPORT jdouble JNICALL Java_javasci_SciComplexArray_GetImaginaryPartElement(J
166 jy = (*env)->GetObjectField(env, obj_this, id_y); 173 jy = (*env)->GetObjectField(env, obj_this, id_y);
167 cy = (*env)->GetDoubleArrayElements(env, jy, NULL); 174 cy = (*env)->GetDoubleArrayElements(env, jy, NULL);
168 175
169 if (readNamedComplexMatrixOfDouble((char*)cname, &cm, &cn, cx, cy)) 176 strErr = readNamedComplexMatrixOfDouble((char*)cname, &cm, &cn, cx, cy);
177 if(strErr.iErr)
170 { 178 {
179 fprintf(stderr,"%s", getErrorMessage(strErr));
171 fprintf(stderr,"Error in Java_javasci_SciComplexArray_GetRealPartElement (4).\n"); 180 fprintf(stderr,"Error in Java_javasci_SciComplexArray_GetRealPartElement (4).\n");
172 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0); 181 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0);
173 (*env)->ReleaseDoubleArrayElements(env, jy, cy, 0); 182 (*env)->ReleaseDoubleArrayElements(env, jy, cy, 0);
diff --git a/scilab/modules/javasci/src/c/javasci_SciDoubleArray.c b/scilab/modules/javasci/src/c/javasci_SciDoubleArray.c
index 649c572..f03ed9b 100644
--- a/scilab/modules/javasci/src/c/javasci_SciDoubleArray.c
+++ b/scilab/modules/javasci/src/c/javasci_SciDoubleArray.c
@@ -13,14 +13,14 @@
13 */ 13 */
14/*--------------------------------------------------------------------------*/ 14/*--------------------------------------------------------------------------*/
15#include "javasci_SciDoubleArray.h" 15#include "javasci_SciDoubleArray.h"
16#include "api_common.h" 16#include "api_scilab.h"
17#include "api_double.h"
18/*--------------------------------------------------------------------------*/ 17/*--------------------------------------------------------------------------*/
19JNIEXPORT jdouble JNICALL Java_javasci_SciDoubleArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg); 18JNIEXPORT jdouble JNICALL Java_javasci_SciDoubleArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg);
20/*--------------------------------------------------------------------------*/ 19/*--------------------------------------------------------------------------*/
21/*! public native double GetElement(int indr, int indc); */ 20/*! public native double GetElement(int indr, int indc); */
22JNIEXPORT jdouble JNICALL Java_javasci_SciDoubleArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg) 21JNIEXPORT jdouble JNICALL Java_javasci_SciDoubleArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg)
23{ 22{
23 StrErr strErr;
24 double Value = 0.0; 24 double Value = 0.0;
25 25
26 jclass class_Mine = (*env)->GetObjectClass(env, obj_this); 26 jclass class_Mine = (*env)->GetObjectClass(env, obj_this);
@@ -41,8 +41,10 @@ JNIEXPORT jdouble JNICALL Java_javasci_SciDoubleArray_GetElement(JNIEnv *env , j
41 41
42 int cm = 0, cn = 0; 42 int cm = 0, cn = 0;
43 43
44 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 44 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
45 if(strErr.iErr)
45 { 46 {
47 fprintf(stderr,"%s", getErrorMessage(strErr));
46 (*env)->ReleaseStringUTFChars(env, jname , cname); 48 (*env)->ReleaseStringUTFChars(env, jname , cname);
47 fprintf(stderr,"Error in Java_javasci_SciDoubleArray_GetElement (1).\n"); 49 fprintf(stderr,"Error in Java_javasci_SciDoubleArray_GetElement (1).\n");
48 return Value; 50 return Value;
@@ -66,8 +68,10 @@ JNIEXPORT jdouble JNICALL Java_javasci_SciDoubleArray_GetElement(JNIEnv *env , j
66 jx = (*env)->GetObjectField(env, obj_this, id_x); 68 jx = (*env)->GetObjectField(env, obj_this, id_x);
67 cx = (*env)->GetDoubleArrayElements(env, jx, NULL); 69 cx = (*env)->GetDoubleArrayElements(env, jx, NULL);
68 70
69 if (readNamedMatrixOfDouble((char*)cname, &cm, &cn, cx)) 71 strErr = readNamedMatrixOfDouble((char*)cname, &cm, &cn, cx);
72 if(strErr.iErr)
70 { 73 {
74 fprintf(stderr,"%s", getErrorMessage(strErr));
71 fprintf(stderr,"Error in Java_javasci_SciDoubleArray_GetElement (4).\n"); 75 fprintf(stderr,"Error in Java_javasci_SciDoubleArray_GetElement (4).\n");
72 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0); 76 (*env)->ReleaseDoubleArrayElements(env, jx, cx, 0);
73 (*env)->ReleaseStringUTFChars(env, jname , cname); 77 (*env)->ReleaseStringUTFChars(env, jname , cname);
diff --git a/scilab/modules/javasci/src/c/javasci_SciIntegerArray.c b/scilab/modules/javasci/src/c/javasci_SciIntegerArray.c
index 4c61a97..4c1bb1e 100644
--- a/scilab/modules/javasci/src/c/javasci_SciIntegerArray.c
+++ b/scilab/modules/javasci/src/c/javasci_SciIntegerArray.c
@@ -11,14 +11,14 @@
11 */ 11 */
12/*--------------------------------------------------------------------------*/ 12/*--------------------------------------------------------------------------*/
13#include "javasci_SciIntegerArray.h" 13#include "javasci_SciIntegerArray.h"
14#include "api_common.h" 14#include "api_scilab.h"
15#include "api_int.h"
16/*--------------------------------------------------------------------------*/ 15/*--------------------------------------------------------------------------*/
17JNIEXPORT jint JNICALL Java_javasci_SciIntegerArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg); 16JNIEXPORT jint JNICALL Java_javasci_SciIntegerArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg);
18/*--------------------------------------------------------------------------*/ 17/*--------------------------------------------------------------------------*/
19/*! public native int GetElement(int indr, int indc); */ 18/*! public native int GetElement(int indr, int indc); */
20JNIEXPORT jint JNICALL Java_javasci_SciIntegerArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg) 19JNIEXPORT jint JNICALL Java_javasci_SciIntegerArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg)
21{ 20{
21 StrErr strErr;
22 int Value = 0; 22 int Value = 0;
23 int j = 0; 23 int j = 0;
24 24
@@ -41,8 +41,10 @@ JNIEXPORT jint JNICALL Java_javasci_SciIntegerArray_GetElement(JNIEnv *env , job
41 41
42 int cm = 0, cn = 0; 42 int cm = 0, cn = 0;
43 43
44 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 44 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
45 if(strErr.iErr)
45 { 46 {
47 fprintf(stderr,"%s", getErrorMessage(strErr));
46 (*env)->ReleaseStringUTFChars(env, jname , cname); 48 (*env)->ReleaseStringUTFChars(env, jname , cname);
47 fprintf(stderr,"Error in Java_javasci_SciIntegerArray_GetElement (1).\n"); 49 fprintf(stderr,"Error in Java_javasci_SciIntegerArray_GetElement (1).\n");
48 return Value; 50 return Value;
@@ -77,8 +79,10 @@ JNIEXPORT jint JNICALL Java_javasci_SciIntegerArray_GetElement(JNIEnv *env , job
77 79
78 for (j = 0; j < cm * cn; j++) icx[j] = (int)cx[j]; 80 for (j = 0; j < cm * cn; j++) icx[j] = (int)cx[j];
79 81
80 if (readNamedMatrixOfInteger32((char*)cname, &cm, &cn, icx)) 82 strErr = readNamedMatrixOfInteger32((char*)cname, &cm, &cn, icx);
83 if(strErr.iErr)
81 { 84 {
85 fprintf(stderr,"%s", getErrorMessage(strErr));
82 FREE(icx); icx = NULL; 86 FREE(icx); icx = NULL;
83 fprintf(stderr,"Error in Java_javasci_SciIntegerArray_GetElement (5).\n"); 87 fprintf(stderr,"Error in Java_javasci_SciIntegerArray_GetElement (5).\n");
84 (*env)->ReleaseIntArrayElements(env, jx, cx, 0); 88 (*env)->ReleaseIntArrayElements(env, jx, cx, 0);
diff --git a/scilab/modules/javasci/src/c/javasci_SciStringArray.c b/scilab/modules/javasci/src/c/javasci_SciStringArray.c
index 0632926..1946a04 100644
--- a/scilab/modules/javasci/src/c/javasci_SciStringArray.c
+++ b/scilab/modules/javasci/src/c/javasci_SciStringArray.c
@@ -14,8 +14,7 @@
14 */ 14 */
15/*--------------------------------------------------------------------------*/ 15/*--------------------------------------------------------------------------*/
16#include "javasci_SciStringArray.h" 16#include "javasci_SciStringArray.h"
17#include "api_common.h" 17#include "api_scilab.h"
18#include "api_string.h"
19#include "freeArrayOfString.h" 18#include "freeArrayOfString.h"
20/*--------------------------------------------------------------------------*/ 19/*--------------------------------------------------------------------------*/
21JNIEXPORT jstring JNICALL Java_javasci_SciStringArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg); 20JNIEXPORT jstring JNICALL Java_javasci_SciStringArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg);
@@ -23,6 +22,7 @@ JNIEXPORT jstring JNICALL Java_javasci_SciStringArray_GetElement(JNIEnv *env , j
23/*! public native String GetElement(int indr, int indc); */ 22/*! public native String GetElement(int indr, int indc); */
24JNIEXPORT jstring JNICALL Java_javasci_SciStringArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg) 23JNIEXPORT jstring JNICALL Java_javasci_SciStringArray_GetElement(JNIEnv *env , jobject obj_this,jint indrarg, jint indcarg)
25{ 24{
25 StrErr strErr;
26 int *pLength = NULL; 26 int *pLength = NULL;
27 char **pStrings = NULL; 27 char **pStrings = NULL;
28 int cm = 0, cn = 0; 28 int cm = 0, cn = 0;
@@ -44,8 +44,10 @@ JNIEXPORT jstring JNICALL Java_javasci_SciStringArray_GetElement(JNIEnv *env , j
44 44
45 int dimension[2]; 45 int dimension[2];
46 46
47 if (getNamedVarDimension((char*)cname, &dimension[0], &dimension[1])) 47 strErr = getNamedVarDimension((char*)cname, &dimension[0], &dimension[1]);
48 if(strErr.iErr)
48 { 49 {
50 fprintf(stderr,"%s", getErrorMessage(strErr));
49 (*env)->ReleaseStringUTFChars(env, jname , cname); 51 (*env)->ReleaseStringUTFChars(env, jname , cname);
50 fprintf(stderr,"Error in Java_javasci_SciStringArray_GetElement (1).\n"); 52 fprintf(stderr,"Error in Java_javasci_SciStringArray_GetElement (1).\n");
51 jstrToReturn = (*env)->NewStringUTF(env, ""); 53 jstrToReturn = (*env)->NewStringUTF(env, "");
@@ -80,8 +82,10 @@ JNIEXPORT jstring JNICALL Java_javasci_SciStringArray_GetElement(JNIEnv *env , j
80 return jstrToReturn; 82 return jstrToReturn;
81 } 83 }
82 84
83 if ( readNamedMatrixOfString((char*)cname, &cm, &cn, pLength, pStrings) ) 85 strErr = readNamedMatrixOfString((char*)cname, &cm, &cn, pLength, pStrings);
86 if(strErr.iErr)
84 { 87 {
88 fprintf(stderr,"%s", getErrorMessage(strErr));
85 (*env)->ReleaseStringUTFChars(env, jname , cname); 89 (*env)->ReleaseStringUTFChars(env, jname , cname);
86 fprintf(stderr,"Error in Java_javasci_SciStringArray_GetElement (5).\n"); 90 fprintf(stderr,"Error in Java_javasci_SciStringArray_GetElement (5).\n");
87 jstrToReturn = (*env)->NewStringUTF(env, ""); 91 jstrToReturn = (*env)->NewStringUTF(env, "");
@@ -111,8 +115,10 @@ JNIEXPORT jstring JNICALL Java_javasci_SciStringArray_GetElement(JNIEnv *env , j
111 } 115 }
112 } 116 }
113 117
114 if ( readNamedMatrixOfString((char*)cname, &cm, &cn, pLength, pStrings) ) 118 strErr = readNamedMatrixOfString((char*)cname, &cm, &cn, pLength, pStrings);
119 if(strErr.iErr)
115 { 120 {
121 fprintf(stderr,"%s", getErrorMessage(strErr));
116 if (pLength) {FREE(pLength); pLength = NULL;} 122 if (pLength) {FREE(pLength); pLength = NULL;}
117 (*env)->ReleaseStringUTFChars(env, jname , cname); 123 (*env)->ReleaseStringUTFChars(env, jname , cname);
118 fprintf(stderr,"Error in Java_javasci_SciStringArray_GetElement (8).\n"); 124 fprintf(stderr,"Error in Java_javasci_SciStringArray_GetElement (8).\n");
diff --git a/scilab/modules/javasci/src/c/javasci_Scilab.c b/scilab/modules/javasci/src/c/javasci_Scilab.c
index e61474c..010cfec 100644
--- a/scilab/modules/javasci/src/c/javasci_Scilab.c
+++ b/scilab/modules/javasci/src/c/javasci_Scilab.c
@@ -13,7 +13,7 @@
13#include <stdio.h> 13#include <stdio.h>
14#include "javasci_Scilab.h" 14#include "javasci_Scilab.h"
15#include "call_scilab.h" 15#include "call_scilab.h"
16#include "api_common.h" 16#include "api_scilab.h"
17#include "../../../modules/graphics/includes/WindowList.h" 17#include "../../../modules/graphics/includes/WindowList.h"
18/*--------------------------------------------------------------------------*/ 18/*--------------------------------------------------------------------------*/
19extern int GetLastErrorCode(void); 19extern int GetLastErrorCode(void);
@@ -88,6 +88,7 @@ JNIEXPORT jboolean JNICALL Java_javasci_Scilab_Finish (JNIEnv *env , jobject obj
88/* public static native boolean ExistVar(String varName); */ 88/* public static native boolean ExistVar(String varName); */
89JNIEXPORT jboolean JNICALL Java_javasci_Scilab_ExistVar(JNIEnv *env , jclass cl, jstring varName) 89JNIEXPORT jboolean JNICALL Java_javasci_Scilab_ExistVar(JNIEnv *env , jclass cl, jstring varName)
90{ 90{
91 StrErr strErr;
91 jboolean bOK = JNI_FALSE; 92 jboolean bOK = JNI_FALSE;
92 const char *cvarName = NULL; 93 const char *cvarName = NULL;
93 int sciType = 0; 94 int sciType = 0;
@@ -101,7 +102,12 @@ JNIEXPORT jboolean JNICALL Java_javasci_Scilab_ExistVar(JNIEnv *env , jclass cl,
101 return JNI_FALSE; 102 return JNI_FALSE;
102 } 103 }
103 104
104 sciType = getNamedVarType((char*)cvarName); 105 strErr = getNamedVarType((char*)cvarName, &sciType);
106 if(strErr.iErr)
107 {
108 fprintf(stderr,"%s", getErrorMessage(strErr));
109 return JNI_FALSE;
110 }
105 111
106 switch(sciType) 112 switch(sciType)
107 { 113 {
@@ -137,6 +143,7 @@ JNIEXPORT jboolean JNICALL Java_javasci_Scilab_ExistVar(JNIEnv *env , jclass cl,
137/* public static native int TypeVar(String varName); */ 143/* public static native int TypeVar(String varName); */
138JNIEXPORT jint JNICALL Java_javasci_Scilab_TypeVar(JNIEnv *env , jclass cl, jstring varName) 144JNIEXPORT jint JNICALL Java_javasci_Scilab_TypeVar(JNIEnv *env , jclass cl, jstring varName)
139{ 145{
146 StrErr strErr;
140 jint type = -1; 147 jint type = -1;
141 const char *cvarName = (*env)->GetStringUTFChars(env, varName, NULL); 148 const char *cvarName = (*env)->GetStringUTFChars(env, varName, NULL);
142 149
@@ -147,7 +154,7 @@ JNIEXPORT jint JNICALL Java_javasci_Scilab_TypeVar(JNIEnv *env , jclass cl, jstr
147 return type; 154 return type;
148 } 155 }
149 156
150 type = (jint)getNamedVarType((char *)cvarName); 157 strErr = getNamedVarType((char *)cvarName, (int*)&type);
151 (*env)->ReleaseStringUTFChars(env, varName , cvarName); 158 (*env)->ReleaseStringUTFChars(env, varName , cvarName);
152 159
153 return type; 160 return type;
diff --git a/scilab/modules/javasci/src/c/javasci_Scilab2.c b/scilab/modules/javasci/src/c/javasci_Scilab2.c
index bb57d2c..97caec2 100644
--- a/scilab/modules/javasci/src/c/javasci_Scilab2.c
+++ b/scilab/modules/javasci/src/c/javasci_Scilab2.c
@@ -15,9 +15,7 @@
15#include <string.h> 15#include <string.h>
16#include "javasci_Scilab2.h" 16#include "javasci_Scilab2.h"
17#include "call_scilab.h" 17#include "call_scilab.h"
18#include "api_common.h" 18#include "api_scilab.h"
19#include "api_double.h"
20#include "api_string.h"
21#include "freeArrayOfString.h" 19#include "freeArrayOfString.h"
22#ifdef _MSC_VER 20#ifdef _MSC_VER
23#include "strdup_windows.h" 21#include "strdup_windows.h"
@@ -38,6 +36,7 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_initialize(JNIEnv *env, jclass cl)
38/*--------------------------------------------------------------------------*/ 36/*--------------------------------------------------------------------------*/
39JNIEXPORT void JNICALL Java_javasci_Scilab_sendDoubleMatrix (JNIEnv *env, jclass cl, jobject objMatrix) 37JNIEXPORT void JNICALL Java_javasci_Scilab_sendDoubleMatrix (JNIEnv *env, jclass cl, jobject objMatrix)
40{ 38{
39 StrErr strErr;
41 const char *cname = NULL; 40 const char *cname = NULL;
42 double *matrix = NULL; 41 double *matrix = NULL;
43 int nbRow = 0, nbCol = 0; 42 int nbRow = 0, nbCol = 0;
@@ -60,8 +59,10 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_sendDoubleMatrix (JNIEnv *env, jclass
60 cname = (*env)->GetStringUTFChars(env, jname, NULL); 59 cname = (*env)->GetStringUTFChars(env, jname, NULL);
61 matrix = (*env)->GetDoubleArrayElements(env, jmatrix, NULL); 60 matrix = (*env)->GetDoubleArrayElements(env, jmatrix, NULL);
62 61
63 if (createNamedMatrixOfDouble((char*)cname, nbRow, nbCol, matrix)) 62 strErr = createNamedMatrixOfDouble((char*)cname, nbRow, nbCol, matrix);
63 if(strErr.iErr)
64 { 64 {
65 fprintf(stderr,"%s", getErrorMessage(strErr));
65 fprintf(stderr,"Error in Java_javasci_Scilab_sendDoubleMatrix.\n"); 66 fprintf(stderr,"Error in Java_javasci_Scilab_sendDoubleMatrix.\n");
66 } 67 }
67 68
@@ -71,6 +72,7 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_sendDoubleMatrix (JNIEnv *env, jclass
71/*--------------------------------------------------------------------------*/ 72/*--------------------------------------------------------------------------*/
72JNIEXPORT void JNICALL Java_javasci_Scilab_receiveDoubleMatrix (JNIEnv *env, jclass cl, jobject objMatrix) 73JNIEXPORT void JNICALL Java_javasci_Scilab_receiveDoubleMatrix (JNIEnv *env, jclass cl, jobject objMatrix)
73{ 74{
75 StrErr strErr;
74 const char *cname = NULL; 76 const char *cname = NULL;
75 double *matrix = NULL; 77 double *matrix = NULL;
76 int nbRow = 0, nbCol = 0; 78 int nbRow = 0, nbCol = 0;
@@ -93,8 +95,10 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_receiveDoubleMatrix (JNIEnv *env, jcl
93 95
94 cname = (*env)->GetStringUTFChars(env, jname, NULL); 96 cname = (*env)->GetStringUTFChars(env, jname, NULL);
95 97
96 if (readNamedMatrixOfDouble((char*)cname, &rows, &cols, NULL)) 98 strErr = readNamedMatrixOfDouble((char*)cname, &rows, &cols, NULL);
99 if(strErr.iErr)
97 { 100 {
101 fprintf(stderr,"%s", getErrorMessage(strErr));
98 fprintf(stderr,"Error in Java_javasci_Scilab_receiveDoubleMatrix (1).\n"); 102 fprintf(stderr,"Error in Java_javasci_Scilab_receiveDoubleMatrix (1).\n");
99 (*env)->ReleaseStringUTFChars(env, jname , cname); 103 (*env)->ReleaseStringUTFChars(env, jname , cname);
100 return; 104 return;
@@ -116,7 +120,11 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_receiveDoubleMatrix (JNIEnv *env, jcl
116 120
117 matrix = (*env)->GetDoubleArrayElements(env, jmatrix, NULL); 121 matrix = (*env)->GetDoubleArrayElements(env, jmatrix, NULL);
118 122
119 readNamedMatrixOfDouble((char*)cname, &rows, &cols, matrix); 123 strErr = readNamedMatrixOfDouble((char*)cname, &rows, &cols, matrix);
124 if(strErr.iErr)
125 {
126 fprintf(stderr,"%s", getErrorMessage(strErr));
127 }
120 128
121 (*env)->ReleaseStringUTFChars(env, jname , cname); 129 (*env)->ReleaseStringUTFChars(env, jname , cname);
122 (*env)->ReleaseDoubleArrayElements(env, jmatrix, matrix, 0); 130 (*env)->ReleaseDoubleArrayElements(env, jmatrix, matrix, 0);
@@ -124,6 +132,7 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_receiveDoubleMatrix (JNIEnv *env, jcl
124/*--------------------------------------------------------------------------*/ 132/*--------------------------------------------------------------------------*/
125JNIEXPORT void JNICALL Java_javasci_Scilab_sendComplexMatrix (JNIEnv *env, jclass cl, jobject objMatrix) 133JNIEXPORT void JNICALL Java_javasci_Scilab_sendComplexMatrix (JNIEnv *env, jclass cl, jobject objMatrix)
126{ 134{
135 StrErr strErr;
127 const char *cname = NULL; 136 const char *cname = NULL;
128 double *cx = NULL, *cy = NULL; 137 double *cx = NULL, *cy = NULL;
129 int nbRow = 0, nbCol = 0; 138 int nbRow = 0, nbCol = 0;
@@ -149,8 +158,10 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_sendComplexMatrix (JNIEnv *env, jclas
149 cx = (*env)->GetDoubleArrayElements(env, jx, NULL); 158 cx = (*env)->GetDoubleArrayElements(env, jx, NULL);
150 cy = (*env)->GetDoubleArrayElements(env, jy, NULL); 159 cy = (*env)->GetDoubleArrayElements(env, jy, NULL);
151 160
152 if ( createNamedComplexMatrixOfDouble((char*)cname, nbRow, nbCol, cx, cy) ) 161 strErr = createNamedComplexMatrixOfDouble((char*)cname, nbRow, nbCol, cx, cy);
162 if(strErr.iErr)
153 { 163 {
164 fprintf(stderr,"%s", getErrorMessage(strErr));
154 fprintf(stderr,"Error in Java_javasci_Scilab_sendComplexMatrix.\n"); 165 fprintf(stderr,"Error in Java_javasci_Scilab_sendComplexMatrix.\n");
155 } 166 }
156 167
@@ -161,6 +172,7 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_sendComplexMatrix (JNIEnv *env, jclas
161/*--------------------------------------------------------------------------*/ 172/*--------------------------------------------------------------------------*/
162JNIEXPORT void JNICALL Java_javasci_Scilab_receiveComplexMatrix (JNIEnv *env, jclass cl, jobject objMatrix) 173JNIEXPORT void JNICALL Java_javasci_Scilab_receiveComplexMatrix (JNIEnv *env, jclass cl, jobject objMatrix)
163{ 174{
175 StrErr strErr;
164 const char *cname = NULL; 176 const char *cname = NULL;
165 double *cx = NULL, *cy = NULL; 177 double *cx = NULL, *cy = NULL;
166 int nbRow = 0, nbCol = 0; 178 int nbRow = 0, nbCol = 0;
@@ -185,8 +197,10 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_receiveComplexMatrix (JNIEnv *env, jc
185 197
186 cname = (*env)->GetStringUTFChars(env, jname, NULL); 198 cname = (*env)->GetStringUTFChars(env, jname, NULL);
187 199
188 if ( readNamedComplexMatrixOfDouble((char*)cname, &rows, &cols, NULL, NULL) ) 200 strErr = readNamedComplexMatrixOfDouble((char*)cname, &rows, &cols, NULL, NULL);
201 if(strErr.iErr)
189 { 202 {
203 fprintf(stderr,"%s", getErrorMessage(strErr));
190 fprintf(stderr,"Error in Java_javasci_Scilab_receiveComplexMatrix (1).\n"); 204 fprintf(stderr,"Error in Java_javasci_Scilab_receiveComplexMatrix (1).\n");
191 (*env)->ReleaseStringUTFChars(env, jname , cname); 205 (*env)->ReleaseStringUTFChars(env, jname , cname);
192 return; 206 return;
@@ -209,8 +223,10 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_receiveComplexMatrix (JNIEnv *env, jc
209 cx = (*env)->GetDoubleArrayElements(env, jx, NULL); 223 cx = (*env)->GetDoubleArrayElements(env, jx, NULL);
210 cy = (*env)->GetDoubleArrayElements(env, jy, NULL); 224 cy = (*env)->GetDoubleArrayElements(env, jy, NULL);
211 225
212 if ( readNamedComplexMatrixOfDouble((char*)cname, &rows, &cols, cx, cy) ) 226 strErr = readNamedComplexMatrixOfDouble((char*)cname, &rows, &cols, cx, cy);
227 if(strErr.iErr)
213 { 228 {
229 fprintf(stderr,"%s", getErrorMessage(strErr));
214 fprintf(stderr,"Error in Java_javasci_Scilab_receiveComplexMatrix (4).\n"); 230 fprintf(stderr,"Error in Java_javasci_Scilab_receiveComplexMatrix (4).\n");
215 (*env)->ReleaseStringUTFChars(env, jname , cname); 231 (*env)->ReleaseStringUTFChars(env, jname , cname);
216 (*env)->ReleaseDoubleArrayElements(env,jx,cx,0); 232 (*env)->ReleaseDoubleArrayElements(env,jx,cx,0);
@@ -271,6 +287,7 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_sendStringMatrix (JNIEnv *env, jclass
271/*--------------------------------------------------------------------------*/ 287/*--------------------------------------------------------------------------*/
272JNIEXPORT void JNICALL Java_javasci_Scilab_receiveStringMatrix (JNIEnv *env, jclass cl, jobject objMatrix) 288JNIEXPORT void JNICALL Java_javasci_Scilab_receiveStringMatrix (JNIEnv *env, jclass cl, jobject objMatrix)
273{ 289{
290 StrErr strErr;
274 const char *cname = NULL; 291 const char *cname = NULL;
275 int nbRow = 0, nbCol = 0; 292 int nbRow = 0, nbCol = 0;
276 int i = 0; 293 int i = 0;
@@ -295,8 +312,11 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_receiveStringMatrix (JNIEnv *env, jcl
295 nbCol = jnbCol; 312 nbCol = jnbCol;
296 313
297 cname = (*env)->GetStringUTFChars(env, jname, NULL); 314 cname = (*env)->GetStringUTFChars(env, jname, NULL);
298 if ( readNamedMatrixOfString((char*)cname, &rows, &cols, pLength, pStrings) ) 315
316 strErr = readNamedMatrixOfString((char*)cname, &rows, &cols, pLength, pStrings);
317 if(strErr.iErr)
299 { 318 {
319 fprintf(stderr,"%s", getErrorMessage(strErr));
300 (*env)->ReleaseStringUTFChars(env, jname , cname); 320 (*env)->ReleaseStringUTFChars(env, jname , cname);
301 return; 321 return;
302 } 322 }
@@ -320,8 +340,10 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_receiveStringMatrix (JNIEnv *env, jcl
320 return; 340 return;
321 } 341 }
322 342
323 if ( readNamedMatrixOfString((char*)cname, &rows, &cols, pLength, pStrings) ) 343 strErr = readNamedMatrixOfString((char*)cname, &rows, &cols, pLength, pStrings);
344 if(strErr.iErr)
324 { 345 {
346 fprintf(stderr,"%s", getErrorMessage(strErr));
325 (*env)->ReleaseStringUTFChars(env, jname , cname); 347 (*env)->ReleaseStringUTFChars(env, jname , cname);
326 return; 348 return;
327 } 349 }
@@ -339,8 +361,10 @@ JNIEXPORT void JNICALL Java_javasci_Scilab_receiveStringMatrix (JNIEnv *env, jcl
339 } 361 }
340 } 362 }
341 363
342 if ( readNamedMatrixOfString((char*)cname, &rows, &cols, pLength, pStrings) ) 364 strErr = readNamedMatrixOfString((char*)cname, &rows, &cols, pLength, pStrings);
365 if(strErr.iErr)
343 { 366 {
367 fprintf(stderr,"%s", getErrorMessage(strErr));
344 if (pLength) {FREE(pLength); pLength = NULL;} 368 if (pLength) {FREE(pLength); pLength = NULL;}
345 (*env)->ReleaseStringUTFChars(env, jname , cname); 369 (*env)->ReleaseStringUTFChars(env, jname , cname);
346 return; 370 return;
@@ -391,16 +415,28 @@ static jobject getStringMatrix(JNIEnv *env, jclass cl, jstring name, jint nbRow
391/*--------------------------------------------------------------------------*/ 415/*--------------------------------------------------------------------------*/
392JNIEXPORT jobject JNICALL Java_javasci_Scilab_receiveDataByName (JNIEnv *env, jclass cl, jstring name) 416JNIEXPORT jobject JNICALL Java_javasci_Scilab_receiveDataByName (JNIEnv *env, jclass cl, jstring name)
393{ 417{
418 StrErr strErr;
394 const char *cname = NULL; 419 const char *cname = NULL;
395 jobject obj =NULL; 420 jobject obj = NULL;
396 int type = 0; 421 int type = 0;
397 int Dimensions[2]; 422 int Dimensions[2];
398 423
399 cname = (*env)->GetStringUTFChars(env, name, NULL); 424 cname = (*env)->GetStringUTFChars(env, name, NULL);
400 (*env)->ReleaseStringUTFChars(env, name , cname); 425 (*env)->ReleaseStringUTFChars(env, name , cname);
401 426
402 type = getNamedVarType((char*)cname); /* give type */ 427 strErr = getNamedVarType((char*)cname, &type); /* give type */
403 if (getNamedVarDimension((char*)cname, &Dimensions[0], &Dimensions[1])); 428 if(strErr.iErr)
429 {
430 fprintf(stderr,"%s", getErrorMessage(strErr));
431 return obj;
432 }
433
434 strErr = getNamedVarDimension((char*)cname, &Dimensions[0], &Dimensions[1]);
435 if(strErr.iErr)
436 {
437 fprintf(stderr,"%s", getErrorMessage(strErr));
438 return obj;
439 }
404 440
405 switch(type) 441 switch(type)
406 { 442 {