mlist api functions, global mlist management ( insertion, extraction, ... ), xml... 99/10399/32
Antoine ELIAS [Tue, 5 Feb 2013 13:55:11 +0000 (14:55 +0100)]
test_run("types","insert",["no_check_error_output"]);
test_run("types","struct",["no_check_error_output"]);
test_run("data_structures","listinsertion",["no_check_error_output"]);
test_run("data_structures","struct",["no_check_error_output"]);
test_run("xml",[],["no_check_error_output"]); // xmlRemove fail because of error message

Change-Id: I345b1a5b4e330a0abb637fdf97bd49e188bf9482

52 files changed:
scilab/etc/modules.xml.in
scilab/etc/modules.xml.vc
scilab/modules/api_scilab/includes/api_common.h
scilab/modules/api_scilab/src/cpp/api_common.cpp
scilab/modules/api_scilab/src/cpp/api_list.cpp
scilab/modules/ast/Makefile.am
scilab/modules/ast/Makefile.in
scilab/modules/ast/ast.vcxproj
scilab/modules/ast/ast.vcxproj.filters
scilab/modules/ast/includes/expHistory.hxx [new file with mode: 0644]
scilab/modules/ast/includes/run_AssignExp.hxx
scilab/modules/ast/includes/runvisitor.hxx
scilab/modules/ast/includes/visitor_common.hxx
scilab/modules/ast/src/cpp/expHistory.cpp [new file with mode: 0644]
scilab/modules/ast/src/cpp/visitor_common.cpp
scilab/modules/elementary_functions/sci_gateway/cpp/sci_size.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_mfprintf.cpp
scilab/modules/functions_manager/includes/dynamic_modules.hxx
scilab/modules/functions_manager/src/cpp/dynamic_modules.cpp
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/graphic_export/sci_gateway/graphic_export_gateway.xml
scilab/modules/output_stream/includes/scilab_sprintf.hxx
scilab/modules/output_stream/sci_gateway/cpp/sci_mprintf.cpp
scilab/modules/output_stream/sci_gateway/cpp/sci_msprintf.cpp
scilab/modules/output_stream/src/cpp/scilab_sprintf.cpp
scilab/modules/system_env/includes/configvariable.hxx
scilab/modules/system_env/src/cpp/lasterror.cpp
scilab/modules/types/includes/list.hxx
scilab/modules/types/includes/listdelete.hxx
scilab/modules/types/includes/singlestruct.hxx
scilab/modules/types/includes/struct.hxx
scilab/modules/types/src/cpp/cell.cpp
scilab/modules/types/src/cpp/function.cpp
scilab/modules/types/src/cpp/list.cpp
scilab/modules/types/src/cpp/macro.cpp
scilab/modules/types/src/cpp/singlestruct.cpp
scilab/modules/types/src/cpp/struct.cpp
scilab/modules/types/src/cpp/tlist.cpp
scilab/modules/types/src/cpp/types_tools.cpp
scilab/modules/types/tests/unit_tests/insert.dia.ref
scilab/modules/types/tests/unit_tests/insert.tst
scilab/modules/xml/Makefile.am
scilab/modules/xml/Makefile.in
scilab/modules/xml/includes/gw_xml.h
scilab/modules/xml/sci_gateway/_xml_gateway.xml [new file with mode: 0644]
scilab/modules/xml/sci_gateway/cpp/sci_percent_s_i_XMLList.cpp
scilab/modules/xml/sci_gateway/xml_gateway.xml
scilab/modules/xml/src/cpp/XMLMlistsManagement.cpp [moved from scilab/modules/xml/src/c/XMLMlistsManagement.c with 86% similarity]
scilab/modules/xml/tests/unit_tests/xmlAddNs.tst
scilab/modules/xml/tests/unit_tests/xmlRead.tst
scilab/modules/xml/xml.vcxproj
scilab/modules/xml/xml.vcxproj.filters

index 271a084..96737ac 100644 (file)
@@ -86,7 +86,7 @@
 <module name="modules_manager" activate="yes"/>
 <module name="history_browser" activate="@JAVA_ENABLE@"/>
 <module name="preferences" activate="@GUI_ENABLE@"/>
-<module name="xml" activate="no"/>
+<module name="xml" activate="yes"/>
 <module name="external_objects" activate="no"/>
 <module name="operations" activate="yes"/>
 <module name="ast" activate="yes"/>
index 7d4f1c7..3c28237 100644 (file)
@@ -83,7 +83,7 @@
     <module name="modules_manager" activate="yes"/>
     <module name="history_browser" activate="yes"/>
     <module name="preferences" activate="yes"/>
-    <module name="xml" activate="no"/>
+    <module name="xml" activate="yes"/>
     <module name="external_objects" activate="no"/>
     <module name="operations" activate="yes"/>
     <module name="ast" activate="yes"/>
