read data in the tlist whit polynom $ 13/16513/5
Sylvain GENIN [Wed, 27 May 2015 06:44:09 +0000 (08:44 +0200)]
 A=[1 2;3 4];
 test=tlist(["test","chp1","chp2"], A, A);
 test($+1-1)== A
 test($+1-2)== A
 test($+1-3)== ["test","chp1","chp2"]
 test($+1-4)
 test($+2-1)

Change-Id: I23a389d0885638cee622d87ce77a31705baa32a4

scilab/modules/ast/src/cpp/types/tlist.cpp

index 024a699..928651e 100644 (file)
@@ -129,13 +129,30 @@ bool TList::invoke(typed_list & in, optional_list & /*opt*/, int _iRetCount, typ
 
             delete pList;
         }
+        else if (arg->isPoly())
+        {
+            Polynom* pPoly = arg->getAs<Polynom>();
+            SinglePoly* pSinglePoly = pPoly->get(0);
+
+            int iMaxDim = 0;
+            double dblParse = -1 * pSinglePoly->get(0);
+            int iSize = getSize();
+
+            if (pSinglePoly->getRank() < 2 && dblParse >= 0 && dblParse < (double)iSize)
+            {
+                out.push_back(get(iSize - 1 - dblParse));
+            }
+            else
+            {
+                return false;
+            }
+        }
 
         if (out.empty() == false)
         {
             return true;
         }
     }
-
     Callable::ReturnValue ret;
     // Overload of extraction need
     // the tlist from where we extract