diff options
author | shag527 | 2021-04-17 12:04:06 +0530 |
---|---|---|
committer | shag527 | 2021-04-17 12:04:06 +0530 |
commit | 91c48b90d09b9873d1498b9e3af80091b0dd4cee (patch) | |
tree | e3bbe438f72302c1eb592f41b257fb3762125bb5 /sci_gateway/cpp | |
parent | e43fd7fe8ac865bd26b2cd15f7574653870c775c (diff) | |
download | fossee-scilab-octave-toolbox-91c48b90d09b9873d1498b9e3af80091b0dd4cee.tar.gz fossee-scilab-octave-toolbox-91c48b90d09b9873d1498b9e3af80091b0dd4cee.tar.bz2 fossee-scilab-octave-toolbox-91c48b90d09b9873d1498b9e3af80091b0dd4cee.zip |
Captured original octave errors in scilab
Diffstat (limited to 'sci_gateway/cpp')
-rwxr-xr-x | sci_gateway/cpp/libscilab_octave.so | bin | 21536 -> 27400 bytes | |||
-rw-r--r-- | sci_gateway/cpp/sci_octave.cpp | 18 |
2 files changed, 17 insertions, 1 deletions
diff --git a/sci_gateway/cpp/libscilab_octave.so b/sci_gateway/cpp/libscilab_octave.so Binary files differindex 229a76c..f4317ae 100755 --- a/sci_gateway/cpp/libscilab_octave.so +++ b/sci_gateway/cpp/libscilab_octave.so diff --git a/sci_gateway/cpp/sci_octave.cpp b/sci_gateway/cpp/sci_octave.cpp index 2ba43b5..d76993f 100644 --- a/sci_gateway/cpp/sci_octave.cpp +++ b/sci_gateway/cpp/sci_octave.cpp @@ -9,9 +9,11 @@ // Organization: FOSSEE, IIT Bombay // Email: toolbox@scilab.in +#include <iostream> #include <string> #include "wchar.h" #include <cstdlib> +#include <sstream> extern "C" { @@ -152,8 +154,22 @@ int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* o return STATUS_ERROR; } } + + // Capturing Errors and warnings + std::stringstream buffer_err; + + // set our error buffer + std::cerr.rdbuf(buffer_err.rdbuf()); int status_fun = fun(argptr, funptr); + + // grab error buffer contents + std::string err = buffer_err.str(); + if(!err.empty()) + sciprint("%s", err.c_str()); + buffer_err.str(""); + + //printf("in scilab status_fun is: %d\n", status_fun); //printf("in scilab funcall.n_out_arguments is: %d\n", funcall.n_out_arguments); //printf("in scilab funcall.n_out_user is: %d\n", funcall.n_out_user); @@ -164,7 +180,7 @@ int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* o //printf("in scilab ouput args are: %d\n", funcall.n_out_arguments); if(status_fun==1) { - Scierror(999, "\nOctave unable to process!\nCorrect usage:\n octave_fun(\"octave_function\",input1,input2,...)\n octave_fun(\"octave_function\",input1,input2,...,optional_input1,optional_input2,...)\n octave_fun(\"octave_function\",\"octave_package\",input1,input2,...)\n octave_fun(\"octave_function\",\"octave_package\",input1,input2,...,optional_input1,optional_input2,...)\n"); + Scierror(999, "Scilab unable to process!\n"); return 1; } else if(funcall.n_out_user <= funcall.n_out_arguments) |