index b970f6d..c83f96b 100644 (file)
@@ -183,6 +183,9 @@ extern "C" {
 #undef OverLoad
 #endif
 #define OverLoad(x) callOverloadFunction(pvApiCtx, x, fname, (unsigned int)strlen(fname))
+
+    int callScilabFunction(void* _pvCtx, char* _pstName, int _iStart, int _iLhs, int _iRhs);
+
     /**
      * Get the memory address of a variable from the variable position
      * @param[in] _iVar variable number
index e335611..12d291e 100644 (file)
@@ -231,13 +231,62 @@ int checkOutputArgumentAtMost(void* _pvCtx, int _iMax)
 }
 
 /*--------------------------------------------------------------------------*/
+int callScilabFunction(void* _pvCtx, char* _pstName, int _iStart, int _iLhs, int _iRhs)
+{
+    GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
+    Function::ReturnValue callResult;
+
+    wchar_t* pwstName = to_wide_string(_pstName);
+    std::wstring wsFunName(pwstName);
+
+    typed_list in;
+    typed_list out;
+
+
+    for (int i = 0 ; i < _iRhs ; i++)
+    {
+        in.push_back((*pStr->m_pIn)[i + (_iStart - 1)]);
+        in[i]->IncreaseRef();
+    }
+
+    callResult = Overload::call(wsFunName, in, _iLhs, out, pStr->m_pVisitor);
+
+    //unprotect input arguments
+    for (int i = 0 ; i < _iRhs ; i++)
+    {
+        in[i]->DecreaseRef();
+    }
+
+    if (callResult == Function::OK)
+    {
+        int iCallerRhs = pStr->m_pIn->size();
+        pStr->m_pIn->resize(iCallerRhs + _iRhs + _iLhs, NULL);
+        for (int i = 0 ; i < _iLhs ; i++)
+        {
+            (*pStr->m_pIn)[iCallerRhs + _iRhs + i] = out[i];
+            //pStr->m_pOutOrder[i] = i + 1;
+        }
+    }
+
+    FREE(pwstName);
+    return 0;
+}
+
 int callOverloadFunction(void* _pvCtx, int _iVar, char* _pstName, unsigned int _iNameLen)
 {
     GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
     Function::ReturnValue callResult;
     typed_list tlReturnedValues;
 
-    wchar_t* pwstName = to_wide_string(pStr->m_pstName);
+    wchar_t* pwstName = NULL;
+    if (_pstName == NULL || strlen(_pstName) == 0)
+    {
+        pwstName = to_wide_string(pStr->m_pstName);
+    }
+    else
+    {
+        pwstName = to_wide_string(_pstName);
+    }
     std::wstring wsFunName;
 
     if (_iVar == 0)
index f225c94..c418ddf 100644 (file)
 #include <map>
 #include <string>
 #include "list.hxx"
+#include "tlist.hxx"
+#include "mlist.hxx"
+#include "gatewaystruct.hxx"
+#include "double.hxx"
+#include "string.hxx"
+#include "int.hxx"
+#include "context.hxx"
 
 extern "C"
 {
@@ -34,6 +41,8 @@ extern "C"
 #include "localization.h"
 }
 
+using namespace types;
+
 //internal functions
 static SciErr createCommonList(void* _pvCtx, int _iVar, int _iListType, int _iNbItem, int** _piAddress);
 static SciErr createCommonListInList(void* _pvCtx, int _iVar, const char* _pstName, int* _piParent, int _iItemPos, int _iListType, int _iNbItem, int** _piAddress, int iNamed);
@@ -279,7 +288,7 @@ SciErr getListItemNumber(void* _pvCtx, int* _piAddress, int* _piNbItem)
         return sciErr;
     }
 
-    types::List* pL = (types::List*)_piAddress;
+    List* pL = (List*)_piAddress;
     switch (iType)
     {
         case sci_list :
@@ -300,8 +309,10 @@ SciErr getListItemAddress(void* _pvCtx, int* _piAddress, int _iItemNum, int** _p
     int* piOffset    = NULL;
     int* piItemAddress = NULL;
 
+    SciErr sciErr = sciErrInit();
+
     //get item count
-    SciErr sciErr = getListItemNumber(_pvCtx, _piAddress, &iItem);
+    sciErr = getListItemNumber(_pvCtx, _piAddress, &iItem);
     if (sciErr.iErr)
     {
         addErrorMessage(&sciErr, API_ERROR_GET_ITEM_ADDRESS, _("%s: Unable to get address of item #%d in argument #%d"), "getListItemAddress", _iItemNum + 1, getRhsFromAddress(_pvCtx, _piAddress));
@@ -314,9 +325,9 @@ SciErr getListItemAddress(void* _pvCtx, int* _piAddress, int _iItemNum, int** _p
         return sciErr;
     }
 
-    types::List* pL = (types::List*)_piAddress;
+    List* pL = (List*)_piAddress;
     //get offset of item array
-    types::InternalType* pIT = pL->get(_iItemNum - 1);
+    InternalType* pIT = pL->get(_iItemNum - 1);
     if (pIT->isListUndefined())
     {
         *_piItemAddress = NULL;
@@ -427,30 +438,47 @@ static SciErr createCommonNamedList(void* _pvCtx, const char* _pstName, int _iLi
 static SciErr createCommonList(void* _pvCtx, int _iVar, int _iListType, int _iNbItem, int** _piAddress)
 {
     SciErr sciErr = sciErrInit();
-#if 0
-    int *piAddr   = NULL;
-    int iNewPos   = Top - Rhs + _iVar;
-    int iAddr    = *Lstk(iNewPos);
+    if (_pvCtx == NULL)
+    {
+        addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "createCommonList");
+        return sciErr;
+    }
 
-    getNewVarAddressFromPosition(_pvCtx, iNewPos, &piAddr);
+    GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
+    typed_list in = *pStr->m_pIn;
+    InternalType** out = pStr->m_pOut;
 
-    SciErr sciErr = fillCommonList(_pvCtx, piAddr, _iListType, _iNbItem);
-    if (sciErr.iErr)
+    List* pL = NULL;
+    try
+    {
+        if (_iListType == sci_list)
+        {
+            pL = new List();
+        }
+        else if (_iListType == sci_mlist)
+        {
+            pL = new MList();
+        }
+        else if (_iListType == sci_tlist)
+        {
+            pL = new TList();
+        }
+    }
+    catch (ast::ScilabError se)
     {
-        addErrorMessage(&sciErr, API_ERROR_CREATE_LIST, _("%s: Unable to create variable in Scilab memory"), "createList");
+        addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: %ls"), "createCommonList", se.GetErrorMessage().c_str());
         return sciErr;
     }
 
-    *_piAddress = piAddr;
-    updateInterSCI(_iVar, '$', iAddr, sadr(iadr(iAddr) + 2 + _iNbItem + 1 + !(_iNbItem % 2)));
-    closeList(iNewPos, piAddr + 2 + _iNbItem + 1 + !(_iNbItem % 2));
-
-    if (_iNbItem != 0)
+    if (pL == NULL)
     {
-        pushListAddress(_iVar, piAddr);
+        addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocate variable"), "createCommonList");
+        return sciErr;
     }
-#endif
 
+    int rhs = _iVar - *getNbInputArgument(_pvCtx);
+    out[rhs - 1] = pL;
+    *_piAddress = (int*)pL;
     return sciErr;
 }
 
@@ -568,9 +596,10 @@ SciErr getMListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, i
 
 SciErr getCommomListInNamedList(void* _pvCtx, const char* _pstName, int* _piParent, int _iItemPos, int _iListType, int** _piAddress)
 {
+    SciErr sciErr = sciErrInit();
     int* piAddr  = NULL;
 
-    SciErr sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr);
+    sciErr = getListItemAddress(_pvCtx, _piParent, _iItemPos, &piAddr);
     if (sciErr.iErr)
     {
         addErrorMessage(&sciErr, API_ERROR_GET_LIST_IN_NAMED_LIST, _("%s: Unable to get address of item #%d in variable \"%s\""), "getListInNamedList", _iItemPos + 1, _pstName);
@@ -602,88 +631,27 @@ SciErr createMListInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos,
     return createCommonListInList(_pvCtx, _iVar, NULL, _piParent, _iItemPos, sci_mlist, _iNbItem, _piAddress, 0);
 }
 
-static SciErr createCommonListInList(void* _pvCtx, int _iVar, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iListType, int _iNbItem, int** _piAddress, int iNamed)
+static SciErr createCommonListInList(void* _pvCtx, int _iVar, const char* _pstName, int* _piParent, int _iItemPos, int _iListType, int _iNbItem, int** _piAddress, int iNamed)
 {
     SciErr sciErr = sciErrInit();
-#if 0
-    int iNewPos    = Top - Rhs + _iVar;
-    int iNbItem    = 0;
-    int* piChildAddr = NULL;
-    int* piParent   = NULL;
-
-    if (iNamed)
-    {
-        piParent = getLastNamedListAddress(_pstName, _iItemPos);
-    }
-    else
-    {
-        piParent = getLastListAddress(_iVar, _iItemPos);
-    }
+    List* pParent = (List*)_piParent;
+    List* pChild = NULL;
 
-    //Does item can be added in the list
-    SciErr sciErr = getListItemNumber(_pvCtx, piParent, &iNbItem);
-
-    if (iNbItem < _iItemPos)
-    {
-        addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1);
-        return sciErr;
-    }
-
-    sciErr = allocCommonItemInList(_pvCtx, piParent, _iItemPos, &piChildAddr);
-    if (sciErr.iErr)
+    if (_iListType == sci_list)
     {
-        addErrorMessage(&sciErr, API_ERROR_CREATE_LIST_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1);
-        return sciErr;
+        pChild = new List();
     }
-
-    sciErr = fillCommonList(_pvCtx, piChildAddr, _iListType, _iNbItem);
-    if (sciErr.iErr)
+    else if (_iListType == sci_mlist)
     {
-        addErrorMessage(&sciErr, API_ERROR_CREATE_LIST_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createListInList", _iItemPos + 1);
-        return sciErr;
+        pChild = new MList();
     }
-
-    *_piAddress = piChildAddr;
-    if (iNamed)
-    {
-        closeList(_iVar, piChildAddr + 2 + _iNbItem + 1 + !(_iNbItem % 2));
-    }
-    else
+    else if (_iListType == sci_tlist)
     {
-        closeList(iNewPos, piChildAddr + 2 + _iNbItem + 1 + !(_iNbItem % 2));
+        pChild = new TList();
     }
 
-    if (_iNbItem == 0)
-    {
-        //for empty list
-        int *piOffset   = piParent + 2;
-        int* piEnd      = piChildAddr + 4;
-
-        piOffset[_iItemPos] = piOffset[_iItemPos - 1] + 2;
-        if (iNamed)
-        {
-            updateNamedListOffset(_pvCtx, _iVar, _pstName, piParent, _iItemPos, piEnd);
-        }
-        else
-        {
-            updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd);
-            if (_iItemPos == piParent[1])
-            {
-                popListAddress(_iVar);
-            }
-        }
-    }
-    else
-    {
-        //not empty list
-        if (iNamed == 0)
-        {
-            //add new child address in stacklist
-            pushListAddress(_iVar, *_piAddress);
-        }
-    }
-#endif
-
+    pParent->set(_iItemPos - 1, pChild);
+    *_piAddress = (int*)pChild;
     return sciErr;
 }
 
@@ -1278,10 +1246,26 @@ SciErr getMatrixOfStringInList(void* _pvCtx, int* _piParent, int _iItemPos, int*
 }
 
 
-SciErr createMatrixOfStringInList(void* _pvCtx, int _iVar, int* /*_piParent*/, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings)
+SciErr createMatrixOfStringInList(void* _pvCtx, int _iVar, int* _piParent, int _iItemPos, int _iRows, int _iCols, const char* const* _pstStrings)
 {
     SciErr sciErr = sciErrInit();
-    // FIXME
+    List* pParent = (List*)_piParent;
+
+    if (_iRows == 0 || _iCols == 0)
+    {
+        pParent->set(_iItemPos - 1, Double::Empty());
+        return sciErr;
+    }
+
+    String* pS = new String(_iRows, _iCols);
+    for (int i = 0 ; i < _iRows * _iCols ; i++)
+    {
+        wchar_t* pwst = to_wide_string(_pstStrings[i]);
+        pS->set(i, pwst);
+        FREE(pwst);
+    }
+
+    pParent->set(_iItemPos - 1, pS);
     return sciErr;
 }
 
@@ -1289,6 +1273,10 @@ SciErr fillCommonMatrixOfStringInList(void* _pvCtx, int _iVar, int* _piParent, i
 {
     SciErr sciErr = sciErrInit();
 #if 0
+=======
+    SciErr sciErr;
+    sciErr.iErr = 0;
+    sciErr.iMsgCount = 0;
     int iNbItem   = 0;
     int* piAddr   = NULL;
     int* piOffset  = NULL;
@@ -1497,29 +1485,29 @@ static SciErr fillMatrixOfBoolInList(void* _pvCtx, int _iVar, int* _piParent, in
         return sciErr;
     }
 
-    if (iNbItem < _iItemPos)
-    {
-        addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBooleanInList", _iItemPos + 1);
-        return sciErr;
-    }
+        if (iNbItem < _iItemPos)
+        {
+            addErrorMessage(&sciErr, API_ERROR_ITEM_LIST_NUMBER, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBooleanInList", _iItemPos + 1);
+            return sciErr;
+        }
 
 
-    sciErr = allocCommonItemInList(_pvCtx, _piParent, _iItemPos, &piChildAddr);
-    if (sciErr.iErr)
-    {
-        addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBoolInList", _iItemPos + 1);
-        return sciErr;
-    }
+        sciErr = allocCommonItemInList(_pvCtx, _piParent, _iItemPos, &piChildAddr);
+        if (sciErr.iErr)
+        {
+            addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBoolInList", _iItemPos + 1);
+            return sciErr;
+        }
 
-    sciErr = fillMatrixOfBoolean(_pvCtx, piChildAddr, _iRows, _iCols, _piBool);
-    if (sciErr.iErr)
-    {
-        addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBoolInList", _iItemPos + 1);
-        return sciErr;
-    }
+        sciErr = fillMatrixOfBoolean(_pvCtx, piChildAddr, _iRows, _iCols, _piBool);
+        if (sciErr.iErr)
+        {
+            addErrorMessage(&sciErr, API_ERROR_FILL_BOOLEAN_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "createMatrixOfBoolInList", _iItemPos + 1);
+            return sciErr;
+        }
 
-    piOffset      = _piParent + 2;
-    piOffset[_iItemPos] = piOffset[_iItemPos - 1] + ((3 + _iRows * _iCols + !((_iRows * _iCols) % 2)) / 2);
+        piOffset      = _piParent + 2;
+        piOffset[_iItemPos] = piOffset[_iItemPos - 1] + ((3 + _iRows * _iCols + !((_iRows * _iCols) % 2)) / 2);
 
 #endif
     return sciErr;
@@ -1931,39 +1919,81 @@ static SciErr fillCommonMatrixOfIntegerInList(void* _pvCtx, int _iVar, int* _piP
     return sciErr;
 }
 
-static SciErr allocCommonMatrixOfIntegerInList(void* _pvCtx, int _iVar, const char* _pstName, int* /*_piParent*/, int _iItemPos, int _iPrecision, int _iRows, int _iCols, void** _pvData)
+static SciErr allocCommonMatrixOfIntegerInList(void* _pvCtx, int _iVar, const char* _pstName, int* _piParent, int _iItemPos, int _iPrecision, int _iRows, int _iCols, void** _pvData)
 {
     SciErr sciErr = sciErrInit();
-#if 0
-    int iNewPos = Top - Rhs + _iVar;
-    int* piEnd = NULL;
-    int* piParent = NULL;
 
-    if (_pstName)
-    {
-        piParent = getLastNamedListAddress(_pstName, _iItemPos);
-    }
-    else
-    {
-        piParent = getLastListAddress(_iVar, _iItemPos);
-    }
+    List* pParent = (List*)_piParent;
 
-    SciErr sciErr = fillCommonMatrixOfIntegerInList(_pvCtx, _iVar, piParent, _iItemPos, _iPrecision, _iRows, _iCols, _pvData);
-    if (sciErr.iErr)
+    if (_iRows == 0 || _iCols == 0)
     {
-        addErrorMessage(&sciErr, API_ERROR_ALLOC_INT_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), "allocMatrixOfIntegerInList", _iItemPos + 1);
+        pParent->set(_iItemPos - 1, Double::Empty());
         return sciErr;
     }
 
-    piEnd = (int*) * _pvData + _iRows * _iCols / (sizeof(int) / (_iPrecision % 10)) + (int)(!!(_iRows * _iCols)) % (sizeof(int) / (_iPrecision % 10));
-    closeList(iNewPos, piEnd);
+    InternalType* pIT = NULL;
 
-    if (_iItemPos == piParent[1])
+    switch (_iPrecision)
     {
-        updateListOffset(_pvCtx, _iVar, piParent, _iItemPos, piEnd);
-        popListAddress(_iVar);
+        case SCI_INT8 :
+        {
+            Int8* pi = new Int8(_iRows, _iCols);
+            *_pvData = pi->get();
+            pIT = pi;
+        }
+        break;
+        case SCI_UINT8 :
+        {
+            UInt8* pi = new UInt8(_iRows, _iCols);
+            *_pvData = pi->get();
+            pIT = pi;
+        }
+        break;
+        case SCI_INT16 :
+        {
+            Int16* pi = new Int16(_iRows, _iCols);
+            *_pvData = pi->get();
+            pIT = pi;
+        }
+        break;
+        case SCI_UINT16 :
+        {
+            UInt16* pi = new UInt16(_iRows, _iCols);
+            *_pvData = pi->get();
+            pIT = pi;
+        }
+        break;
+        case SCI_INT32 :
+        {
+            Int32* pi = new Int32(_iRows, _iCols);
+            *_pvData = pi->get();
+            pIT = pi;
+        }
+        break;
+        case SCI_UINT32 :
+        {
+            UInt32* pi = new UInt32(_iRows, _iCols);
+            *_pvData = pi->get();
+            pIT = pi;
+        }
+        break;
+        case SCI_INT64 :
+        {
+            Int64* pi = new Int64(_iRows, _iCols);
+            *_pvData = pi->get();
+            pIT = pi;
+        }
+        break;
+        case SCI_UINT64 :
+        {
+            UInt64* pi = new UInt64(_iRows, _iCols);
+            *_pvData = pi->get();
+            pIT = pi;
+        }
+        break;
     }
-#endif
+
+    pParent->set(_iItemPos - 1, pIT);
     return sciErr;
 }
 
@@ -2415,7 +2445,7 @@ static SciErr createCommonSparseMatrixInList(void* _pvCtx, int _iVar, const char
         piParent = getLastListAddress(_iVar, _iItemPos);
     }
 
-    SciErr sciErr = getListItemAddress(_pvCtx, piParent, _iItemPos, &piAddr);
+    sciErr = getListItemAddress(_pvCtx, piParent, _iItemPos, &piAddr);
     if (sciErr.iErr)
     {
         addErrorMessage(&sciErr, API_ERROR_CREATE_SPARSE_IN_LIST, _("%s: Unable to create list item #%d in Scilab memory"), _iComplex ? "createComplexSparseMatrixInList" : "createComplexSparseMatrixInList", _iItemPos + 1);
index 7228fcc..215b2f9 100644 (file)
@@ -21,7 +21,8 @@ libsciast_la_SOURCES = \
        src/cpp/mutevisitor.cpp \
        src/cpp/shortcutvisitor.cpp \
        src/cpp/scilabexception.cpp \
-       src/cpp/macrovarvisitor.cpp
+       src/cpp/macrovarvisitor.cpp \
+       src/cpp/expHistory.cpp
 
 libsciast_la_CPPFLAGS = \
        -Iincludes \
index fc8f79d..9b3b017 100644 (file)
@@ -165,7 +165,8 @@ am_libsciast_la_OBJECTS = src/cpp/libsciast_la-libAst.lo \
        src/cpp/libsciast_la-mutevisitor.lo \
        src/cpp/libsciast_la-shortcutvisitor.lo \
        src/cpp/libsciast_la-scilabexception.lo \
-       src/cpp/libsciast_la-macrovarvisitor.lo
+       src/cpp/libsciast_la-macrovarvisitor.lo \
+       src/cpp/libsciast_la-expHistory.lo
 libsciast_la_OBJECTS = $(am_libsciast_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -526,7 +527,8 @@ libsciast_la_SOURCES = \
        src/cpp/mutevisitor.cpp \
        src/cpp/shortcutvisitor.cpp \
        src/cpp/scilabexception.cpp \
-       src/cpp/macrovarvisitor.cpp
+       src/cpp/macrovarvisitor.cpp \
+       src/cpp/expHistory.cpp
 
 libsciast_la_CPPFLAGS = \
        -Iincludes \
@@ -721,6 +723,8 @@ src/cpp/libsciast_la-scilabexception.lo: src/cpp/$(am__dirstamp) \
        src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libsciast_la-macrovarvisitor.lo: src/cpp/$(am__dirstamp) \
        src/cpp/$(DEPDIR)/$(am__dirstamp)
+src/cpp/libsciast_la-expHistory.lo: src/cpp/$(am__dirstamp) \
+       src/cpp/$(DEPDIR)/$(am__dirstamp)
 
 libsciast.la: $(libsciast_la_OBJECTS) $(libsciast_la_DEPENDENCIES) $(EXTRA_libsciast_la_DEPENDENCIES) 
        $(AM_V_CXXLD)$(CXXLINK) -rpath $(pkglibdir) $(libsciast_la_OBJECTS) $(libsciast_la_LIBADD) $(LIBS)
@@ -734,6 +738,7 @@ distclean-compile:
        -rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciast_la-debugvisitor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciast_la-expHistory.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciast_la-libAst.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciast_la-macrovarvisitor.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libsciast_la-mutevisitor.Plo@am__quote@
@@ -822,6 +827,13 @@ src/cpp/libsciast_la-macrovarvisitor.lo: src/cpp/macrovarvisitor.cpp
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciast_la-macrovarvisitor.lo `test -f 'src/cpp/macrovarvisitor.cpp' || echo '$(srcdir)/'`src/cpp/macrovarvisitor.cpp
 
+src/cpp/libsciast_la-expHistory.lo: src/cpp/expHistory.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libsciast_la-expHistory.lo -MD -MP -MF src/cpp/$(DEPDIR)/libsciast_la-expHistory.Tpo -c -o src/cpp/libsciast_la-expHistory.lo `test -f 'src/cpp/expHistory.cpp' || echo '$(srcdir)/'`src/cpp/expHistory.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libsciast_la-expHistory.Tpo src/cpp/$(DEPDIR)/libsciast_la-expHistory.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/expHistory.cpp' object='src/cpp/libsciast_la-expHistory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libsciast_la-expHistory.lo `test -f 'src/cpp/expHistory.cpp' || echo '$(srcdir)/'`src/cpp/expHistory.cpp
+
 mostlyclean-libtool:
        -rm -f *.lo
 
index c4ebf0f..2d4fa2a 100644 (file)
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="src\cpp\debugvisitor.cpp" />
+    <ClCompile Include="src\cpp\expHistory.cpp" />
     <ClCompile Include="src\cpp\libAst.cpp" />
     <ClCompile Include="src\cpp\macrovarvisitor.cpp" />
     <ClCompile Include="src\cpp\mutevisitor.cpp" />
     <ClInclude Include="includes\dummyvisitor.hxx" />
     <ClInclude Include="includes\execvisitor.hxx" />
     <ClInclude Include="includes\exp.hxx" />
+    <ClInclude Include="includes\expHistory.hxx" />
     <ClInclude Include="includes\fieldexp.hxx" />
     <ClInclude Include="includes\floatexp.hxx" />
     <ClInclude Include="includes\forexp.hxx" />
index 9c99692..2fdeabe 100644 (file)
@@ -22,6 +22,9 @@
     <ClCompile Include="src\cpp\macrovarvisitor.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="src\cpp\expHistory.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="includes\all.hxx">
     <ClInclude Include="includes\macrovarvisitor.hxx">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="includes\expHistory.hxx">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <Library Include="..\..\bin\blasplus.lib" />
diff --git a/scilab/modules/ast/includes/expHistory.hxx b/scilab/modules/ast/includes/expHistory.hxx
new file mode 100644 (file)
index 0000000..9d3583c
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2014 - Scilab Enterpprises - Cedric Delamarre
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#ifndef __EXPHISTORY_HXX__
+#define __EXPHISTORY_HXX__
+
+#include <list>
+#include <vector>
+#include "types.hxx"
+#include "ast.hxx"
+#include "simplevar.hxx"
+
+class ExpHistory
+{
+public :
+    ExpHistory();
+    ExpHistory(ExpHistory*, const ast::SimpleVar*);
+    ExpHistory(ExpHistory*, types::typed_list*);
+    ExpHistory(ExpHistory*, const ast::SimpleVar*, types::typed_list*, int, bool, types::InternalType*);
+
+    ~ExpHistory();
+
+    // expression "a"
+    void                    setExp(const ast::SimpleVar*);
+    const ast::SimpleVar*   getExp();
+    std::wstring            getExpAsString();
+
+    // arguments x of a(x)
+    void                    setArgs(types::typed_list*);
+    types::typed_list*      getArgs();
+    int                     getSizeFromArgs();
+    int                     getArgsDims();
+    int*                    getArgsDimsArray();
+    void                    computeArgs();
+    bool                    needResize();
+
+    // current InternalType a
+    bool                    setCurrent(types::InternalType*);
+    types::InternalType*    getCurrent();
+
+    // parent of me
+    ExpHistory*             getParent();
+
+    // use to know if we have to reinsert current in there parent and where
+    void                    setReinsertion();
+    void                    resetReinsertion();
+    bool                    reinsertMe();
+    int                     getWhereReinsert();
+    void                    setWhereReinsert(int);
+
+    // use to know where we are in expression
+    void                    setLevel(int);
+    int                     getLevel();
+
+    // management of expression a(x) or a{x}
+    void                    setCellExp();
+    bool                    isCellExp();
+
+private :
+
+    void                    initHistory();
+
+    types::typed_list*      m_pArgs;
+    int*                    m_piArgsDimsArray;
+    int                     m_iArgsDims;
+
+    const ast::SimpleVar*   m_pExp;
+    ExpHistory*             m_pParent;
+    types::InternalType*    m_pITCurrent;
+
+    bool                    m_bReinsertMe;
+    int                     m_iWhere;
+    int                     m_iLevel;
+
+    bool                    m_bCellExp;
+};
+
+#endif /* __EXPHISTORY_HXX__ */
index 46f06f5..3bc2701 100644 (file)
@@ -87,35 +87,7 @@ void visitprivate(const AssignExp  &e)
         const CellCallExp *pCell = dynamic_cast<const CellCallExp*>(&e.left_exp_get());
         if (pCell)
         {
-            InternalType *pIT;
-            bool bNew           = false;
-
-            //retrieve variable
-            pVar = dynamic_cast<const SimpleVar*>(&pCell->name_get());
-            if (pVar == NULL)
-            {
-                //manage a.b{1} = x
-                pCell->name_get().accept(*this);
-
-                if (result_get() != NULL && result_get()->isCell())
-                {
-                    pIT = result_get();
-                }
-                else
-                {
-                    //never append ?
-                    std::wostringstream os;
-                    os << _W("Unable to extract left part expression.\n");
-                    //os << ((Location)e.left_exp_get().location_get()).location_getString() << std::endl;
-                    throw ScilabError(os.str(), 999, e.left_exp_get().location_get());
-                }
-                //reset result
-                result_set(NULL);
-            }
-            else
-            {
-                pIT = symbol::Context::getInstance()->get(pVar->name_get());
-            }
+            InternalType *pOut = NULL;
 
             /*getting what to assign*/
             InternalType* pITR = e.right_val_get();
@@ -124,7 +96,7 @@ void visitprivate(const AssignExp  &e)
                 e.right_exp_get().accept(*this);
                 pITR = result_get();
                 //reset result
-                result_set(pIT);
+                result_set(NULL);
             }
 
             if (pITR == NULL)
@@ -135,70 +107,25 @@ void visitprivate(const AssignExp  &e)
                 throw ScilabError(os.str(), 999, e.left_exp_get().location_get());
             }
 
-            if (pIT == NULL)
-            {
-                //Var doesn't exist, create it with good dimensions
-                bNew = true;
-            }
-            else
-            {
-                if (pIT->isRef(1) == true)
-                {
-                    pIT = pIT->clone();
-                    bNew = true;
-                }
-            }
-
-            InternalType *pOut = NULL;
-            typed_list *pArgs = GetArgumentList(pCell->args_get());
-
-            //fisrt extract implicit list
-            if (pITR->isImplicitList())
-            {
-                InternalType *pIL = ((InternalType*)pITR)->getAs<ImplicitList>()->extractFullMatrix();
-                if (pITR->isDeletable())
-                {
-                    delete pITR;
-                }
-                pITR = pIL;
-            }
-            else if (pITR->isContainer() && pITR->isDeletable() == false)
+            std::list<ExpHistory*> fields;
+            if (getFieldsFromExp(pCell, fields) == false)
             {
-                InternalType* pIL = pITR->clone();
-                pITR = pIL;
+                std::wostringstream os;
+                os << _W("Get fields from expression failed.");
+                throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
 
+            pOut = evaluateFields(pCell, fields, pITR);
 
-            if (pIT == NULL)
-            {
-                //call static insert function
-                pOut = Cell::insertNewCell(pArgs, pITR);
-            }
-            else
+            if (pOut == NULL)
             {
-                //call type insert function
-                pOut = pIT->getAs<Cell>()->insertCell(pArgs, pITR);
-
-                if (pOut && pOut != pIT)
-                {
-                    //variable change
-                    pIT->DecreaseRef();
-                    if (pIT->isDeletable())
-                    {
-                        delete pIT;
-                    }
-                    bNew = true;
-                }
+                std::wostringstream os;
+                os << _W("Fields evaluation failed.");
+                throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
 
-
             if (pOut != NULL)
             {
-                if (bNew)
-                {
-                    symbol::Context::getInstance()->put(pVar->name_get(), *pOut);
-                }
-
                 if (e.is_verbose() && ConfigVariable::isPromptShow())
                 {
                     std::wostringstream ostr;
@@ -223,19 +150,9 @@ void visitprivate(const AssignExp  &e)
                 //manage error
                 std::wostringstream os;
                 os << _W("Invalid Index.\n");
-                //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
                 throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
-            //            delete piMaxDim;
-            //            delete[] piDimSize;
-            for (int iArg = 0 ; iArg < (int)pArgs->size() ; iArg++)
-            {
-                if ((*pArgs)[iArg]->isDeletable())
-                {
-                    delete (*pArgs)[iArg];
-                }
-            }
-            delete pArgs;
+
             return;
         }
 
@@ -243,34 +160,7 @@ void visitprivate(const AssignExp  &e)
         if (pCall)
         {
             //x(?) = ?
-            InternalType *pIT;
-            bool bNew   = false;
-
-            pVar = dynamic_cast<const SimpleVar*>(&pCall->name_get());
-            if (pVar == NULL)
-            {
-                //manage a.b(1) = x
-                pCall->name_get().accept(*this);
-
-                if (result_get() != NULL)
-                {
-                    pIT = result_get();
-                }
-                else
-                {
-                    //never append ?
-                    std::wostringstream os;
-                    os << _W("Unable to extract left part expression.\n");
-                    //os << ((Location)e.left_exp_get().location_get()).location_getString() << std::endl;
-                    throw ScilabError(os.str(), 999, e.left_exp_get().location_get());
-                }
-
-                result_set(NULL);
-            }
-            else
-            {
-                pIT = symbol::Context::getInstance()->getCurrentLevel(pVar->name_get());
-            }
+            InternalType *pOut = NULL;
 
             /*getting what to assign*/
             InternalType* pITR = e.right_val_get();
@@ -290,535 +180,34 @@ void visitprivate(const AssignExp  &e)
                 throw ScilabError(os.str(), 999, e.left_exp_get().location_get());
             }
 
-            if (pIT == NULL)
-            {
-                //Var doesn't exist, create it with good dimensions
-                bNew = true;
-            }
-            else
-            {
-                if (pIT->isRef(1) == true)
-                {
-                    InternalType* pITTemp = pIT->clone();
-                    pIT = pITTemp;
-                    bNew = true;
-                }
-            }
-
-            typed_list *pArgs = GetArgumentList(pCall->args_get());
-            InternalType *pOut = NULL;
-
-            //fisrt extract implicit list
-            if (pITR->isColon())
-            {
-                //double* pdbl = NULL;
-                //pITR = new Double(-1, -1, &pdbl);
-                //pdbl[0] = 1;
-                pITR = Double::Identity(-1, -1);
-            }
-            else if (pITR->isImplicitList())
-            {
-                InternalType *pIL = pITR->getAs<ImplicitList>()->extractFullMatrix();
-                if (pIL)
-                {
-                    pITR = pIL;
-                }
-            }
-            else if (pITR->isContainer() && pITR->isRef())
-            {
-                //std::cout << "assign container type during insertion" << std::endl;
-                InternalType* pIL = pITR->clone();
-                pITR = pIL;
-            }
-
-            if (pITR->isDouble() && pITR->getAs<Double>()->isEmpty() && pIT == NULL)
-            {
-                // l(x) = [] when l is not defined => create l = []
-                pOut = Double::Empty();
-                bNew = true;
-            }
-            else if (pITR->isDouble() && pITR->getAs<Double>()->isEmpty() && pIT->isStruct() == false && pIT->isList() == false)
+            std::list<ExpHistory*> fields;
+            if (getFieldsFromExp(pCall, fields) == false)
             {
-                //insert [] so deletion except for Struct and List which can insert []
-                if (pIT->isDouble())
-                {
-                    pOut = pIT->getAs<Double>()->remove(pArgs);
-                }
-                else if (pIT->isString())
-                {
-                    pOut = pIT->getAs<String>()->remove(pArgs);
-                }
-                else if (pIT->isCell())
-                {
-                    pOut = pIT->getAs<Cell>()->remove(pArgs);
-                }
-                else if (pIT->isBool())
-                {
-                    pOut = pIT->getAs<Bool>()->remove(pArgs);
-                }
-                else if (pIT->isPoly())
-                {
-                    pOut = pIT->getAs<Polynom>()->remove(pArgs);
-                }
-                else if (pIT->isInt8())
-                {
-                    pOut = pIT->getAs<Int8>()->remove(pArgs);
-                }
-                else if (pIT->isUInt8())
-                {
-                    pOut = pIT->getAs<UInt8>()->remove(pArgs);
-                }
-                else if (pIT->isInt16())
-                {
-                    pOut = pIT->getAs<Int16>()->remove(pArgs);
-                }
-                else if (pIT->isUInt16())
-                {
-                    pOut = pIT->getAs<UInt16>()->remove(pArgs);
-                }
-                else if (pIT->isInt32())
-                {
-                    pOut = pIT->getAs<Int32>()->remove(pArgs);
-                }
-                else if (pIT->isUInt32())
-                {
-                    pOut = pIT->getAs<UInt32>()->remove(pArgs);
-                }
-                else if (pIT->isInt64())
-                {
-                    pOut = pIT->getAs<Int64>()->remove(pArgs);
-                }
-                else if (pIT->isUInt64())
-                {
-                    pOut = pIT->getAs<UInt64>()->remove(pArgs);
-                }
-                else if (pIT->isSparse())
-                {
-                    pOut = pIT->getAs<Sparse>()->remove(pArgs);
-                }
-                else if (pIT->isSparseBool())
-                {
-                    pOut = pIT->getAs<SparseBool>()->remove(pArgs);
-                }
-                else if (pIT->isHandle())
-                {
-                    pOut = pIT->getAs<GraphicHandle>()->remove(pArgs);
-                }
-                else if (pIT->isStruct())
-                {
-                    // a("b") = [] is not a deletion !!
-
-                    //Struct* pStr = pIT->getAs<Struct>();
-
-                    pOut = pIT->getAs<Struct>()->insert(pArgs, pITR);
-                }
-
-                if (pOut && pOut != pIT)
-                {
-                    bNew = true;
-                }
+                std::wostringstream os;
+                os << _W("Get fields from expression failed.");
+                throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
-            else if (pIT == NULL || (pIT->isDouble() && pIT->getAs<Double>()->getSize() == 0))
-            {
-                //insert in a new variable or []
-                //call static insert function
-                //special case for insertion in []
-                if (pIT != NULL && pIT->isDouble() && pIT->getAs<Double>()->getSize() == 0)
-                {
-                    bNew = true;
-                }
 
-                //if pIT == NULL and pArg is single string, it's a struct creation
-                if ((*pArgs)[0]->isString())
-                {
-                    String *pS = (*pArgs)[0]->getAs<types::String>();
-                    Struct* pStr = new Struct(1, 1);
+            pOut = evaluateFields(pCall, fields, pITR);
 
-                    if (pArgs->size() != 1 || pS->isScalar() == false)
-                    {
-                        //manage error
-                        std::wostringstream os;
-                        os << _W("Invalid Index.\n");
-                        //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
-                        throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
-                    }
-
-                    pStr->addField(pS->get(0));
-                    pStr->get(0)->set(pS->get(0), pITR);
-                    pOut = pStr;
-                }
-                else
-                {
-                    switch (pITR->getType())
-                    {
-                        case InternalType::RealDouble :
-                            pOut = Double::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealString :
-                            pOut = String::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealCell :
-                            pOut = Cell::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealBool :
-                            pOut = Bool::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealPoly :
-                            pOut = Polynom::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealInt8 :
-                            pOut = Int8::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealUInt8 :
-                            pOut = UInt8::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealInt16 :
-                            pOut = Int16::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealUInt16 :
-                            pOut = UInt16::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealInt32 :
-                            pOut = Int32::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealUInt32 :
-                            pOut = UInt32::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealInt64 :
-                            pOut = Int64::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealUInt64 :
-                            pOut = UInt64::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealSparse :
-                            pOut = Sparse::insertNew(pArgs, pITR);
-                            break;
-                        case InternalType::RealSparseBool :
-                            pOut = SparseBool::insertNew(pArgs, pITR);
-                            break;
-                        default :
-                        {
-                            // overload
-                            types::Double* pEmpty = types::Double::Empty();
-                            pOut = callOverload(L"i", pArgs, pITR, pEmpty);
-                            delete pEmpty;
-                            break;
-                        }
-                    }
-                }
-            }
-            else
+            if (pOut == NULL)
             {
-                //call type insert function
-                InternalType* pRet = NULL;
-                InternalType* pInsert = pITR;
-                //check types compatibilties
-
-                if (pIT->isDouble() && pInsert->isDouble())
-                {
-                    pRet = pIT->getAs<Double>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isDouble() && pInsert->isSparse())
-                {
-                    Sparse* pSp = pInsert->getAs<Sparse>();
-                    Double* pD = new Double(pSp->getRows(), pSp->getCols(), pSp->isComplex());
-                    pSp->fill(*pD);
-                    pRet = pIT->getAs<Double>()->insert(pArgs, pD);
-                    free(pD);
-                }
-                else if (pIT->isString() && pInsert->isString())
-                {
-                    pRet = pIT->getAs<String>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isCell() && pInsert->isCell())
-                {
-                    pRet = pIT->getAs<Cell>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isBool() && pInsert->isBool())
-                {
-                    pRet = pIT->getAs<Bool>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isSparse() && pInsert->isSparse())
-                {
-                    pRet = pIT->getAs<Sparse>()->insert(pArgs, pInsert->getAs<Sparse>());
-                }
-                else if (pIT->isSparse() && pInsert->isDouble())
-                {
-                    pRet = pIT->getAs<Sparse>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isSparseBool() && pInsert->isSparseBool())
-                {
-                    pRet = pIT->getAs<SparseBool>()->insert(pArgs, pInsert->getAs<SparseBool>());
-                }
-                else if (pIT->isSparseBool() && pInsert->isBool())
-                {
-                    pRet = pIT->getAs<SparseBool>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isDouble() && pInsert->isPoly())
-                {
-                    Double* pDest = pIT->getAs<Double>();
-                    Polynom* pIns = pInsert->getAs<Polynom>();
-                    Polynom* pP = new Polynom(pIns->getVariableName(), pDest->getDims(), pDest->getDimsArray());
-                    pP->setComplex(pDest->isComplex());
-
-                    for (int idx = 0 ; idx < pP->getSize() ; idx++)
-                    {
-                        double* pR = NULL;
-                        double* pI = NULL;
-                        if (pP->isComplex())
-                        {
-                            SinglePoly* pS = new SinglePoly(&pR, &pI, 1);
-                            double dblR = pDest->get(idx);
-                            double dblI = pDest->getImg(idx);
-                            pS->setCoef(&dblR, &dblI);
-                            pP->set(idx, pS);
-                            delete pS;
-                        }
-                        else
-                        {
-                            SinglePoly* pS = new SinglePoly(&pR, 1);
-                            double dblR = pDest->get(idx);
-                            pS->setCoef(&dblR, NULL);
-                            pP->set(idx, pS);
-                            delete pS;
-                        }
-                    }
-
-                    pRet = pP->insert(pArgs, pIns);
-                    pDest->DecreaseRef();
-                }
-                else if (pIT->isPoly() && pInsert->isDouble())
-                {
-                    Polynom* pDest = pIT->getAs<Polynom>();
-                    Double* pIns = pInsert->getAs<Double>();
-                    Polynom* pP = new Polynom(pDest->getVariableName(), pIns->getDims(), pIns->getDimsArray());
-                    pP->setComplex(pIns->isComplex());
-
-                    for (int idx = 0 ; idx < pP->getSize() ; idx++)
-                    {
-                        double* pR = NULL;
-                        double* pI = NULL;
-                        if (pP->isComplex())
-                        {
-                            SinglePoly* pS = new SinglePoly(&pR, &pI, 1);
-                            double dblR = pIns->get(idx);
-                            double dblI = pIns->getImg(idx);
-                            pS->setCoef(&dblR, &dblI);
-                            pP->set(idx, pS);
-                            delete pS;
-                        }
-                        else
-                        {
-                            SinglePoly* pS = new SinglePoly(&pR, 1);
-                            double dblR = pIns->get(idx);
-                            pS->setCoef(&dblR, NULL);
-                            pP->set(idx, pS);
-                            delete pS;
-                        }
-                    }
-                    pRet = pDest->insert(pArgs, pP);
-                    delete pP;
-                }
-                else if (pIT->isPoly() && pInsert->isPoly())
-                {
-                    pRet = pIT->getAs<Polynom>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isInt8() && pInsert->isInt8())
-                {
-                    pRet = pIT->getAs<Int8>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isUInt8() && pInsert->isUInt8())
-                {
-                    pRet = pIT->getAs<UInt8>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isInt16() && pInsert->isInt16())
-                {
-                    pRet = pIT->getAs<Int16>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isUInt16() && pInsert->isUInt16())
-                {
-                    pRet = pIT->getAs<UInt16>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isInt32() && pInsert->isInt32())
-                {
-                    pRet = pIT->getAs<Int32>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isUInt32() && pInsert->isUInt32())
-                {
-                    pRet = pIT->getAs<UInt32>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isInt64() && pInsert->isInt64())
-                {
-                    pRet = pIT->getAs<Int64>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isUInt64() && pInsert->isUInt64())
-                {
-                    pRet = pIT->getAs<UInt64>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isStruct())
-                {
-                    Struct* pStr = pIT->getAs<Struct>();
-                    if (pArgs->size() == 1 && (*pArgs)[0]->isString())
-                    {
-                        //s("x") = y
-                        String *pS = (*pArgs)[0]->getAs<types::String>();
-                        if (pS->isScalar() == false)
-                        {
-                            //manage error
-                            std::wostringstream os;
-                            os << _W("Invalid Index.\n");
-                            //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
-                            throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
-                        }
-
-                        pStr->addField(pS->get(0));
-                        pStr->get(0)->set(pS->get(0), pInsert);
-                        pRet = pStr;
-                    }
-                    else
-                    {
-                        pRet = pStr->insert(pArgs, pInsert);
-                    }
-                }
-                else if (pIT->isTList() || pIT->isMList())
-                {
-                    TList* pTL = pIT->getAs<TList>();
-                    if (pArgs->size() == 1)
-                    {
-                        if((*pArgs)[0]->isString())
-                        {
-                            //s("x") = y
-                            String *pS = (*pArgs)[0]->getAs<types::String>();
-                            if (pS->isScalar() == false)
-                            {
-                                //manage error
-                                std::wostringstream os;
-                                os << _W("Invalid Index.\n");
-                                //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
-                                throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
-                            }
-
-                            pTL->set(pS->get(0), pInsert);
-                            pRet = pTL;
-                        }
-                        else
-                        {
-                            pRet = pTL->insert(pArgs, pInsert);
-                        }
-                    }
-                    else
-                    {
-                        // call the overload if it exists.
-                        pRet = callOverload(L"i", pArgs, pInsert, pIT);
-                        if(pRet == NULL)
-                        {
-                            // else normal insert
-                            pRet = pTL->insert(pArgs, pInsert);
-                        }
-                    }
-                }
-                else if (pIT->isList())
-                {
-                    pRet = pIT->getAs<List>()->insert(pArgs, pInsert);
-                }
-                else if (pIT->isHandle())
-                {
-                    if (pArgs->size() == 1 && (*pArgs)[0]->isString())
-                    {
-                        //s(["x"])
-                        types::GraphicHandle* pH = pIT->getAs<types::GraphicHandle>();
-                        types::String *pS = (*pArgs)[0]->getAs<types::String>();
-                        typed_list in;
-                        typed_list out;
-                        optional_list opt;
-
-                        in.push_back(pH);
-                        in.push_back(pS);
-                        in.push_back(pInsert);
-
-                        Function* pCallSet = (Function*)symbol::Context::getInstance()->get(symbol::Symbol(L"set"));
-                        Callable::ReturnValue ret =  pCallSet->call(in, opt, 1, out, this);
-                        if (ret == Callable::OK)
-                        {
-                            pRet = pIT;
-                        }
-                    }
-                    else
-                    {
-                        pRet = pIT->getAs<types::GraphicHandle>()->extract(pArgs);
-                    }
-                }
-                else
-                {
-                    // overload
-                    pRet = callOverload(L"i", pArgs, pInsert, pIT);
-                }
-
-                if (pRet && pRet != pIT)
-                {
-                    bNew = true;
-                }
-
-                pOut = pRet;
+                std::wostringstream os;
+                os << _W("Fields evaluation failed.");
+                throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
 
-            if (pOut != NULL)
+            if (e.is_verbose() && ConfigVariable::isPromptShow())
             {
-                if (bNew)
-                {
-                    if (pVar == NULL && pIT->isHandle() == false)
-                    {
-                        //is not a(x) = y but something like a.b(x) = y
-                        //so we have to retrieve struct and children to assign new value
-                        InternalType* pMain     = NULL;
-                        InternalType* pCurrent  = NULL;
-                        getStructFromExp(&pCall->name_get(), &pMain, &pCurrent, NULL, pOut);
-                        //change pOut only to toString call
-                        pOut = pMain;
-                    }
-                    else
-                    {
-                        symbol::Context::getInstance()->put(pVar->name_get(), *((GenericType*)pOut));
-                    }
-                }
-
-                if (e.is_verbose() && ConfigVariable::isPromptShow())
-                {
-                    std::wostringstream ostr;
-                    const wchar_t* wcsVarName;
+                std::wostringstream ostr;
+                const wchar_t* wcsVarName;
 
-                    if (pVar)
-                    {
-                        ostr << pVar->name_get().name_get() << L"  = " << std::endl;
-                        wcsVarName = pVar->name_get().name_get().c_str();
-                    }
-                    else
-                    {
-                        ostr << *getStructNameFromExp(&pCall->name_get()) << L"  = " << std::endl;
-                        wcsVarName = getStructNameFromExp(&pCall->name_get())->c_str();
-                    }
+                ostr << *getStructNameFromExp(&pCall->name_get()) << L"  = " << std::endl;
+                wcsVarName = getStructNameFromExp(&pCall->name_get())->c_str();
 
-                    ostr << std::endl;
-                    scilabWriteW(ostr.str().c_str());
-                    VariableToString(pOut, wcsVarName);
-                }
-            }
-            else
-            {
-                //manage error
-                std::wostringstream os;
-                os << _W("Invalid index.\n");
-                //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
-                throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
-            }
-            //delete piMaxDim;
-            //delete[] piDimSize;
-            for (int iArg = 0 ; iArg < (int)pArgs->size() ; iArg++)
-            {
-                if ((*pArgs)[iArg]->isDeletable())
-                {
-                    delete (*pArgs)[iArg];
-                }
+                ostr << std::endl;
+                scilabWriteW(ostr.str().c_str());
+                VariableToString(pOut, wcsVarName);
             }
 
             if (pITR->isDeletable())
@@ -827,7 +216,6 @@ void visitprivate(const AssignExp  &e)
             }
 
             result_clear();
-            delete pArgs;
             return;
         }
 
@@ -885,176 +273,22 @@ void visitprivate(const AssignExp  &e)
                     pIT = pTemp;
                 }
             }
-            else if (pIT->isContainer())
+
+            std::list<ExpHistory*> fields;
+            if (getFieldsFromExp(pField, fields) == false)
             {
-                //if assigned value is a container, copy it before assign.
-                //std::cout << "assign container type to field" << std::endl;
-                //pIT = pIT->clone();
+                std::wostringstream os;
+                os << _W("Get fields from expression failed.");
+                throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
 
-            //try to find struct or handle
+            if (evaluateFields(pField, fields, pIT) == NULL)
             {
-                InternalType* pMain     = NULL;
-                InternalType* pCurrent  = NULL;
-                const Exp* pCurrentExp  = pField;
-
-                const wstring *pstName  = getStructNameFromExp(pField);
-                if (pstName)
-                {
-                    InternalType* pCurrentStr = symbol::Context::getInstance()->getCurrentLevel(symbol::Symbol(*pstName));
-                    InternalType* pHigherStr = symbol::Context::getInstance()->get(symbol::Symbol(*pstName));
-                    if (pHigherStr && pHigherStr->isStruct() && pCurrentStr == NULL)
-                    {
-                        //struct come from higher scope, so we need to clone and put it in current scope
-                        InternalType *pITClone = pHigherStr->clone();
-                        symbol::Context::getInstance()->put(symbol::Symbol(*pstName), *pITClone);
-                    }
-                }
-
-                bool bOK = getStructFromExp(pCurrentExp, &pMain, &pCurrent, NULL, pIT);
-                if (bOK)
-                {
-                    //someting was done
-                }
-                else
-                {
-                    //not a struct/handle but it can be a MList ou TList
-                    pField->head_get()->accept(*this);
-                    InternalType *pHead = result_get();
-
-                    if (pHead->isMList())
-                    {
-                        //TODO:
-                    }
-                    else if (pHead->isTList())
-                    {
-                        //assign result to new field
-                        const SimpleVar* pTail =  dynamic_cast<const SimpleVar*>(pField->tail_get());
-                        TList* pT = pHead->getAs<TList>();
-                        if (pT->exists(pTail->name_get().name_get()))
-                        {
-                            pT->set(pTail->name_get().name_get(), pIT);
-                        }
-                        else
-                        {
-                            std::wostringstream os;
-                            os << _W("Field must be exist");
-                            throw ScilabError(os.str(), 999, pVar->location_get());
-                        }
-                    }
-                    else
-                    {
-                        std::wostringstream os;
-                        os << _W("invalid operation");
-                        throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
-                    }
-                }
+                std::wostringstream os;
+                os << _W("Fields evaluation failed.");
+                throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
 
-            //if(pHead->isStruct() || pHead == NULL)
-            //{
-            //    InternalType* pMain     = NULL;
-            //    InternalType* pCurrent  = NULL;
-            //    const Exp* pCurrentExp  = pField;
-            //    const wstring *pstName  = getStructNameFromExp(pField);
-            //    if(pstName)
-            //    {
-            //        InternalType* pCurrentStr = symbol::Context::getInstance()->getCurrentLevel(symbol::Symbol(*pstName));
-            //        InternalType* pHigherStr = symbol::Context::getInstance()->get(symbol::Symbol(*pstName));
-            //        if(pHigherStr && pCurrentStr == NULL)
-            //        {//struct come from higher scope, so we need to clone and put it in current scope
-            //            InternalType *pITClone = pHigherStr->clone();
-            //            symbol::Context::getInstance()->put(symbol::Symbol(*pstName), *pITClone);
-            //        }
-            //    }
-
-            //    if(pHead != NULL)
-            //    {
-            //        pMain = pHead->getAs<Struct>();
-            //        pCurrentExp = pField->tail_get();
-            //    }
-
-            //    bool bOK = getStructFromExp(pCurrentExp, &pMain, &pCurrent, NULL, pIT);
-            //    if (pMain != NULL)
-            //    {
-            //        pHead = pMain;
-            //    }
-
-            //    //if a is already assign, make a copy and replace it
-            //    if (pHead->isRef(1) == true)
-            //    {
-            //        pHead = pHead->clone();
-            //        pstName = getStructNameFromExp(pField);
-            //        symbol::Context::getInstance()->put(symbol::Symbol(*pstName), *pHead->clone());
-            //    }
-            //}
-            //else if(pHead->isMList())
-            //{
-            //    //TODO:
-            //}
-            //else if(pHead->isTList())
-            //{
-            //    //assign result to new field
-            //    const SimpleVar* pTail =  dynamic_cast<const SimpleVar*>(pField->tail_get());
-            //    TList* pT = pHead->getAs<TList>();
-            //    if (pT->exists(pTail->name_get().name_get()))
-            //    {
-            //        pT->set(pTail->name_get().name_get(), pIT);
-            //    }
-            //    else
-            //    {
-            //        std::wostringstream os;
-            //        os << L"Field must be exist";
-            //        throw ScilabError(os.str(), 999, pVar->location_get());
-            //    }
-            //}
-            //else if(pHead->isHandle())
-            //{
-            //    //parse head exp to create a list of "index" to call %x_i_h macro
-            //    //List* pList = getPropertyTree((Exp*)pField->tail_get(), new List());
-            //    //typed_list arg;
-            //    //arg.push_back(new Double(1));
-            //    //ListDelete* pDel = new ListDelete();
-            //    //pList->insert(&arg, pDel);
-            //    //delete pDel;
-            //    //delete arg[0];
-
-            //    //call overload %x_i_h
-            //    String* pS = new String(((SimpleVar*)pField->tail_get())->name_get().name_get().c_str());
-            //    std::wstring str = L"%" + pIT->getShortTypeStr() + L"_i_h";
-
-            //    typed_list in;
-            //    typed_list out;
-            //    optional_list opt;
-
-            //    in.push_back(pS);
-            //    in.push_back(pIT);
-            //    in.push_back(pHead);
-            //    pS->IncreaseRef();
-            //    pIT->IncreaseRef();
-            //    pHead->IncreaseRef();
-
-            //    Function* pCall = (Function*)symbol::Context::getInstance()->get(symbol::Symbol(str));
-            //    Callable::ReturnValue ret =  pCall->call(in, opt, 1, out, this);
-            //    //delete pS;
-
-            //    pS->DecreaseRef();
-            //    pIT->DecreaseRef();
-            //    pHead->DecreaseRef();
-            //    if(ret != Callable::OK)
-            //    {
-            //        std::wostringstream os;
-            //        os << L"unable to update handle";
-            //        throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
-            //    }
-            //}
-            //else
-            //{
-            //    std::wostringstream os;
-            //    os << L"invalid operation";
-            //    throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
-            //}
-
             if (e.is_verbose() && ConfigVariable::isPromptShow())
             {
                 const wstring *pstName = getStructNameFromExp(pField);
@@ -1080,49 +314,3 @@ void visitprivate(const AssignExp  &e)
         throw error;
     }
 }
-
-/*** overload insertion ***/
-//%x_i_x(i1, i2, ..., in, source, dest)
-//i1, ..., in : indexes
-//dest : variable where to insert data
-//source : data to insert
-types::InternalType* callOverload(std::wstring strType, types::typed_list* _pArgs, types::InternalType* _source, types::InternalType* _dest)
-{
-    types::InternalType* pITOut = NULL;
-    types::typed_list in;
-    types::typed_list out;
-
-    for(int i = 0; i < _pArgs->size(); i++)
-    {
-        (*_pArgs)[i]->IncreaseRef();
-        in.push_back((*_pArgs)[i]);
-    }
-
-    _source->IncreaseRef();
-    _dest->IncreaseRef();
-
-    in.push_back(_source);
-    in.push_back(_dest);
-
-    std::wstring function_name;
-    function_name = L"%" + _source->getAs<List>()->getShortTypeStr() + L"_" + strType + L"_" +_dest->getAs<List>()->getShortTypeStr();
-    if(symbol::Context::getInstance()->get(symbol::Symbol(function_name)))
-    {
-        Overload::call(function_name, in, 1, out, this);
-    }
-
-    for(int i = 0; i < _pArgs->size(); i++)
-    {
-        (*_pArgs)[i]->DecreaseRef();
-    }
-
-    _source->DecreaseRef();
-    _dest->DecreaseRef();
-
-    if (out.size() != 0)
-    {
-        pITOut = out[0];
-    }
-
-    return pITOut;
-}
index e7abc18..56032df 100644 (file)
@@ -473,101 +473,104 @@ public :
             throw error;
         }
 
+        SimpleVar *psvRightMember = dynamic_cast<SimpleVar *>(const_cast<Exp *>(e.tail_get()));
+        std::wstring wstField = L"";
+        if (psvRightMember != NULL)
+        {
+            wstField = psvRightMember->name_get().name_get();
+        }
+        else
+        {
+            wchar_t szError[bsiz];
+            os_swprintf(szError, bsiz, _W("/!\\ Unmanaged FieldExp.\n"));
+            throw ScilabError(szError, 999, e.location_get());
+        }
+
         if (result_get() != NULL && result_get()->isStruct())
         {
-            SimpleVar *psvRightMember = dynamic_cast<SimpleVar *>(const_cast<Exp *>(e.tail_get()));
-            if (psvRightMember != NULL)
+            InternalType* pTemp = result_get();
+            result_set(NULL);
+            Struct* psValue = pTemp->getAs<Struct>();
+            if (psValue->exists(wstField))
             {
-                InternalType* pTemp = result_get();
-                result_set(NULL);
-                Struct* psValue = pTemp->getAs<Struct>();
-                if (psValue->exists(psvRightMember->name_get().name_get()))
+                if (psValue->getSize() != 1)
                 {
-                    if (psValue->getSize() != 1)
-                    {
-                        std::vector<std::wstring> wstFields;
-                        wstFields.push_back(psvRightMember->name_get().name_get());
-
-                        std::vector<InternalType*> result;
-                        result = psValue->extractFields(wstFields);
-
-                        result_set(result[0]);
-                    }
-                    else
-                    {
-                        InternalType* pIT = psValue->get(0)->get(psvRightMember->name_get().name_get())->clone();
-                        result_set(pIT);
-                    }
+                    std::vector<std::wstring> wstFields;
+                    wstFields.push_back(wstField);
+                    std::vector<InternalType*> result;
+                    result = psValue->extractFields(wstFields);
+                    result_set(result[0]);
                 }
                 else
                 {
-                    wchar_t szError[bsiz];
-                    os_swprintf(szError, bsiz, _W("Unknown field : %ls.\n"), psvRightMember->name_get().name_get().c_str());
-                    throw ScilabError(szError, 999, psvRightMember->location_get());
+                    InternalType* pIT = psValue->get(0)->get(wstField)->clone();
+                    result_set(pIT);
                 }
             }
             else
             {
                 wchar_t szError[bsiz];
-                os_swprintf(szError, bsiz, _W("/!\\ Unmanaged FieldExp.\n"));
-                throw ScilabError(szError, 999, e.location_get());
+                os_swprintf(szError, bsiz, _W("Unknown field : %ls.\n"), wstField.c_str());
+                throw ScilabError(szError, 999, e.tail_get()->location_get());
             }
         }
-        else if (result_get() != NULL && result_get()->isMList())
+        else if (result_get() != NULL && (result_get()->isMList() || result_get()->isTList()))
         {
-            SimpleVar *psvRightMember = dynamic_cast<SimpleVar *>(const_cast<Exp *>(e.tail_get()));
-            if (psvRightMember != NULL)
+            TList* psValue = ((InternalType*)result_get())->getAs<MList>();
+
+            if (psValue->exists(wstField))
             {
-                TList* psValue = ((InternalType*)result_get())->getAs<MList>();
-                result_set(NULL);
-                if (psValue->exists(psvRightMember->name_get().name_get()))
+                //without overloading function, extract by name
+                result_set(psValue->getField(wstField));
+            }
+            else
+            {
+                //call %mlisttype_e
+                std::wostringstream ostr;
+                types::typed_list in;
+                types::optional_list opt;
+                types::typed_list out;
+
+                //firt argument: index
+                String* pS = new String(wstField.c_str());
+                pS->IncreaseRef();
+                in.push_back(pS);
+
+                //second argument: me ( mlist or tlist )
+                psValue->IncreaseRef();
+                in.push_back(psValue);
+
+                Callable::ReturnValue Ret = Overload::call(L"%" + psValue->getShortTypeStr() + L"_e", in, 1, out, this);
+
+                if (Ret != Callable::OK)
                 {
-                    InternalType* pIT = psValue->getField(psvRightMember->name_get().name_get());
-                    result_set(pIT);
+                    throw ScilabError(L"", 999, e.location_get());
                 }
-                else
+
+                if (out.size() == 0)
                 {
-                    wchar_t szError[bsiz];
-                    os_swprintf(szError, bsiz, _W("Unknown field : %ls.\n"), psvRightMember->name_get().name_get().c_str());
-                    throw ScilabError(szError, 999, psvRightMember->location_get());
+                    result_set(NULL);
                 }
-            }
-            else
-            {
-                wchar_t szError[bsiz];
-                os_swprintf(szError, bsiz, _W("/!\\ Unmanaged FieldExp.\n"));
-                throw ScilabError(szError, 999, e.location_get());
-            }
-        }
-        else if (result_get() != NULL && result_get()->isTList())
-        {
-            SimpleVar *psvRightMember = dynamic_cast<SimpleVar *>(const_cast<Exp *>(e.tail_get()));
-            if (psvRightMember != NULL)
-            {
-                TList* psValue = ((InternalType*)result_get())->getAs<TList>();
-                result_set(NULL);
-                if (psValue->exists(psvRightMember->name_get().name_get()))
+                else if (out.size() == 1)
                 {
-                    InternalType* pIT = psValue->getField(psvRightMember->name_get().name_get());
-                    result_set(pIT);
+                    out[0]->DecreaseRef();
+                    result_set(out[0]);
                 }
                 else
                 {
-                    wchar_t szError[bsiz];
-                    os_swprintf(szError, bsiz, _W("Unknown field : %ls.\n"), psvRightMember->name_get().name_get().c_str());
-                    throw ScilabError(szError, 999, psvRightMember->location_get());
+                    for (int i = 0 ; i < static_cast<int>(out.size()) ; i++)
+                    {
+                        out[i]->DecreaseRef();
+                        result_set(i, out[i]);
+                    }
                 }
-            }
-            else
-            {
-                wchar_t szError[bsiz];
-                os_swprintf(szError, bsiz, _W("/!\\ Unmanaged FieldExp.\n"));
-                throw ScilabError(szError, 999, e.location_get());
+
+                psValue->DecreaseRef();
+                pS->DecreaseRef();
             }
         }
         else if (result_get() != NULL && result_get()->isHandle())
         {
-            SimpleVar *psvRightMember = dynamic_cast<SimpleVar *>(const_cast<Exp *>(e.tail_get()));
             typed_list in;
             typed_list out;
             optional_list opt;
index a89491a..9856367 100644 (file)
@@ -17,6 +17,9 @@
 #include "struct.hxx"
 #include "list.hxx"
 #include "exp.hxx"
+#include "symbol.hxx"
+#include <list>
+#include "expHistory.hxx"
 
 #define bsiz   4096
 
@@ -25,27 +28,38 @@ EXTERN_AST bool bConditionState(types::InternalType *_pITResult);
 //EXTERN_AST void ExpandList(int ** _piList, int *_piListSize, int _iListSizeSize, int *_piResultList);
 
 EXTERN_AST types::InternalType* AddElementToVariable(
-                                               types::InternalType* _poDest,
-                                               types::InternalType* _poSource,
-                                               int _iRows, int _iCols);
+    types::InternalType* _poDest,
+    types::InternalType* _poSource,
+    int _iRows, int _iCols);
 
 EXTERN_AST types::InternalType* AddElementToVariableFromCol(
-                        types::InternalType* _poDest,
-                        types::InternalType* _poSource,
-                        int _iRows, int _iCols, int *_piCols);
+    types::InternalType* _poDest,
+    types::InternalType* _poSource,
+    int _iRows, int _iCols, int *_piCols);
 
 EXTERN_AST types::InternalType* AddElementToVariableFromRow(
-                        types::InternalType* _poDest,
-                        types::InternalType* _poSource,
-                        int _iRows, int _iCols, int *_piRows);
+    types::InternalType* _poDest,
+    types::InternalType* _poSource,
+    int _iRows, int _iCols, int *_piRows);
 
 EXTERN_AST const std::wstring* getStructNameFromExp(const ast::Exp* _pExp);
 
-EXTERN_AST bool getStructFromExp(const ast::Exp* _pExp, types::InternalType** _pMain, types::InternalType** _pCurrent, types::typed_list** _pArgs, types::InternalType* _pIT);
+EXTERN_AST bool getFieldsFromExp(const ast::Exp* _pExp, std::list<ExpHistory*>& fields);
+
+EXTERN_AST types::InternalType* evaluateFields(const ast::Exp* _pExp, std::list<ExpHistory*>& fields, types::InternalType* pIT);
+
+EXTERN_AST types::InternalType* callOverload(const ast::Exp& e,
+        std::wstring _strType,
+        types::typed_list* _pArgs,
+        types::InternalType* _source,
+        types::InternalType* _dest);
+
+EXTERN_AST types::InternalType* callOverload(std::wstring strType, types::InternalType* _paramL, types::InternalType* _paramR);
 
 EXTERN_AST void callOnPrompt(void);
 
 EXTERN_AST types::List* getPropertyTree(ast::Exp* e, types::List* pList);
 
+EXTERN_AST types::InternalType* insertionCall(const ast::Exp& e, types::typed_list* _pArgs, types::InternalType* _pVar, types::InternalType* _pInsert);
 
 #endif //!AST_VISITOR_COMMON_HXX
diff --git a/scilab/modules/ast/src/cpp/expHistory.cpp b/scilab/modules/ast/src/cpp/expHistory.cpp
new file mode 100644 (file)
index 0000000..43c90a8
--- /dev/null
@@ -0,0 +1,319 @@
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2014 - Scilab Enterprises - Cedric Delamarre
+ *
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
+
+#include "expHistory.hxx"
+#include "types_tools.hxx"
+#include "types.hxx"
+
+/**
+** Constructor & Destructor (public)
+*/
+
+void ExpHistory::initHistory()
+{
+    m_pArgs             = NULL;
+    m_piArgsDimsArray   = NULL;
+    m_pExp              = NULL;
+    m_pParent           = NULL;
+    m_pITCurrent        = NULL;
+    m_bReinsertMe       = false;
+    m_bCellExp          = false;
+    m_iArgsDims         = 0;
+    m_iWhere            = -1;
+    m_iLevel            = 0;
+}
+
+ExpHistory::ExpHistory()
+{
+    initHistory();
+}
+
+
+ExpHistory::ExpHistory(ExpHistory* _pEH, const ast::SimpleVar* _pExp)
+{
+    initHistory();
+
+    m_pExp      = _pExp;
+    m_pParent   = _pEH;
+}
+
+ExpHistory::ExpHistory(ExpHistory* _pParent, types::typed_list* _pArgs)
+{
+    initHistory();
+
+    m_pArgs     = _pArgs;
+    m_pParent   = _pParent;
+}
+
+ExpHistory::ExpHistory(ExpHistory* _pParent, const ast::SimpleVar* _pExp, types::typed_list* _pArgs, int _iLevel,  bool _bCellExp, types::InternalType* _pITCurrent)
+{
+    initHistory();
+
+    m_pArgs         = _pArgs;
+    m_pExp          = _pExp;
+    m_pParent       = _pParent;
+    m_pITCurrent    = _pITCurrent;
+    m_iLevel        = _iLevel;
+    m_bCellExp      = _bCellExp;
+}
+
+ExpHistory::~ExpHistory()
+{
+    if (m_piArgsDimsArray)
+    {
+        delete m_piArgsDimsArray;
+    }
+}
+
+/**
+** Accessor (public)
+*/
+
+void ExpHistory::setExp(const ast::SimpleVar* _pExp)
+{
+    m_pExp = _pExp;
+}
+
+const ast::SimpleVar* ExpHistory::getExp()
+{
+    return m_pExp;
+}
+
+std::wstring ExpHistory::getExpAsString()
+{
+    std::wstring wcsExp = L"";
+    if (m_pExp)
+    {
+        wcsExp = m_pExp->name_get().name_get();
+    }
+
+    return wcsExp;
+}
+
+void ExpHistory::setArgs(types::typed_list* _pArgs)
+{
+    m_pArgs = _pArgs;
+}
+
+void ExpHistory::computeArgs()
+{
+    if (m_pArgs)
+    {
+        m_iArgsDims = (int)m_pArgs->size();
+
+        // compute indexes
+        m_piArgsDimsArray  = new int[m_iArgsDims];
+
+        int* piCountDim = new int[m_pArgs->size()];
+        types::typed_list* pNewArgs = new types::typed_list();
+
+        int iCount = types::checkIndexesArguments(m_pITCurrent, m_pArgs, pNewArgs, m_piArgsDimsArray, piCountDim);
+
+        m_pArgs = pNewArgs;
+        delete[] piCountDim;
+
+        int* piDimsArray = m_pITCurrent->getAs<types::GenericType>()->getDimsArray();
+        if (m_iArgsDims == 1)
+        {
+            if (m_pITCurrent->getAs<types::GenericType>()->getDims() == 2)
+            {
+                if ( piDimsArray[1] == 1 ||
+                        piDimsArray[0] == 0 && piDimsArray[1] == 0)
+                {
+                    int iTemp = m_piArgsDimsArray[0];
+                    delete[] m_piArgsDimsArray;
+                    m_piArgsDimsArray = new int[2];
+                    m_iArgsDims = 2;
+                    m_piArgsDimsArray[0] = iTemp;
+                    m_piArgsDimsArray[1] = 1;
+                }
+                else if (piDimsArray[0] == 1)
+                {
+                    int iTemp = m_piArgsDimsArray[0];
+                    delete[] m_piArgsDimsArray;
+                    m_piArgsDimsArray = new int[2];
+                    m_iArgsDims = 2;
+                    m_piArgsDimsArray[0] = 1;
+                    m_piArgsDimsArray[1] = iTemp;
+                }
+            }
+        }
+        else
+        {
+            for (int i = 0; i < std::min(m_iArgsDims, m_pITCurrent->getAs<types::GenericType>()->getDims()); i++)
+            {
+                m_piArgsDimsArray[i] = std::max(m_piArgsDimsArray[i], piDimsArray[i]);
+            }
+        }
+    }
+}
+
+types::typed_list* ExpHistory::getArgs()
+{
+    return m_pArgs;
+}
+
+int ExpHistory::getSizeFromArgs()
+{
+    int iSizeFromArgs = 0;
+
+    if (m_pArgs)
+    {
+        iSizeFromArgs = 1;
+        if (m_piArgsDimsArray == NULL)
+        {
+            computeArgs();
+        }
+
+        for (int i = 0; i < m_pArgs->size(); i++)
+        {
+            iSizeFromArgs *= m_piArgsDimsArray[i];
+        }
+    }
+
+    return iSizeFromArgs;
+}
+
+int* ExpHistory::getArgsDimsArray()
+{
+    if (m_pArgs)
+    {
+        if (m_piArgsDimsArray == NULL)
+        {
+            computeArgs();
+        }
+    }
+
+    return m_piArgsDimsArray;
+}
+
+int ExpHistory::getArgsDims()
+{
+    if (m_pArgs)
+    {
+        if (m_piArgsDimsArray == NULL)
+        {
+            computeArgs();
+        }
+    }
+
+    return m_iArgsDims;
+}
+
+bool ExpHistory::needResize()
+{
+    if (m_pArgs)
+    {
+        int iDims = m_pITCurrent->getAs<types::GenericType>()->getDims();
+
+        if (m_piArgsDimsArray == NULL)
+        {
+            computeArgs();
+        }
+
+        if (m_iArgsDims == 1)
+        {
+            int iSize = m_pITCurrent->getAs<types::GenericType>()->getSize();
+            if (iSize < m_piArgsDimsArray[0])
+            {
+                return true;
+            }
+        }
+        else
+        {
+            if (iDims < m_iArgsDims)
+            {
+                return true;
+            }
+
+            int* piDimsArray = m_pITCurrent->getAs<types::GenericType>()->getDimsArray();
+            for (int i = 0; i < m_iArgsDims; i++)
+            {
+                if (piDimsArray[i] < m_piArgsDimsArray[i])
+                {
+                    return true;
+                }
+            }
+        }
+    }
+
+    return false;
+}
+
+bool ExpHistory::setCurrent(types::InternalType* _pITCurrent)
+{
+    if (m_pITCurrent == _pITCurrent)
+    {
+        return false;
+    }
+
+    m_pITCurrent = _pITCurrent;
+    return true;
+}
+
+types::InternalType* ExpHistory::getCurrent()
+{
+    return m_pITCurrent;
+}
+
+ExpHistory* ExpHistory::getParent()
+{
+    return m_pParent;
+}
+
+void ExpHistory::setReinsertion()
+{
+    if (m_pITCurrent != NULL && m_pITCurrent->isHandle() == false)
+    {
+        m_bReinsertMe = true;
+    }
+}
+
+void ExpHistory::resetReinsertion()
+{
+    m_bReinsertMe = false;
+}
+
+bool ExpHistory::reinsertMe()
+{
+    return m_bReinsertMe;
+}
+
+int ExpHistory::getWhereReinsert()
+{
+    return m_iWhere;
+}
+
+void ExpHistory::setWhereReinsert(int _iWhere)
+{
+    m_iWhere = _iWhere;
+}
+
+int ExpHistory::getLevel()
+{
+    return m_iLevel;
+}
+
+void ExpHistory::setLevel(int _iLevel)
+{
+    m_iLevel = _iLevel;
+}
+
+void ExpHistory::setCellExp()
+{
+    m_bCellExp = true;
+}
+
+bool ExpHistory::isCellExp()
+{
+    return m_bCellExp;
+}
\ No newline at end of file
index 3d29485..62ef234 100644 (file)
@@ -537,7 +537,7 @@ types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::I
                     {
                         for (int j = 0; j < poSource->getCols(); j++)
                         {
-                            bool bValue = poSource->get(i, j) == 1;
+                            bool bValue = poSource->get(i, j) != 0;
                             if (bValue)
                             {
                                 spResult->set(i + iCurRow, j + iCurCol, true);
@@ -670,7 +670,88 @@ const std::wstring* getStructNameFromExp(const Exp* _pExp)
     return NULL;
 }
 
-bool getStructFromExp(const Exp* _pExp, types::InternalType** _pMain, types::InternalType** _pCurrent, typed_list** _pArgs, types::InternalType* _pIT)
+/*** overload insertion                 ||         extraction       ***/
+//%x_i_x(i1, i2, ..., in, source, dest) || %x_e(i1, i2, ..., in, source, dest)
+//i1, ..., in : indexes
+//dest : variable where insert data     || NULL
+//source : data to insert               || extract indexes from source
+types::InternalType* callOverload(const Exp& e, std::wstring _strType, types::typed_list* _pArgs, types::InternalType* _source, types::InternalType* _dest)
+{
+    types::InternalType* pITOut = NULL;
+    types::typed_list in;
+    types::typed_list out;
+
+    std::wstring function_name;
+    function_name = L"%" + _source->getShortTypeStr() + L"_" + _strType;
+
+    for (int i = 0; i < _pArgs->size(); i++)
+    {
+        (*_pArgs)[i]->IncreaseRef();
+        in.push_back((*_pArgs)[i]);
+    }
+
+    _source->IncreaseRef();
+    in.push_back(_source);
+
+    if (_dest)
+    {
+        _dest->IncreaseRef();
+        in.push_back(_dest);
+
+        function_name += L"_" + _dest->getShortTypeStr();
+    }
+
+    InternalType* pFunc = symbol::Context::getInstance()->get(symbol::Symbol(function_name));
+    // if %type_6 doesn't exist, call %l_6
+    if (_dest == NULL && pFunc == NULL)
+    {
+        function_name = L"%l_" + _strType;
+    }
+
+    // For insertion in TList, call normal insertion if overload doesn't exits
+    if ((_dest  && _dest->isTList() && pFunc == NULL) == false || _source->isListDelete())
+    {
+        ExecVisitor exec;
+        if (Overload::call(function_name, in, 1, out, &exec))
+        {
+            //manage error
+            std::wostringstream os;
+            os << _W("Error in overload function: ") << function_name << std::endl;
+            throw ScilabError(os.str(), 999, e.location_get());
+        }
+    }
+
+    for (int i = 0; i < _pArgs->size(); i++)
+    {
+        (*_pArgs)[i]->DecreaseRef();
+    }
+
+    _source->DecreaseRef();
+    if (_dest)
+    {
+        _dest->DecreaseRef();
+    }
+
+    if (out.size() == 1)
+    {
+        pITOut = out[0];
+    }
+    else if (out.size() > 1)
+    {
+        List* pListOut = new List();
+        for (int i = 0; i < out.size(); i++)
+        {
+            pListOut->append(out[i]);
+        }
+
+        pITOut = pListOut;
+    }
+
+    return pITOut;
+}
+
+
+bool getFieldsFromExp(const ast::Exp* _pExp, std::list<ExpHistory*>& fields)
 {
     const FieldExp* pField      = dynamic_cast<const FieldExp*>(_pExp);
     const SimpleVar* pVar       = dynamic_cast<const SimpleVar*>(_pExp);
@@ -679,487 +760,1271 @@ bool getStructFromExp(const Exp* _pExp, types::InternalType** _pMain, types::Int
 
     if (pField)
     {
-        //y.x
+        if (getFieldsFromExp(pField->head_get(), fields))
+        {
+            return getFieldsFromExp(pField->tail_get(), fields);
+        }
+
+        return false;
+    }
+    else if (pVar)
+    {
+        if (fields.empty())
+        {
+            fields.push_back(new ExpHistory(NULL, pVar));
+        }
+        else
+        {
+            ExpHistory* pEHParent = fields.back();
+            fields.push_back(new ExpHistory(pEHParent, pVar));
+            fields.back()->setLevel(pEHParent->getLevel() + 1);
+        }
+
+        return true;
+    }
+    else if (pCall)
+    {
+        ExecVisitor execMe;
+        typed_list* pCurrentArgs = execMe.GetArgumentList(pCall->args_get());
 
-        //evaluate head "y"
-        typed_list *pArgs       = NULL;
-        InternalType* pMain     = *_pMain;
-        InternalType* pCurrent  = *_pCurrent;
+        bool bErr = getFieldsFromExp(&pCall->name_get(), fields);
+        if (fields.back()->getArgs())
+        {
+            // a(x)(y)(z)
+            ExpHistory* pEHParent = fields.back();
+            fields.push_back(new ExpHistory(pEHParent, pCurrentArgs));
+            fields.back()->setLevel(pEHParent->getLevel() + 1);
+        }
+        else
+        {
+            // a(x)
+            fields.back()->setArgs(pCurrentArgs);
+        }
 
-        bool bOK = getStructFromExp(pField->head_get(), &pMain, &pCurrent, &pArgs, NULL);
-        if (bOK)
+        if (pCell)
         {
-            pVar    = dynamic_cast<const SimpleVar*>(pField->tail_get());
+            // a{x}
+            fields.back()->setCellExp();
+        }
 
-            if (pCurrent->isStruct())
+        return bErr;
+    }
+    else
+    {
+        return false;
+    }
+}
+
+types::InternalType* evaluateFields(const ast::Exp* _pExp, std::list<ExpHistory*>& fields, InternalType* _pAssignValue)
+{
+    std::list<ExpHistory*> evalFields;
+
+    //*** get main variable ***//
+    std::list<ExpHistory*>::iterator iterFields = fields.begin();
+    ExpHistory* pFirstField = *iterFields;
+    InternalType* pIT = symbol::Context::getInstance()->get(pFirstField->getExp()->name_get());
+    if (pIT == NULL)
+    {
+        if (pFirstField->isCellExp())
+        {
+            // a{x}, where "a" doesn't exists
+            pIT = new Cell(1, 1);
+            symbol::Context::getInstance()->put(pFirstField->getExp()->name_get(), *pIT);
+        }
+        else if (fields.size() > 1)
+        {
+            // is a field exp
+            //"a" does not exist or it is another type, create it with size 1,1 and return it
+            //create new structure variable
+            pIT = new Struct(1, 1);
+            symbol::Context::getInstance()->put(pFirstField->getExp()->name_get(), *pIT);
+        }
+        // else
+        // is a call exp
+        // a(x) = "something" and a does not exist
+        // a will be create in insertionCall
+    }
+    else if (pIT->getRef() > 1 && pIT->isHandle() == false)
+    {
+        pIT = pIT->clone();
+        symbol::Context::getInstance()->put(pFirstField->getExp()->name_get(), *pIT);
+    }
+    else if (pIT == _pAssignValue)
+    {
+        // clone me before insert me in myself.
+        // ie : a.b = 2; a.b.c.d = a;
+        _pAssignValue = _pAssignValue->clone();
+    }
+
+    iterFields++;
+
+    std::list<ExpHistory*> workFields;
+    workFields.push_back(new ExpHistory(NULL,
+                                        pFirstField->getExp(),
+                                        pFirstField->getArgs(),
+                                        pFirstField->getLevel(),
+                                        pFirstField->isCellExp(),
+                                        pIT));
+
+    //*** evaluate fields ***//
+    while (iterFields != fields.end())
+    {
+        ExpHistory* pEH = workFields.front();
+        evalFields.push_back(pEH);
+        workFields.pop_front();
+
+        types::InternalType* pITCurrent = pEH->getCurrent();
+
+        if (pEH->isCellExp() && pITCurrent->isCell() == false)
+        {
+            std::wostringstream os;
+            os << _W("Wrong insertion : use extraction with {} only on a Cell.");
+            throw ScilabError(os.str(), 999, _pExp->location_get());
+        }
+
+        if (pITCurrent->isStruct())
+        {
+            Struct* pStruct = pITCurrent->getAs<Struct>();
+            std::wstring pwcsFieldname = (*iterFields)->getExpAsString();
+            int iSizeStuct = pStruct->getSize();
+
+            if (pEH->needResize())
             {
-                Struct* pCurStr = pCurrent->getAs<Struct>();
-                //clone _pIT BEFORE addField in case of st.b = st
-                types::InternalType* pIT = _pIT ? _pIT->clone() : NULL;
-
-                //create field "x"
-                std::wstring var = pVar->name_get().name_get();
-                pCurStr->addField(pVar->name_get().name_get());
-                if (*_pMain == NULL && _pIT != NULL)
+                if (pEH->getArgsDims() == 1)
                 {
-                    //first stack, assign value to field and return main structure
+                    std::wostringstream os;
+                    os << _W("Invalid index.");
+                    throw ScilabError(os.str(), 999, _pExp->location_get());
+                }
+
+                // resize current struct
+                pStruct->resize(pEH->getArgsDimsArray(), pEH->getArgsDims());
+            }
 
-                    if (pArgs != NULL && pArgs->size() != 0)
+            // create field in parent if it not exist
+            if (pStruct->exists(pwcsFieldname) == false)
+            {
+                pStruct->addField(pwcsFieldname);
+            }
+
+            if (pEH->getArgs())
+            {
+                InternalType* pIT = pStruct->extractWithoutClone(pEH->getArgs());
+                workFields.push_front(new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), pIT));
+            }
+            else
+            {
+                // extract field x and append it to elements for next recursion.
+                List* pLOut = pStruct->extractFieldWithoutClone(pwcsFieldname);
+                for (int iList = 0; iList < pLOut->getSize(); iList++)
+                {
+                    InternalType* pIT = pLOut->get(iList);
+                    if (pIT->getRef() > 1)
                     {
-                        //args returned by "parent"
-                        //be careful, extract functions copy values
-
-                        Struct *pStr = pCurStr->extractWithoutClone(pArgs)->getAs<Struct>();
-                        pStr->setCloneInCopyValue(false);
-                        SingleStruct* pSS = pStr->get(0);
-                        pSS->set(pVar->name_get().name_get(), pIT);
-                        pSS->IncreaseRef();
-                        delete pStr;
-                        pSS->DecreaseRef();
+                        // clone element before modify it.
+                        pIT->DecreaseRef();
+                        pIT = pIT->clone();
+                        pStruct->get(iList)->set(pwcsFieldname, pIT);
                     }
-                    else if (_pArgs == NULL || *_pArgs == NULL)
+
+                    ExpHistory* pEHChield = new ExpHistory( pEH,
+                                                            (*iterFields)->getExp(),
+                                                            (*iterFields)->getArgs(),
+                                                            (*iterFields)->getLevel(),
+                                                            (*iterFields)->isCellExp(),
+                                                            pIT);
+                    pEHChield->setWhereReinsert(iList);
+                    workFields.push_back(pEHChield);
+                }
+            }
+        }
+        else if (pITCurrent->isTList() || pITCurrent->isMList())
+        {
+            TList* pTL = pITCurrent->getAs<TList>();
+            typed_list* pArgs = pEH->getArgs();
+            if (pArgs && (*pArgs)[0]->isString() == false)
+            {
+                if (pArgs->size() > 1 || pITCurrent->isMList())
+                {
+                    // call overload
+                    InternalType* pExtract = callOverload(*pEH->getExp(), L"6", pArgs, pTL, NULL);
+                    if ((*iterFields)->getExp() == NULL)
                     {
-                        //std::wcout << var << L" <- " << pIT->getTypeStr() << std::endl;
-                        pCurStr->get(0)->set(pVar->name_get().name_get(), pIT);
+                        // a(x)(y) => a.b(y)
+                        // extract a(x) and push_BACK to extract next level
+                        workFields.push_back(new ExpHistory(pEH, NULL, (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract));
+                        workFields.back()->setReinsertion();
                     }
                     else
                     {
-                        Struct* pStr = new Struct(1, 1);
-                        pStr->addField(pVar->name_get().name_get());
-                        pStr->get(0)->set(pVar->name_get().name_get(), pIT);
-                        pCurStr->insertWithoutClone(*_pArgs, pStr->get(0));
-                        delete pStr;
+                        // a(x).b
+                        // extract a(x) and push_FRONT to extract b from a(x)
+                        workFields.push_front(new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), pExtract));
+                        workFields.front()->setReinsertion();
                     }
                 }
                 else
                 {
-                    //y.x.w
-                    //in this case, we are in the middle of expression
-                    //we know that "x" is a struct but we can't assign value yet
-                    //so assign empty struct and return new pCurrent
-                    Struct* pStr = NULL;
-
-                    /*try to extract field*/
-                    if (pArgs == NULL)
+                    // resize TList
+                    int iNewSize = pEH->getSizeFromArgs();
+                    if (pTL->getSize() < iNewSize)
                     {
-                        //without extract argument
-                        pStr = pCurStr->get(0)->get(pVar->name_get().name_get())->getAs<Struct>();
-                    }
-                    else
-                    {
-                        Struct* pStepStr = pCurStr->extractWithoutClone(pArgs)->getAs<Struct>();
-                        pStepStr->setCloneInCopyValue(false);
-                        SingleStruct* pSS = pStepStr->get(0);
-                        pStr = pSS->get(pVar->name_get().name_get())->getAs<Struct>();
-                        //we can delete pStepStr without deleted its fields
-                        pSS->IncreaseRef();
-                        delete pStepStr;
-                        pSS->DecreaseRef();
+                        pTL->set(iNewSize - 1, new ListUndefined());
                     }
 
-                    if (pStr == NULL)
+                    std::vector<InternalType*> vectpIT = pTL->extract(pArgs);
+                    std::vector<InternalType*>::iterator iterVect;
+                    double* pdblArgs = (*pArgs)[0]->getAs<Double>()->get();
+                    int iLoop = 0;
+
+                    if ((*iterFields)->getExp() == NULL)
                     {
-                        //new field or not struct field
-                        if (_pArgs == NULL || *_pArgs == NULL)
+                        // a(x)(y) => a.b(y)
+                        // extract a(x) and push_BACK to extract next level
+                        for (iterVect = vectpIT.begin(); iterVect != vectpIT.end(); iterVect++, iLoop++)
                         {
-                            pStr = new Struct(1, 1);
+                            ExpHistory* pEHExtract = new ExpHistory(pEH, NULL, (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), *iterVect);
+                            pEHExtract->setWhereReinsert((int)(pdblArgs[iLoop] - 1));
+                            workFields.push_back(pEHExtract);
                         }
-                        else
+                    }
+                    else
+                    {
+                        // a(x).b
+                        // extract a(x) and push_FRONT to extract b from a(x)
+                        for (iterVect = vectpIT.begin(); iterVect != vectpIT.end(); iterVect++, iLoop++)
                         {
-                            Struct* p = new Struct(1, 1);
-                            pStr = Struct::insertNew(*_pArgs, p)->getAs<Struct>();
-                            delete p;
+                            ExpHistory* pEHExtract = new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), *iterVect);
+                            pEHExtract->setWhereReinsert((int)(pdblArgs[iLoop] - 1));
+                            workFields.push_front(pEHExtract);
                         }
+                    }
+                }
+            }
+            else
+            {
+                // get string "x"
+                InternalType* pExtract = NULL;
+                std::wstring pwcsFieldname = L"";
+                bool bReinsert = false;
+                ExpHistory* pEHChield = NULL;
 
-                        if (pArgs != NULL)
+                if (pArgs)
+                {
+                    // a('x')
+                    pwcsFieldname = (*pArgs)[0]->getAs<String>()->get(0);
+                }
+                else
+                {
+                    // a.x
+                    pwcsFieldname = (*iterFields)->getExpAsString();
+                }
+
+                // check if field exists
+                if (pTL->exists(pwcsFieldname) == false)
+                {
+                    std::list<ExpHistory*>::iterator iterFieldsNext(iterFields);
+                    ++iterFieldsNext;
+
+                    if (iterFieldsNext != fields.end() || (*iterFields)->getArgs() != NULL)
+                    {
+                        // M=mlist(['MType','x','y'], ...
+                        // M.rows1 = "somthing"
+                        if (pArgs == NULL)
                         {
-                            Struct* pStepStr = pCurStr->extractWithoutClone(pArgs)->getAs<Struct>();
-                            pStepStr->setCloneInCopyValue(false);
-                            SingleStruct* pSS = pStepStr->get(0);
-                            pSS->set(pVar->name_get().name_get(), pStr);
-                            pSS->IncreaseRef();
-                            delete pStepStr;
-                            pSS->DecreaseRef();
+                            pArgs = new typed_list();
+                            pArgs->push_back(new String(pwcsFieldname.c_str()));
                         }
-                        else
+
+                        // call overload
+                        pExtract = callOverload(*pEH->getExp(), L"6", pArgs, pTL, NULL);
+                        bReinsert = true;
+
+                        if (pEH->getArgs() == NULL)
                         {
-                            pCurStr->get(0)->set(pVar->name_get().name_get(), pStr);
+                            delete pArgs;
                         }
                     }
-
-                    pCurrent = pStr;
+                }
+                else
+                {
+                    // extract field x and append it to elements for next recursion.
+                    pExtract = pTL->getField(pwcsFieldname);
                 }
 
-                *_pMain = pMain;
-                *_pCurrent = pCurrent;
-            }
-            else //handle
-            {
-                String* pTail = new String(pVar->name_get().name_get().c_str());
-                if (_pArgs != NULL && *_pArgs == NULL)
+                // History management
+                if (pEH->getArgs())
                 {
-                    *_pArgs = new typed_list;
-                    pArgs = *_pArgs;
+                    if ((*iterFields)->getExp() == NULL)
+                    {
+                        // a('x')(y) => a.b(y)
+                        // extract a(x) and push_BACK to extract next level
+                        pEHChield = new ExpHistory(pEH, NULL, (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract);
+                        workFields.push_back(pEHChield);
+                    }
+                    else
+                    {
+                        // a('x').b -> a('x')('b')
+                        // extract a(x) and push_FRONT to extract b from a(x)
+                        pEHChield = new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), pExtract);
+                        workFields.push_front(pEHChield);
+                    }
                 }
-                else if (pArgs == NULL)
+                else
                 {
-                    pArgs = new typed_list;
+                    // a.x
+                    pEHChield = new ExpHistory(pEH, (*iterFields)->getExp(), (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract);
+                    workFields.push_back(pEHChield);
                 }
 
-                if (pArgs)
+                if (bReinsert)
+                {
+                    pEHChield->setReinsertion();
+                }
+            }
+        }
+        else if (pITCurrent->isList())
+        {
+            List* pL = pITCurrent->getAs<List>();
+            if (pEH->getParent() && pEH->getParent()->getLevel() == pEH->getLevel())
+            {
+                // pITCurrent is an extraction of other Type
+                for (int iLoop = 0; iLoop < pL->getSize(); iLoop++)
                 {
-                    pArgs->push_back(pTail);
-                    if (_pIT == NULL)
+                    ExpHistory* pEHExtract = new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), pL->get(iLoop));
+                    pEHExtract->setWhereReinsert(iLoop);
+                    workFields.push_front(pEHExtract);
+                }
+            }
+            else
+            {
+                // pITCurrent is a field
+                if (pEH->getArgs())
+                {
+                    if (pEH->getArgs()->size() > 1)
                     {
-                        //let caller work
+                        // call overload
+                        InternalType* pExtract = callOverload(*pEH->getExp(), L"6", pEH->getArgs(), pL, NULL);
 
-                        //try to extract, if extract work, clear args and flag we need set operation after.
-                        GraphicHandle* pCurH = pCurrent->getAs<GraphicHandle>();
-                        typed_list in;
-                        typed_list out;
-                        optional_list opt;
-                        ExecVisitor exec;
-
-                        if (pArgs->size() == 1)
+                        if ((*iterFields)->getExp() == NULL)
                         {
-                            in.push_back((*pArgs)[0]);
+                            // a(x)(y)
+                            // extract a(x) and push_BACK to extract next level
+                            workFields.push_back(new ExpHistory(pEH, NULL, (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract));
+                            workFields.back()->setReinsertion();
                         }
                         else
                         {
-                            List* pList = new List();
-                            for (int i = 0 ; i < pArgs->size() ; i++)
-                            {
-                                pList->append((*pArgs)[i]);
-                            }
-                            in.push_back(pList);
+                            // a(x).b
+                            // extract a(x) and push_FRONT to extract b from a(x)
+                            workFields.push_front(new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), pExtract));
+                            workFields.front()->setReinsertion();
                         }
-
-                        in.push_back(pCurrent);
-                        in.front()->IncreaseRef();
-                        pCurrent->IncreaseRef();
-
-                        Function* pCall = (Function*)symbol::Context::getInstance()->get(symbol::Symbol(L"%h_e"));
-                        Callable::ReturnValue ret =  pCall->call(in, opt, 1, out, &exec);
-
-                        in.front()->DecreaseRef();
-                        pCurrent->DecreaseRef();
-
-                        if (in.front()->isList())
+                    }
+                    else
+                    {
+                        // resize List
+                        int iNewSize = pEH->getSizeFromArgs();
+                        if (pL->getSize() < iNewSize)
                         {
-                            //delete pList
-                            delete in.front();
+                            pL->set(iNewSize - 1, new ListUndefined());
                         }
 
-                        if (ret != Callable::OK)
-                        {
-                            std::wostringstream os;
-                            os << _W("unable to update handle");
-                            throw ScilabError(os.str(), 999, pField->location_get());
-                        }
+                        Double* pDblArgs = (*pEH->getArgs())[0]->getAs<Double>();
+                        double* pdblArgs = pDblArgs->get();
 
-                        if (out[0]->isHandle() || out[0]->isStruct())
+                        if ((*iterFields)->getExp() == NULL)
                         {
-                            *_pCurrent = out[0];
-                            (*_pCurrent)->IncreaseRef();
-
-                            //clean *_pArgs to do nt extract previons fields
-                            if (_pArgs && *_pArgs)
+                            // a(x)(y) => a.b(y)
+                            // extract a(x) and push_BACK to extract next level
+                            for (int iLoop = 0; iLoop < pDblArgs->getSize(); iLoop++)
                             {
-                                (*_pArgs)->clear();
+                                ExpHistory* pEHExtract = new ExpHistory(pEH, NULL, (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pL->get((int)pdblArgs[iLoop] - 1));
+                                pEHExtract->setWhereReinsert((int)(pdblArgs[iLoop] - 1));
+                                workFields.push_back(pEHExtract);
                             }
-
                         }
                         else
                         {
-                            *_pCurrent = pCurrent;
+                            // a(x).b
+                            // extract a(x) and push_FRONT to extract b from a(x)
+                            for (int iLoop = 0; iLoop < pDblArgs->getSize(); iLoop++)
+                            {
+                                ExpHistory* pEHExtract = new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), pL->get((int)pdblArgs[iLoop] - 1));
+                                pEHExtract->setWhereReinsert((int)(pdblArgs[iLoop] - 1));
+                                workFields.push_front(pEHExtract);
+                            }
                         }
-
-                        *_pMain = pMain;
-                        return true;
                     }
+                }
+                else
+                {
+                    // a.x, get string "x"
+                    std::wstring pwcsFieldname = (*iterFields)->getExpAsString();
+
+                    // call overload
+                    typed_list* args = new typed_list();
+                    args->push_back(new String(pwcsFieldname.c_str()));
+                    pEH->setArgs(args);
+
+                    InternalType* pExtract = callOverload(*pEH->getExp(), L"6", args, pL, NULL);
+
+                    // append extraction of a.x for next level.
+                    workFields.push_back(new ExpHistory(pEH, (*iterFields)->getExp(), (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract));
+                    workFields.back()->setReinsertion();
+                }
+            }
+        }
+        else if (pITCurrent->isHandle())
+        {
+            // call overload
+            if (pEH->getArgs())
+            {
+                // call overload
+                InternalType* pExtract = callOverload(*pEH->getExp(), L"e", pEH->getArgs(), pITCurrent, NULL);
+
+                if ((*iterFields)->getExp() == NULL)
+                {
+                    // a(x)(y)
+                    // extract a(x) and push_BACK to extract next level
+                    workFields.push_back(new ExpHistory(pEH, NULL, (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract));
+                    workFields.back()->setReinsertion();
+                }
+                else
+                {
+                    // a(x).b
+                    // extract a(x) and push_FRONT to extract b from a(x)
+                    workFields.push_front(new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), pEH->isCellExp(), pExtract));
+                    workFields.front()->setReinsertion();
+                }
+            }
+            else
+            {
+                // a.x, get string "x"
+                std::wstring pwcsFieldname = (*iterFields)->getExpAsString();
 
-                    //call %x_i_h
-                    GraphicHandle* pCurH = pCurrent->getAs<GraphicHandle>();
-                    typed_list in;
-                    typed_list out;
-                    optional_list opt;
-                    ExecVisitor exec;
+                // create arg with next field
+                typed_list* args = new typed_list();
+                args->push_back(new String(pwcsFieldname.c_str()));
+                pEH->setArgs(args);
 
+                // call overload
+                InternalType* pExtract = callOverload(*pEH->getExp(), L"e", args, pITCurrent, NULL);
 
-                    if (pArgs->size() == 1)
+                // append extraction of a.x for next level.
+                workFields.push_back(new ExpHistory(pEH, (*iterFields)->getExp(), (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pExtract));
+                workFields.front()->setReinsertion();
+            }
+        }
+        else if (pITCurrent->isCell())
+        {
+            Cell* pCell = pITCurrent->getAs<Cell>();
+            if (pEH->getArgs() && (*pEH->getArgs())[0]->isString() == false)
+            {
+                if (pEH->isCellExp())
+                {
+                    // a{x} => extract like a(x){[1 2 ...]}
+                    if (pEH->getParent() && pEH->getLevel() == pEH->getParent()->getLevel())
                     {
-                        in.push_back((*pArgs)[0]);
+                        // extract each elements of a(x)
+                        for (int iCell = 0; iCell < pCell->getSize(); iCell++)
+                        {
+                            InternalType* pIT = pCell->get(iCell);
+                            if ((*iterFields)->getExp() == NULL)
+                            {
+                                // a{x}(y)
+                                ExpHistory* pEHChield = new ExpHistory(pEH, NULL, (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pIT);
+                                pEHChield->setWhereReinsert(iCell);
+                                workFields.push_back(pEHChield);
+                            }
+                            else
+                            {
+                                // a{x}.b
+                                ExpHistory* pEHChield = new ExpHistory(pEH, pEH->getExp(), NULL, pEH->getLevel(), false, pIT);
+                                pEHChield->setWhereReinsert(iCell);
+                                workFields.push_front(pEHChield);
+                            }
+                        }
                     }
                     else
                     {
-                        List* pList = new List();
-                        for (int i = 0 ; i < pArgs->size() ; i++)
+                        if (pEH->needResize())
                         {
-                            pList->append((*pArgs)[i]);
-                        }
-                        in.push_back(pList);
-                    }
+                            if (pEH->getArgsDims() == 1)
+                            {
+                                std::wostringstream os;
+                                os << _W("Invalid index.");
+                                throw ScilabError(os.str(), 999, _pExp->location_get());
+                            }
 
-                    std::wstring str = L"%" + _pIT->getShortTypeStr() + L"_i_h";
+                            // resize current Cell
+                            pCell->resize(pEH->getArgsDimsArray(), pEH->getArgsDims());
+                        }
 
-                    in.push_back(_pIT);
-                    in.push_back(pCurrent);
-                    in.front()->IncreaseRef();
-                    _pIT->IncreaseRef();
-                    pCurrent->IncreaseRef();
+                        InternalType* pIT = pCell->extract(pEH->getArgs());
+                        workFields.push_front(new ExpHistory(pEH, pEH->getExp(), pEH->getArgs(), pEH->getLevel(), pEH->isCellExp(), pIT));
+                        workFields.front()->setReinsertion();
+                    }
+                }
+                else
+                {
+                    if ((*iterFields)->isCellExp())
+                    {
+                        // a(x){y}
+                        if (pEH->needResize())
+                        {
+                            if (pEH->getArgsDims() == 1)
+                            {
+                                std::wostringstream os;
+                                os << _W("Invalid index.");
+                                throw ScilabError(os.str(), 999, _pExp->location_get());
+                            }
 
-                    Function* pCall = (Function*)symbol::Context::getInstance()->get(symbol::Symbol(str));
-                    Callable::ReturnValue ret =  pCall->call(in, opt, 1, out, &exec);
-                    in.front()->DecreaseRef();
-                    //_pIT->DecreaseRef();
-                    pCurrent->DecreaseRef();
+                            // resize current Cell
+                            pCell->resize(pEH->getArgsDimsArray(), pEH->getArgsDims());
+                        }
 
-                    if (in.front()->isList())
-                    {
-                        //delete pList
-                        delete in.front();
+                        InternalType* pIT = pCell->extract(pEH->getArgs());
+                        workFields.push_back(new ExpHistory(pEH, (*iterFields)->getExp(), (*iterFields)->getArgs(), (*iterFields)->getLevel(), (*iterFields)->isCellExp(), pIT));
+                        workFields.front()->setReinsertion();
                     }
-
-                    if (ret != Callable::OK)
+                    else
                     {
+                        // only a(x)
                         std::wostringstream os;
-                        os << _W("unable to update handle");
-                        throw ScilabError(os.str(), 999, pField->location_get());
+                        os << _W("Wrong insertion in a Cell.");
+                        throw ScilabError(os.str(), 999, _pExp->location_get());
                     }
                 }
-                else
+            }
+            else
+            {
+                std::wostringstream os;
+                os << _W("Wrong insertion in a Cell.");
+                throw ScilabError(os.str(), 999, _pExp->location_get());
+            }
+        }
+        else
+        {
+            InternalType* pIT = new Struct(1, 1);
+            pEH->setCurrent(pIT);
+            pEH->setReinsertion();
+
+            workFields.push_front(pEH);
+            evalFields.pop_back();
+        }
+
+        if (workFields.front()->getLevel() == (*iterFields)->getLevel())
+        {
+            // go to next field
+            iterFields++;
+        }
+    }
+
+    //*** insert what we have to assign ***//
+    while (workFields.empty() == false)
+    {
+        ExpHistory* pEH = workFields.front();
+        evalFields.push_back(pEH);
+        workFields.pop_front();
+
+        if (pEH->getArgs())
+        {
+            typed_list* pArgs = pEH->getArgs();
+            if (pEH->isCellExp())
+            {
+                Cell* pCell = pEH->getCurrent()->getAs<Cell>();
+                // insert "something" in b{x}
+                if ((*pArgs)[0]->isString())
                 {
                     std::wostringstream os;
-                    os << _W("impossible !");
-                    throw ScilabError(os.str(), 999, pField->location_get());
+                    os << _W("Wrong insertion in a Cell.");
+                    throw ScilabError(os.str(), 999, _pExp->location_get());
                 }
 
+                pCell->insertCell(pArgs, _pAssignValue);
             }
-
-
-            //clean pArgs return by getStructFromExp
-            for (int iArg = 0 ; pArgs != NULL && iArg < pArgs->size() ; iArg++)
+            else
             {
-                if ((*pArgs)[iArg]->isDeletable())
+                // insert "something" in b(x,y)
+                InternalType* pIT = insertionCall(*_pExp, pArgs, pEH->getCurrent(), _pAssignValue);
+                if (pIT == NULL)
                 {
-                    delete (*pArgs)[iArg];
+                    std::wostringstream os;
+                    os << _W("Error in insertion of Struct.");
+                    throw ScilabError(os.str(), 999, _pExp->location_get());
+                }
+
+                if (pEH->setCurrent(pIT))
+                {
+                    pEH->setReinsertion();
                 }
             }
-            delete pArgs;
-            return true;
         }
         else
         {
-            return false;
+            InternalType* pParent = pEH->getParent()->getCurrent();
+            if (pParent->isStruct())
+            {
+                Struct* pStruct = pParent->getAs<Struct>();
+                if (_pAssignValue->isListDelete())
+                {
+                    pStruct->removeField(pEH->getExpAsString());
+                }
+                else
+                {
+                    pStruct->get(pEH->getWhereReinsert())->set(pEH->getExpAsString(), _pAssignValue);
+                }
+            }
+            else if (pParent->isTList() || pParent->isMList())
+            {
+                TList* pTL = pParent->getAs<TList>();
+                if (_pAssignValue->isListDelete() || (pTL->exists(pEH->getExpAsString()) == false))
+                {
+                    typed_list args;
+                    args.push_back(new String(pEH->getExpAsString().c_str()));
+                    InternalType* pIT = insertionCall(*_pExp, &args, pEH->getParent()->getCurrent(), _pAssignValue);
+                    if (pIT == NULL)
+                    {
+                        std::wostringstream os;
+                        os << _W("Error in insertion of TList.");
+                        throw ScilabError(os.str(), 999, _pExp->location_get());
+                    }
+
+                    if (pEH->getParent()->setCurrent(pIT))
+                    {
+                        pEH->getParent()->setReinsertion();
+                        pEH->resetReinsertion();
+                    }
+                }
+                else
+                {
+                    pTL->set(pEH->getExpAsString(), _pAssignValue);
+                }
+            }
+            else
+            {
+                pEH->setCurrent(_pAssignValue);
+                pEH->setReinsertion();
+            }
         }
     }
-    else if (pVar)
+
+    //*** update fields ***//
+    while (evalFields.empty() == false)
     {
-        //a.x : with x not only a SimpleVar
-        types::InternalType *pStr = NULL;
-        types::InternalType *pIT = symbol::Context::getInstance()->get(pVar->name_get());
-        if (pIT == NULL ||
-                (   pIT->isStruct() == false &&
-                    pIT->isHandle() == false &&
-                    pIT->isMList() == false &&
-                    pIT->isTList() == false))
-        {
-            //"a" doest not exist or it is another type, create it with size 1,1 and return it
-            //create new structure variable
-            if (_pArgs == NULL || *_pArgs == NULL)
+        ExpHistory* pEH = evalFields.back();
+        if (pEH->reinsertMe())
+        {
+            ExpHistory* pEHParent = pEH->getParent();
+
+            if (pEHParent == NULL)
             {
-                pStr = new types::Struct(1, 1);
+                symbol::Context::getInstance()->put(pEH->getExp()->name_get(), *pEH->getCurrent());
+                break;
             }
-            else
+
+            typed_list* pParentArgs = pEHParent->getArgs();
+            if (pParentArgs == NULL || pEH->getWhereReinsert() != -1)
             {
-                if ((**_pArgs)[0]->isString())
+                InternalType* pParent = pEHParent->getCurrent();
+                if (pParent->isStruct())
                 {
-                    pStr = new types::Struct(1, 1);
+                    Struct* pStruct = pParent->getAs<Struct>();
+                    pStruct->get(pEH->getWhereReinsert())->set(pEH->getExpAsString(), pEH->getCurrent());
+                    evalFields.pop_back();
+                    continue;
                 }
-                else
+                else if (pParent->isTList() || pParent->isMList())
+                {
+                    TList* pTL = pParent->getAs<TList>();
+                    if (pParentArgs)
+                    {
+                        pTL->set(pEH->getWhereReinsert(), pEH->getCurrent());
+                        evalFields.pop_back();
+                        continue;
+                    }
+                    else
+                    {
+                        if (pTL->exists(pEH->getExpAsString()))
+                        {
+                            pTL->set(pEH->getExpAsString(), pEH->getCurrent());
+                            evalFields.pop_back();
+                            continue;
+                        }
+
+                        pParentArgs = new typed_list();
+                        pParentArgs->push_back(new String(pEH->getExpAsString().c_str()));
+                    }
+                }
+                else if (pParent->isCell())
                 {
-                    Struct* p = new Struct(1, 1);
-                    pStr = Struct::insertNew(*_pArgs, p)->getAs<Struct>();
-                    delete p;
+                    Cell* pCell = pParent->getAs<Cell>();
+                    if (pEHParent->isCellExp() && pEH->getWhereReinsert() != -1)
+                    {
+                        // a{x}.b => reinsert b in a{x}
+                        pCell->set(pEH->getWhereReinsert(), pEH->getCurrent());
+                        pEHParent->setReinsertion();
+                        evalFields.pop_back();
+                        continue;
+                    }
                 }
             }
-            //Add variable to scope
-            symbol::Context::getInstance()->put(pVar->name_get(), *pStr);
+
+            InternalType* pIT = insertionCall(*_pExp, pParentArgs, pEHParent->getCurrent(), pEH->getCurrent());
+            if (pIT == NULL)
+            {
+                std::wostringstream os;
+                os << _W("Error in insertion of Struct.");
+                throw ScilabError(os.str(), 999, _pExp->location_get());
+            }
+
+            if (pEHParent->setCurrent(pIT))
+            {
+                pEHParent->setReinsertion();
+            }
+
+            if (pEHParent->getArgs() == NULL)
+            {
+                delete pParentArgs;
+            }
         }
-        else if (pIT->isHandle() || pIT->isStruct())
+
+        evalFields.pop_back();
+    }
+
+    return symbol::Context::getInstance()->get(pFirstField->getExp()->name_get());
+}
+
+InternalType* insertionCall(const Exp& e, typed_list* _pArgs, InternalType* _pVar, InternalType* _pInsert)
+{
+    InternalType* pOut = NULL;
+    //fisrt extract implicit list
+    if (_pInsert->isColon())
+    {
+        //double* pdbl = NULL;
+        //_pInsert = new Double(-1, -1, &pdbl);
+        //pdbl[0] = 1;
+        _pInsert = Double::Identity(-1, -1);
+    }
+    else if (_pInsert->isImplicitList())
+    {
+        InternalType *pIL = _pInsert->getAs<ImplicitList>()->extractFullMatrix();
+        if (pIL)
         {
-            pStr = pIT;
+            _pInsert = pIL;
         }
-        else
+    }
+    else if (_pInsert->isContainer() && _pInsert->isRef())
+    {
+        //std::cout << "assign container type during insertion" << std::endl;
+        //InternalType* pIL = _pInsert->clone();
+        //_pInsert = pIL;
+    }
+
+    if (_pInsert->isDouble() && _pInsert->getAs<Double>()->isEmpty() && _pVar == NULL)
+    {
+        // l(x) = [] when l is not defined => create l = []
+        pOut = Double::Empty();
+    }
+    else if (_pInsert->isDouble() && _pInsert->getAs<Double>()->isEmpty() && _pVar->isStruct() == false && _pVar->isList() == false)
+    {
+        //insert [] so deletion except for Struct and List which can insert []
+        if (_pVar->isDouble())
         {
-            //TList or MList, work will be done outside
-            return false;
+            pOut = _pVar->getAs<Double>()->remove(_pArgs);
         }
-
-        if (*_pMain == NULL)
+        else if (_pVar->isString())
         {
-            *_pMain = pStr;
+            pOut = _pVar->getAs<String>()->remove(_pArgs);
+        }
+        else if (_pVar->isCell())
+        {
+            pOut = _pVar->getAs<Cell>()->remove(_pArgs);
+        }
+        else if (_pVar->isBool())
+        {
+            pOut = _pVar->getAs<Bool>()->remove(_pArgs);
+        }
+        else if (_pVar->isPoly())
+        {
+            pOut = _pVar->getAs<Polynom>()->remove(_pArgs);
+        }
+        else if (_pVar->isInt8())
+        {
+            pOut = _pVar->getAs<Int8>()->remove(_pArgs);
+        }
+        else if (_pVar->isUInt8())
+        {
+            pOut = _pVar->getAs<UInt8>()->remove(_pArgs);
+        }
+        else if (_pVar->isInt16())
+        {
+            pOut = _pVar->getAs<Int16>()->remove(_pArgs);
+        }
+        else if (_pVar->isUInt16())
+        {
+            pOut = _pVar->getAs<UInt16>()->remove(_pArgs);
+        }
+        else if (_pVar->isInt32())
+        {
+            pOut = _pVar->getAs<Int32>()->remove(_pArgs);
+        }
+        else if (_pVar->isUInt32())
+        {
+            pOut = _pVar->getAs<UInt32>()->remove(_pArgs);
+        }
+        else if (_pVar->isInt64())
+        {
+            pOut = _pVar->getAs<Int64>()->remove(_pArgs);
+        }
+        else if (_pVar->isUInt64())
+        {
+            pOut = _pVar->getAs<UInt64>()->remove(_pArgs);
+        }
+        else if (_pVar->isStruct())
+        {
+            // a("b") = [] is not a deletion !!
+            Struct* pStr = _pVar->getAs<Struct>();
+
+            pOut = _pVar->getAs<Struct>()->insert(_pArgs, _pInsert);
         }
-        *_pCurrent = pStr;
-        return true;
     }
-    else if (pCall)
+    else if (_pVar == NULL || (_pVar->isDouble() && _pVar->getAs<Double>()->getSize() == 0))
     {
-        //a(x,y)
-        ExecVisitor execMe;
-        InternalType* pCurrent = NULL;
+        //insert in a new variable or []
+        //call static insert function
+        //if _pVar == NULL and pArg is single string, it's a struct creation
+        if ((*_pArgs)[0]->isString())
+        {
+            String *pS = (*_pArgs)[0]->getAs<types::String>();
+            Struct* pStr = new Struct(1, 1);
 
-        typed_list *pCurrentArgs = execMe.GetArgumentList(pCall->args_get());
-        typed_list *pReturnedArgs = NULL;
+            if (_pArgs->size() != 1 || pS->isScalar() == false)
+            {
+                //manage error
+                std::wostringstream os;
+                os << _W("Invalid Index.\n");
+                throw ScilabError(os.str(), 999, e.location_get());
+            }
 
-        //Struct* pStruct = Struct::insertNew(pArgs, new Struct(1,1))->getAs<Struct>();
-        if (*_pMain == NULL)
+            pStr->addField(pS->get(0));
+            pStr->get(0)->set(pS->get(0), _pInsert);
+            pOut = pStr;
+        }
+        else
         {
-            //a is the new main but can be a complex expression
-            //bool bOK = getStructFromExp(&pCall->name_get(), _pMain, &pCurrent, &pArgs, pStruct);
-            bool bOK = getStructFromExp(&pCall->name_get(), _pMain, &pCurrent, &pReturnedArgs, NULL);
-            if (bOK == false)
+            switch (_pInsert->getType())
             {
-                return false;
+                case InternalType::RealDouble :
+                    pOut = Double::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealString :
+                    pOut = String::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealCell :
+                    pOut = Cell::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealBool :
+                    pOut = Bool::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealPoly :
+                    pOut = Polynom::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealInt8 :
+                    pOut = Int8::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealUInt8 :
+                    pOut = UInt8::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealInt16 :
+                    pOut = Int16::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealUInt16 :
+                    pOut = UInt16::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealInt32 :
+                    pOut = Int32::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealUInt32 :
+                    pOut = UInt32::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealInt64 :
+                    pOut = Int64::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealUInt64 :
+                    pOut = UInt64::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealSparse :
+                    pOut = Sparse::insertNew(_pArgs, _pInsert);
+                    break;
+                case InternalType::RealSparseBool :
+                    pOut = SparseBool::insertNew(_pArgs, _pInsert);
+                    break;
+                default :
+                {
+                    // overload
+                    types::Double* pEmpty = types::Double::Empty();
+                    pOut = callOverload(e, L"i", _pArgs, _pInsert, pEmpty);
+                    delete pEmpty;
+                    break;
+                }
             }
+        }
+    }
+    else
+    {
+        //call type insert function
+        InternalType* pRet = NULL;
 
-            if ((*pCurrentArgs)[0]->isString())
+        //check types compatibilties
+        if (_pVar->isDouble() && _pInsert->isDouble())
+        {
+            pRet = _pVar->getAs<Double>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isDouble() && _pInsert->isSparse())
+        {
+            Sparse* pSp = _pInsert->getAs<Sparse>();
+            Double* pD = new Double(pSp->getRows(), pSp->getCols(), pSp->isComplex());
+            pSp->fill(*pD);
+            pRet = _pVar->getAs<Double>()->insert(_pArgs, pD);
+            free(pD);
+        }
+        else if (_pVar->isString() && _pInsert->isString())
+        {
+            pRet = _pVar->getAs<String>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isCell() && _pInsert->isCell())
+        {
+            pRet = _pVar->getAs<Cell>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isBool() && _pInsert->isBool())
+        {
+            pRet = _pVar->getAs<Bool>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isSparse() && _pInsert->isSparse())
+        {
+            pRet = _pVar->getAs<Sparse>()->insert(_pArgs, _pInsert->getAs<Sparse>());
+        }
+        else if (_pVar->isSparse() && _pInsert->isDouble())
+        {
+            pRet = _pVar->getAs<Sparse>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isSparseBool() && _pInsert->isSparseBool())
+        {
+            pRet = _pVar->getAs<SparseBool>()->insert(_pArgs, _pInsert->getAs<SparseBool>());
+        }
+        else if (_pVar->isSparseBool() && _pInsert->isBool())
+        {
+            pRet = _pVar->getAs<SparseBool>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isDouble() && _pInsert->isPoly())
+        {
+            Double* pDest = _pVar->getAs<Double>();
+            Polynom* pIns = _pInsert->getAs<Polynom>();
+            Polynom* pP = new Polynom(pIns->getVariableName(), pDest->getDims(), pDest->getDimsArray());
+            pP->setComplex(pDest->isComplex());
+
+            for (int idx = 0 ; idx < pP->getSize() ; idx++)
+            {
+                double* pR = NULL;
+                double* pI = NULL;
+                if (pP->isComplex())
+                {
+                    SinglePoly* pS = new SinglePoly(&pR, &pI, 1);
+                    double dblR = pDest->get(idx);
+                    double dblI = pDest->getImg(idx);
+                    pS->setCoef(&dblR, &dblI);
+                    pP->set(idx, pS);
+                    delete pS;
+                }
+                else
+                {
+                    SinglePoly* pS = new SinglePoly(&pR, 1);
+                    double dblR = pDest->get(idx);
+                    pS->setCoef(&dblR, NULL);
+                    pP->set(idx, pS);
+                    delete pS;
+                }
+            }
+
+            pRet = pP->insert(_pArgs, pIns);
+            pDest->DecreaseRef();
+        }
+        else if (_pVar->isPoly() && _pInsert->isDouble())
+        {
+            Polynom* pDest = _pVar->getAs<Polynom>();
+            Double* pIns = _pInsert->getAs<Double>();
+            Polynom* pP = new Polynom(pDest->getVariableName(), pIns->getDims(), pIns->getDimsArray());
+            pP->setComplex(pIns->isComplex());
+
+            for (int idx = 0 ; idx < pP->getSize() ; idx++)
             {
-                String* pS = (*pCurrentArgs)[0]->getAs<String>();
-                if (pCurrentArgs->size() != 1 || pS->isScalar() == false)
+                double* pR = NULL;
+                double* pI = NULL;
+                if (pP->isComplex())
+                {
+                    SinglePoly* pS = new SinglePoly(&pR, &pI, 1);
+                    double dblR = pIns->get(idx);
+                    double dblI = pIns->getImg(idx);
+                    pS->setCoef(&dblR, &dblI);
+                    pP->set(idx, pS);
+                    delete pS;
+                }
+                else
+                {
+                    SinglePoly* pS = new SinglePoly(&pR, 1);
+                    double dblR = pIns->get(idx);
+                    pS->setCoef(&dblR, NULL);
+                    pP->set(idx, pS);
+                    delete pS;
+                }
+            }
+            pRet = pDest->insert(_pArgs, pP);
+            delete pP;
+        }
+        else if (_pVar->isPoly() && _pInsert->isPoly())
+        {
+            pRet = _pVar->getAs<Polynom>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isInt8() && _pInsert->isInt8())
+        {
+            pRet = _pVar->getAs<Int8>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isUInt8() && _pInsert->isUInt8())
+        {
+            pRet = _pVar->getAs<UInt8>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isInt16() && _pInsert->isInt16())
+        {
+            pRet = _pVar->getAs<Int16>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isUInt16() && _pInsert->isUInt16())
+        {
+            pRet = _pVar->getAs<UInt16>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isInt32() && _pInsert->isInt32())
+        {
+            pRet = _pVar->getAs<Int32>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isUInt32() && _pInsert->isUInt32())
+        {
+            pRet = _pVar->getAs<UInt32>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isInt64() && _pInsert->isInt64())
+        {
+            pRet = _pVar->getAs<Int64>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isUInt64() && _pInsert->isUInt64())
+        {
+            pRet = _pVar->getAs<UInt64>()->insert(_pArgs, _pInsert);
+        }
+        else if (_pVar->isStruct())
+        {
+            Struct* pStruct = _pVar->getAs<Struct>();
+            // insert something in a field of a struct
+            if (_pArgs->size() == 1 && (*_pArgs)[0]->isString())
+            {
+                //s("x") = y
+                String *pS = (*_pArgs)[0]->getAs<types::String>();
+                if (pS->isScalar() == false)
                 {
                     //manage error
                     std::wostringstream os;
                     os << _W("Invalid Index.\n");
-                    throw ScilabError(os.str(), 999, (*(pCall->args_get().begin()))->location_get());
+                    throw ScilabError(os.str(), 999, e.location_get());
                 }
 
-                wchar_t* pFieldName = pS->get(0);
-
-
-                if (pCurrent->isStruct())
+                pStruct->addField(pS->get(0));
+                for (int i = 0; i < pStruct->getSize(); i++)
                 {
-                    Struct* pStr = NULL;
-                    Struct *pCurStr = pCurrent->getAs<Struct>();
-                    if (pReturnedArgs && (*pReturnedArgs)[0]->isString() == false)
-                    {
-                        pStr = pCurStr->extractWithoutClone(pReturnedArgs)->getAs<Struct>();
-                        pStr->setCloneInCopyValue(false);
-                    }
-                    else
-                    {
-                        pStr = pCurStr;
-                    }
+                    pStruct->get(i)->set(pS->get(0), _pInsert);
+                }
 
-                    SingleStruct* pSS = pStr->get(0);
+                pRet = pStruct;
+            }
+            else // insert something in a struct
+            {
+                if (_pInsert->isStruct())
+                {
+                    String* pStrFieldsName = pStruct->getFieldNames();
+                    Struct* pStructInsert = _pInsert->clone()->getAs<Struct>();
+                    String* pStrInsertFieldsName = pStructInsert->getFieldNames();
+                    Struct* pStructRet = NULL;
 
-                    //check if field already exists
-                    if (pStr->exists(pFieldName))
+                    // insert fields of pStruct in pStructInsert
+                    for (int i = pStrFieldsName->getSize(); i > 0; i--)
                     {
-                        InternalType* pField = pSS->get(pFieldName);
-                        if (pField->isStruct())
+                        if (pStructInsert->exists(pStrFieldsName->get(i - 1)) == false)
                         {
-                            pStr = pField->getAs<Struct>();
+                            pStructInsert->addFieldFront(pStrFieldsName->get(i - 1));
                         }
                         else
                         {
-                            //erase previous value by a struct(1,1)
-                            pSS->set(pFieldName, new Struct(1, 1));
-                            pStr = pSS->get(pFieldName)->getAs<Struct>();
+                            std::wstring pwcsField = pStrFieldsName->get(i - 1);
+                            List* pLExtract = pStructInsert->extractFieldWithoutClone(pwcsField);
+
+                            for (int i = 0; i < pLExtract->getSize(); i++)
+                            {
+                                // protect element wich are not cloned before call removeField.
+                                pLExtract->get(i)->IncreaseRef();
+                            }
+
+                            pStructInsert->removeField(pwcsField);
+                            pStructInsert->addFieldFront(pwcsField);
+
+                            for (int i = 0; i < pLExtract->getSize(); i++)
+                            {
+                                // set elements in the new position
+                                pStructInsert->get(i)->set(pwcsField, pLExtract->get(i));
+                            }
                         }
                     }
-                    else
-                    {
-                        //field does not exist
-                        pCurStr->addField(pFieldName);
-                        pSS->set(pFieldName, new Struct(1, 1));
-                        pCurrent = pSS->get(pFieldName);
-                    }
 
-                    if (pReturnedArgs && (*pReturnedArgs)[0]->isString() == false)
-                    {
-                        pSS->IncreaseRef();
-                        delete pStr;
-                        pSS->DecreaseRef();
+                    // insert elements in following pArgs
+                    pRet = pStruct->insert(_pArgs, pStructInsert);
+                    pStructRet = pRet->getAs<Struct>();
 
-                        //clean pReturnedArgs return by GetArgumentList
-                        for (int iArg = 0 ; iArg < pReturnedArgs->size() ; iArg++)
+                    // insert fields of pStructInsert in pRet
+                    for (int i = 0; i < pStrInsertFieldsName->getSize(); i++)
+                    {
+                        if (pStructRet->exists(pStrInsertFieldsName->get(i)) == false)
                         {
-                            if ((*pReturnedArgs)[iArg]->isDeletable())
-                            {
-                                delete (*pReturnedArgs)[iArg];
-                            }
+                            pStructRet->addField(pStrInsertFieldsName->get(i));
                         }
-                        delete pReturnedArgs;
                     }
                 }
                 else
                 {
-                    //handle
-                    GraphicHandle* pCurH = pCurrent->getAs<GraphicHandle>();
+                    pRet = callOverload(e, L"i", _pArgs, _pInsert, _pVar);
                 }
             }
-            else
+        }
+        else if (_pVar->isTList() || _pVar->isMList())
+        {
+            TList* pTL = _pVar->getAs<TList>();
+            if (_pArgs->size() == 1)
             {
-                /*try to extract sub struct, if it fails, resize the struct and try again*/
-                if (pCurrent->isStruct())
+                if ((*_pArgs)[0]->isString())
                 {
-                    Struct* pCurStr = pCurrent->getAs<Struct>();
-                    InternalType* pIT = pCurStr->extract(pCurrentArgs);
-                    if (pIT == NULL)
+                    //s("x") = y
+                    String *pS = (*_pArgs)[0]->getAs<types::String>();
+                    if (pS->isScalar() == false)
                     {
-                        //fail to extract, pCurrent is not enough big, resize it !
-                        Struct* p = new Struct(1, 1);
-                        pCurStr->insert(pCurrentArgs, p); //insert empty struct, caller will assign the good value
-                        delete p;
+                        //manage error
+                        std::wostringstream os;
+                        os << _W("Invalid Index.\n");
+                        throw ScilabError(os.str(), 999, e.location_get());
                     }
-                    else
+
+                    if (_pInsert->isListDelete())
+                    {
+                        return callOverload(e, L"i", _pArgs, _pInsert, _pVar);
+                    }
+
+                    if (pTL->exists(pS->get(0)))
                     {
-                        delete pIT;
+                        pTL->set(pS->get(0), _pInsert);
+                        pRet = pTL;
                     }
+                    else
+                    {
+                        return callOverload(e, L"i", _pArgs, _pInsert, _pVar);
 
-                    *_pArgs = pCurrentArgs;
+                        //ExecVisitor exec;
+                        //types::typed_list in;
+                        //types::typed_list out;
+                        //std::wstring function_name = L"%l_e";
+
+                        //_pInsert->IncreaseRef();
+                        //in.push_back(_pInsert);
+
+                        //Overload::call(function_name, in, 1, out, &exec);
+                        //_pInsert->DecreaseRef();
+
+                        //if (out.size() != 0)
+                        //{
+                        //    pRet = in[0];
+                        //}
+                    }
                 }
                 else
                 {
-                    //handle
-                    GraphicHandle* pCurH = pCurrent->getAs<GraphicHandle>();
-                    InternalType* pIT = pCurH->extract(pCurrentArgs);
-                    if (pIT == NULL)
+                    // s(x)
+                    if (_pVar->isMList())
                     {
-                        //manage error
-                        std::wostringstream os;
-                        os << _W("Invalid Index.\n");
-                        throw ScilabError(os.str(), 999, (*(pCall->args_get().begin()))->location_get());
+                        pRet = callOverload(e, L"i", _pArgs, _pInsert, _pVar);
                     }
                     else
                     {
-                        delete pIT;
+                        pRet = pTL->insert(_pArgs, _pInsert);
                     }
-
-                    *_pArgs = pCurrentArgs;
                 }
             }
+            else
+            {
+                if (_pVar->isMList())
+                {
+                    pRet = callOverload(e, L"i", _pArgs, _pInsert, _pVar);
+                }
+                else
+                {
+                    // call the overload if it exists.
+                    pRet = callOverload(e, L"i", _pArgs, _pInsert, _pVar);
+                    if (pRet == NULL)
+                    {
+                        // else normal insert
+                        pRet = pTL->insert(_pArgs, _pInsert);
+                    }
+                }
+            }
+        }
+        else if (_pVar->isList())
+        {
+            pRet = _pVar->getAs<List>()->insert(_pArgs, _pInsert);
+            if (pRet == NULL)
+            {
+                // call overload
+                pRet = callOverload(e, L"i", _pArgs, _pInsert, _pVar);
+            }
+        }
+        else if (_pVar->isHandle())
+        {
+            if (_pArgs->size() == 1 && (*_pArgs)[0]->isString())
+            {
+                //s(["x"])
+                types::GraphicHandle* pH = _pVar->getAs<types::GraphicHandle>();
+                types::String *pS = (*_pArgs)[0]->getAs<types::String>();
+                typed_list in;
+                typed_list out;
+                optional_list opt;
+                ExecVisitor exec;
+
+                in.push_back(pH);
+                in.push_back(pS);
+                in.push_back(_pInsert);
+
+                Function* pCall = (Function*)symbol::Context::getInstance()->get(symbol::Symbol(L"set"));
+                Callable::ReturnValue ret =  pCall->call(in, opt, 1, out, &exec);
+                if (ret == Callable::OK)
+                {
+                    pRet = _pVar;
+                }
+            }
+            else
+            {
+                pRet = _pVar->getAs<types::GraphicHandle>()->extract(_pArgs);
+            }
         }
         else
         {
-            //we have a parent, so assign "a" to this parent
-            //(*_pMain)->set(0, pStruct->get(0));
+            // overload
+            pRet = callOverload(e, L"i", _pArgs, _pInsert, _pVar);
         }
-        *_pCurrent = pCurrent;
-        return true;
-    }
-    else if (pCell)
-    {
-    }
-    else
-    {
-        std::wostringstream os;
-        os << _W("Unknown expression");
-        //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
-        throw ScilabError(os.str(), 999, _pExp->location_get());
+
+        pOut = pRet;
     }
-    return false;
+    return pOut;
 }
 
 void callOnPrompt(void)
index e46c0aa..1c5c59f 100644 (file)
@@ -41,7 +41,7 @@ Function::ReturnValue sci_size(types::typed_list &in, int _iRetCount, types::typ
             // Dedicated case for lists.
         case InternalType::RealMList:
         {
-            std::wstring wstFuncName = L"%"  + in[0]->getTypeStr() + L"_size";
+            std::wstring wstFuncName = L"%"  + in[0]->getShortTypeStr() + L"_size";
             Overload::call(wstFuncName, in, _iRetCount, out, new ExecVisitor());
             break;
         }
index 000d1e0..09f29d4 100644 (file)
@@ -202,7 +202,7 @@ Function::ReturnValue sci_mfprintf(types::typed_list &in, int _iRetCount, types:
     }
 
     int iNewLine = 0;
-    wcsStringToWrite = scilab_sprintf(L"mfprintf", wcsInput, in, pArgs, iNumberPercent, &nbrOfLines, &iNewLine);
+    wcsStringToWrite = scilab_sprintf("mfprintf", wcsInput, in, pArgs, iNumberPercent, &nbrOfLines, &iNewLine);
 
     if (isSTD)
     {
index 7d15955..a2b5b02 100644 (file)
@@ -173,4 +173,10 @@ public :
     static int Load();
 };
 
+class XmlModule : public GenericModule
+{
+public :
+    static int Load();
+};
+
 #endif /* !__DYNAMIC_MODULES_HXX_ */
index 9e8eaad..8cf7ec0 100644 (file)
@@ -561,3 +561,21 @@ int CompletionModule::Load()
 
     return 1;
 }
+
+int XmlModule::Load()
+{
+    wstring wstModuleName = L"xml";
+#ifdef _MSC_VER
+    wchar_t* pwstLibName = buildModuleDynLibraryNameW(wstModuleName.c_str(), DYNLIB_NAME_FORMAT_1);
+#else
+    wchar_t* pwstLibName = buildModuleDynLibraryNameW(wstModuleName.c_str(), DYNLIB_NAME_FORMAT_3);
+#endif
+    vectGateway vect = loadGatewaysName(wstModuleName);
+
+    for (int i = 0 ; i < (int)vect.size() ; i++)
+    {
+        symbol::Context::getInstance()->addFunction(types::Function::createFunction(vect[i].wstFunction, vect[i].wstName, pwstLibName, vect[i].iType, NULL, wstModuleName));
+    }
+
+    return 1;
+}
index acefb57..9b690e4 100644 (file)
@@ -330,6 +330,7 @@ bool FuncManager::CreateModuleList(void)
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"data_structures", &DataStructuresModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"call_scilab", &CallScilabModule::Load));
     m_ModuleMap.insert(pair<wstring, GW_MOD>(L"completion", &CompletionModule::Load));
+    m_ModuleMap.insert(pair<wstring, GW_MOD>(L"xml", &XmlModule::Load));
 
     if (ConfigVariable::getScilabMode() != SCILAB_NWNI)
     {
index 5969ae0..1e970c8 100644 (file)
@@ -18,7 +18,7 @@
 
  Don't touch if you do not know what you are doing
 -->
-<module name="sound">
+<module name="graphic_export">
     <gateway name="sci_xs2bmp"  function="xs2bmp"   type="0" />
     <gateway name="sci_xs2gif"  function="xs2gif"   type="0" />
     <gateway name="sci_xs2jpg"  function="xs2jpg"   type="0" />
index d37a582..b28d246 100644 (file)
@@ -31,7 +31,7 @@ typedef struct
     types::InternalType::RealType type;
 } ArgumentPosition;
 
-OUTPUT_STREAM_IMPEXP_GW wchar_t** scilab_sprintf(wchar_t* _pwstName, wchar_t* _pwstInput, types::typed_list &in, ArgumentPosition* _pArgs, int _iArgsCount, int* _piOutputRows, int* piNewLine);
+OUTPUT_STREAM_IMPEXP_GW wchar_t** scilab_sprintf(char* _pstName, wchar_t* _pwstInput, types::typed_list &in, ArgumentPosition* _pArgs, int _iArgsCount, int* _piOutputRows, int* piNewLine);
 
 
 #endif /* !__SCILAB_SPRINTF_HXX__ */
index b5885f7..187d9a8 100644 (file)
@@ -120,7 +120,7 @@ types::Callable::ReturnValue sci_mprintf(types::typed_list &in, int _iRetCount,
 
     int iOutputRows = 0;
     int iNewLine = 0;
-    wchar_t** pwstOutput = scilab_sprintf(L"mprintf", pwstInput, in, pArgs, iNumberPercent, &iOutputRows, &iNewLine);
+    wchar_t** pwstOutput = scilab_sprintf("mprintf", pwstInput, in, pArgs, iNumberPercent, &iOutputRows, &iNewLine);
 
     for (int i = 0 ; i < iOutputRows ; i++)
     {
index 0ab166f..769fa35 100644 (file)
@@ -117,7 +117,7 @@ types::Callable::ReturnValue sci_msprintf(types::typed_list &in, int _iRetCount,
 
     int iOutputRows = 0;
     int iNewLine = 0;
-    wchar_t** pwstOutput = scilab_sprintf(L"msprintf", pwstInput, in, pArgs, iNumberPercent, &iOutputRows, &iNewLine);
+    wchar_t** pwstOutput = scilab_sprintf("msprintf", pwstInput, in, pArgs, iNumberPercent, &iOutputRows, &iNewLine);
 
     types::String* pOut = new types::String(iOutputRows, 1);
     pOut->set(pwstOutput);
index 1d69bb2..a9662fc 100644 (file)
@@ -32,7 +32,7 @@ extern "C"
 
 static wchar_t* replaceAndCountLines(wchar_t* _pwstInput, int* _piLines, int* _piNewLine);
 
-wchar_t** scilab_sprintf(wchar_t* _pwstName, wchar_t* _pwstInput, typed_list &in, ArgumentPosition* _pArgs, int _iArgsCount, int* _piOutputRows, int* _piNewLine)
+wchar_t** scilab_sprintf(char* _pstName, wchar_t* _pwstInput, typed_list &in, ArgumentPosition* _pArgs, int _iArgsCount, int* _piOutputRows, int* _piNewLine)
 {
     wchar_t** pwstOutput        = NULL;
     wchar_t* pwstFirstOutput    = NULL;
@@ -173,7 +173,8 @@ wchar_t** scilab_sprintf(wchar_t* _pwstName, wchar_t* _pwstInput, typed_list &in
                     case L'X' : //HEX
                         if (_pArgs[iPosArg].type != InternalType::RealDouble)
                         {
-                            Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), _pwstName);
+                            Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), _pstName);
+                            *_piOutputRows = 0;
                             return NULL;
                         }
                         pToken[iToken].outputType = InternalType::RealInt32;
@@ -186,7 +187,8 @@ wchar_t** scilab_sprintf(wchar_t* _pwstName, wchar_t* _pwstInput, typed_list &in
                     case L'G' : //shorter between float or EXP
                         if (_pArgs[iPosArg].type != InternalType::RealDouble)
                         {
-                            Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), _pwstName);
+                            Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), _pstName);
+                            *_piOutputRows = 0;
                             return NULL;
                         }
                         pToken[iToken].outputType = InternalType::RealDouble;
