fix some trouble to allow compilation of toolbox 83/14583/9
Antoine ELIAS [Wed, 28 May 2014 13:01:46 +0000 (15:01 +0200)]
Change-Id: I76c4a37a88609f9cc787e8f2b4f24fbd36e74702

12 files changed:
scilab/modules/api_scilab/includes/api_double.hxx
scilab/modules/api_scilab/src/cpp/api_double_cpp.cpp
scilab/modules/api_scilab/src/cpp/api_string_cpp.cpp
scilab/modules/ast/includes/deserializervisitor.hxx
scilab/modules/ast/includes/exps/functiondec.hxx
scilab/modules/ast/includes/exps/vardec.hxx
scilab/modules/ast/includes/serializervisitor.hxx
scilab/modules/dynamic_link/macros/ilib_compile.sci
scilab/modules/dynamic_link/macros/windows/dlwGetScilabIncludes.sci
scilab/modules/dynamic_link/macros/windows/dlwGetScilabLibraries.sci
scilab/modules/string/sci_gateway/cpp/sci_strsplit.cpp
scilab/modules/symbol/src/cpp/context.cpp

index d6338d5..cae1f15 100644 (file)
@@ -47,6 +47,7 @@ public :
     };
 
     static Double* getAsDouble(types::InternalType* _pdbl);
