%_sodload can recover the struct and cell data 76/16376/3
Sylvain GENIN [Wed, 15 Apr 2015 15:29:51 +0000 (17:29 +0200)]
Change-Id: I1203508b82fd8fb8a64693eafee6d582d692c35d

scilab/modules/io/macros/%_sodload.sci

index 50ca6a6..1dfcf8a 100644 (file)
@@ -47,7 +47,40 @@ function %_sodload(%__filename__, varargin)
     endfunction
 
     function varValue = parseList(varValue)
-        if typeof(varValue)=="list" then
+
+        if or(typeof(varValue)==["cell","st"]) then
+            if typeof(varValue)=="st" then
+                fieldNames = fieldnames(varValue);
+            else
+                fieldNames = varValue;
+            end
+
+            for kField = 1:size(fieldNames,"*")
+
+                if typeof(varValue)=="st" then
+                    fieldValue = varValue(fieldNames(kField));
+                else
+                    fieldValue = varValue{kField};
+                end
+
+                if typeof(fieldValue) == "ScilabMatrixHandle" then
+                    fieldValue = createMatrixHandle(fieldValue);
+                elseif typeof(fieldValue) == "ScilabMacro" then
+                    //convert tlist to macro
+                    fieldValue = createMacro(fieldValue, "function");
+                elseif isList(fieldValue) then
+                    fieldValue = parseList(fieldValue);
+                end
+
+                if typeof(varValue)=="st" then
+                    varValue(fieldNames(kField)) = fieldValue;
+                else
+                    varValue{kField} = fieldValue;
+                end
+
+            end
+
+        elseif typeof(varValue)=="list" then
             for i = definedfields(varValue)
                 if typeof(varValue(i)) == "ScilabMatrixHandle" then
                     varValue(i) = createMatrixHandle(varValue(i));