@@ -196,7 +198,8 @@ wchar_t** scilab_sprintf(wchar_t* _pwstName, wchar_t* _pwstInput, typed_list &in
                     case L'c' :
                         if (_pArgs[iPosArg].type != InternalType::RealString)
                         {
-                            Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), _pwstName);
+                            Scierror(999, _("%s: Wrong number of input arguments: data doesn't fit with format.\n"), _pstName);
+                            *_piOutputRows = 0;
                             return NULL;
                         }
                         pToken[iToken].outputType = InternalType::RealString;
@@ -217,7 +220,7 @@ wchar_t** scilab_sprintf(wchar_t* _pwstName, wchar_t* _pwstInput, typed_list &in
 
         int iLoop = 1;
         int iFirstArg = 1;
-        if (wcscmp(_pwstName, L"mfprintf") == 0)
+        if (strcmp(_pstName, "mfprintf") == 0)
         {
             iFirstArg = 2;
         }
@@ -267,6 +270,7 @@ wchar_t** scilab_sprintf(wchar_t* _pwstName, wchar_t* _pwstInput, typed_list &in
                     int posS = (int)wcscspn(pToken[i].pwstToken, L"s");
                     if (!posS || !posC)
                     {
+                        *_piOutputRows = 0;
                         return NULL;
                     }
                     if (posC < posS)
index a693cac..442ffe3 100644 (file)
@@ -167,6 +167,7 @@ public :
     static void setError();
     static bool isError();
     static void resetError();
+
     //Last Error Line
 private :
     static int m_iErrorLine;
index c43cf6f..80a88ae 100644 (file)
@@ -82,6 +82,7 @@ void setLastError(int _iError, const wchar_t* _pwstError, int _iLine, const wcha
     setLastErrorLine(_iLine);
     setLastErrorFunction(_pwstFunction);
 }
+
 /*--------------------------------------------------------------------------*/
 void SetError()
 {
@@ -96,4 +97,4 @@ int isError()
 void resetError()
 {
     ConfigVariable::resetError();
-}
\ No newline at end of file
+}
index 0471d33..7637774 100644 (file)
@@ -66,6 +66,7 @@ public :
     InternalType*                   insert(typed_list* _pArgs, InternalType* _pSource);
     std::vector<InternalType*>      extract(typed_list* _pArgs);
     virtual InternalType*           get(const int _iIndex);
+    virtual bool                    set(const int _iIndex, InternalType* _pIT);
 
     /* return type as string ( double, int, cell, list, ... )*/
     virtual std::wstring            getTypeStr()
index b29f53d..e67a7db 100644 (file)
@@ -46,7 +46,7 @@ public :
     /* return type as short string ( s, i, ce, l, ... )*/
     virtual std::wstring    getShortTypeStr()
     {
-        return L"";
+        return L"0";
     }
 };
 }
