diff options
author | Rupak Rokade | 2021-04-26 14:58:22 +0530 |
---|---|---|
committer | GitHub | 2021-04-26 14:58:22 +0530 |
commit | c6fd117ed4944b99d5974c77c8a82a2f564f0539 (patch) | |
tree | a29484d05688642cb61bb7ced21e601a3be969da | |
parent | e43fd7fe8ac865bd26b2cd15f7574653870c775c (diff) | |
parent | 540c02f594fe49e47828a589115f282f95304b72 (diff) | |
download | fossee-scilab-octave-toolbox-c6fd117ed4944b99d5974c77c8a82a2f564f0539.tar.gz fossee-scilab-octave-toolbox-c6fd117ed4944b99d5974c77c8a82a2f564f0539.tar.bz2 fossee-scilab-octave-toolbox-c6fd117ed4944b99d5974c77c8a82a2f564f0539.zip |
Merge pull request #2 from ananmaysuri/master
Capturing the original octave error messages and returning them to scilab
31 files changed, 74 insertions, 46 deletions
diff --git a/.travis.yml b/.travis.yml index e6dfbfb..1bf2494 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,20 @@ -language: scilab -dist: bionic +language: cpp +dist: focal before_install: - sudo apt-get update - - wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/scilab/6.0.1-1ubuntu1/scilab_6.0.1-1ubuntu1.debian.tar.xz - - tar -xf scilab_6.0.1-1ubuntu1.debian.tar.xz - - bash scilab_6.0.1-1ubuntu1.debian/scilab.install +# - wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/scilab/6.0.1-1ubuntu1/scilab_6.0.1-1ubuntu1.debian.tar.xz +# - tar -xf scilab_6.0.1-1ubuntu1.debian.tar.xz +# - bash debian/scilab.install + - sudo apt-get install scilab - sudo apt-get install octave - sudo apt-get install build-essential - sudo apt-get install liboctave-dev + - sudo apt-get install octave-signal + script: - - octave-cli tests/oct-setup.m - - scilab -nw -f tests/test.sce +- cd $TRAVIS_BUILD_DIR/ +- cd src/ +- bash make.sh +- cd $TRAVIS_BUILD_DIR/ +- scilab-cli -f tests/test.sce diff --git a/help/en_US/master_help.xml b/help/en_US/master_help.xml index 42de660..3ec9204 100644 --- a/help/en_US/master_help.xml +++ b/help/en_US/master_help.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE book [ <!--Begin Entities--> -<!ENTITY a2f62ac6eea8f91207887f252e499ff51 SYSTEM "/home/rupak19/scilab-octave-toolbox/fossee-scilab-octave-toolbox/help/en_US/octave_fun.xml"> +<!ENTITY aa15f19e90e8889fc1cf1bbfeeb08ce0d SYSTEM "/home/ananmay/Documents/fossee-scilab-octave-toolbox/help/en_US/octave_fun.xml"> <!--End Entities--> ]> <book version="5.0-subset Scilab" xml:lang="en_US" @@ -16,8 +16,8 @@ <title>scilab_octave</title> </info> -<part xml:id='section_1c1bd9c3fd43e22beeaa17904025e167'> +<part xml:id='section_03d75e04f21a47a401a1c20a6b501bc4'> <title>scilab_octave</title> -&a2f62ac6eea8f91207887f252e499ff51; +&aa15f19e90e8889fc1cf1bbfeeb08ce0d; </part> </book> diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS Binary files differindex a1d2a47..e7476c0 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB index 8619a1d..d8995ba 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB @@ -1 +1 @@ -eÿÿÿ÷_ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÐÿÿÿꪪªªªªªªªªªªªªªªªªªªªªªª¦
\ No newline at end of file +eÿÿÿö_ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÐÿÿÿꪪªªªªªªªªªªªªªªªªªªªªªª¦
\ No newline at end of file diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS index c3c7752..ec3f923 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS @@ -1 +1 @@ -‡PƒÎÀk`
\ No newline at end of file +‡™€ƒÀadn`
\ No newline at end of file diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS Binary files differindex 04e849b..14c2668 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP Binary files differindex 171b814..33d0cbc 100644 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP diff --git a/help/en_US/scilab_en_US_help/ScilabCaution.png b/help/en_US/scilab_en_US_help/ScilabCaution.png Binary files differindex 77a9f4a..437c544 100644 --- a/help/en_US/scilab_en_US_help/ScilabCaution.png +++ b/help/en_US/scilab_en_US_help/ScilabCaution.png diff --git a/help/en_US/scilab_en_US_help/ScilabEdit.png b/help/en_US/scilab_en_US_help/ScilabEdit.png Binary files differindex 4eb8bb9..8dac6b4 100644 --- a/help/en_US/scilab_en_US_help/ScilabEdit.png +++ b/help/en_US/scilab_en_US_help/ScilabEdit.png diff --git a/help/en_US/scilab_en_US_help/ScilabExecute.png b/help/en_US/scilab_en_US_help/ScilabExecute.png Binary files differindex 06716cb..a240b4f 100644 --- a/help/en_US/scilab_en_US_help/ScilabExecute.png +++ b/help/en_US/scilab_en_US_help/ScilabExecute.png diff --git a/help/en_US/scilab_en_US_help/ScilabImportant.png b/help/en_US/scilab_en_US_help/ScilabImportant.png Binary files differindex 1993bb3..e70a03c 100644 --- a/help/en_US/scilab_en_US_help/ScilabImportant.png +++ b/help/en_US/scilab_en_US_help/ScilabImportant.png diff --git a/help/en_US/scilab_en_US_help/ScilabNote.png b/help/en_US/scilab_en_US_help/ScilabNote.png Binary files differindex 04e0e54..8907940 100644 --- a/help/en_US/scilab_en_US_help/ScilabNote.png +++ b/help/en_US/scilab_en_US_help/ScilabNote.png diff --git a/help/en_US/scilab_en_US_help/ScilabTip.png b/help/en_US/scilab_en_US_help/ScilabTip.png Binary files differindex 04e0e54..8907940 100644 --- a/help/en_US/scilab_en_US_help/ScilabTip.png +++ b/help/en_US/scilab_en_US_help/ScilabTip.png diff --git a/help/en_US/scilab_en_US_help/ScilabWarning.png b/help/en_US/scilab_en_US_help/ScilabWarning.png Binary files differindex 77a9f4a..437c544 100644 --- a/help/en_US/scilab_en_US_help/ScilabWarning.png +++ b/help/en_US/scilab_en_US_help/ScilabWarning.png diff --git a/help/en_US/scilab_en_US_help/index.html b/help/en_US/scilab_en_US_help/index.html index a7bcb41..5851fba 100644 --- a/help/en_US/scilab_en_US_help/index.html +++ b/help/en_US/scilab_en_US_help/index.html @@ -31,7 +31,7 @@ <h3 class="book-title">scilab_octave</h3> <ul class="list-part"><a name="scilab_octave_manual"></a><div class="info"></div> -<li><a href="section_1c1bd9c3fd43e22beeaa17904025e167.html" class="part">scilab_octave</a> +<li><a href="section_03d75e04f21a47a401a1c20a6b501bc4.html" class="part">scilab_octave</a> <ul class="list-chapter"><li><a href="octave_fun.html" class="refentry">octave_fun</a> — <span class="refentry-description">Calls an octave function with given inputs and returns the expected output</span></li></ul></li></ul> <br /> diff --git a/help/en_US/scilab_en_US_help/jhelpmap.jhm b/help/en_US/scilab_en_US_help/jhelpmap.jhm index f46231d..bd4e16f 100644 --- a/help/en_US/scilab_en_US_help/jhelpmap.jhm +++ b/help/en_US/scilab_en_US_help/jhelpmap.jhm @@ -2,6 +2,6 @@ <!DOCTYPE map PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN" "http://java.sun.com/products/javahelp/map_1_0.dtd"> <map version="1.0"> <mapID target="index" url="index.html"/> -<mapID target="section_1c1bd9c3fd43e22beeaa17904025e167" url="section_1c1bd9c3fd43e22beeaa17904025e167.html"/> +<mapID target="section_03d75e04f21a47a401a1c20a6b501bc4" url="section_03d75e04f21a47a401a1c20a6b501bc4.html"/> <mapID target="octave_fun" url="octave_fun.html"/> </map>
\ No newline at end of file diff --git a/help/en_US/scilab_en_US_help/jhelptoc.xml b/help/en_US/scilab_en_US_help/jhelptoc.xml index 0a9d60c..5b72dc8 100644 --- a/help/en_US/scilab_en_US_help/jhelptoc.xml +++ b/help/en_US/scilab_en_US_help/jhelptoc.xml @@ -2,7 +2,7 @@ <!DOCTYPE toc PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN" "http://java.sun.com/products/javahelp/toc_1_0.dtd"> <toc version="1.0"> <tocitem target="index" text="scilab_octave"> -<tocitem target="section_1c1bd9c3fd43e22beeaa17904025e167" text="scilab_octave"> +<tocitem target="section_03d75e04f21a47a401a1c20a6b501bc4" text="scilab_octave"> <tocitem target="octave_fun" text="octave_fun"/> </tocitem> </tocitem> diff --git a/help/en_US/scilab_en_US_help/octave_fun.html b/help/en_US/scilab_en_US_help/octave_fun.html index 3bff286..16b6d23 100644 --- a/help/en_US/scilab_en_US_help/octave_fun.html +++ b/help/en_US/scilab_en_US_help/octave_fun.html @@ -12,11 +12,11 @@ <div class="manualnavbar"> <table width="100%"><tr> <td width="30%"> - <span class="previous"><a href="section_1c1bd9c3fd43e22beeaa17904025e167.html"><< scilab_octave</a></span> + <span class="previous"><a href="section_03d75e04f21a47a401a1c20a6b501bc4.html"><< scilab_octave</a></span> </td> <td width="40%" class="center"> - <span class="top"><a href="section_1c1bd9c3fd43e22beeaa17904025e167.html">scilab_octave</a></span> + <span class="top"><a href="section_03d75e04f21a47a401a1c20a6b501bc4.html">scilab_octave</a></span> </td> <td width="30%" class="next"> @@ -28,7 +28,7 @@ - <span class="path" dir="ltr"><a href="index.html">scilab_octave</a> >> <a href="section_1c1bd9c3fd43e22beeaa17904025e167.html">scilab_octave</a> > octave_fun</span> + <span class="path"><a href="index.html">scilab_octave</a> >> <a href="section_03d75e04f21a47a401a1c20a6b501bc4.html">scilab_octave</a> > octave_fun</span> <br /><br /> <div class="refnamediv"><h1 class="refname">octave_fun</h1> @@ -94,11 +94,11 @@ <tr><td colspan="3" class="next"><a href="http://bugzilla.scilab.org/enter_bug.cgi?product=Scilab%20software&component=Documentation%20pages" class="ulink">Report an issue</a></td></tr> <tr> <td width="30%"> - <span class="previous"><a href="section_1c1bd9c3fd43e22beeaa17904025e167.html"><< scilab_octave</a></span> + <span class="previous"><a href="section_03d75e04f21a47a401a1c20a6b501bc4.html"><< scilab_octave</a></span> </td> <td width="40%" class="center"> - <span class="top"><a href="section_1c1bd9c3fd43e22beeaa17904025e167.html">scilab_octave</a></span> + <span class="top"><a href="section_03d75e04f21a47a401a1c20a6b501bc4.html">scilab_octave</a></span> </td> <td width="30%" class="next"> diff --git a/help/en_US/scilab_en_US_help/section_1c1bd9c3fd43e22beeaa17904025e167.html b/help/en_US/scilab_en_US_help/section_03d75e04f21a47a401a1c20a6b501bc4.html index a6d3f49..a828712 100644 --- a/help/en_US/scilab_en_US_help/section_1c1bd9c3fd43e22beeaa17904025e167.html +++ b/help/en_US/scilab_en_US_help/section_03d75e04f21a47a401a1c20a6b501bc4.html @@ -27,7 +27,7 @@ - <span class="path" dir="ltr"><a href="index.html">scilab_octave</a> >> scilab_octave</span> + <span class="path"><a href="index.html">scilab_octave</a> >> scilab_octave</span> <br /><br /> <h3 class="title-part">scilab_octave</h3> diff --git a/help/en_US/scilab_en_US_help/style.css b/help/en_US/scilab_en_US_help/style.css index edc0b85..93bd898 100644 --- a/help/en_US/scilab_en_US_help/style.css +++ b/help/en_US/scilab_en_US_help/style.css @@ -68,7 +68,6 @@ h5 { color:#333333; line-height:120%; padding:10px; - direction: ltr; } .literal { @@ -92,14 +91,12 @@ h5 { font-family: monospace; font-size: 100%; color: #32b9b9; - direction: ltr; } .varname { font-family: monospace; font-weight: bold; font-size: 100%; - direction: ltr; } .constant { @@ -133,7 +130,6 @@ a:hover { pre { margin-bottom: 0px; margin-top: 0px; - direction: ltr; } .leftpart { @@ -207,10 +203,9 @@ ul.toc li { /* Top and bottom navigation controls on manual pages --------------------- */ div.manualnavbar { background-color: #F0F0FF; - color: inherit; - padding: 4px; - margin-bottom: 10px; - direction: ltr; + color: inherit; + padding: 4px; + margin-bottom: 10px; } div.manualnavbar .prev { padding-right: 4px; @@ -380,7 +375,4 @@ td.revnumber { vertical-align: top; } -tr -{ - vertical-align: top; -} + diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar Binary files differindex ff4e566..02270d7 100644 --- a/jar/scilab_en_US_help.jar +++ b/jar/scilab_en_US_help.jar diff --git a/macros/octave_fun.bin b/macros/octave_fun.bin Binary files differindex ba7dc3f..065f472 100644 --- a/macros/octave_fun.bin +++ b/macros/octave_fun.bin diff --git a/sci_gateway/cpp/libscilab_octave.so b/sci_gateway/cpp/libscilab_octave.so Binary files differindex 229a76c..e5c4f0f 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..5f1f685 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" { @@ -56,7 +58,7 @@ int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* o char* c; double* n = NULL; int row = 0; - int col = 0; + int col = 0; double* in_real; double* in_img; @@ -147,13 +149,26 @@ int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* o } } else - { - Scierror(999, _("%s: Wrong type of input argument %d.\n"), fname, i); - return STATUS_ERROR; - } + { + Scierror(999, _("%s: Wrong type of input argument %d.\n"), fname, i); + 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); - int status_fun = fun(argptr, funptr); + // grab error buffer contents + std::string err = buffer_err.str(); + + if(!err.empty() && status_fun==0) + sciprint("Warning from Octave\n%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 +179,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,"Error from Octave\n%s", err.c_str()); return 1; } else if(funcall.n_out_user <= funcall.n_out_arguments) @@ -211,9 +226,9 @@ int sci_octave_fun(scilabEnv env, int nin, scilabVar* in, int nopt, scilabOpt* o } else { - Scierror(77, _("%s: Wrong number of output arguments: This function can return a maximum of %d output(s).\n"), fname, funcall.n_out_arguments); - return 1; - } + Scierror(77, _("%s: Wrong number of output arguments: This function can return a maximum of %d output(s).\n"), fname, funcall.n_out_arguments); + return 1; + } diff --git a/src/fun.cpp b/src/fun.cpp index 7e30688..4eeb24c 100644 --- a/src/fun.cpp +++ b/src/fun.cpp @@ -183,7 +183,7 @@ extern "C" }
catch (const octave::execution_exception&)
{
- std::cerr << "error encountered in Octave evaluator!" << std::endl;
+ //std::cerr << "error encountered in Octave evaluator!" << std::endl;
return 1;
}
return 0;
Binary files differdiff --git a/src/libfun.so b/src/libfun.so Binary files differindex 777cb3f..6c97c22 100755 --- a/src/libfun.so +++ b/src/libfun.so diff --git a/src/make.sh b/src/make.sh new file mode 100644 index 0000000..096275d --- /dev/null +++ b/src/make.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# build and test the fun library using the makefile at /src +make clean +make +make install +./testfun +# test.sce runs in cli mode, no gui prompts allowed while using builder.sce +# removed the tbx_builder_gateway(toolbox_dir) and tbx_build_localization(toolbox_dir) funciton calls from buider.sce + +cd .. +sed -i '37d' ./builder.sce +sed -i '40,41d' ./builder.sce diff --git a/src/testfun b/src/testfun Binary files differindex 5e607f7..500b639 100755 --- a/src/testfun +++ b/src/testfun diff --git a/tests/test.sce b/tests/test.sce index e53eed3..b3a7993 100644 --- a/tests/test.sce +++ b/tests/test.sce @@ -1,3 +1,6 @@ +exec builder.sce +exec loader.sce + //exec build.sce test_pass=[] @@ -290,12 +293,12 @@ end /////////Test case for bilinear ////////// -[b a] = octave_fun("bilinear","signal",[1 2 3], [4 5 6], 1, 1); +[b a] = octave_fun("bilinear","signal",[1 2 3], [4 5 6], 1); b = round(b*10000)/10000; a = round(a*10000)/10000; -if(round(a) == [1 7 18 14]) +if(round(a) == [1 -1 0]) test_pass=[test_pass,1]; else test_pass=[test_pass,0]; diff --git a/thirdparty/linux/lib/x64/libfun.so b/thirdparty/linux/lib/x64/libfun.so Binary files differindex 777cb3f..6c97c22 100755 --- a/thirdparty/linux/lib/x64/libfun.so +++ b/thirdparty/linux/lib/x64/libfun.so |