diff options
author | rupak | 2019-08-23 16:53:56 +0530 |
---|---|---|
committer | rupak | 2019-08-23 16:53:56 +0530 |
commit | 378f77aefd60289e955d1b180e3326e461cfcbec (patch) | |
tree | f85f0f651d65b8b65b59c6e311c3d5ca707349a1 /sci_gateway/cpp | |
parent | 273f28978c7167e03784e46d60a205b1b346ca9a (diff) | |
download | fossee-scilab-octave-toolbox-378f77aefd60289e955d1b180e3326e461cfcbec.tar.gz fossee-scilab-octave-toolbox-378f77aefd60289e955d1b180e3326e461cfcbec.tar.bz2 fossee-scilab-octave-toolbox-378f77aefd60289e955d1b180e3326e461cfcbec.zip |
fixed missing fun.h
Diffstat (limited to 'sci_gateway/cpp')
-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 |
4 files changed, 86 insertions, 10 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; +} |