index f01c569..4515134 100644 (file)
@@ -30,7 +30,6 @@ public :
 
 private :
     SingleStruct(SingleStruct *_oListCopyMe);
-    int                                     getFieldIndex(const std::wstring& _field);
 
 public :
     SingleStruct*                           clone();
@@ -49,9 +48,12 @@ public :
     std::vector<InternalType*>              extract(std::list<std::wstring> _stFields);
     String*                                 getFieldNames();
     bool                                    addField(const std::wstring& _sKey);
-    std::vector<InternalType *>             getData();
-    std::vector<std::wstring>               getFields();
-
+    bool                                    addFieldFront(const std::wstring& _sKey);
+    std::list<InternalType *>               getData();
+    std::list<std::wstring>                 getFields();
+    int                                     getFieldIndex(const std::wstring& _field);
+    bool                                    removeField(const std::wstring& _sKey);
+    void                                    addFieldsFront(String* _pStrFieldNames);
 
     /* return type as string ( double, int, cell, list, ... )*/
     virtual std::wstring                    getTypeStr()
@@ -65,8 +67,8 @@ public :
     }
 
 private :
-    std::vector<std::wstring> m_wstFields;
-    std::vector<InternalType *> m_Data;
+    std::list<std::wstring> m_wstFields;
+    std::list<InternalType *> m_Data;
 };
 }
 