+    static Double* Empty();
 
     types::InternalType::ScilabType getType()
     {
index 9f3390d..bd59848 100644 (file)
 
 namespace api_scilab
 {
+Double* Double::Empty()
+{
+    return new Double(0, 0);
+}
+
 Double::Double(double _dbl)
 {
     data = new types::Double(_dbl);
index d7664a0..23ce4d9 100644 (file)
@@ -15,7 +15,7 @@ namespace api_scilab
 {
 String::String(int _iRows, int _iCols)
 {
-    data = new types::String(_iRows, _iRows);
+    data = new types::String(_iRows, _iCols);
     created = true;
 }
 
index 658ce16..b686cbf 100644 (file)
@@ -571,7 +571,11 @@ private :
         {
             exp->continuable_set();
         }
-        exp->nodeNumber_set(nodeNumber);
+
+        if (nodeNumber != 0)
+        {
+            exp->nodeNumber_set(nodeNumber);
+        }
 
         return exp;
     }
index 04624ae..18cfa82 100644 (file)
@@ -71,7 +71,7 @@ public:
     virtual FunctionDec* clone()
     {
         Location* newloc = const_cast<Location*>(&location_get())->clone();
-        FunctionDec* cloned = new FunctionDec(*newloc, name_get(), *args_get().clone(), *returns_get().clone(), *body_get().clone());
+        FunctionDec* cloned = new FunctionDec(*newloc, *new symbol::Symbol(name_get().name_get()), *args_get().clone(), *returns_get().clone(), *body_get().clone());
         cloned->set_verbose(is_verbose());
         return cloned;
     }
index 7200ba9..a74a793 100644 (file)
@@ -68,7 +68,7 @@ public:
     virtual VarDec* clone()
     {
         Location* newloc = const_cast<Location*>(&location_get())->clone();
-        VarDec* cloned = new VarDec(*newloc, name_get(), *init_get().clone());
+        VarDec* cloned = new VarDec(*newloc, *new symbol::Symbol(name_get().name_get()), *init_get().clone());
         cloned->set_verbose(is_verbose());
         return cloned;
     }
index d7ead44..42efec1 100644 (file)
@@ -30,6 +30,7 @@ private :
     int buflen;
     int bufsize;
     ast::Exp* ast;
+    bool saveNodeNumber;
 
     unsigned char* get_buf(void)
     {
@@ -59,7 +60,14 @@ private :
     {
         Location loc = e.location_get();
         add_uint8(code);
-        add_uint64(e.nodeNumber_get());
+        if (saveNodeNumber)
+        {
+            add_uint64(e.nodeNumber_get());
+        }
+        else
+        {
+            add_uint64((unsigned long long)0);
+        }
         add_location(e.location_get());
         add_uint8(e.is_verbose());
         add_uint8(e.is_break());
@@ -569,10 +577,11 @@ private :
     }
 
 public :
-    SerializeVisitor(ast::Exp* _ast) : ast(_ast), buf(NULL), buflen(0), bufsize(0) {}
+    SerializeVisitor(ast::Exp* _ast) : ast(_ast), buf(NULL), buflen(0), bufsize(0), saveNodeNumber(true) {}
 
-    unsigned char* serialize()
+    unsigned char* serialize(bool _saveNodeNumber = true)
     {
+        saveNodeNumber = _saveNodeNumber;
         ast->accept(*this);
         return get_buf();
     }
index 0863ad8..09fc29a 100644 (file)
@@ -77,7 +77,7 @@ function libn = ilib_compile(lib_name, ..
         // Source tree version
         // Headers are dispatched in the source tree
         if isdir(SCI+"/modules/core/includes/") then
-            defaultModulesCHeader=[ "core", "mexlib","api_scilab","output_stream","localization", "operations", "symbol", "types", "ast",  "dynamic_link", "../lib/Eigen"];
+            defaultModulesCHeader=[ "core", "mexlib","api_scilab","output_stream","localization", "operations", "symbol", "types", "ast",  "dynamic_link",  "system_env",  "threads",  "string",  "console", "../lib/Eigen"];
             defaultModulesFHeader=[ "core" ];
             ScilabTreeFound=%t
 
index e5c2a0b..fdc3b54 100644 (file)
@@ -24,10 +24,14 @@ function scilabincludeslist = dlwGetScilabIncludes()
     "$(SCIDIR)/modules/time/includes"; ..
     "$(SCIDIR)/modules/windows_tools/includes"; ..
     "$(SCIDIR)/modules/symbol/includes"; ..
+    "$(SCIDIR)/modules/system_env/includes"; ..
+    "$(SCIDIR)/modules/threads/includes"; ..
     "$(SCIDIR)/modules/types/includes"; ..
     "$(SCIDIR)/modules/operations/includes"; ..
     "$(SCIDIR)/modules/ast/includes"; ..
     "$(SCIDIR)/modules/ast/includes/exps"; ..
+    "$(SCIDIR)/modules/string/includes"; ..
+    "$(SCIDIR)/modules/console/includes"; ..
     "$(SCIDIR)/libs/Eigen/includes"];
 endfunction
 //=============================================================================
index 2608ddc..ef43f09 100644 (file)
@@ -14,7 +14,6 @@ function scilablibrarieslist = dlwGetScilabLibraries()
     "core.lib"; ..
     "core_f.lib"; ..
     "lapack.lib"; ..
-    "libintl.lib"; ..
     "output_stream.lib"; ..
     "dynamic_link.lib"; ..
     "integer.lib"; ..
@@ -26,9 +25,20 @@ function scilablibrarieslist = dlwGetScilabLibraries()
     "time.lib"; ..
     "api_scilab.lib"; ..
     "types.lib"; ..
+    "typesmacro.lib"; ..
     "operations.lib"; ..
     "symbol.lib"; ..
     "libintl.lib"; ..
+    "ast.lib"; ..
+    "fileio.lib"; ..
+    "io.lib"; ..
+    "parse.lib"; ..
+    "ast-tools.lib"; ..
+    "symbol.lib"; ..
+    "system_env.lib"; ..
+    "string.lib"; ..
+    "threads.lib"; ..
+    "sciconsole.lib"; ..
     "scilab_windows.lib"];
 endfunction
 //=============================================================================
index 5c3b38c..0d282ef 100644 (file)
@@ -31,7 +31,7 @@ types::Function::ReturnValue sci_strsplit(types::typed_list &in, int _iRetCount,
     types::String* pStrIn = NULL;
     int iValueThree = 0;
 
-    if (in.size() < 1 && in.size() > 3)
+    if (in.size() < 1 || in.size() > 3)
     {
         Scierror(999, _("%s: Wrong number of input arguments: %d to %d expected.\n"), "strsplit", 1, 3);
         return types::Function::Error;
index a4f0dcb..bdc6e61 100644 (file)
@@ -197,17 +197,18 @@ void Context::put(Variable* _var, types::InternalType* _pIT)
     {
         (*varStack.top())[_var->name_get()] = _var;
     }
+
+    if (_pIT->isLibrary())
+    {
+        Library* lib = libraries.getOrCreate(_var->name_get());
+        lib->put((types::Library*)_pIT, m_iLevel);
+    }
 }
 
 void Context::put(const Symbol& _key, types::InternalType* _pIT)
 {
     Variable* var = variables.getOrCreate(_key);
     put(var, _pIT);
-    if (_pIT->isLibrary())
-    {
-        Library* lib = libraries.getOrCreate(_key);
-        lib->put((types::Library*)_pIT, m_iLevel);
-    }
 }
 
 bool Context::remove(const Symbol& _key)
@@ -248,7 +249,8 @@ bool Context::putInPreviousScope(Variable* _var, types::InternalType* _pIT)
 
 bool Context::addFunction(types::Function *_info)
 {
-    put(Symbol(_info->getName()), _info);
+    Variable* var = variables.getOrCreate(Symbol(_info->getName()));
+    variables.putInPreviousScope(var, _info, 1);
     return true;
 }