display fixed when error occured in toString. 36/15536/3
Cedric Delamarre [Mon, 17 Nov 2014 10:56:51 +0000 (11:56 +0100)]
a = h5open(TMPDIR + "/x.sod");
disp(a)
disp(a,a)
list("e", 12, a, %s)

h5close(a);
disp(a)
disp(a,a)
list("e", 12, a, %s)

test_run("hdf5","h5close",["no_check_error_output" ]);
test_run("hdf5","h5ln",["no_check_error_output" ]);

Change-Id: I042f123b73d6b20d587d199e328ce1ea07c8398e

scilab/modules/ast/includes/types/types_tools.hxx
scilab/modules/ast/src/cpp/types/list.cpp
scilab/modules/ast/src/cpp/types/tlist.cpp
scilab/modules/ast/src/cpp/types/types_tools.cpp
scilab/modules/output_stream/sci_gateway/cpp/sci_disp.cpp
scilab/modules/string/Makefile.am
scilab/modules/string/Makefile.in
scilab/modules/string/src/c/string.vcxproj
scilab/modules/xml/Makefile.am
scilab/modules/xml/Makefile.in
scilab/modules/xml/xml.vcxproj

index 0cdd1c2..90cae5e 100644 (file)
@@ -14,6 +14,7 @@
 #define __TYPES_TOOLS_HXX__
 
 #include "types.hxx"
+#include "function.hxx"
 
 namespace types
 {
@@ -21,7 +22,7 @@ EXTERN_AST int checkIndexesArguments(InternalType* _pRef, typed_list* _pArgsIn,
 EXTERN_AST void cleanIndexesArguments(typed_list* _pArgsOrig, typed_list* _pArgsNew);
 EXTERN_AST void getIndexesWithDims(int _iIndex, int* _piIndexes, int* _piDims, int _iDims);
 EXTERN_AST int getIndexWithDims(int* _piIndexes, int* _piDims, int _iDims);
-EXTERN_AST void VariableToString(types::InternalType* pIT, const wchar_t* wcsVarName);
+EXTERN_AST types::Function::ReturnValue VariableToString(types::InternalType* pIT, const wchar_t* wcsVarName);
 }
 
 #endif /* !__TYPES_TOOLS_HXX__ */
index a0fba21..7c7cc76 100644 (file)
@@ -20,6 +20,7 @@
 #include "localization.hxx"
 #include "scilabWrite.hxx"
 #include "types_tools.hxx"
+#include "function.hxx"
 
 #ifndef NDEBUG
 #include "inspector.hxx"
@@ -135,7 +136,12 @@ bool List::toString(std::wostringstream& ostr)
             nextVarName << " " << wcsVarName << L"(" << iPosition << L")";
             ostr << std::endl << nextVarName.str() << std::endl << std::endl;
             scilabWriteW(ostr.str().c_str());
-            VariableToString(*itValues, nextVarName.str().c_str());
+            if (VariableToString(*itValues, nextVarName.str().c_str()) == types::Function::Error)
+            {
+                free(wcsVarName);
+                ostr.str(L"");
+                return true;
+            }
         }
 
         ostr.str(L"");
index 817aa22..6efdd65 100644 (file)
@@ -271,17 +271,20 @@ bool TList::toString(std::wostringstream& ostr)
 
     try
     {
-        if (Overload::generateNameAndCall(L"p", in, 1, out, exec) == Function::OK)
+        if (Overload::generateNameAndCall(L"p", in, 1, out, exec) == Function::Error)
         {
-            ostr.str(L"");
-            DecreaseRef();
-            delete exec;
-            return true;
+            ConfigVariable::setError();
         }
+
+        ostr.str(L"");
+        DecreaseRef();
+        delete exec;
+        return true;
     }
     catch (ast::ScilabError /* &e */)
     {
         // avoid error message about undefined overload %type_p
+        ConfigVariable::resetError();
     }
 
     DecreaseRef();
index 04b87fd..d08727a 100644 (file)
@@ -319,10 +319,11 @@ int getIndexWithDims(int* _piIndexes, int* _piDims, int _iDims)
     return idx;
 }
 