index 42d66f1..4e6d6f5 100644 (file)
@@ -13,6 +13,7 @@
 #ifndef __STRUCT_HXX__
 #define __STRUCT_HXX__
 
+#include "list.hxx"
 #include "arrayof.hxx"
 #include "singlestruct.hxx"
 #include "dynlib_types.h"
@@ -81,11 +82,15 @@ public :
     String*                     getFieldNames();
     bool                        exists(const std::wstring& _sKey);
     bool                        addField(const std::wstring& _sKey);
+    bool                        addFieldFront(const std::wstring& _sKey);
+    bool                        removeField(const std::wstring& _sKey);
     bool                        toString(std::wostringstream& ostr);
+    List*                       extractFieldWithoutClone(std::wstring _wstField);
     std::vector<InternalType*>  extractFields(std::vector<std::wstring> _wstFields);
     std::vector<InternalType*>  extractFields(typed_list* _pArgs);
 
-
+    bool                        resize(int* _piDims, int _iDims);
+    bool                        resize(int _iNewRows, int _iNewCols);
 
     /*specials functions to disable clone operation during copydata*/
     InternalType*               insertWithoutClone(typed_list* _pArgs, InternalType* _pSource);
index 46e0c81..14bea7f 100644 (file)
@@ -119,6 +119,11 @@ bool Cell::set(int _iRows, int _iCols, const InternalType* _pIT)
 
 bool Cell::set(int _iIndex, InternalType* _pIT)
 {
+    if (m_pRealData[_iIndex] == _pIT)
+    {
+        return true;
+    }
+
     if (_iIndex < getSize())
     {
         if (m_pRealData[_iIndex] != NULL)
index 25693a8..49a100b 100644 (file)
 #include "function.hxx"
 #include "double.hxx"
 #include "gatewaystruct.hxx"
+#include "lasterror.h"
+
 extern "C"
 {
 #include "core_math.h"
 #include "charEncoding.h"
 #include "Scierror.h"
+#include "sciprint.h"
 #include "localization.h"
 #include "sci_path.h"
 #include "MALLOC.h"
@@ -202,18 +205,19 @@ Function::ReturnValue WrapFunction::call(typed_list &in, optional_list &opt, int
 
     char* pFunctionName = wide_string_to_UTF8(m_wstName.c_str());
 
-    //call gateway (thoses cast should looks  suspicious)
+    //call gateway
     iRet = m_pOldFunc(pFunctionName, reinterpret_cast<int*>(&gStr));
     FREE(pFunctionName);
     if (isError())
     {
         retVal = Callable::Error;
+        resetError();
     }
     else
     {
         for (std::size_t i(0); i != _iRetCount && outOrder[i] != -1 && outOrder[i] != 0 ; ++i)
         {
-            if (outOrder[i] - 1 < inCopy.size())
+            if (outOrder[i] - 1 < in.size())
             {
                 std::size_t const iPos(outOrder[i] - 1);
                 //protect variable to deletion
@@ -234,7 +238,7 @@ Function::ReturnValue WrapFunction::call(typed_list &in, optional_list &opt, int
             }
             else
             {
-                std::size_t const iPos(outOrder[i] - gStr.m_iIn - 1);
+                std::size_t const iPos(outOrder[i] - in.size() - 1);
                 if (tmpOut[iPos]->isDouble() && ((types::Double*)tmpOut[iPos])->isViewAsInteger())
                 {
                     types::Double* pD = tmpOut[iPos]->getAs<types::Double>();
index 8fb8f06..369f67f 100644 (file)
@@ -223,7 +223,10 @@ InternalType* List::insert(typed_list* _pArgs, InternalType* _pSource)
         os << _W("Unable to insert multiple item in a list.\n");
         throw ast::ScilabError(os.str());
     }
-
+    else if (iSeqCount < 0)
+    {
+        return NULL;
+    }
 
     int idx = (int)pArg[0]->getAs<Double>()->get(0);
     if (_pSource->isListDelete())
@@ -320,6 +323,38 @@ InternalType* List::get(const int _iIndex)
     return NULL;
 }
 
+bool List::set(const int _iIndex, InternalType* _pIT)
+{
+    if (_iIndex < 0)
+    {
+        return false;
+    }
+
+    while (m_plData->size() <= _iIndex)
+    {
+        //incease list size and fill with "Undefined"
+        m_plData->push_back(new ListUndefined());
+        m_iSize = getSize();
+    }
+
+    InternalType* pOld = (*m_plData)[_iIndex];
+
+    _pIT->IncreaseRef();
+    (*m_plData)[_iIndex] = _pIT;
+
+    //manage ref on the old value
+    if (pOld)
+    {
+        pOld->DecreaseRef();
+        if (pOld->isDeletable())
+        {
+            delete pOld;
+        }
+    }
+
+    return true;
+}
+
 bool List::operator==(const InternalType& it)
 {
     if (const_cast<InternalType &>(it).isList() == false)
index b0ccebc..77871f3 100644 (file)
@@ -223,7 +223,7 @@ Callable::ReturnValue Macro::call(typed_list &in, optional_list &opt, int _iRetC
             }
 
             List* pVarOut = pOut->getAs<List>();
-            for (int i = 0 ; i < Min(pVarOut->getSize(), _iRetCount) ; i++)
+            for (int i = 0 ; i < Max(pVarOut->getSize(), _iRetCount) ; i++)
             {
                 InternalType* pIT = pVarOut->get(i)->clone();
                 if (pIT->isListUndefined())
index d3058fb..c15d98a 100644 (file)
@@ -33,12 +33,13 @@ SingleStruct::~SingleStruct()
 {
     if (isDeletable() == true)
     {
-        for (int i = 0 ; i < m_Data.size() ; i++)
+        std::list<InternalType*>::iterator iterFieldData;
+        for (iterFieldData = m_Data.begin(); iterFieldData != m_Data.end() ; iterFieldData++)
         {
-            m_Data[i]->DecreaseRef();
-            if (m_Data[i]->isDeletable())
+            (*iterFieldData)->DecreaseRef();
+            if ((*iterFieldData)->isDeletable())
             {
-                delete m_Data[i];
+                delete (*iterFieldData);
             }
         }
     }
@@ -46,33 +47,36 @@ SingleStruct::~SingleStruct()
 
 SingleStruct::SingleStruct(SingleStruct *_oSingleStructCopyMe)
 {
-    std::vector<std::wstring> wstFields = _oSingleStructCopyMe->getFields();
-    std::vector<InternalType *> Data = _oSingleStructCopyMe->getData();
+    std::list<std::wstring> wstFields = _oSingleStructCopyMe->getFields();
+    std::list<InternalType *> Data = _oSingleStructCopyMe->getData();
 
-    for (int i = 0 ; i < Data.size() ; i++)
+    std::list<InternalType*>::iterator iterFieldData;
+    std::list<std::wstring>::iterator iterFieldName = wstFields.begin();
+    for (iterFieldData = Data.begin(); iterFieldData != Data.end() ; iterFieldData++, iterFieldName++)
     {
-        m_wstFields.push_back(wstFields[i]);
-        m_Data.push_back(Data[i]->clone());
+        m_wstFields.push_back(*iterFieldName);
+        m_Data.push_back((*iterFieldData)->clone());
     }
 }
 
-std::vector<InternalType *> SingleStruct::getData()
+std::list<InternalType *> SingleStruct::getData()
 {
     return m_Data;
 }
 
-std::vector<std::wstring> SingleStruct::getFields()
+std::list<std::wstring> SingleStruct::getFields()
 {
     return m_wstFields;
 }
 
 int SingleStruct::getFieldIndex(const std::wstring& _field)
 {
-    for (int i = 0 ; i < m_wstFields.size() ; i++)
+    std::list<std::wstring>::iterator iterFieldNames = m_wstFields.begin();
+    for (int idx = 0; iterFieldNames != m_wstFields.end() ; iterFieldNames++, idx++)
     {
-        if (m_wstFields[i] == _field)
+        if (*iterFieldNames == _field)
         {
-            return i;
+            return idx;
         }
     }
 
@@ -87,24 +91,31 @@ bool SingleStruct::set(const std::wstring& _sKey, InternalType *_typedValue)
         return false;
     }
 
-    /* Look if we are replacing some existing value */
-    if (m_Data[index] != NULL)
+    std::list<InternalType*>::iterator iterFieldData = m_Data.begin();
+    std::advance(iterFieldData, index);
+
+    InternalType* pOld = *iterFieldData;
+    if (pOld != _typedValue)
     {
-        m_Data[index]->DecreaseRef();
-        if (m_Data[index]->isDeletable())
+        /* Look if we are replacing some existing value */
+        if (pOld != NULL)
         {
-            delete m_Data[index];
+            pOld->DecreaseRef();
+            if (pOld->isDeletable())
+            {
+                delete pOld;
+            }
         }
-    }
 
-    if (_typedValue)
-    {
-        _typedValue->IncreaseRef();
-        m_Data[index] = _typedValue;
-    }
-    else
-    {
-        m_Data[index] = NULL;
+        if (_typedValue)
+        {
+            _typedValue->IncreaseRef();
+            *iterFieldData = _typedValue;
+        }
+        else
+        {
+            *iterFieldData = NULL;
+        }
     }
     return true;
 }
@@ -119,7 +130,10 @@ InternalType* SingleStruct::get(const std::wstring& _sKey)
         return NULL;
     }
 
-    return m_Data[index];
+    std::list<InternalType*>::iterator iterFieldData = m_Data.begin();
+    std::advance(iterFieldData, index);
+
+    return *iterFieldData;
 }
 
 bool SingleStruct::exists(const std::wstring& _sKey)
@@ -182,28 +196,42 @@ std::vector<InternalType*> SingleStruct::extract(std::list<std::wstring> _stFiel
 String* SingleStruct::getFieldNames()
 {
     String* pOut = new String((int)m_wstFields.size(), 1);
+    std::list<std::wstring>::iterator iterFieldNames = m_wstFields.begin();
 
-    for (int i = 0 ; i < m_wstFields.size() ; i++)
+    for (int i = 0 ; iterFieldNames != m_wstFields.end() ; iterFieldNames++, i++)
     {
-        pOut->set(i, m_wstFields[i].c_str());
+        pOut->set(i, (*iterFieldNames).c_str());
     }
     return pOut;
 }
 
-bool SingleStruct::toString(std::wostringstream& ostr)
+bool SingleStruct::removeField(const std::wstring& _sKey)
 {
-    if (m_Data.size() == 0)
-    {
-        ostr << L"empty SingleStruct";
-        return true;
-    }
-    else
+    std::list<std::wstring>::iterator iterFieldNames = m_wstFields.begin();
+    std::list<InternalType*>::iterator iterFieldData = m_Data.begin();
+    std::list<std::wstring> wstFields;
+    std::list<InternalType *> Data;
+
+    for (int i = 0; iterFieldNames != m_wstFields.end(); iterFieldNames++, iterFieldData++, i++)
     {
-        for (int i = 0 ; i < m_Data.size() ; i++)
+        if (*iterFieldNames == _sKey)
         {
-            ostr << m_wstFields[i] << L" : " << m_Data[i]->getTypeStr() << std::endl;
+            (*iterFieldData)->DecreaseRef();
+            if ((*iterFieldData)->isDeletable())
+            {
+                delete (*iterFieldData);
+            }
+
+            continue;
         }
+
+        wstFields.push_back(*iterFieldNames);
+        Data.push_back(*iterFieldData);
     }
+
+    m_wstFields = wstFields;
+    m_Data = Data;
+
     return true;
 }
 
@@ -220,4 +248,38 @@ bool SingleStruct::addField(const std::wstring& _sKey)
     m_Data.push_back(Double::Empty());
     return true;
 }
+
+bool SingleStruct::addFieldFront(const std::wstring& _sKey)
+{
+    if (exists(_sKey))
+    {
+        //field already exists, do nothing and return false
+        return false;
+    }
+
+    //not found so add field with []
+    m_wstFields.push_front(_sKey);
+    m_Data.push_front(Double::Empty());
+    return true;
+}
+
+bool SingleStruct::toString(std::wostringstream& ostr)
+{
+    if (m_Data.size() == 0)
+    {
+        ostr << L"empty SingleStruct";
+        return true;
+    }
+    else
+    {
+        std::list<std::wstring>::iterator iterFieldNames;
+        std::list<InternalType*>::iterator iterFieldData = m_Data.begin();
+        for (iterFieldNames = m_wstFields.begin() ; iterFieldNames != m_wstFields.end(); iterFieldNames++, iterFieldData++)
+        {
+            ostr << *iterFieldNames << L" : " << (*iterFieldData)->getTypeStr() << std::endl;
+        }
+    }
+    return true;
+}
+
 }
index 69eccb3..34c2b40 100644 (file)
@@ -134,22 +134,25 @@ bool Struct::set(int _iIndex, SingleStruct* _pIT)
 {
     if (_iIndex < getSize())
     {
-        if (m_pRealData[_iIndex] != NULL)
+        if (m_bDisableCloneInCopyValue && m_pRealData[_iIndex] == _pIT)
         {
-            m_pRealData[_iIndex]->DecreaseRef();
-            if (m_pRealData[_iIndex]->isDeletable())
-            {
-                delete m_pRealData[_iIndex];
-            }
-            else
-            {
-                //std::wcout << L"Found singlestruct with more than one ref(" << m_pRealData[_iIndex]->getRef() << L")" << std::endl;
-            }
+            return true;
         }
 
+        InternalType* pOld = m_pRealData[_iIndex];
+
         m_pRealData[_iIndex] = copyValue(_pIT);
         m_pRealData[_iIndex]->IncreaseRef();
-        //std::wcout << L"set -> " << m_pRealData[_iIndex] << L" : " << m_pRealData[_iIndex]->getRef() << std::endl;
+
+        if (pOld != NULL)
+        {
+            pOld->DecreaseRef();
+            if (pOld->isDeletable())
+            {
+                delete pOld;
+            }
+        }
+
         return true;
     }
     return false;
@@ -159,16 +162,19 @@ bool Struct::set(int _iIndex, const SingleStruct* _pIT)
 {
     if (_iIndex < getSize())
     {
-        if (m_pRealData[_iIndex] != NULL)
+        InternalType* pOld = m_pRealData[_iIndex];
+
+        m_pRealData[_iIndex] = const_cast<SingleStruct*>(_pIT)->clone();
+
+        if (pOld != NULL)
         {
-            m_pRealData[_iIndex]->DecreaseRef();
-            if (m_pRealData[_iIndex]->isDeletable())
+            pOld->DecreaseRef();
+            if (pOld->isDeletable())
             {
-                delete m_pRealData[_iIndex];
+                delete pOld;
             }
         }
 
-        m_pRealData[_iIndex] = const_cast<SingleStruct*>(_pIT)->clone();
         return true;
     }
     return false;
@@ -250,7 +256,7 @@ SingleStruct* Struct::getNullValue()
 Struct* Struct::createEmpty(int _iDims, int* _piDims, bool _bComplex)
 {
     Struct* pStr = new Struct(_iDims, _piDims);
-    pStr->setCloneInCopyValue(m_bDisableCloneInCopyValue);
+    pStr->setCloneInCopyValue(!m_bDisableCloneInCopyValue);
     return pStr;
 }
 
@@ -327,6 +333,32 @@ bool Struct::addField(const std::wstring& _sKey)
     return true;
 }
 
+bool Struct::addFieldFront(const std::wstring& _sKey)
+{
+    if (getSize() == 0)
+    {
+        //change dimension to 1x1 and add field
+        resize(1, 1);
+    }
+
+    for (int i = 0 ; i < getSize() ; i++)
+    {
+        get(i)->addFieldFront(_sKey);
+    }
+
+    return true;
+}
+
+bool Struct::removeField(const std::wstring& _sKey)
+{
+    for (int j = 0; j < getSize(); j++)
+    {
+        get(j)->removeField(_sKey);
+    }
+
+    return true;
+}
+
 bool Struct::toString(std::wostringstream& ostr)
 {
     if (getSize() == 0)
@@ -379,6 +411,17 @@ bool Struct::toString(std::wostringstream& ostr)
     return true;
 }
 
+List* Struct::extractFieldWithoutClone(std::wstring _wstField)
+{
+    List* pL = new List();
+    for (int j = 0 ; j < getSize() ; j++)
+    {
+        pL->set(j, get(j)->get(_wstField));
+    }
+
+    return pL;
+}
+
 std::vector<InternalType*> Struct::extractFields(std::vector<std::wstring> _wstFields)
 {
     std::vector<InternalType*> ResultList;
@@ -416,6 +459,7 @@ std::vector<InternalType*> Struct::extractFields(std::vector<std::wstring> _wstF
     return ResultList;
 }
 
+
 std::vector<InternalType*> Struct::extractFields(typed_list* _pArgs)
 {
     std::vector<InternalType*> ResultList;
@@ -479,7 +523,10 @@ std::vector<InternalType*> Struct::extractFields(typed_list* _pArgs)
         else if (getSize() == 1)
         {
             //return elements
-            ResultList.push_back(get(0)->getData()[iIndex - 3]->clone());
+            std::list<InternalType*> pData = get(0)->getData();
+            std::list<InternalType*>::iterator it = pData.begin();
+            std::advance(it, iIndex - 3);
+            ResultList.push_back((*it)->clone());
         }
         else
         {
@@ -489,7 +536,10 @@ std::vector<InternalType*> Struct::extractFields(typed_list* _pArgs)
             for (int j = 0 ; j < getSize() ; j++)
             {
                 //-2 for fieldlist and dims, -1 for indexed at 0
-                pL->append(get(j)->getData()[iIndex - 3]->clone());
+                std::list<InternalType*> pData = get(j)->getData();
+                std::list<InternalType*>::iterator it = pData.begin();
+                std::advance(it, iIndex - 3);
+                pL->append((*it)->clone());
             }
 
             ResultList.push_back(pL);
@@ -508,6 +558,31 @@ std::vector<InternalType*> Struct::extractFields(typed_list* _pArgs)
     return ResultList;
 }
 
+bool Struct::resize(int _iNewRows, int _iNewCols)
+{
+    int piDims[2] = {_iNewRows, _iNewCols};
+    return resize(piDims, 2);
+}
+
+bool Struct::resize(int* _piDims, int _iDims)
+{
+    bool bRes = ArrayOf::resize(_piDims, _iDims);
+    if (bRes)
+    {
+        // insert field(s) only in new element(s) of current struct
+        String* pFields = getFieldNames();
+        for (int iterField = 0; iterField < pFields->getSize(); iterField++)
+        {
+            for (int iterStruct = 0; iterStruct < getSize(); iterStruct++)
+            {
+                get(iterStruct)->addField(pFields->get(iterField));
+            }
+        }
+    }
+
+    return bRes;
+}
+
 InternalType* Struct::insertWithoutClone(typed_list* _pArgs, InternalType* _pSource)
 {
     //std::wcout << L"insertWithoutClone start" << std::endl;
@@ -532,7 +607,7 @@ InternalType* Struct::extractWithoutClone(typed_list* _pArgs)
 
 void Struct::setCloneInCopyValue(bool _val)
 {
-    m_bDisableCloneInCopyValue = _val;
+    m_bDisableCloneInCopyValue = !_val;
 }
 
 }
index 0915b9a..b38e36a 100644 (file)
@@ -23,7 +23,7 @@
 
 extern "C"
 {
-    #include "os_wcsdup.h"
+#include "os_wcsdup.h"
 }
 
 namespace types
@@ -120,7 +120,6 @@ int TList::getIndexFromString(const std::wstring& _sKey)
 std::vector<InternalType*> TList::extractStrings(const std::list<std::wstring>& _stFields)
 {
     std::vector<InternalType*> Result;
-
     std::list<std::wstring>::const_iterator it;
     for (it = _stFields.begin() ; it != _stFields.end() ; it++)
     {
@@ -154,41 +153,12 @@ std::wstring TList::getShortTypeStr()
 
 bool TList::set(const std::wstring& _sKey, InternalType* _pIT)
 {
-    return set(getIndexFromString(_sKey), _pIT);
+    return List::set(getIndexFromString(_sKey), _pIT);
 }
 
 bool TList::set(const int _iIndex, InternalType* _pIT)
 {
-    if (_iIndex < 0)
-    {
-        return false;
-    }
-
-    while (m_plData->size() < _iIndex)
-    {
-        //incease list size and fill with "Undefined"
-        m_plData->push_back(new ListUndefined());
-        m_iSize = getSize();
-    }
-
-    // replace an existing element
-    if (m_plData->size() > _iIndex)
-    {
-        InternalType* pOld = (*m_plData)[_iIndex];
-        if (pOld && pOld->isDeletable())
-        {
-            delete pOld;
-        }
-
-        (*m_plData)[_iIndex] = _pIT->clone();
-    }
-    else // insert a new element
-    {
-        m_plData->push_back(_pIT->clone());
-    }
-
-    (*m_plData)[_iIndex]->IncreaseRef();
-    return true;
+    return List::set(_iIndex, _pIT);
 }
 
 String* TList::getFieldNames()
@@ -209,16 +179,16 @@ bool TList::toString(std::wostringstream& ostr)
     {
         ostr << wcsVarName << L"()" << std::endl;
     }
-    else if((*m_plData)[0]->isString() &&
-            (*m_plData)[0]->getAs<types::String>()->getSize() > 0 &&
-            wcscmp((*m_plData)[0]->getAs<types::String>()->get(0), L"lss") == 0)
+    else if ((*m_plData)[0]->isString() &&
+             (*m_plData)[0]->getAs<types::String>()->getSize() > 0 &&
+             wcscmp((*m_plData)[0]->getAs<types::String>()->get(0), L"lss") == 0)
     {
         int iPosition = 1;
         wchar_t* wcsDesc[7] = {L"  (state-space system:)", L"= A matrix =", L"= B matrix =", L"= C matrix =", L"= D matrix =", L"= X0 (initial state) =", L"= Time domain ="};
         std::vector<InternalType *>::iterator itValues;
         for (itValues = m_plData->begin() ; itValues != m_plData->end() ; ++itValues, ++iPosition)
         {
-            ostr << "     " << wcsVarName << L"(" << iPosition << L") " << wcsDesc[iPosition-1] << std::endl;
+            ostr << "     " << wcsVarName << L"(" << iPosition << L") " << wcsDesc[iPosition - 1] << std::endl;
             //maange lines
             bool bFinish = (*itValues)->toString(ostr);
             ostr << std::endl;
@@ -240,4 +210,4 @@ bool TList::toString(std::wostringstream& ostr)
     free(wcsVarName);
     return true;
 }
-}
+} // end namespace types
index 067de40..12bdce9 100644 (file)
@@ -84,8 +84,39 @@ int checkIndexesArguments(InternalType* _pRef, typed_list* _pArgsIn, typed_list*
         }
         else if (pIT->isString())
         {
-            //see later for extract from struct or Tlist
-            _pArgsOut->push_back(NULL);
+            String* pStr = pIT->getAs<String>();
+            if (_pArgsIn->size() != 1 || pStr->isScalar() == false)
+            {
+                bUndefine = true;
+                continue;
+            }
+
+            wchar_t* pFieldName = pStr->get(0);
+
+            if (_pRef->isStruct())
+            {
+                Struct* pStruct = _pRef->getAs<Struct>();
+                // pCurrent arg is indexed to 1 unlike the return of "getFieldIndex"
+                int iIndex = pStruct->get(0)->getFieldIndex(pFieldName) + 1;
+                if (iIndex == -1)
+                {
+                    bUndefine = true;
+                    continue;
+                }
+
+                pCurrentArg = new Double((double)iIndex);
+            }
+            else if (_pRef->isList())
+            {
+            }
+            else if (_pRef->isCell())
+            {
+            }
+            else
+            {
+            }
+
+            //_pArgsOut->push_back(NULL);
             bUndefine = true;
             break;
         }
index 93f6c2d..87f38c5 100644 (file)
 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 //
 //
-
-
+oldFuncProt = funcprot(0);
 ref = [0 0 0 ; 0 1 4 ; 0 2 5];
 a = zeros(3,3);a(:) = 1:9;
 b(2:3, 2:3) = a(1:2,1:2);
-
 assert_checkequal(b, ref);
+a=2;
+a.b=3;
+assert_checkequal(a.b, 3);
+a.b.c=4;
+assert_checkequal(a.b.c, 4);
+clear a
+a.b = 2;
+a.c = 3;
+a.d = 4;
+e.f = 7;
+e.d = 55;
+e.g = 12;
+a(2) = e;
+assert_checkequal(fieldnames(a(1)), fieldnames(a(2)));
+assert_checkequal(a(1).d, 4);
+assert_checkequal(a(2).d, 55);
+clear a;
+clear e;
+a.a.a = -2;
+assert_checkequal(a.a.a, -2);
+a(2, 1:3, [2 6 7]).b = 12;
+computed = a.b;
+expected = list();
+for i=1:(2*3*7)
+    expected(i) = [];
+end
+expected(8)  = 12;
+expected(10) = 12;
+expected(12) = 12;
+expected(32) = 12;
+expected(34) = 12;
+expected(36) = 12;
+expected(38) = 12;
+expected(40) = 12;
+expected(42) = 12;
+assert_checkequal(a.b, expected);
+clear a;
+a(1,3).b = 2;
+assert_checkequal(size(a), [1 3]);
+a(5).b = 2;
+assert_checkequal(size(a), [1 5]);
+a(2,3).b = 2;
+assert_checkequal(size(a), [2 5]);
+clear a;
+st.f.e = 22;
+st.f(3).e = 112;
+assert_checkequal(st.f.e, list(22, [], 112));
+st.f(2).j = 1124;
+assert_checkequal(st.f.j, list([], 1124, []));
+clear st;
+//tlist
+tl=tlist(["myTlist" "gg"], 22);
+tll=tlist(["myTlOfTl" "tt"],tl);
+a.b=tll;
+a.b.tt(2) = 4;
+assert_checkequal(a.b.tt(2), 4);
+assert_checkequal(a.b.tt.gg, 4);
+a.b.tt.gg = 5;
+assert_checkequal(a.b.tt(2), 5);
+assert_checkequal(a.b.tt.gg, 5);
+clear a;
+rl = rlist(%s,2);
+a.b = [rl rl rl];
+a.b(2) = [4 4 4];
+assert_checkequal(a.b.num, [4 4 4]);
+assert_checkequal(a.b.den, [2 2 2]);
+clear a;
+a.b = [rl rl rl];
+%r_6 = %r_e;
+a.b(1,2).num = 14;
+assert_checkequal(a.b.num, [%s 14 %s]);
+assert_checkequal(a.b.den, [2 2 2]);
+a(2).b = [rl rl rl] * %s;
+assert_checkequal(size(a), [2 1]);
+assert_checkequal(a(2).b.num, [%s**2 %s**2 %s**2]);
+a.b(1,3).num = 5;
+assert_checkequal(a.b(1).num, [%s 14 5]);
+assert_checkequal(a(2).b.num, [%s**2 %s**2 5]);
+a(3).b.num = 12;
+a.b(1,1).num = -9;
+assert_checkequal(a.b(1).num, [-9 14 5]+(0*%s));
+assert_checkequal(a(2).b.num, [-9 %s**2 5]);
+assert_checkequal(a(3).b.num, -9);
+clear a;
+tt = tlist(["toto" "gg" "ff"] , 12, 13);
+tt(3).c = 23;
+assert_checkequal(tt.ff.c, 23);
+tt(2).c = 22;
+assert_checkequal(tt.gg.c, 22);
+tt([2 3]).d = 99;
+assert_checkequal(tt.gg.d, 99);
+assert_checkequal(tt.ff.d, 99);
+tt([2 3]).d.e = 98;
+assert_checkequal(tt.gg.d.e, 98);
+assert_checkequal(tt.ff.d.e, 98);
+tt([2 3]).d(3).e = 78;
+assert_checkequal(tt.ff.d.e, list(98, [], 78));
+assert_checkequal(tt.gg.d.e, list(98, [], 78));
+tt(2).d.e(4) = 12;
+assert_checkequal(tt.gg.d.e, list([98; 0; 0; 12], [0; 0; 0; 12], [78; 0; 0; 12]));
+clear tt;
+tl=tlist(["toto" "gg"],11);
+function tutu(tl)
+    tl.gg = 12;
+    assert_checkequal(tl.gg, 12);
+endfunction
+tutu(tl);
+assert_checkequal(tl.gg, 11);
+clear tl;
+// mlist
+function varargout=%toto_e(varargin)
+    args = varargin(1);
+    ml = varargin($);
+    varargout = list();
+
+    for i=args
+        if i == 1
+            varargout($+1) = ["toto" "gg" "ff"];
+        elseif i == 2
+            varargout($+1) = ml.gg;
+        elseif i == 3
+            varargout($+1) = ml.ff;
+        end
+    end
+endfunction
+%toto_6 = %toto_e;
+function r=%l_i_toto(varargin)
+    args = varargin(1);
+    l = varargin($-1);
+    r = varargin($);
+    for i=1:size(args, "*")
+        if args(i) == 2
+            r.gg = l(i);
+        elseif args(i) == 3
+            r.ff = l(i);
+        end
+    end
+endfunction
+function r=%st_i_toto(varargin)
+    args = varargin(1);
+    st = varargin($-1);
+    r = varargin($);
+    for i=args
+        if i == 2
+            r.gg = st;
+        elseif i == 3
+            r.ff = st;
+        end
+    end
+endfunction
+mm = tlist(["toto" "gg" "ff"] , 12, 13);
+mm(3).c = 23;
+assert_checkequal(mm.ff.c, 23);
+mm(2).c = 22;
+assert_checkequal(mm.gg.c, 22);
+mm([2 3]).d = 99;
+assert_checkequal(mm.gg.d, 99);
+assert_checkequal(mm.ff.d, 99);
+mm([2 3]).d.e = 98;
+assert_checkequal(mm.gg.d.e, 98);
+assert_checkequal(mm.ff.d.e, 98);
+mm([2 3]).d(3).e = 78;
+assert_checkequal(mm.ff.d.e, list(98, [], 78));
+assert_checkequal(mm.gg.d.e, list(98, [], 78));
+mm(2).d.e(4) = 12;
+assert_checkequal(mm.gg.d.e, list([98; 0; 0; 12], [0; 0; 0; 12], [78; 0; 0; 12]));
+clear mm;
+ml = mlist(["tutu" "t"], 12);
+std=struct("d", 5);
+stc=struct("c", 6);
+a=std;
+assert_checkequal(a, std);
+a=stc;
+assert_checkequal(a, stc);
+ml.t = std;
+assert_checkequal(ml.t.d, 5);
+ml.t = stc;
+assert_checkequal(ml.t.c, 6);
+ml = mlist(["tutu" "t"], 12);
+ml.t = 21;
+assert_checkequal(ml.t, 21);
+function r=%s_i_tutu(varargin)
+    s1=varargin($-1);
+    s2=varargin($);
+    //s2(i,j)=s1 s1 matrix of scalar
+    r=s2;
+    r.t = s1;
+endfunction
+function r=%tutu_e(varargin)
+    r=varargin($).t;
+endfunction
+function r=%st_i_tutu(varargin)
+    s1=varargin($-1);
+    s2=varargin($);
+    //s2(i,j)=s1 s1 is a struct
+    r=s2;
+    r.t = s1;
+endfunction
+%tutu_6 = %tutu_e;
+a.b = ml;
+assert_checkequal(a.b(2), 21);
+a.b(2) = stc;
+assert_checkequal(a.b(2), stc);
+a.b(2).c=44;
+assert_checkequal(a.b(2).c, 44);
+clear a;
+//tlist/mlist
+tl =tlist(["toto" "gg"], tlist(["tutu" "tt" "ee"], 22, 23));
+tl(2)(3)=12;
+assert_checkequal(tl.gg.ee, 12);
+tl(2)(3)(4)=88;
+assert_checkequal(tl.gg.ee, [12; 0; 0; 88]);
+function r=%tata_e(varargin)
+    r=varargin($).ff;
+endfunction
+%tata_6 = %tata_e;
+function r=%toto_i_tata(varargin)
+    s1=varargin($-1);
+    s2=varargin($);
+    //s2(i,j)=s1 s1 is a struct
+    r=s2;
+    r.ff = s1;
+endfunction
+ml = mlist(["tata" "ff"], tl);
+assert_checkequal(ml.ff.gg.ee, [12; 0; 0; 88]);
+ml(2)(2)(3) = 44;
+assert_checkequal(ml.ff.gg.ee, 44);
+clear tl;
+// List
+st.l = list([1 2 3], "toto");
+st.l = 44;
+assert_checkequal(st.l, 44);
+st.l = list([1 2 3], "toto");
+st.l(3) = 55;
+assert_checkequal(st.l(3), 55);
+st.l(1)(2) = -2;
+assert_checkequal(st.l(1), [1 -2 3]);
+st.l(3) = tlist(["toto", "gg"], 112);
+function r=%l_6(varargin)
+    r=[]
+    for in = varargin(2)
+        if type(in) == 16 // tlist
+            if find(varargin(1) == in(1)) <> [] // search field in tlist
+                r = in(varargin(1));
+            end
+        end
+    end
+endfunction
+function l=%st_i_l(varargin)
+    l=list();
+    pos = 0;
+    for in = varargin(3)
+        pos = pos + 1;
+        if type(in) == 16 // tlist
+            in((varargin(1))) = varargin(2);
+        end
+        l(pos) = in;
+    end
+endfunction
+st.l.gg.c = 12;
+assert_checkequal(st.l(1), [1 -2 3]);
+assert_checkequal(st.l(2), "toto");
+assert_checkequal(st.l(3).gg, struct("c", 12));
+clear st;
+st.l = list([1 2 3], "toto");
+function r=%s_i_l(varargin)
+    r=struct(varargin(1), varargin(2)) ;
+endfunction
+st.l.c = 24;
+assert_checkequal(st.l, struct("c", 24));
+clear st;
+// list delete
+tl = tlist(["toto" "gg" "ff" "uu"], 45, 89, 87);
+tl(2) = null();
+assert_checkequal(tl(1), ["toto" "gg" "ff" "uu"]);
+assert_checkequal(tl(2), 89);
+assert_checkequal(tl(3), 87);
+tl = tlist(["toto" "gg" "ff" "uu"], 45, 89, 87);
+//tl.gg = null();
+function l=%0_i_toto(varargin)
+    idx = find(varargin(3)(1) == varargin(1));
+    l = varargin(3);
+    l(idx) = null();
+endfunction
+tl.gg = null();
+assert_checkequal(tl(1), ["toto" "gg" "ff" "uu"]);
+assert_checkequal(tl(2), 89);
+assert_checkequal(tl(3), 87);
+clear tl;
+l = list(["toto" "gg" "ff" "uu"], 45, 89, 87);
+l(2) = null();
+assert_checkequal(l(1), ["toto" "gg" "ff" "uu"]);
+assert_checkequal(l(2), 89);
+assert_checkequal(l(3), 87);
+l = list(["toto" "gg" "ff" "uu"], 45, 89, 87);
+//l.gg = null();
+clear l;
+// cell
+function varargout=%toto_e(varargin)
+    args = varargin(1);
+    ml = varargin($);
+    varargout = list();
 
+    for i=args
+        if i == 1
+            varargout($+1) = ["toto" "ff"];
+        elseif i == 2
+            varargout($+1) = ml.ff;
+        end
+    end
+endfunction
+%toto_6 = %toto_e;
+function ml=%s_i_toto(varargin)
+    args = varargin(1);
+    s = varargin($-1);
+    ml = varargin($);
+    for i=1:size(args, "*")
+        if args(i) == 2
+            ml.ff = s;
+        end
+    end
+endfunction
+tl = tlist(["tutu" "gg"], 12);
+ml = mlist(["toto" "ff"], 22);
+a{2} = 2;
+assert_checkequal(a{2}, 2);
+a{1,3} = tl;
+assert_checkequal(a{5}(1), ["tutu" "gg"]);
+assert_checkequal(a{5}(2), 12);
+a{[3 6]} = ml;
+assert_checkequal(a{3}(1), ["toto" "ff"]);
+assert_checkequal(a{3}(2), 22);
+assert_checkequal(a{6}(1), ["toto" "ff"]);
+assert_checkequal(a{6}(2), 22);
+a{2}.c = 123;
+assert_checkequal(a{2}.c, 123);
+a{2}(3).e = 12;
+assert_checkequal(a{2}.e, list([], [], 12));
+assert_checkequal(a{2}.c, list(123, [], []));
+a{2}.b = 12;
+assert_checkequal(a{2}.b, list(12, 12, 12));
+a{2}.e = 99;
+assert_checkequal(a{2}.e, list(99, 99, 99));
+a{6}(2) = 8;
+assert_checkequal(a{6}(1), ["toto" "ff"]);
+assert_checkequal(a{6}(2), 8);
+a{1, [1 3]}.gg = 14;
+assert_checkequal(a{1}.gg, 14);
+assert_checkequal(a{5}.gg, 14);
+a{1:2, [1 3], 2}.g = "A string";
+assert_checkequal(a{7}.g, "A string");
+assert_checkequal(a{8}.g, "A string");
+assert_checkequal(a{11}.g, "A string");
+assert_checkequal(a{12}.g, "A string");
+clear a;
+a{1,3}.b = 2;
+assert_checkequal(size(a), [1 3]);
+a{5}.b = 2;
+assert_checkequal(size(a), [1 5]);
+a{2,3}.b = 2;
+assert_checkequal(size(a), [2 5]);
+clear a;
+a{1,3} = 2;
+assert_checkequal(size(a), [1 3]);
+a{5} = 2;
+assert_checkequal(size(a), [1 5]);
+a{2,3} = 2;
+assert_checkequal(size(a), [2 5]);
+clear a;
+funcprot(oldFuncProt);
index 93f6c2d..b4985b8 100644 (file)
 //
 //
 
-
+oldFuncProt = funcprot(0);
 ref = [0 0 0 ; 0 1 4 ; 0 2 5];
 a = zeros(3,3);a(:) = 1:9;
 b(2:3, 2:3) = a(1:2,1:2);
 
 assert_checkequal(b, ref);
 
+a=2;
+a.b=3;
+assert_checkequal(a.b, 3);
+a.b.c=4;
+assert_checkequal(a.b.c, 4);
+clear a
+
+a.b = 2;
+a.c = 3;
+a.d = 4;
+
+e.f = 7;
+e.d = 55;
+e.g = 12;
+
+a(2) = e;
+assert_checkequal(fieldnames(a(1)), fieldnames(a(2)));
+assert_checkequal(a(1).d, 4);
+assert_checkequal(a(2).d, 55);
+
+clear a;
+clear e;
+
+a.a.a = -2;
+assert_checkequal(a.a.a, -2);
+
+a(2, 1:3, [2 6 7]).b = 12;
+computed = a.b;
+expected = list();
+for i=1:(2*3*7)
+    expected(i) = [];
+end
+expected(8)  = 12;
+expected(10) = 12;
+expected(12) = 12;
+expected(32) = 12;
+expected(34) = 12;
+expected(36) = 12;
+expected(38) = 12;
+expected(40) = 12;
+expected(42) = 12;
+assert_checkequal(a.b, expected);
+clear a;
+
+a(1,3).b = 2;
+assert_checkequal(size(a), [1 3]);
+a(5).b = 2;
+assert_checkequal(size(a), [1 5]);
+a(2,3).b = 2;
+assert_checkequal(size(a), [2 5]);
+clear a;
+
+st.f.e = 22;
+st.f(3).e = 112;
+assert_checkequal(st.f.e, list(22, [], 112));
+
+st.f(2).j = 1124;
+assert_checkequal(st.f.j, list([], 1124, []));
+clear st;
+
+//tlist
+tl=tlist(["myTlist" "gg"], 22);
+tll=tlist(["myTlOfTl" "tt"],tl);
+
+a.b=tll;
+a.b.tt(2) = 4;
+assert_checkequal(a.b.tt(2), 4);
+assert_checkequal(a.b.tt.gg, 4);
+a.b.tt.gg = 5;
+assert_checkequal(a.b.tt(2), 5);
+assert_checkequal(a.b.tt.gg, 5);
+clear a;
+
+rl = rlist(%s,2);
+a.b = [rl rl rl];
+a.b(2) = [4 4 4];
+assert_checkequal(a.b.num, [4 4 4]);
+assert_checkequal(a.b.den, [2 2 2]);
+clear a;
+
+a.b = [rl rl rl];
+%r_6 = %r_e;
+
+a.b(1,2).num = 14;
+assert_checkequal(a.b.num, [%s 14 %s]);
+assert_checkequal(a.b.den, [2 2 2]);
+
+a(2).b = [rl rl rl] * %s;
+assert_checkequal(size(a), [2 1]);
+assert_checkequal(a(2).b.num, [%s**2 %s**2 %s**2]);
+
+a.b(1,3).num = 5;
+assert_checkequal(a.b(1).num, [%s 14 5]);
+assert_checkequal(a(2).b.num, [%s**2 %s**2 5]);
+
+a(3).b.num = 12;
+a.b(1,1).num = -9;
+assert_checkequal(a.b(1).num, [-9 14 5]+(0*%s));
+assert_checkequal(a(2).b.num, [-9 %s**2 5]);
+assert_checkequal(a(3).b.num, -9);
+clear a;
+
+tt = tlist(["toto" "gg" "ff"] , 12, 13);
+tt(3).c = 23;
+assert_checkequal(tt.ff.c, 23);
+tt(2).c = 22;
+assert_checkequal(tt.gg.c, 22);
+tt([2 3]).d = 99;
+assert_checkequal(tt.gg.d, 99);
+assert_checkequal(tt.ff.d, 99);
+tt([2 3]).d.e = 98;
+assert_checkequal(tt.gg.d.e, 98);
+assert_checkequal(tt.ff.d.e, 98);
+
+tt([2 3]).d(3).e = 78;
+assert_checkequal(tt.ff.d.e, list(98, [], 78));
+assert_checkequal(tt.gg.d.e, list(98, [], 78));
+
+tt(2).d.e(4) = 12;
+assert_checkequal(tt.gg.d.e, list([98; 0; 0; 12], [0; 0; 0; 12], [78; 0; 0; 12]));
+
+clear tt;
+
+tl=tlist(["toto" "gg"],11);
+function tutu(tl)
+    tl.gg = 12;
+    assert_checkequal(tl.gg, 12);
+endfunction
+
+tutu(tl);
+assert_checkequal(tl.gg, 11);
+clear tl;
+
+// mlist
+function varargout=%toto_e(varargin)
+    args = varargin(1);
+    ml = varargin($);
+    varargout = list();
+
+    for i=args
+        if i == 1
+            varargout($+1) = ["toto" "gg" "ff"];
+        elseif i == 2
+            varargout($+1) = ml.gg;
+        elseif i == 3
+            varargout($+1) = ml.ff;
+        end
+    end
+endfunction
+
+%toto_6 = %toto_e;
+
+function r=%l_i_toto(varargin)
+    args = varargin(1);
+    l = varargin($-1);
+    r = varargin($);
+    for i=1:size(args, "*")
+        if args(i) == 2
+            r.gg = l(i);
+        elseif args(i) == 3
+            r.ff = l(i);
+        end
+    end
+endfunction
+
+function r=%st_i_toto(varargin)
+    args = varargin(1);
+    st = varargin($-1);
+    r = varargin($);
+    for i=args
+        if i == 2
+            r.gg = st;
+        elseif i == 3
+            r.ff = st;
+        end
+    end
+endfunction
+
+mm = tlist(["toto" "gg" "ff"] , 12, 13);
+mm(3).c = 23;
+assert_checkequal(mm.ff.c, 23);
+mm(2).c = 22;
+assert_checkequal(mm.gg.c, 22);
+mm([2 3]).d = 99;
+assert_checkequal(mm.gg.d, 99);
+assert_checkequal(mm.ff.d, 99);
+mm([2 3]).d.e = 98;
+assert_checkequal(mm.gg.d.e, 98);
+assert_checkequal(mm.ff.d.e, 98);
+
+mm([2 3]).d(3).e = 78;
+assert_checkequal(mm.ff.d.e, list(98, [], 78));
+assert_checkequal(mm.gg.d.e, list(98, [], 78));
+
+mm(2).d.e(4) = 12;
+assert_checkequal(mm.gg.d.e, list([98; 0; 0; 12], [0; 0; 0; 12], [78; 0; 0; 12]));
+
+clear mm;
+
+ml = mlist(["tutu" "t"], 12);
+std=struct("d", 5);
+stc=struct("c", 6);
+a=std;
+assert_checkequal(a, std);
+a=stc;
+assert_checkequal(a, stc);
+ml.t = std;
+assert_checkequal(ml.t.d, 5);
+ml.t = stc;
+assert_checkequal(ml.t.c, 6);
+
+ml = mlist(["tutu" "t"], 12);
+ml.t = 21;
+assert_checkequal(ml.t, 21);
+
+function r=%s_i_tutu(varargin)
+    s1=varargin($-1);
+    s2=varargin($);
+    //s2(i,j)=s1 s1 matrix of scalar
+    r=s2;
+    r.t = s1;
+endfunction
+
+function r=%tutu_e(varargin)
+    r=varargin($).t;
+endfunction
+
+function r=%st_i_tutu(varargin)
+    s1=varargin($-1);
+    s2=varargin($);
+    //s2(i,j)=s1 s1 is a struct
+    r=s2;
+    r.t = s1;
+endfunction
+
+%tutu_6 = %tutu_e;
+
+a.b = ml;
+assert_checkequal(a.b(2), 21);
+a.b(2) = stc;
+assert_checkequal(a.b(2), stc);
+a.b(2).c=44;
+assert_checkequal(a.b(2).c, 44);
+clear a;
+
+//tlist/mlist
+tl =tlist(["toto" "gg"], tlist(["tutu" "tt" "ee"], 22, 23));
+tl(2)(3)=12;
+assert_checkequal(tl.gg.ee, 12);
+tl(2)(3)(4)=88;
+assert_checkequal(tl.gg.ee, [12; 0; 0; 88]);
+
+function r=%tata_e(varargin)
+    r=varargin($).ff;
+endfunction
+
+%tata_6 = %tata_e;
+
+function r=%toto_i_tata(varargin)
+    s1=varargin($-1);
+    s2=varargin($);
+    //s2(i,j)=s1 s1 is a struct
+    r=s2;
+    r.ff = s1;
+endfunction
+
+ml = mlist(["tata" "ff"], tl);
+assert_checkequal(ml.ff.gg.ee, [12; 0; 0; 88]);
+ml(2)(2)(3) = 44;
+assert_checkequal(ml.ff.gg.ee, 44);
+clear tl;
+
+// List
+st.l = list([1 2 3], "toto");
+st.l = 44;
+assert_checkequal(st.l, 44);
+
+st.l = list([1 2 3], "toto");
+st.l(3) = 55;
+assert_checkequal(st.l(3), 55);
+
+st.l(1)(2) = -2;
+assert_checkequal(st.l(1), [1 -2 3]);
+
+st.l(3) = tlist(["toto", "gg"], 112);
+
+function r=%l_6(varargin)
+    r=[]
+    for in = varargin(2)
+        if type(in) == 16 // tlist
+            if find(varargin(1) == in(1)) <> [] // search field in tlist
+                r = in(varargin(1));
+            end
+        end
+    end
+endfunction
+
+function l=%st_i_l(varargin)
+    l=list();
+    pos = 0;
+    for in = varargin(3)
+        pos = pos + 1;
+        if type(in) == 16 // tlist
+            in((varargin(1))) = varargin(2);
+        end
+        l(pos) = in;
+    end
+endfunction
+
+st.l.gg.c = 12;
+assert_checkequal(st.l(1), [1 -2 3]);
+assert_checkequal(st.l(2), "toto");
+assert_checkequal(st.l(3).gg, struct("c", 12));
+clear st;
+
+st.l = list([1 2 3], "toto");
+function r=%s_i_l(varargin)
+    r=struct(varargin(1), varargin(2)) ;
+endfunction
+
+st.l.c = 24;
+assert_checkequal(st.l, struct("c", 24));
+clear st;
+
+// list delete
+
+tl = tlist(["toto" "gg" "ff" "uu"], 45, 89, 87);
+tl(2) = null();
+
+assert_checkequal(tl(1), ["toto" "gg" "ff" "uu"]);
+assert_checkequal(tl(2), 89);
+assert_checkequal(tl(3), 87);
+
+tl = tlist(["toto" "gg" "ff" "uu"], 45, 89, 87);
+//tl.gg = null();
+
+function l=%0_i_toto(varargin)
+    idx = find(varargin(3)(1) == varargin(1));
+    l = varargin(3);
+    l(idx) = null();
+endfunction
+
+tl.gg = null();
+assert_checkequal(tl(1), ["toto" "gg" "ff" "uu"]);
+assert_checkequal(tl(2), 89);
+assert_checkequal(tl(3), 87);
+
+clear tl;
+
+l = list(["toto" "gg" "ff" "uu"], 45, 89, 87);
+l(2) = null();
+
+assert_checkequal(l(1), ["toto" "gg" "ff" "uu"]);
+assert_checkequal(l(2), 89);
+assert_checkequal(l(3), 87);
+
+l = list(["toto" "gg" "ff" "uu"], 45, 89, 87);
+//l.gg = null();
+
+clear l;
+
+// cell
+
+function varargout=%toto_e(varargin)
+    args = varargin(1);
+    ml = varargin($);
+    varargout = list();
+
+    for i=args
+        if i == 1
+            varargout($+1) = ["toto" "ff"];
+        elseif i == 2
+            varargout($+1) = ml.ff;
+        end
+    end
+endfunction
+
+%toto_6 = %toto_e;
+
+function ml=%s_i_toto(varargin)
+    args = varargin(1);
+    s = varargin($-1);
+    ml = varargin($);
+    for i=1:size(args, "*")
+        if args(i) == 2
+            ml.ff = s;
+        end
+    end
+endfunction
+
+tl = tlist(["tutu" "gg"], 12);
+ml = mlist(["toto" "ff"], 22);
+
+a{2} = 2;
+assert_checkequal(a{2}, 2);
+a{1,3} = tl;
+assert_checkequal(a{5}(1), ["tutu" "gg"]);
+assert_checkequal(a{5}(2), 12);
+a{[3 6]} = ml;
+assert_checkequal(a{3}(1), ["toto" "ff"]);
+assert_checkequal(a{3}(2), 22);
+assert_checkequal(a{6}(1), ["toto" "ff"]);
+assert_checkequal(a{6}(2), 22);
+
+a{2}.c = 123;
+assert_checkequal(a{2}.c, 123);
+
+a{2}(3).e = 12;
+assert_checkequal(a{2}.e, list([], [], 12));
+assert_checkequal(a{2}.c, list(123, [], []));
+
+a{2}.b = 12;
+assert_checkequal(a{2}.b, list(12, 12, 12));
+
+a{2}.e = 99;
+assert_checkequal(a{2}.e, list(99, 99, 99));
+
+a{6}(2) = 8;
+assert_checkequal(a{6}(1), ["toto" "ff"]);
+assert_checkequal(a{6}(2), 8);
+
+a{1, [1 3]}.gg = 14;
+assert_checkequal(a{1}.gg, 14);
+assert_checkequal(a{5}.gg, 14);
+
+a{1:2, [1 3], 2}.g = "A string";
+assert_checkequal(a{7}.g, "A string");
+assert_checkequal(a{8}.g, "A string");
+assert_checkequal(a{11}.g, "A string");
+assert_checkequal(a{12}.g, "A string");
+clear a;
+
+a{1,3}.b = 2;
+assert_checkequal(size(a), [1 3]);
+a{5}.b = 2;
+assert_checkequal(size(a), [1 5]);
+a{2,3}.b = 2;
+assert_checkequal(size(a), [2 5]);
+clear a;
+
+a{1,3} = 2;
+assert_checkequal(size(a), [1 3]);
+a{5} = 2;
+assert_checkequal(size(a), [1 5]);
+a{2,3} = 2;
+assert_checkequal(size(a), [2 5]);
+clear a;
+
+funcprot(oldFuncProt);
+
index 93d1e66..a3ab905 100644 (file)
@@ -15,7 +15,7 @@ modulename=xml
 
 #### xml : Conf files ####
 libscixml_la_rootdir = $(mydatadir)
-libscixml_la_root_DATA =  license.txt 
+libscixml_la_root_DATA =  license.txt
 
 
 #### scinotes : init scripts & configuration files ####
@@ -25,25 +25,25 @@ libscixml_la_etc_DATA = etc/xml.quit \
 
 include $(top_srcdir)/Makefile.incl.am
 
-XML_JNI_SOURCES = 
-
-XML_C_SOURCES = src/c/XMLMlistsManagement.c
-
-XML_CXX_SOURCES = src/cpp/VariableScope.cpp \
-          src/cpp/XMLObject.cpp \
-          src/cpp/XMLDocument.cpp \
-          src/cpp/XMLElement.cpp \
-          src/cpp/XMLAttr.cpp \
-          src/cpp/XMLNs.cpp \
-          src/cpp/XMLNodeList.cpp \
-          src/cpp/XMLNodeSet.cpp \
-          src/cpp/XMLXPath.cpp \
-          src/cpp/XMLList.cpp \
-          src/cpp/XMLNotHandledElement.cpp \
-          src/cpp/XMLValidation.cpp \
-          src/cpp/XMLValidationDTD.cpp \
-          src/cpp/XMLValidationSchema.cpp \
-          src/cpp/XMLValidationRelaxNG.cpp
+XML_JNI_SOURCES =
+
+XML_CXX_SOURCES = \
+src/cpp/VariableScope.cpp \
+src/cpp/XMLObject.cpp \
+src/cpp/XMLDocument.cpp \
+src/cpp/XMLElement.cpp \
+src/cpp/XMLAttr.cpp \
+src/cpp/XMLNs.cpp \
+src/cpp/XMLNodeList.cpp \
+src/cpp/XMLNodeSet.cpp \
+src/cpp/XMLXPath.cpp \
+src/cpp/XMLList.cpp \
+src/cpp/XMLNotHandledElement.cpp \
+src/cpp/XMLValidation.cpp \
+src/cpp/XMLValidationDTD.cpp \
+src/cpp/XMLValidationSchema.cpp \
+src/cpp/XMLValidationRelaxNG.cpp \
+src/cpp/XMLMlistsManagement.cpp
 
 GATEWAY_C_SOURCES = sci_gateway/c/gw_xml.c
 
@@ -98,6 +98,8 @@ libscixml_la_CPPFLAGS = -I$(srcdir)/includes/ \
     -I$(top_srcdir)/modules/fileio/includes/ \
        -I$(top_srcdir)/modules/operations/includes/ \
        -I$(top_srcdir)/modules/string/includes/ \
+       -I$(top_srcdir)/modules/types/includes/ \
+       -I$(top_srcdir)/modules/ast/includes/ \
     $(XML_FLAGS) \
     $(AM_CPPFLAGS)
 
@@ -105,7 +107,7 @@ libscixml_la_CPPFLAGS = -I$(srcdir)/includes/ \
 pkglib_LTLIBRARIES = libscixml.la
 noinst_LTLIBRARIES = libscixml-algo.la
 
-libscixml_algo_la_SOURCES = $(XML_C_SOURCES) $(XML_JNI_SOURCES) $(XML_CXX_SOURCES)
+libscixml_algo_la_SOURCES = $(XML_JNI_SOURCES) $(XML_CXX_SOURCES)
 libscixml_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_CXX_SOURCES)
 libscixml_algo_la_CPPFLAGS = $(libscixml_la_CPPFLAGS)
 
@@ -113,7 +115,7 @@ libscixml_la_LDFLAGS = $(AM_LDFLAGS)
 libscixml_la_LIBADD = libscixml-algo.la $(XML_LIBS)
 
 # For the code check (splint)
-CHECK_SRC= $(XML_C_SOURCES) $(GATEWAY_C_SOURCES)
+CHECK_SRC= $(GATEWAY_C_SOURCES)
 INCLUDE_FLAGS = $(libscixml_la_CPPFLAGS)
 
 #### xml : include files ####
index 2944d1a..a202020 100644 (file)
@@ -168,10 +168,9 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" \
        "$(DESTDIR)$(libscixml_la_sci_gatewaydir)"
 LTLIBRARIES = $(noinst_LTLIBRARIES) $(pkglib_LTLIBRARIES)
 libscixml_algo_la_LIBADD =
+am__objects_1 =
 am__dirstamp = $(am__leading_dot)dirstamp
-am__objects_1 = src/c/libscixml_algo_la-XMLMlistsManagement.lo
-am__objects_2 =
-am__objects_3 = src/cpp/libscixml_algo_la-VariableScope.lo \
+am__objects_2 = src/cpp/libscixml_algo_la-VariableScope.lo \
        src/cpp/libscixml_algo_la-XMLObject.lo \
        src/cpp/libscixml_algo_la-XMLDocument.lo \
        src/cpp/libscixml_algo_la-XMLElement.lo \
@@ -185,9 +184,9 @@ am__objects_3 = src/cpp/libscixml_algo_la-VariableScope.lo \
        src/cpp/libscixml_algo_la-XMLValidation.lo \
        src/cpp/libscixml_algo_la-XMLValidationDTD.lo \
        src/cpp/libscixml_algo_la-XMLValidationSchema.lo \
-       src/cpp/libscixml_algo_la-XMLValidationRelaxNG.lo
-am_libscixml_algo_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
-       $(am__objects_3)
+       src/cpp/libscixml_algo_la-XMLValidationRelaxNG.lo \
+       src/cpp/libscixml_algo_la-XMLMlistsManagement.lo
+am_libscixml_algo_la_OBJECTS = $(am__objects_1) $(am__objects_2)
 libscixml_algo_la_OBJECTS = $(am_libscixml_algo_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -195,8 +194,8 @@ am__v_lt_0 = --silent
 am__v_lt_1 = 
 am__DEPENDENCIES_1 =
 libscixml_la_DEPENDENCIES = libscixml-algo.la $(am__DEPENDENCIES_1)
-am__objects_4 = sci_gateway/c/libscixml_la-gw_xml.lo
-am__objects_5 = sci_gateway/cpp/libscixml_la-sci_xmlRead.lo \
+am__objects_3 = sci_gateway/c/libscixml_la-gw_xml.lo
+am__objects_4 = sci_gateway/cpp/libscixml_la-sci_xmlRead.lo \
        sci_gateway/cpp/libscixml_la-sci_xmlXPath.lo \
        sci_gateway/cpp/libscixml_la-sci_extraction.lo \
        sci_gateway/cpp/libscixml_la-sci_insertion.lo \
@@ -235,7 +234,7 @@ am__objects_5 = sci_gateway/cpp/libscixml_la-sci_xmlRead.lo \
        sci_gateway/cpp/libscixml_la-sci_htmlReadStr.lo \
        sci_gateway/cpp/libscixml_la-sci_htmlWrite.lo \
        sci_gateway/cpp/libscixml_la-sci_htmlDump.lo
-am_libscixml_la_OBJECTS = $(am__objects_4) $(am__objects_5)
+am_libscixml_la_OBJECTS = $(am__objects_3) $(am__objects_4)
 libscixml_la_OBJECTS = $(am_libscixml_la_OBJECTS)
 libscixml_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@@ -610,7 +609,7 @@ modulename = xml
 
 #### xml : Conf files ####
 libscixml_la_rootdir = $(mydatadir)
-libscixml_la_root_DATA = license.txt 
+libscixml_la_root_DATA = license.txt
 
 #### scinotes : init scripts & configuration files ####
 libscixml_la_etcdir = $(mydatadir)/etc
@@ -691,22 +690,23 @@ HELP_CHAPTERDIR = help/
 HELP_CHAPTERFILE = addchapter.sce
 HELP_CHAPTERLANG = en_US fr_FR pt_BR
 XML_JNI_SOURCES = 
-XML_C_SOURCES = src/c/XMLMlistsManagement.c
-XML_CXX_SOURCES = src/cpp/VariableScope.cpp \
-          src/cpp/XMLObject.cpp \
-          src/cpp/XMLDocument.cpp \
-          src/cpp/XMLElement.cpp \
-          src/cpp/XMLAttr.cpp \
-          src/cpp/XMLNs.cpp \
-          src/cpp/XMLNodeList.cpp \
-          src/cpp/XMLNodeSet.cpp \
-          src/cpp/XMLXPath.cpp \
-          src/cpp/XMLList.cpp \
-          src/cpp/XMLNotHandledElement.cpp \
-          src/cpp/XMLValidation.cpp \
-          src/cpp/XMLValidationDTD.cpp \
-          src/cpp/XMLValidationSchema.cpp \
-          src/cpp/XMLValidationRelaxNG.cpp
+XML_CXX_SOURCES = \
+src/cpp/VariableScope.cpp \
+src/cpp/XMLObject.cpp \
+src/cpp/XMLDocument.cpp \
+src/cpp/XMLElement.cpp \
+src/cpp/XMLAttr.cpp \
+src/cpp/XMLNs.cpp \
+src/cpp/XMLNodeList.cpp \
+src/cpp/XMLNodeSet.cpp \
+src/cpp/XMLXPath.cpp \
+src/cpp/XMLList.cpp \
+src/cpp/XMLNotHandledElement.cpp \
+src/cpp/XMLValidation.cpp \
+src/cpp/XMLValidationDTD.cpp \
+src/cpp/XMLValidationSchema.cpp \
+src/cpp/XMLValidationRelaxNG.cpp \
+src/cpp/XMLMlistsManagement.cpp
 
 GATEWAY_C_SOURCES = sci_gateway/c/gw_xml.c
 GATEWAY_CXX_SOURCES = sci_gateway/cpp/sci_xmlRead.cpp \
@@ -760,19 +760,21 @@ libscixml_la_CPPFLAGS = -I$(srcdir)/includes/ \
     -I$(top_srcdir)/modules/fileio/includes/ \
        -I$(top_srcdir)/modules/operations/includes/ \
        -I$(top_srcdir)/modules/string/includes/ \
+       -I$(top_srcdir)/modules/types/includes/ \
+       -I$(top_srcdir)/modules/ast/includes/ \
     $(XML_FLAGS) \
     $(AM_CPPFLAGS)
 
 pkglib_LTLIBRARIES = libscixml.la
 noinst_LTLIBRARIES = libscixml-algo.la
-libscixml_algo_la_SOURCES = $(XML_C_SOURCES) $(XML_JNI_SOURCES) $(XML_CXX_SOURCES)
+libscixml_algo_la_SOURCES = $(XML_JNI_SOURCES) $(XML_CXX_SOURCES)
 libscixml_la_SOURCES = $(GATEWAY_C_SOURCES) $(GATEWAY_CXX_SOURCES)
 libscixml_algo_la_CPPFLAGS = $(libscixml_la_CPPFLAGS)
 libscixml_la_LDFLAGS = $(AM_LDFLAGS)
 libscixml_la_LIBADD = libscixml-algo.la $(XML_LIBS)
 
 # For the code check (splint)
-CHECK_SRC = $(XML_C_SOURCES) $(GATEWAY_C_SOURCES)
+CHECK_SRC = $(GATEWAY_C_SOURCES)
 INCLUDE_FLAGS = $(libscixml_la_CPPFLAGS)
 
 #### xml : include files ####
@@ -862,14 +864,6 @@ clean-pkglibLTLIBRARIES:
          echo rm -f $${locs}; \
          rm -f $${locs}; \
        }
-src/c/$(am__dirstamp):
-       @$(MKDIR_P) src/c
-       @: > src/c/$(am__dirstamp)
-src/c/$(DEPDIR)/$(am__dirstamp):
-       @$(MKDIR_P) src/c/$(DEPDIR)
-       @: > src/c/$(DEPDIR)/$(am__dirstamp)
-src/c/libscixml_algo_la-XMLMlistsManagement.lo: src/c/$(am__dirstamp) \
-       src/c/$(DEPDIR)/$(am__dirstamp)
 src/cpp/$(am__dirstamp):
        @$(MKDIR_P) src/cpp
        @: > src/cpp/$(am__dirstamp)
@@ -906,6 +900,8 @@ src/cpp/libscixml_algo_la-XMLValidationSchema.lo:  \
        src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 src/cpp/libscixml_algo_la-XMLValidationRelaxNG.lo:  \
        src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
+src/cpp/libscixml_algo_la-XMLMlistsManagement.lo:  \
+       src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
 
 libscixml-algo.la: $(libscixml_algo_la_OBJECTS) $(libscixml_algo_la_DEPENDENCIES) $(EXTRA_libscixml_algo_la_DEPENDENCIES) 
        $(AM_V_CXXLD)$(CXXLINK)  $(libscixml_algo_la_OBJECTS) $(libscixml_algo_la_LIBADD) $(LIBS)
@@ -1050,8 +1046,6 @@ mostlyclean-compile:
        -rm -f sci_gateway/c/*.lo
        -rm -f sci_gateway/cpp/*.$(OBJEXT)
        -rm -f sci_gateway/cpp/*.lo
-       -rm -f src/c/*.$(OBJEXT)
-       -rm -f src/c/*.lo
        -rm -f src/cpp/*.$(OBJEXT)
        -rm -f src/cpp/*.lo
 
@@ -1098,12 +1092,12 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscixml_la-sci_xmlValidationFile.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscixml_la-sci_xmlWrite.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@sci_gateway/cpp/$(DEPDIR)/libscixml_la-sci_xmlXPath.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscixml_algo_la-XMLMlistsManagement.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-VariableScope.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-XMLAttr.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-XMLDocument.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-XMLElement.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-XMLList.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-XMLMlistsManagement.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-XMLNodeList.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-XMLNodeSet.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscixml_algo_la-XMLNotHandledElement.Plo@am__quote@
@@ -1139,13 +1133,6 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-src/c/libscixml_algo_la-XMLMlistsManagement.lo: src/c/XMLMlistsManagement.c
-@am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscixml_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscixml_algo_la-XMLMlistsManagement.lo -MD -MP -MF src/c/$(DEPDIR)/libscixml_algo_la-XMLMlistsManagement.Tpo -c -o src/c/libscixml_algo_la-XMLMlistsManagement.lo `test -f 'src/c/XMLMlistsManagement.c' || echo '$(srcdir)/'`src/c/XMLMlistsManagement.c
-@am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscixml_algo_la-XMLMlistsManagement.Tpo src/c/$(DEPDIR)/libscixml_algo_la-XMLMlistsManagement.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      $(AM_V_CC)source='src/c/XMLMlistsManagement.c' object='src/c/libscixml_algo_la-XMLMlistsManagement.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscixml_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscixml_algo_la-XMLMlistsManagement.lo `test -f 'src/c/XMLMlistsManagement.c' || echo '$(srcdir)/'`src/c/XMLMlistsManagement.c
-
 sci_gateway/c/libscixml_la-gw_xml.lo: sci_gateway/c/gw_xml.c
 @am__fastdepCC_TRUE@   $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscixml_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sci_gateway/c/libscixml_la-gw_xml.lo -MD -MP -MF sci_gateway/c/$(DEPDIR)/libscixml_la-gw_xml.Tpo -c -o sci_gateway/c/libscixml_la-gw_xml.lo `test -f 'sci_gateway/c/gw_xml.c' || echo '$(srcdir)/'`sci_gateway/c/gw_xml.c
 @am__fastdepCC_TRUE@   $(AM_V_at)$(am__mv) sci_gateway/c/$(DEPDIR)/libscixml_la-gw_xml.Tpo sci_gateway/c/$(DEPDIR)/libscixml_la-gw_xml.Plo
@@ -1282,6 +1269,13 @@ src/cpp/libscixml_algo_la-XMLValidationRelaxNG.lo: src/cpp/XMLValidationRelaxNG.
 @AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscixml_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscixml_algo_la-XMLValidationRelaxNG.lo `test -f 'src/cpp/XMLValidationRelaxNG.cpp' || echo '$(srcdir)/'`src/cpp/XMLValidationRelaxNG.cpp
 
+src/cpp/libscixml_algo_la-XMLMlistsManagement.lo: src/cpp/XMLMlistsManagement.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscixml_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libscixml_algo_la-XMLMlistsManagement.lo -MD -MP -MF src/cpp/$(DEPDIR)/libscixml_algo_la-XMLMlistsManagement.Tpo -c -o src/cpp/libscixml_algo_la-XMLMlistsManagement.lo `test -f 'src/cpp/XMLMlistsManagement.cpp' || echo '$(srcdir)/'`src/cpp/XMLMlistsManagement.cpp
+@am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libscixml_algo_la-XMLMlistsManagement.Tpo src/cpp/$(DEPDIR)/libscixml_algo_la-XMLMlistsManagement.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     $(AM_V_CXX)source='src/cpp/XMLMlistsManagement.cpp' object='src/cpp/libscixml_algo_la-XMLMlistsManagement.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscixml_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscixml_algo_la-XMLMlistsManagement.lo `test -f 'src/cpp/XMLMlistsManagement.cpp' || echo '$(srcdir)/'`src/cpp/XMLMlistsManagement.cpp
+
 sci_gateway/cpp/libscixml_la-sci_xmlRead.lo: sci_gateway/cpp/sci_xmlRead.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscixml_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sci_gateway/cpp/libscixml_la-sci_xmlRead.lo -MD -MP -MF sci_gateway/cpp/$(DEPDIR)/libscixml_la-sci_xmlRead.Tpo -c -o sci_gateway/cpp/libscixml_la-sci_xmlRead.lo `test -f 'sci_gateway/cpp/sci_xmlRead.cpp' || echo '$(srcdir)/'`sci_gateway/cpp/sci_xmlRead.cpp
 @am__fastdepCXX_TRUE@  $(AM_V_at)$(am__mv) sci_gateway/cpp/$(DEPDIR)/libscixml_la-sci_xmlRead.Tpo sci_gateway/cpp/$(DEPDIR)/libscixml_la-sci_xmlRead.Plo
@@ -1562,7 +1556,6 @@ clean-libtool:
        -rm -rf .libs _libs
        -rm -rf sci_gateway/c/.libs sci_gateway/c/_libs
        -rm -rf sci_gateway/cpp/.libs sci_gateway/cpp/_libs
-       -rm -rf src/c/.libs src/c/_libs
        -rm -rf src/cpp/.libs src/cpp/_libs
 install-libscixml_la_etcDATA: $(libscixml_la_etc_DATA)
        @$(NORMAL_INSTALL)
@@ -1748,8 +1741,6 @@ distclean-generic:
        -rm -f sci_gateway/c/$(am__dirstamp)
        -rm -f sci_gateway/cpp/$(DEPDIR)/$(am__dirstamp)
        -rm -f sci_gateway/cpp/$(am__dirstamp)
-       -rm -f src/c/$(DEPDIR)/$(am__dirstamp)
-       -rm -f src/c/$(am__dirstamp)
        -rm -f src/cpp/$(DEPDIR)/$(am__dirstamp)
        -rm -f src/cpp/$(am__dirstamp)
 
@@ -1762,7 +1753,7 @@ clean-am: clean-generic clean-libtool clean-local \
        clean-noinstLTLIBRARIES clean-pkglibLTLIBRARIES mostlyclean-am
 
 distclean: distclean-am
-       -rm -rf sci_gateway/c/$(DEPDIR) sci_gateway/cpp/$(DEPDIR) src/c/$(DEPDIR) src/cpp/$(DEPDIR)
+       -rm -rf sci_gateway/c/$(DEPDIR) sci_gateway/cpp/$(DEPDIR) src/cpp/$(DEPDIR)
        -rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
        distclean-local distclean-tags
@@ -1810,7 +1801,7 @@ install-ps-am:
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
-       -rm -rf sci_gateway/c/$(DEPDIR) sci_gateway/cpp/$(DEPDIR) src/c/$(DEPDIR) src/cpp/$(DEPDIR)
+       -rm -rf sci_gateway/c/$(DEPDIR) sci_gateway/cpp/$(DEPDIR) src/cpp/$(DEPDIR)
        -rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
index 6b2f621..4900862 100644 (file)
 #define __GW_XML_H__
 /*--------------------------------------------------------------------------*/
 #include "dynlib_xml_scilab.h"
+#include "c_gateway_prototype.h"
 /*--------------------------------------------------------------------------*/
-XML_SCILAB_IMPEXP int gw_xml(void);
-
-/*--------------------------------------------------------------------------*/
-int sci_xmlRead(char *fname, void *pvApiCtx);
-int sci_xmlDelete(char *fname, void *pvApiCtx);
-int sci_xmlDump(char *fname, void *pvApiCtx);
-int sci_xmlGetOpenDocs(char *fname, void *pvApiCtx);
-int sci_xmlXPath(char *fname, void *pvApiCtx);
-int sci_percent_XMLDoc_e(char *fname, void *pvApiCtx);
-int sci_percent_XMLElem_e(char *fname, void *pvApiCtx);
-int sci_percent_XMLNs_e(char *fname, void *pvApiCtx);
-int sci_percent_XMLAttr_e(char *fname, void *pvApiCtx);
-int sci_percent_XMLList_e(char *fname, void *pvApiCtx);
-int sci_percent_XMLDoc_p(char *fname, void *pvApiCtx);
-int sci_percent_XMLElem_p(char *fname, void *pvApiCtx);
-int sci_percent_XMLNs_p(char *fname, void *pvApiCtx);
-int sci_percent_XMLList_p(char *fname, void *pvApiCtx);
-int sci_percent_XMLAttr_p(char *fname, void *pvApiCtx);
-int sci_percent_XMLSet_p(char *fname, void *pvApiCtx);
-int sci_percent_XMLList_size(char *fname, void *pvApiCtx);
-int sci_percent_XMLSet_size(char *fname, void *pvApiCtx);
-int sci_percent_XMLAttr_size(char *fname, void *pvApiCtx);
-int sci_percent_c_i_XMLDoc(char *fname, void *pvApiCtx);
-int sci_percent_XMLElem_i_XMLDoc(char *fname, void *pvApiCtx);
-int sci_percent_c_i_XMLElem(char *fname, void *pvApiCtx);
-int sci_percent_XMLElem_i_XMLElem(char *fname, void *pvApiCtx);
-int sci_percent_XMLAttr_i_XMLElem(char *fname, void *pvApiCtx);
-int sci_percent_XMLList_i_XMLElem(char *fname, void *pvApiCtx);
-int sci_percent_XMLNs_i_XMLElem(char *fname, void *pvApiCtx);
-int sci_percent_c_i_XMLAttr(char *fname, void *pvApiCtx);
-int sci_percent_XMLElem_i_XMLList(char *fname, void *pvApiCtx);
-int sci_percent_XMLDoc_i_XMLList(char *fname, void *pvApiCtx);
-int sci_percent_c_i_XMLList(char *fname, void *pvApiCtx);
-int sci_percent_s_i_XMLList(char *fname, void *pvApiCtx);
-int sci_percent_foo_i_XMLList(char *fname, void *pvApiCtx);
-int sci_percent_XMLList_i_XMLList(char *fname, void *pvApiCtx);
-int sci_xmlReadStr(char *fname, void *pvApiCtx);
-int sci_xmlFormat(char *fname, void *pvApiCtx);
-int sci_xmlElement(char *fname, void *pvApiCtx);
-int sci_xmlDocument(char *fname, void *pvApiCtx);
-int sci_xmlNs(char *fname, void *pvApiCtx);
-int sci_xmlAddNs(char *fname, void *pvApiCtx);
-int sci_xmlGetNsByHref(char *fname, void *pvApiCtx);
-int sci_xmlGetNsByPrefix(char *fname, void *pvApiCtx);
-int sci_xmlWrite(char *fname, void *pvApiCtx);
-int sci_percent_XMLList_length(char *fname, void *pvApiCtx);
-int sci_percent_XMLAttr_length(char *fname, void *pvApiCtx);
-int sci_xmlDTD(char *fname, void *pvApiCtx);
-int sci_xmlSchema(char *fname, void *pvApiCtx);
-int sci_xmlRelaxNG(char *fname, void *pvApiCtx);
-int sci_xmlValidate(char *fname, void *pvApiCtx);
-int sci_percent_XMLValid_p(char *fname, void *pvApiCtx);
-int sci_xmlIsValidObject(char *fname, void *pvApiCtx);
-int sci_xmlAsNumber(char *fname, void *pvApiCtx);
-int sci_xmlAsText(char *fname, void *pvApiCtx);
-int sci_xmlRemove(char *fname, void *pvApiCtx);
-int sci_xmlSetAttributes(char *fname, void *pvApiCtx);
-int sci_xmlName(char *fname, void *pvApiCtx);
-int sci_xmlAppend(char *fname, void *pvApiCtx);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlRead);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlDelete);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlDump);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlGetOpenDocs);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlXPath);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLDoc_e);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLElem_e);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLNs_e);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLAttr_e);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLList_e);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLDoc_p);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLElem_p);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLNs_p);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLList_p);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLAttr_p);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLSet_p);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLList_size);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLSet_size);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLAttr_size);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_c_i_XMLDoc);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLElem_i_XMLDoc);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_c_i_XMLElem);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLElem_i_XMLElem);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLAttr_i_XMLElem);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLList_i_XMLElem);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLNs_i_XMLElem);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_c_i_XMLAttr);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLElem_i_XMLList);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLDoc_i_XMLList);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_c_i_XMLList);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_s_i_XMLList);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_foo_i_XMLList);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLList_i_XMLList);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlReadStr);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlFormat);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlElement);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlDocument);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlNs);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlAddNs);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlGetNsByHref);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlGetNsByPrefix);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlWrite);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLList_length);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLAttr_length);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlDTD);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlSchema);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlRelaxNG);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlValidate);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_percent_XMLValid_p);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlIsValidObject);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlAsNumber);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlAsText);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlRemove);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlSetAttributes);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlName);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_xmlAppend);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_htmlRead);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_htmlReadStr);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_htmlWrite);
+XML_SCILAB_IMPEXP C_GATEWAY_PROTOTYPE (sci_htmlDump);
 
 /*--------------------------------------------------------------------------*/
 #endif /* __GW_XML_H__ */
