diff options
-rwxr-xr-x | sci_gateway/cpp/libscilab_toolbox.so | bin | 16448 -> 16528 bytes | |||
-rw-r--r-- | sci_gateway/cpp/sci_matrix.c | 38 | ||||
-rw-r--r-- | sci_gateway/cpp/sci_matrix.cpp | 20 | ||||
-rw-r--r-- | sci_gateway/cpp/sci_matrix.c~ | 38 | ||||
-rw-r--r-- | thirdparty/linux/include/fun.h | 3 | ||||
-rwxr-xr-x | thirdparty/linux/lib/x64/libfun.so | bin | 2644928 -> 2654856 bytes |
6 files changed, 88 insertions, 11 deletions
diff --git a/sci_gateway/cpp/libscilab_toolbox.so b/sci_gateway/cpp/libscilab_toolbox.so Binary files differindex 6251da2..ed9057f 100755 --- a/sci_gateway/cpp/libscilab_toolbox.so +++ b/sci_gateway/cpp/libscilab_toolbox.so 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<Scierror.h> +#include<sciprint.h> +#include<api_scilab.h> +#include "localization.h" +#include "fun.h" +#include <stdio.h> +#include <math.h> + +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<sciprint.h> #include<api_scilab.h> #include "localization.h" -#include<fun.h> +#include "fun.h" +#include <cstdio> +#include <math.h> 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<Scierror.h> +#include<sciprint.h> +#include<api_scilab.h> +#include "localization.h" +#include "fun.h" +#include <stdio.h> +#include <math.h> + +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 Binary files differindex 690d8bd..c118c4b 100755 --- a/thirdparty/linux/lib/x64/libfun.so +++ b/thirdparty/linux/lib/x64/libfun.so |