From 378f77aefd60289e955d1b180e3326e461cfcbec Mon Sep 17 00:00:00 2001 From: rupak Date: Fri, 23 Aug 2019 16:53:56 +0530 Subject: fixed missing fun.h --- sci_gateway/cpp/libscilab_toolbox.so | Bin 16448 -> 16528 bytes sci_gateway/cpp/sci_matrix.c | 38 +++++++++++++++++++++++++++++++++++ sci_gateway/cpp/sci_matrix.cpp | 20 +++++++++--------- sci_gateway/cpp/sci_matrix.c~ | 38 +++++++++++++++++++++++++++++++++++ thirdparty/linux/include/fun.h | 3 ++- thirdparty/linux/lib/x64/libfun.so | Bin 2644928 -> 2654856 bytes 6 files changed, 88 insertions(+), 11 deletions(-) create mode 100644 sci_gateway/cpp/sci_matrix.c create mode 100644 sci_gateway/cpp/sci_matrix.c~ diff --git a/sci_gateway/cpp/libscilab_toolbox.so b/sci_gateway/cpp/libscilab_toolbox.so index 6251da2..ed9057f 100755 Binary files a/sci_gateway/cpp/libscilab_toolbox.so and b/sci_gateway/cpp/libscilab_toolbox.so differ diff --git a/sci_gateway/cpp/sci_matrix.c b/sci_gateway/cpp/sci_matrix.c new file mode 100644 index 0000000..cf217d6 --- /dev/null +++ b/sci_gateway/cpp/sci_matrix.c @@ -0,0 +1,38 @@ + +#include +#include +#include +#include "localization.h" +#include "fun.h" +#include +#include + +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 retval; +double* out1 = NULL; + +if (nin != 0) + { + Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), fname, 2); + return 1; + } + +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, 5); + fun(&retval); + printf("%f\n", retval); + *out1 = retval; + scilab_getDoubleArray(env, out[0], &out1); + + + + return 0; +} diff --git a/sci_gateway/cpp/sci_matrix.cpp b/sci_gateway/cpp/sci_matrix.cpp index 2b2c544..ca147a7 100644 --- a/sci_gateway/cpp/sci_matrix.cpp +++ b/sci_gateway/cpp/sci_matrix.cpp @@ -5,13 +5,16 @@ extern "C" #include #include #include "localization.h" -#include +#include "fun.h" +#include +#include 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; if (nin != 0) { @@ -24,17 +27,14 @@ 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); + //double retval = fun(); + //printf("%f\n", retval); + //*out1 = retval; + scilab_getDoubleArray(env, out[0], &out1); + out1[0]=fun(); - //int x = fun(); - //typename (x); - double x = fun(); - //sciprint("%f\n", fun()); - - out[0] = scilab_createDouble(env, x); - - //out[0] = scilab_createDoubleMatrix(env, 20, 1, 0); - //scilab_getDoubleArray(env, out[0], &x); return 0; } diff --git a/sci_gateway/cpp/sci_matrix.c~ b/sci_gateway/cpp/sci_matrix.c~ new file mode 100644 index 0000000..45a33e9 --- /dev/null +++ b/sci_gateway/cpp/sci_matrix.c~ @@ -0,0 +1,38 @@ + +#include +#include +#include +#include "localization.h" +#include "fun.h" +#include +#include + +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 retval; +double* out1 = NULL; + +if (nin != 0) + { + Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), fname, 2); + return 1; + } + +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, 5); + retval = fun(); + printf("%f\n", retval); + *out1 = retval; + scilab_getDoubleArray(env, out[0], &out1); + + + + return 0; +} diff --git a/thirdparty/linux/include/fun.h b/thirdparty/linux/include/fun.h index a3e7829..99ef937 100644 --- a/thirdparty/linux/include/fun.h +++ b/thirdparty/linux/include/fun.h @@ -1 +1,2 @@ -int fun(void); +extern "C" double fun(); + diff --git a/thirdparty/linux/lib/x64/libfun.so b/thirdparty/linux/lib/x64/libfun.so index 690d8bd..c118c4b 100755 Binary files a/thirdparty/linux/lib/x64/libfun.so and b/thirdparty/linux/lib/x64/libfun.so differ -- cgit