diff --git a/scilab/modules/xml/sci_gateway/_xml_gateway.xml b/scilab/modules/xml/sci_gateway/_xml_gateway.xml
new file mode 100644 (file)
index 0000000..c23abc6
--- /dev/null
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2012 - Scilab Enterprises - Calixte Denizet
+ * 
+ * This file must be used under the terms of the CeCILL.
+ * This source file is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution.  The terms
+ * are also available at    
+ * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ -->
+<!DOCTYPE GATEWAY SYSTEM "../../functions/xml/gateway.dtd">
+<GATEWAY name="xml">
+    
+    <!--
+ Scilab
+ Interface description. In this file, we define the list of the function which
+ will be available into Scilab and the link to the "native" function.
+
+ gatewayId is the position in the hashtable 'Interfaces' defined in the
+ file SCI/modules/core/src/c/callinterf.h
+
+ primitiveId is the position in the hashtable '<module>Table Tab[]' defined
+ in the file modules/<module>/sci_gateway/c/gw_<module>.c
+
+ primitiveName is the name of the Scilab function
+
+ Don't touch if you do not know what you are doing
+
+-->
+    <PRIMITIVE gatewayId="68" primitiveId="1" primitiveName="xmlRead" />
+    <PRIMITIVE gatewayId="68" primitiveId="2" primitiveName="xmlDelete" />
+    <PRIMITIVE gatewayId="68" primitiveId="3" primitiveName="xmlDump" />
+    <PRIMITIVE gatewayId="68" primitiveId="4" primitiveName="xmlGetOpenDocs" />
+    <PRIMITIVE gatewayId="68" primitiveId="5" primitiveName="xmlXPath" />
+    <PRIMITIVE gatewayId="68" primitiveId="6" primitiveName="%XMLDoc_e" />
+    <PRIMITIVE gatewayId="68" primitiveId="7" primitiveName="%XMLElem_e" />
+    <PRIMITIVE gatewayId="68" primitiveId="8" primitiveName="%XMLNs_e" />
+    <PRIMITIVE gatewayId="68" primitiveId="9" primitiveName="%XMLAttr_e" />
+    <PRIMITIVE gatewayId="68" primitiveId="10" primitiveName="%XMLList_e" />
+    <PRIMITIVE gatewayId="68" primitiveId="11" primitiveName="%XMLSet_e" />
+    <PRIMITIVE gatewayId="68" primitiveId="12" primitiveName="%XMLDoc_p" />
+    <PRIMITIVE gatewayId="68" primitiveId="13" primitiveName="%XMLElem_p" />
+    <PRIMITIVE gatewayId="68" primitiveId="14" primitiveName="%XMLNs_p" />
+    <PRIMITIVE gatewayId="68" primitiveId="15" primitiveName="%XMLList_p" />
+    <PRIMITIVE gatewayId="68" primitiveId="16" primitiveName="%XMLAttr_p" />
+    <PRIMITIVE gatewayId="68" primitiveId="17" primitiveName="%XMLSet_p" />
+    <PRIMITIVE gatewayId="68" primitiveId="18" primitiveName="%XMLList_size" />
+    <PRIMITIVE gatewayId="68" primitiveId="19" primitiveName="%XMLSet_size" />
+    <PRIMITIVE gatewayId="68" primitiveId="20" primitiveName="%XMLAttr_size" />
+    <PRIMITIVE gatewayId="68" primitiveId="21" primitiveName="%c_i_XMLDoc" />
+    <PRIMITIVE gatewayId="68" primitiveId="22" primitiveName="%XMLElem_i_XMLDoc" />
+    <PRIMITIVE gatewayId="68" primitiveId="23" primitiveName="%c_i_XMLElem" />
+    <PRIMITIVE gatewayId="68" primitiveId="24" primitiveName="%XMLElem_i_XMLElem" />
+    <PRIMITIVE gatewayId="68" primitiveId="25" primitiveName="%XMLAttr_i_XMLElem" />
+    <PRIMITIVE gatewayId="68" primitiveId="26" primitiveName="%XMLList_i_XMLElem" />
+    <PRIMITIVE gatewayId="68" primitiveId="27" primitiveName="%XMLNs_i_XMLElem" />
+    <PRIMITIVE gatewayId="68" primitiveId="28" primitiveName="%c_i_XMLAttr" />
+    <PRIMITIVE gatewayId="68" primitiveId="29" primitiveName="%XMLElem_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="30" primitiveName="%XMLDoc_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="31" primitiveName="%c_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="32" primitiveName="%s_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="33" primitiveName="%p_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="34" primitiveName="%b_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="35" primitiveName="%sp_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="36" primitiveName="%spb_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="37" primitiveName="%msp_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="38" primitiveName="%i_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="39" primitiveName="%h_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="40" primitiveName="%fptr_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="41" primitiveName="%mc_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="42" primitiveName="%l_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="43" primitiveName="%hm_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="44" primitiveName="%ptr_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="45" primitiveName="%ce_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="46" primitiveName="%st_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="47" primitiveName="%r_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="48" primitiveName="%lss_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="49" primitiveName="%ip_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="50" primitiveName="%XMLList_i_XMLList" />
+    <PRIMITIVE gatewayId="68" primitiveId="51" primitiveName="xmlReadStr" />
+    <PRIMITIVE gatewayId="68" primitiveId="52" primitiveName="xmlFormat" />
+    <PRIMITIVE gatewayId="68" primitiveId="53" primitiveName="xmlElement" />
+    <PRIMITIVE gatewayId="68" primitiveId="54" primitiveName="xmlDocument" />
+    <PRIMITIVE gatewayId="68" primitiveId="55" primitiveName="xmlNs" />
+    <PRIMITIVE gatewayId="68" primitiveId="56" primitiveName="xmlAddNs" />
+    <PRIMITIVE gatewayId="68" primitiveId="57" primitiveName="xmlGetNsByHref" />
+    <PRIMITIVE gatewayId="68" primitiveId="58" primitiveName="xmlGetNsByPrefix" />
+    <PRIMITIVE gatewayId="68" primitiveId="59" primitiveName="%XMLElem_6" />
+    <PRIMITIVE gatewayId="68" primitiveId="60" primitiveName="%XMLDoc_6" />
+    <PRIMITIVE gatewayId="68" primitiveId="61" primitiveName="%XMLNs_6" />
+    <PRIMITIVE gatewayId="68" primitiveId="62" primitiveName="%XMLAttr_6" />
+    <PRIMITIVE gatewayId="68" primitiveId="63" primitiveName="%XMLList_6" />
+    <PRIMITIVE gatewayId="68" primitiveId="64" primitiveName="%XMLSet_6" />
+    <PRIMITIVE gatewayId="68" primitiveId="65" primitiveName="xmlWrite" />
+    <PRIMITIVE gatewayId="68" primitiveId="66" primitiveName="%XMLList_length" />
+    <PRIMITIVE gatewayId="68" primitiveId="67" primitiveName="%XMLSet_length" />
+    <PRIMITIVE gatewayId="68" primitiveId="68" primitiveName="%XMLAttr_length" />
+    <PRIMITIVE gatewayId="68" primitiveId="69" primitiveName="xmlDTD" />
+    <PRIMITIVE gatewayId="68" primitiveId="70" primitiveName="xmlSchema" />
+    <PRIMITIVE gatewayId="68" primitiveId="71" primitiveName="xmlRelaxNG" />
+    <PRIMITIVE gatewayId="68" primitiveId="72" primitiveName="xmlValidate" />
+    <PRIMITIVE gatewayId="68" primitiveId="73" primitiveName="%XMLValid_p" />
+    <PRIMITIVE gatewayId="68" primitiveId="74" primitiveName="xmlIsValidObject" />
+    <PRIMITIVE gatewayId="68" primitiveId="75" primitiveName="xmlAsNumber" />
+    <PRIMITIVE gatewayId="68" primitiveId="76" primitiveName="xmlAsText" />
+    <PRIMITIVE gatewayId="68" primitiveId="77" primitiveName="xmlRemove" />
+    <PRIMITIVE gatewayId="68" primitiveId="78" primitiveName="xmlSetAttributes" />
+    <PRIMITIVE gatewayId="68" primitiveId="79" primitiveName="xmlName" />
+    <PRIMITIVE gatewayId="68" primitiveId="80" primitiveName="xmlAppend" />
+</GATEWAY>
index e122838..6213bb2 100644 (file)
@@ -102,11 +102,13 @@ int sci_percent_s_i_XMLList(char *fname, void* pvApiCtx)
     }
     else if (isNamedVarExist(pvApiCtx, "%s_xmlFormat"))
     {
+        callScilabFunction(pvApiCtx, "%s_xmlFormat", iBegin, mlhs, mrhs);
         //Call function directly in scilab 6 C++ api
         //Nbvars = Max(Nbvars, Lhs + Rhs);
         //SciString(&iBegin, (char *)"%s_xmlFormat", &mlhs, &mrhs);
         //Nbvars = Max(Nbvars, Lhs + Rhs + mlhs + mrhs);
 
+        iBegin = nbInputArgument(pvApiCtx) + mrhs + 1;
         err = getVarAddressFromPosition(pvApiCtx, iBegin, &retaddr);
         if (err.iErr)
         {
index a13f154..194344a 100644 (file)
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE module SYSTEM "../../functions/xml/gateway.dtd">
 <!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2012 - Scilab Enterprises - Calixte Denizet
- * 
- * This file must be used under the terms of the CeCILL.
- * This source file is licensed as described in the file COPYING, which
- * you should have received as part of this distribution.  The terms
- * are also available at    
- * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
+/*
+ *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *  Copyright (C) 2012 - Scilab Enterprises - Cedric DELAMARRE
  *
- -->
-<!DOCTYPE GATEWAY SYSTEM "../../functions/xml/gateway.dtd">
-<GATEWAY name="xml">
-    
-    <!--
+ *  This file must be used under the terms of the CeCILL.
+ *  This source file is licensed as described in the file COPYING, which
+ *  you should have received as part of this distribution.  The terms
+ *  are also available at
+ *  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+ *
+ */
  Scilab
  Interface description. In this file, we define the list of the function which
  will be available into Scilab and the link to the "native" function.
 
- gatewayId is the position in the hashtable 'Interfaces' defined in the
- file SCI/modules/core/src/c/callinterf.h
-
- primitiveId is the position in the hashtable '<module>Table Tab[]' defined
- in the file modules/<module>/sci_gateway/c/gw_<module>.c
-
- primitiveName is the name of the Scilab function
-
  Don't touch if you do not know what you are doing
-
 -->
-    <PRIMITIVE gatewayId="68" primitiveId="1" primitiveName="xmlRead" />
-    <PRIMITIVE gatewayId="68" primitiveId="2" primitiveName="xmlDelete" />
-    <PRIMITIVE gatewayId="68" primitiveId="3" primitiveName="xmlDump" />
-    <PRIMITIVE gatewayId="68" primitiveId="4" primitiveName="xmlGetOpenDocs" />
-    <PRIMITIVE gatewayId="68" primitiveId="5" primitiveName="xmlXPath" />
-    <PRIMITIVE gatewayId="68" primitiveId="6" primitiveName="%XMLDoc_e" />
-    <PRIMITIVE gatewayId="68" primitiveId="7" primitiveName="%XMLElem_e" />
-    <PRIMITIVE gatewayId="68" primitiveId="8" primitiveName="%XMLNs_e" />
-    <PRIMITIVE gatewayId="68" primitiveId="9" primitiveName="%XMLAttr_e" />
-    <PRIMITIVE gatewayId="68" primitiveId="10" primitiveName="%XMLList_e" />
-    <PRIMITIVE gatewayId="68" primitiveId="11" primitiveName="%XMLSet_e" />
-    <PRIMITIVE gatewayId="68" primitiveId="12" primitiveName="%XMLDoc_p" />
-    <PRIMITIVE gatewayId="68" primitiveId="13" primitiveName="%XMLElem_p" />
-    <PRIMITIVE gatewayId="68" primitiveId="14" primitiveName="%XMLNs_p" />
-    <PRIMITIVE gatewayId="68" primitiveId="15" primitiveName="%XMLList_p" />
-    <PRIMITIVE gatewayId="68" primitiveId="16" primitiveName="%XMLAttr_p" />
-    <PRIMITIVE gatewayId="68" primitiveId="17" primitiveName="%XMLSet_p" />
-    <PRIMITIVE gatewayId="68" primitiveId="18" primitiveName="%XMLList_size" />
-    <PRIMITIVE gatewayId="68" primitiveId="19" primitiveName="%XMLSet_size" />
-    <PRIMITIVE gatewayId="68" primitiveId="20" primitiveName="%XMLAttr_size" />
-    <PRIMITIVE gatewayId="68" primitiveId="21" primitiveName="%c_i_XMLDoc" />
-    <PRIMITIVE gatewayId="68" primitiveId="22" primitiveName="%XMLElem_i_XMLDoc" />
-    <PRIMITIVE gatewayId="68" primitiveId="23" primitiveName="%c_i_XMLElem" />
-    <PRIMITIVE gatewayId="68" primitiveId="24" primitiveName="%XMLElem_i_XMLElem" />
-    <PRIMITIVE gatewayId="68" primitiveId="25" primitiveName="%XMLAttr_i_XMLElem" />
-    <PRIMITIVE gatewayId="68" primitiveId="26" primitiveName="%XMLList_i_XMLElem" />
-    <PRIMITIVE gatewayId="68" primitiveId="27" primitiveName="%XMLNs_i_XMLElem" />
-    <PRIMITIVE gatewayId="68" primitiveId="28" primitiveName="%c_i_XMLAttr" />
-    <PRIMITIVE gatewayId="68" primitiveId="29" primitiveName="%XMLElem_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="30" primitiveName="%XMLDoc_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="31" primitiveName="%c_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="32" primitiveName="%s_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="33" primitiveName="%p_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="34" primitiveName="%b_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="35" primitiveName="%sp_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="36" primitiveName="%spb_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="37" primitiveName="%msp_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="38" primitiveName="%i_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="39" primitiveName="%h_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="40" primitiveName="%fptr_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="41" primitiveName="%mc_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="42" primitiveName="%l_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="43" primitiveName="%hm_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="44" primitiveName="%ptr_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="45" primitiveName="%ce_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="46" primitiveName="%st_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="47" primitiveName="%r_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="48" primitiveName="%lss_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="49" primitiveName="%ip_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="50" primitiveName="%XMLList_i_XMLList" />
-    <PRIMITIVE gatewayId="68" primitiveId="51" primitiveName="xmlReadStr" />
-    <PRIMITIVE gatewayId="68" primitiveId="52" primitiveName="xmlFormat" />
-    <PRIMITIVE gatewayId="68" primitiveId="53" primitiveName="xmlElement" />
-    <PRIMITIVE gatewayId="68" primitiveId="54" primitiveName="xmlDocument" />
-    <PRIMITIVE gatewayId="68" primitiveId="55" primitiveName="xmlNs" />
-    <PRIMITIVE gatewayId="68" primitiveId="56" primitiveName="xmlAddNs" />
-    <PRIMITIVE gatewayId="68" primitiveId="57" primitiveName="xmlGetNsByHref" />
-    <PRIMITIVE gatewayId="68" primitiveId="58" primitiveName="xmlGetNsByPrefix" />
-    <PRIMITIVE gatewayId="68" primitiveId="59" primitiveName="%XMLElem_6" />
-    <PRIMITIVE gatewayId="68" primitiveId="60" primitiveName="%XMLDoc_6" />
-    <PRIMITIVE gatewayId="68" primitiveId="61" primitiveName="%XMLNs_6" />
-    <PRIMITIVE gatewayId="68" primitiveId="62" primitiveName="%XMLAttr_6" />
-    <PRIMITIVE gatewayId="68" primitiveId="63" primitiveName="%XMLList_6" />
-    <PRIMITIVE gatewayId="68" primitiveId="64" primitiveName="%XMLSet_6" />
-    <PRIMITIVE gatewayId="68" primitiveId="65" primitiveName="xmlWrite" />
-    <PRIMITIVE gatewayId="68" primitiveId="66" primitiveName="%XMLList_length" />
-    <PRIMITIVE gatewayId="68" primitiveId="67" primitiveName="%XMLSet_length" />
-    <PRIMITIVE gatewayId="68" primitiveId="68" primitiveName="%XMLAttr_length" />
-    <PRIMITIVE gatewayId="68" primitiveId="69" primitiveName="xmlDTD" />
-    <PRIMITIVE gatewayId="68" primitiveId="70" primitiveName="xmlSchema" />
-    <PRIMITIVE gatewayId="68" primitiveId="71" primitiveName="xmlRelaxNG" />
-    <PRIMITIVE gatewayId="68" primitiveId="72" primitiveName="xmlValidate" />
-    <PRIMITIVE gatewayId="68" primitiveId="73" primitiveName="%XMLValid_p" />
-    <PRIMITIVE gatewayId="68" primitiveId="74" primitiveName="xmlIsValidObject" />
-    <PRIMITIVE gatewayId="68" primitiveId="75" primitiveName="xmlAsNumber" />
-    <PRIMITIVE gatewayId="68" primitiveId="76" primitiveName="xmlAsText" />
-    <PRIMITIVE gatewayId="68" primitiveId="77" primitiveName="xmlRemove" />
-    <PRIMITIVE gatewayId="68" primitiveId="78" primitiveName="xmlSetAttributes" />
-    <PRIMITIVE gatewayId="68" primitiveId="79" primitiveName="xmlName" />
-    <PRIMITIVE gatewayId="68" primitiveId="80" primitiveName="xmlAppend" />
-    <PRIMITIVE gatewayId="68" primitiveId="81" primitiveName="htmlRead" />
-    <PRIMITIVE gatewayId="68" primitiveId="82" primitiveName="htmlReadStr" />
-    <PRIMITIVE gatewayId="68" primitiveId="83" primitiveName="htmlWrite" />
-    <PRIMITIVE gatewayId="68" primitiveId="84" primitiveName="htmlDump" />
-</GATEWAY>
+<module name="xml">
+    <gateway name="sci_xmlRead"                     function="xmlRead"              type="0" />
+    <gateway name="sci_xmlDelete"                   function="xmlDelete"            type="0" />
+    <gateway name="sci_xmlDump"                     function="xmlDump"              type="0" />
+    <gateway name="sci_xmlGetOpenDocs"              function="xmlGetOpenDocs"       type="0" />
+    <gateway name="sci_xmlXPath"                    function="xmlXPath"             type="0" />
+    <gateway name="sci_percent_XMLDoc_e"            function="%XMLDoc_e"            type="0" />
+    <gateway name="sci_percent_XMLElem_e"           function="%XMLElem_e"           type="0" />
+    <gateway name="sci_percent_XMLNs_e"             function="%XMLNs_e"             type="0" />
+    <gateway name="sci_percent_XMLAttr_e"           function="%XMLAttr_e"           type="0" />
+    <gateway name="sci_percent_XMLList_e"           function="%XMLList_e"           type="0" />
+    <gateway name="sci_percent_XMLList_e"           function="%XMLSet_e"            type="0" />
+    <gateway name="sci_percent_XMLDoc_p"            function="%XMLDoc_p"            type="0" />
+    <gateway name="sci_percent_XMLElem_p"           function="%XMLElem_p"           type="0" />
+    <gateway name="sci_percent_XMLNs_p"             function="%XMLNs_p"             type="0" />
+    <gateway name="sci_percent_XMLList_p"           function="%XMLList_p"           type="0" />
+    <gateway name="sci_percent_XMLAttr_p"           function="%XMLAttr_p"           type="0" />
+    <gateway name="sci_percent_XMLSet_p"            function="%XMLSet_p"            type="0" />
+    <gateway name="sci_percent_XMLList_size"        function="%XMLList_size"        type="0" />
+    <gateway name="sci_percent_XMLList_size"        function="%XMLSet_size"         type="0" />
+    <gateway name="sci_percent_XMLAttr_size"        function="%XMLAttr_size"        type="0" />
+    <gateway name="sci_percent_c_i_XMLDoc"          function="%c_i_XMLDoc"          type="0" />
+    <gateway name="sci_percent_XMLElem_i_XMLDoc"    function="%XMLElem_i_XMLDoc"    type="0" />
+    <gateway name="sci_percent_c_i_XMLElem"         function="%c_i_XMLElem"         type="0" />
+    <gateway name="sci_percent_XMLElem_i_XMLElem"   function="%XMLElem_i_XMLElem"   type="0" />
+    <gateway name="sci_percent_XMLAttr_i_XMLElem"   function="%XMLAttr_i_XMLElem"   type="0" />
+    <gateway name="sci_percent_XMLList_i_XMLElem"   function="%XMLList_i_XMLElem"   type="0" />
+    <gateway name="sci_percent_XMLNs_i_XMLElem"     function="%XMLNs_i_XMLElem"     type="0" />
+    <gateway name="sci_percent_c_i_XMLAttr"         function="%c_i_XMLAttr"         type="0" />
+    <gateway name="sci_percent_XMLElem_i_XMLList"   function="%XMLElem_i_XMLList"   type="0" />
+    <gateway name="sci_percent_XMLDoc_i_XMLList"    function="%XMLDoc_i_XMLList"    type="0" />
+    <gateway name="sci_percent_c_i_XMLList"         function="%c_i_XMLList"         type="0" />
+    <gateway name="sci_percent_s_i_XMLList"         function="%s_i_XMLList"         type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%p_i_XMLList"         type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%b_i_XMLList"         type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%sp_i_XMLList"        type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%spb_i_XMLList"       type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%msp_i_XMLList"       type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%i_i_XMLList"         type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%h_i_XMLList"         type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%fptr_i_XMLList"      type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%mc_i_XMLList"        type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%l_i_XMLList"         type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%hm_i_XMLList"        type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%ptr_i_XMLList"       type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%ce_i_XMLList"        type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%st_i_XMLList"        type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%r_i_XMLList"         type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%lss_i_XMLList"       type="0" />
+    <gateway name="sci_percent_foo_i_XMLList"       function="%ip_i_XMLList"        type="0" />
+    <gateway name="sci_percent_XMLList_i_XMLList"   function="%XMLList_i_XMLList"   type="0" />
+    <gateway name="sci_xmlReadStr"                  function="xmlReadStr"           type="0" />
+    <gateway name="sci_xmlFormat"                   function="xmlFormat"            type="0" />
+    <gateway name="sci_xmlElement"                  function="xmlElement"           type="0" />
+    <gateway name="sci_xmlDocument"                 function="xmlDocument"          type="0" />
+    <gateway name="sci_xmlNs"                       function="xmlNs"                type="0" />
+    <gateway name="sci_xmlAddNs"                    function="xmlAddNs"             type="0" />
+    <gateway name="sci_xmlGetNsByHref"              function="xmlGetNsByHref"       type="0" />
+    <gateway name="sci_xmlGetNsByPrefix"            function="xmlGetNsByPrefix"     type="0" />
+    <gateway name="sci_percent_XMLElem_e"           function="%XMLElem_6"           type="0" />
+    <gateway name="sci_percent_XMLDoc_e"            function="%XMLDoc_6"            type="0" />
+    <gateway name="sci_percent_XMLNs_e"             function="%XMLNs_6"             type="0" />
+    <gateway name="sci_percent_XMLAttr_e"           function="%XMLAttr_6"           type="0" />
+    <gateway name="sci_percent_XMLList_e"           function="%XMLList_6"           type="0" />
+    <gateway name="sci_percent_XMLList_e"           function="%XMLSet_6"            type="0" />
+    <gateway name="sci_xmlWrite"                    function="xmlWrite"             type="0" />
+    <gateway name="sci_percent_XMLList_length"      function="%XMLList_length"      type="0" />
+    <gateway name="sci_percent_XMLList_length"      function="%XMLSet_length"       type="0" />
+    <gateway name="sci_percent_XMLAttr_length"      function="%XMLAttr_length"      type="0" />
+    <gateway name="sci_xmlDTD"                      function="xmlDTD"               type="0" />
+    <gateway name="sci_xmlSchema"                   function="xmlSchema"            type="0" />
+    <gateway name="sci_xmlRelaxNG"                  function="xmlRelaxNG"           type="0" />
+    <gateway name="sci_xmlValidate"                 function="xmlValidate"          type="0" />
+    <gateway name="sci_percent_XMLValid_p"          function="%XMLValid_p"          type="0" />
+    <gateway name="sci_xmlIsValidObject"            function="xmlIsValidObject"     type="0" />
+    <gateway name="sci_xmlAsNumber"                 function="xmlAsNumber"          type="0" />
+    <gateway name="sci_xmlAsText"                   function="xmlAsText"            type="0" />
+    <gateway name="sci_xmlRemove"                   function="xmlRemove"            type="0" />
+    <gateway name="sci_xmlSetAttributes"            function="xmlSetAttributes"     type="0" />
+    <gateway name="sci_xmlName"                     function="xmlName"              type="0" />
+    <gateway name="sci_xmlAppend"                   function="xmlAppend"            type="0" />
+    <gateway name="sci_htmlRead"                    function="htmlRead"             type="0" />
+    <gateway name="sci_htmlReadStr"                 function="htmlRadStr"           type="0" />
+    <gateway name="sci_htmlWrite"                   function="htmlWrite"            type="0" />
+    <gateway name="sci_htmlDump"                    function="htmlDump"             type="0" />
+</module>
  *
  */
 
+extern "C"
+{
 #include <string.h>
 #include "xml_mlist.h"
 #include "api_scilab.h"
 #include "Scierror.h"
 #include "MALLOC.h"
+}
+
+#include "mlist.hxx"
+#include "tlist.hxx"
+#include "internal.hxx"
+#include "string.hxx"
 
 static const char *_XMLDoc[] = { "XMLDoc", "_id" };
 static const char *_XMLElem[] = { "XMLElem", "_id" };
@@ -250,48 +258,56 @@ int getXMLObjectId(int *mlist, void *pvApiCtx)
 /*--------------------------------------------------------------------------*/
 int getMListType(int * mlist, void * pvApiCtx)
 {
-    if (mlist[0] != sci_mlist || mlist[1] != 2)
+    types::InternalType* pIT = (types::InternalType*)mlist;
+    types::MList* m = dynamic_cast<types::MList*>(pIT);
+
+    if (m == NULL || m->getSize() != 2)
     {
         return -1;
     }
 
-    if (mlist[6] != sci_strings || mlist[7] != 1 || mlist[8] != 2)
+    types::String* pS = m->getFieldNames();
+
+    if (pS->getRows() != 1 || pS->getCols() != 2)
     {
         // first field is not a matrix 1x2 of strings
         return -1;
     }
 
-    if (mlist[13] == -33 && mlist[14] == -22 && mlist[15] == -21)
+    wchar_t* pwstType = pS->get(0);
+    int iLen = (int)wcslen(pwstType);
+
+    if (wcsncmp(pwstType, L"XML", 3) == 0)
     {
-        if (mlist[11] - 1 == strlen("XMLDoc") && mlist[16] == -13 && mlist[17] == 24  && mlist[18] == 12)
+        if (iLen == 6 /*strlen("XMLDoc")*/ && wcscmp(pwstType + 3, L"Doc") == 0)
         {
             return XMLDOCUMENT;
         }
-        if (mlist[11] - 1 == strlen("XMLElem") && mlist[16] == -14 && mlist[17] == 21 && mlist[18] == 14 && mlist[19] == 22)
+        if (iLen == 7 /*strlen("XMLElem")*/ && wcscmp(pwstType + 3, L"Elem") == 0)
         {
             return XMLELEMENT;
         }
-        if (mlist[11] - 1 == strlen("XMLAttr") && mlist[16] == -10 && mlist[17] == 29 && mlist[18] == 29 && mlist[19] == 27)
+        if (iLen == 7 /*strlen("XMLAttr")*/ && wcscmp(pwstType + 3, L"Attr") == 0)
         {
             return XMLATTRIBUTE;
         }
-        if (mlist[11] - 1 == strlen("XMLNs") && mlist[16] == -23 && mlist[17] == 28)
+        if (iLen == 5 /*strlen("XMLNs")*/ && wcscmp(pwstType + 3, L"Ns") == 0)
         {
             return XMLNAMESPACE;
         }
-        if (mlist[11] - 1 == strlen("XMLList") && mlist[16] == -21 && mlist[17] == 18 && mlist[18] == 28 && mlist[19] == 29)
+        if (iLen == 7 /*strlen("XMLList")*/ && wcscmp(pwstType + 3, L"List") == 0)
         {
             return XMLLIST;
         }
-        if (mlist[11] - 1 == strlen("XMLNH") && mlist[16] == -23 && mlist[17] == 17)
+        if (iLen == 5 /*strlen("XMLNH")*/ && wcscmp(pwstType + 3, L"NH") == 0)
         {
             return XMLNOTHANDLED;
         }
-        if (mlist[11] - 1 == strlen("XMLSet") && mlist[16] == -28 && mlist[17] == 14 && mlist[18] == 29)
+        if (iLen == 6 /*strlen("XMLSet")*/ && wcscmp(pwstType + 3, L"Set") == 0)
         {
             return XMLSET;
         }
-        if (mlist[11] - 1 == strlen("XMLValid") && mlist[16] == -31 && mlist[17] == 10 && mlist[18] == 21 && mlist[19] == 18 && mlist[20] == 13)
+        if (iLen == 8 /*strlen("XMLValid")*/ && wcscmp(pwstType + 3, L"Valid") == 0)
         {
             return XMLVALID;
         }
index da51c9a..d66cd5a 100644 (file)
@@ -41,4 +41,4 @@ c = doc.root.children(1).children(2);
 a=xmlGetNsByHref(c, "http://www.scilab.org");
 assert_checkequal(a.prefix,"scilab");
 assert_checkequal(a.href,"http://www.scilab.org");
-xmlDelete(doc);
\ No newline at end of file
+xmlDelete(doc);
index 9fd7cff..111b6e7 100644 (file)
 xmlFile=xmlRead(SCI+"/etc/modules.xml");
 assert_checktrue(xmlIsValidObject(xmlFile));
 a=xmlGetOpenDocs();
+
 if getos() == "Windows" then
     assert_checkequal(a(1).url, "file:///" + SCI+"/etc/modules.xml");
 else
     assert_checkequal(a(1).url, SCI+"/etc/modules.xml");
 end
 
-
 content=xmlDump(xmlFile);
 assert_checktrue(length(content)>0);
 assert_checktrue(size(content)>=[20,1]);
index e07eaa7..46177af 100644 (file)
@@ -80,7 +80,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../../libs/intl;../../libs/libxml2;../api_scilab/includes;../windows_tools/includes;../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../../libs/intl;../../libs/libxml2;../api_scilab/includes;../windows_tools/includes;../operations/includes;../types/includes;../ast/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;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../../libs/intl;../../libs/libxml2;../api_scilab/includes;../windows_tools/includes;../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../../libs/intl;../../libs/libxml2;../api_scilab/includes;../windows_tools/includes;../operations/includes;../types/includes;../ast/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;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../../libs/intl;../../libs/libxml2;../api_scilab/includes;../windows_tools/includes;../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../../libs/intl;../../libs/libxml2;../api_scilab/includes;../windows_tools/includes;../operations/includes;../types/includes;../ast/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;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../../libs/intl;../../libs/libxml2;../api_scilab/includes;../windows_tools/includes;../operations/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>includes;src/c;src/cpp;../core/includes;../output_stream/includes;../string/includes;../fileio/includes;../localization/includes;../../libs/intl;../../libs/libxml2;../api_scilab/includes;../windows_tools/includes;../operations/includes;../types/includes;../ast/includes;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>FORDLL;NDEBUG;_WINDOWS;_USRDLL;XML_SCILAB_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     <ProjectReference Include="..\string\src\c\string.vcxproj">
       <Project>{8d45767a-9b03-4905-97f6-d2f3f79141ea}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\types\types.vcxproj">
+      <Project>{64e090da-dcb5-4f4d-93d7-e88ddec9c2ef}</Project>
+    </ProjectReference>
     <ProjectReference Include="..\windows_tools\src\c\scilab_windows\scilab_windows.vcxproj">
       <Project>{8028f371-6a94-4a26-8804-6e7f05f1d1aa}</Project>
     </ProjectReference>
     <ClCompile Include="src\cpp\XMLDocument.cpp" />
     <ClCompile Include="src\cpp\XMLElement.cpp" />
     <ClCompile Include="src\cpp\XMLList.cpp" />
+    <ClCompile Include="src\cpp\XMLMlistsManagement.cpp" />
     <ClCompile Include="src\cpp\XMLNodeList.cpp" />
     <ClCompile Include="src\cpp\XMLNodeSet.cpp" />
     <ClCompile Include="src\cpp\XMLNotHandledElement.cpp" />
     <ClCompile Include="src\cpp\XMLValidationSchema.cpp" />
     <ClCompile Include="src\cpp\XMLXPath.cpp" />
     <ClCompile Include="src\c\DllmainXml.c" />
-    <ClCompile Include="src\c\XMLMlistsManagement.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
index 4dbbc23..7433f55 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup>
     <Filter Include="Source Files">
     <ClCompile Include="sci_gateway\cpp\sci_xmlXPath.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="src\c\XMLMlistsManagement.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="sci_gateway\cpp\sci_insertion.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
     <ClCompile Include="sci_gateway\cpp\sci_htmlWrite.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="src\cpp\XMLMlistsManagement.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>
\ No newline at end of file