-void VariableToString(types::InternalType* pIT, const wchar_t* wcsVarName)
+types::Function::ReturnValue VariableToString(types::InternalType* pIT, const wchar_t* wcsVarName)
 {
     if (pIT->hasToString() == false)
     {
+        types::Function::ReturnValue ret = types::Function::Error;
         //call overload %type_p
         types::typed_list in;
         types::typed_list out;
@@ -333,9 +334,10 @@ void VariableToString(types::InternalType* pIT, const wchar_t* wcsVarName)
 
         try
         {
-            Overload::generateNameAndCall(L"p", in, 1, out, exec);
+            ret = Overload::generateNameAndCall(L"p", in, 1, out, exec);
             delete exec;
             pIT->DecreaseRef();
+            return ret;
         }
         catch (ast::ScilabError &e)
         {
@@ -360,6 +362,13 @@ void VariableToString(types::InternalType* pIT, const wchar_t* wcsVarName)
         {
             //block by block
             bFinish = pIT->toString(ostr);
+            if (ConfigVariable::isError())
+            {
+                ConfigVariable::resetError();
+                ostr.str(L"");
+                return types::Function::Error;
+            }
+
             if (bFinish == false && iLines != 0)
             {
                 //show message on prompt
@@ -372,6 +381,7 @@ void VariableToString(types::InternalType* pIT, const wchar_t* wcsVarName)
         while (bFinish == false);
 
         pIT->clearPrintState();
+        return types::Function::OK;
     }
 }
 }
index ba8c827..4c4e85c 100644 (file)
@@ -35,7 +35,10 @@ types::Function::ReturnValue sci_disp(types::typed_list &in, int _iRetCount, typ
     for (it = in.rbegin() ; it != in.rend() ; it++)
     {
         scilabForcedWriteW(L"\n");
-        VariableToString(*it, SPACES_LIST);
+        if (VariableToString(*it, SPACES_LIST) == types::Function::Error)
+        {
+            return types::Function::Error;
+        }
     }
 
     return types::Function::OK;
index 689be13..b55836d 100644 (file)
@@ -103,6 +103,7 @@ libscistring_la_CPPFLAGS= \
     -I$(top_srcdir)/modules/dynamic_link/includes \
     -I$(top_srcdir)/modules/threads/includes \
     -I$(top_srcdir)/modules/console/includes \
+    -I$(top_srcdir)/modules/dynamic_link/includes \
     $(EIGEN_CPPFLAGS)
 
 libscistring_algo_la_CPPFLAGS = $(libscistring_la_CPPFLAGS)
index b161700..cfe0b89 100644 (file)
@@ -709,6 +709,7 @@ libscistring_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/dynamic_link/includes \
     -I$(top_srcdir)/modules/threads/includes \
     -I$(top_srcdir)/modules/console/includes \
+    -I$(top_srcdir)/modules/dynamic_link/includes \
     $(EIGEN_CPPFLAGS)
 
 libscistring_algo_la_CPPFLAGS = $(libscistring_la_CPPFLAGS)
index c241451..c867c07 100644 (file)
@@ -81,7 +81,7 @@
     <ClCompile>
       <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/Eigen/includes;../../../../libs/pcre;../../../../libs/hashtable;../../../../libs/intl;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/Eigen/includes;../../../../libs/pcre;../../../../libs/hashtable;../../../../libs/intl;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>
@@ -121,7 +121,7 @@ lib /DEF:"$(ProjectDir)localization_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pl
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/Eigen/includes;../../../../libs/pcre;../../../../libs/hashtable;../../../../libs/intl;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/Eigen/includes;../../../../libs/pcre;../../../../libs/hashtable;../../../../libs/intl;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>Default</BasicRuntimeChecks>
@@ -162,7 +162,7 @@ lib /DEF:"$(ProjectDir)localization_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pl
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/Eigen/includes;../../../../libs/pcre;../../../../libs/hashtable;../../../../libs/intl;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/Eigen/includes;../../../../libs/pcre;../../../../libs/hashtable;../../../../libs/intl;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -211,7 +211,7 @@ lib /DEF:"$(ProjectDir)localization_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Pl
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/Eigen/includes;../../../../libs/pcre;../../../../libs/hashtable;../../../../libs/intl;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>.;../../includes;../../../../libs/Eigen/includes;../../../../libs/pcre;../../../../libs/hashtable;../../../../libs/intl;../../../core/includes;../../../api_scilab/includes;../../../windows_tools/includes;../../../localization/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../ast/includes/types;../../../ast/includes/ast;../../../ast/includes/analysis;../../../ast/includes/exps;../../../ast/includes/operations;../../../ast/includes/symbol;../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;STRING_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
index 6cab064..e1e1bde 100644 (file)
@@ -108,6 +108,7 @@ libscixml_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/string/includes/ \
     -I$(top_srcdir)/modules/fileio/includes/ \
     -I$(top_srcdir)/modules/string/includes/ \
+    -I$(top_srcdir)/modules/dynamic_link/includes \
     $(XML_FLAGS) \
     $(EIGEN_CPPFLAGS) \
     $(AM_CPPFLAGS)
index 43f8d8e..a85b724 100644 (file)
@@ -772,6 +772,7 @@ libscixml_la_CPPFLAGS = \
     -I$(top_srcdir)/modules/string/includes/ \
     -I$(top_srcdir)/modules/fileio/includes/ \
     -I$(top_srcdir)/modules/string/includes/ \
+    -I$(top_srcdir)/modules/dynamic_link/includes \
     $(XML_FLAGS) \
     $(EIGEN_CPPFLAGS) \
     $(AM_CPPFLAGS)
index c048af0..77ece71 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../../libs/intl;../../libs/libxml2;../../libs/Eigen/includes;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../api_scilab/includes;../windows_tools/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../../libs/intl;../../libs/libxml2;../../libs/Eigen/includes;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../api_scilab/includes;../windows_tools/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;XML_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../../libs/intl;../../libs/libxml2;../../libs/Eigen/includes;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../api_scilab/includes;../windows_tools/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../../libs/intl;../../libs/libxml2;../../libs/Eigen/includes;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../api_scilab/includes;../windows_tools/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;_DEBUG;_WINDOWS;_USRDLL;XML_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <WarningLevel>Level3</WarningLevel>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../../libs/intl;../../libs/libxml2;../../libs/Eigen/includes;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../api_scilab/includes;../windows_tools/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../../libs/intl;../../libs/libxml2;../../libs/Eigen/includes;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../api_scilab/includes;../windows_tools/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;XML_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
       <WholeProgramOptimization>false</WholeProgramOptimization>
-      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../../libs/intl;../../libs/libxml2;../../libs/Eigen/includes;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../api_scilab/includes;../windows_tools/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../../libs/intl;../../libs/libxml2;../../libs/Eigen/includes;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../api_scilab/includes;../windows_tools/includes;../ast/includes/types;../ast/includes/ast;../ast/includes/analysis;../ast/includes/exps;../ast/includes/operations;../ast/includes/symbol;../ast/includes/system_env;../dynamic_link/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;XML_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>