summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrupak2019-08-23 17:41:20 +0530
committerrupak2019-08-23 17:41:20 +0530
commit18719adcd3e801d072085ecb8ed60acbad3ffd0a (patch)
tree776df650afdbcd00396d30f6cc98312963439d7b
parent378f77aefd60289e955d1b180e3326e461cfcbec (diff)
downloadfossee-scilab-octave-toolbox-18719adcd3e801d072085ecb8ed60acbad3ffd0a.tar.gz
fossee-scilab-octave-toolbox-18719adcd3e801d072085ecb8ed60acbad3ffd0a.tar.bz2
fossee-scilab-octave-toolbox-18719adcd3e801d072085ecb8ed60acbad3ffd0a.zip
scilab recieves 1D array from octave
-rw-r--r--build.sce2
-rw-r--r--macros/scilab_error.binbin1951 -> 1951 bytes
-rw-r--r--macros/scilab_sum.binbin913 -> 913 bytes
-rwxr-xr-xsci_gateway/cpp/libscilab_toolbox.sobin16528 -> 16528 bytes
-rw-r--r--sci_gateway/cpp/sci_matrix.cpp16
-rw-r--r--thirdparty/linux/include/fun.h3
-rwxr-xr-xthirdparty/linux/lib/x64/libfun.sobin2654856 -> 2670672 bytes
7 files changed, 15 insertions, 6 deletions
diff --git a/build.sce b/build.sce
index 7b9cf91..5321f6d 100644
--- a/build.sce
+++ b/build.sce
@@ -18,4 +18,4 @@ ulink
exec builder.sce
exec loader.sce
-octave_fun()
+//octave_fun()
diff --git a/macros/scilab_error.bin b/macros/scilab_error.bin
index c5f954f..332cba1 100644
--- a/macros/scilab_error.bin
+++ b/macros/scilab_error.bin
Binary files differ
diff --git a/macros/scilab_sum.bin b/macros/scilab_sum.bin
index 2e854dd..ba64f9e 100644
--- a/macros/scilab_sum.bin
+++ b/macros/scilab_sum.bin
Binary files differ
diff --git a/sci_gateway/cpp/libscilab_toolbox.so b/sci_gateway/cpp/libscilab_toolbox.so
index ed9057f..9cf2138 100755
--- a/sci_gateway/cpp/libscilab_toolbox.so
+++ b/sci_gateway/cpp/libscilab_toolbox.so
Binary files differ
diff --git a/sci_gateway/cpp/sci_matrix.cpp b/sci_gateway/cpp/sci_matrix.cpp
index ca147a7..aa45bed 100644
--- a/sci_gateway/cpp/sci_matrix.cpp
+++ b/sci_gateway/cpp/sci_matrix.cpp
@@ -14,8 +14,10 @@ static const char fname[] = "octave_fun";
int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* opt, int nout, scilabVar* out)
{
-double* out1 = NULL;
-
+ double* out1 = NULL;
+ int n=5;
+ double ar[n];
+
if (nin != 0)
{
Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), fname, 2);
@@ -27,13 +29,19 @@ if (nout != 1)
Scierror(77, _("%s: Wrong number of output argument(s): %d expected.\n"), fname, 1);
return 1;
}
- *out = scilab_createDoubleMatrix2d(env, 1, 1, 0);
+
+ fun(ar, n);
+ *out = scilab_createDoubleMatrix2d(env, n, 1, 0);
//double retval = fun();
//printf("%f\n", retval);
//*out1 = retval;
scilab_getDoubleArray(env, out[0], &out1);
- out1[0]=fun();
+ //out1[0]=fun();
+ for(int i=0; i<n; i++)
+ {
+ out1[i] = ar[i];//.float_value();
+ }
return 0;
diff --git a/thirdparty/linux/include/fun.h b/thirdparty/linux/include/fun.h
index 99ef937..d2bcdf3 100644
--- a/thirdparty/linux/include/fun.h
+++ b/thirdparty/linux/include/fun.h
@@ -1,2 +1,3 @@
-extern "C" double fun();
+#define fun_h__
+extern "C" int fun (double* answ, int size);
diff --git a/thirdparty/linux/lib/x64/libfun.so b/thirdparty/linux/lib/x64/libfun.so
index c118c4b..3e8cbca 100755
--- a/thirdparty/linux/lib/x64/libfun.so
+++ b/thirdparty/linux/lib/x64/libfun.so
Binary files differ