template and multi dimension 89/3089/12
Antoine ELIAS [Wed, 2 Feb 2011 09:56:23 +0000 (10:56 +0100)]
Change-Id: I150b243f728c3a27b344b02845c00ed25176c681

234 files changed:
scilab/.gitignore
scilab/Scilab.sln
scilab/modules/abstractSyntaxTree/abstractSyntaxTree-tools.vcproj
scilab/modules/abstractSyntaxTree/includes/commentexp.hxx
scilab/modules/abstractSyntaxTree/includes/dollarvar.hxx
scilab/modules/abstractSyntaxTree/includes/location.hxx
scilab/modules/abstractSyntaxTree/includes/run_AssignExp.hxx
scilab/modules/abstractSyntaxTree/includes/run_CallExp.hxx
scilab/modules/abstractSyntaxTree/includes/run_MatrixExp.hxx
scilab/modules/abstractSyntaxTree/includes/run_OpExp.hxx
scilab/modules/abstractSyntaxTree/includes/runvisitor.hxx
scilab/modules/abstractSyntaxTree/includes/visitor_common.hxx
scilab/modules/abstractSyntaxTree/src/cpp/visitor_common.cpp
scilab/modules/api_scilab/src/cpp/api_boolean.cpp
scilab/modules/api_scilab/src/cpp/api_common.cpp
scilab/modules/api_scilab/src/cpp/api_double.cpp
scilab/modules/api_scilab/src/cpp/api_int.cpp
scilab/modules/api_scilab/src/cpp/api_poly.cpp
scilab/modules/api_scilab/src/cpp/api_string.cpp
scilab/modules/boolean/src/cpp/boolean_gw.vcproj
scilab/modules/core/includes/stack3.h
scilab/modules/core/sci_gateway/cpp/sci_argn.cpp
scilab/modules/core/sci_gateway/cpp/sci_clear.cpp
scilab/modules/core/sci_gateway/cpp/sci_clearglobal.cpp
scilab/modules/core/sci_gateway/cpp/sci_error.cpp
scilab/modules/core/sci_gateway/cpp/sci_exists.cpp
scilab/modules/core/sci_gateway/cpp/sci_exit.cpp
scilab/modules/core/sci_gateway/cpp/sci_getmd5.cpp
scilab/modules/core/sci_gateway/cpp/sci_getmodules.cpp
scilab/modules/core/sci_gateway/cpp/sci_getos.cpp
scilab/modules/core/sci_gateway/cpp/sci_getscilabmode.cpp
scilab/modules/core/sci_gateway/cpp/sci_getversion.cpp
scilab/modules/core/sci_gateway/cpp/sci_global.cpp
scilab/modules/core/sci_gateway/cpp/sci_isglobal.cpp
scilab/modules/core/sci_gateway/cpp/sci_lasterror.cpp
scilab/modules/core/sci_gateway/cpp/sci_warning.cpp
scilab/modules/core/sci_gateway/cpp/sci_with_module.cpp
scilab/modules/core/src/cpp/scilab.cpp
scilab/modules/elementary_functions/Makefile.am
scilab/modules/elementary_functions/Makefile.in
scilab/modules/elementary_functions/includes/elem_func_gw.hxx
scilab/modules/elementary_functions/includes/gw_elementary_functions.h
scilab/modules/elementary_functions/macros/null.sci [deleted file]
scilab/modules/elementary_functions/sci_gateway/c/sci_ones.c [deleted file]
scilab/modules/elementary_functions/sci_gateway/c/sci_zeros.c [deleted file]
scilab/modules/elementary_functions/sci_gateway/cpp/elem_func_gw/elem_func_gw.vcproj
scilab/modules/elementary_functions/sci_gateway/cpp/sci_eye.cpp
scilab/modules/elementary_functions/sci_gateway/cpp/sci_ones.cpp [new file with mode: 0644]
scilab/modules/elementary_functions/sci_gateway/cpp/sci_size.cpp
scilab/modules/elementary_functions/sci_gateway/cpp/sci_zeros.cpp [new file with mode: 0644]
scilab/modules/elementary_functions/src/c/elementary_functions.vcproj
scilab/modules/fileio/sci_gateway/cpp/sci_basename.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_createdir.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_deletefile.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_fileext.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_fileinfo.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_fileparts.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_filesep.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_findfiles.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_fullpath.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_getlongpathname.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_getshortpathname.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_isdir.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_isfile.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_mclose.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_mget.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_mgetl.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_mopen.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_mput.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_mputl.cpp
scilab/modules/fileio/sci_gateway/cpp/sci_pathconvert.cpp
scilab/modules/fileio/src/cpp/expandPathVariable.cpp
scilab/modules/fileio/src/cpp/filemanager.cpp
scilab/modules/fileio/src/cpp/mget.cpp
scilab/modules/functions/sci_gateway/cpp/sci_exec.cpp
scilab/modules/functions/sci_gateway/cpp/sci_execstr.cpp
scilab/modules/functions/sci_gateway/cpp/sci_functionlist.cpp
scilab/modules/functions/sci_gateway/cpp/sci_getThreads.cpp
scilab/modules/functions/sci_gateway/cpp/sci_mode.cpp
scilab/modules/functions/sci_gateway/cpp/sci_whereis.cpp
scilab/modules/functions_manager/src/cpp/funcmanager.cpp
scilab/modules/gui/src/c/gui.vcproj
scilab/modules/integer/sci_gateway/cpp/sci_inttype.cpp
scilab/modules/io/sci_gateway/cpp/sci_file.cpp
scilab/modules/io/sci_gateway/cpp/sci_genlib.cpp
scilab/modules/io/sci_gateway/cpp/sci_host.cpp
scilab/modules/io/sci_gateway/cpp/sci_load.cpp
scilab/modules/jvm/sci_gateway/cpp/sci_system_getproperty.cpp
scilab/modules/localization/sci_gateway/cpp/sci_getdefaultlanguage.cpp
scilab/modules/localization/sci_gateway/cpp/sci_getlanguage.cpp
scilab/modules/localization/sci_gateway/cpp/sci_gettext.cpp
scilab/modules/localization/sci_gateway/cpp/sci_setdefaultlanguage.cpp
scilab/modules/localization/sci_gateway/cpp/sci_setlanguage.cpp
scilab/modules/matio/sci_gateway/cpp/matio_gw.vcproj
scilab/modules/operations/Makefile.am
scilab/modules/operations/Makefile.in
scilab/modules/operations/includes/matrix_addition.h
scilab/modules/operations/includes/matrix_substraction.h
scilab/modules/operations/includes/operations_tools.h [new file with mode: 0644]
scilab/modules/operations/includes/types_addition.hxx
scilab/modules/operations/includes/types_divide.hxx
scilab/modules/operations/includes/types_finite.hxx
scilab/modules/operations/includes/types_multiplication.hxx
scilab/modules/operations/includes/types_power.hxx
scilab/modules/operations/includes/types_substraction.hxx
scilab/modules/operations/operations.vcproj
scilab/modules/operations/src/c/matrix_addition.c
scilab/modules/operations/src/c/matrix_power.c
scilab/modules/operations/src/c/matrix_substraction.c
scilab/modules/operations/src/c/operations_tools.c [new file with mode: 0644]
scilab/modules/operations/src/cpp/types_addition.cpp
scilab/modules/operations/src/cpp/types_divide.cpp
scilab/modules/operations/src/cpp/types_finite.cpp
scilab/modules/operations/src/cpp/types_multiplication.cpp
scilab/modules/operations/src/cpp/types_power.cpp
scilab/modules/operations/src/cpp/types_substraction.cpp
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/overloading/macros/%r_p.sci
scilab/modules/parse/parse.vcproj
scilab/modules/scinotes/src/c/scinotes.vcproj
scilab/modules/string/sci_gateway/cpp/sci_ascii.cpp
scilab/modules/string/sci_gateway/cpp/sci_grep.cpp
scilab/modules/string/sci_gateway/cpp/sci_length.cpp
scilab/modules/string/sci_gateway/cpp/sci_part.cpp
scilab/modules/string/sci_gateway/cpp/sci_regexp.cpp
scilab/modules/string/sci_gateway/cpp/sci_strcat.cpp
scilab/modules/string/sci_gateway/cpp/sci_strindex.cpp
scilab/modules/string/sci_gateway/cpp/sci_string.cpp
scilab/modules/string/sci_gateway/cpp/sci_stripblanks.cpp
scilab/modules/string/sci_gateway/cpp/sci_strsubst.cpp
scilab/modules/string/src/cpp/stripblanks.cpp
scilab/modules/string/src/cpp/stripblanks.hxx
scilab/modules/symbol/includes/heap.hxx
scilab/modules/symbol/symbol.vcproj
scilab/modules/system_env/includes/configvariable.hxx
scilab/modules/system_env/src/cpp/home.cpp
scilab/modules/system_env/src/cpp/promptmode.cpp
scilab/modules/system_env/src/cpp/sci_home.cpp
scilab/modules/system_env/src/cpp/sci_path.cpp
scilab/modules/system_env/src/cpp/sci_tmpdir.cpp
scilab/modules/system_env/src/cpp/sci_warning.cpp
scilab/modules/time/sci_gateway/cpp/sci_tictoc.cpp
scilab/modules/types/Makefile.am
scilab/modules/types/Makefile.in
scilab/modules/types/includes/alltypes.hxx
scilab/modules/types/includes/anytype.hxx
scilab/modules/types/includes/arrayof.hxx [new file with mode: 0644]
scilab/modules/types/includes/bool.hxx
scilab/modules/types/includes/callable.hxx
scilab/modules/types/includes/cell.hxx
scilab/modules/types/includes/colon.hxx [new file with mode: 0644]
scilab/modules/types/includes/container.hxx
scilab/modules/types/includes/dollar.hxx [new file with mode: 0644]
scilab/modules/types/includes/double.hxx
scilab/modules/types/includes/file.hxx
scilab/modules/types/includes/float.hxx
scilab/modules/types/includes/function.hxx
scilab/modules/types/includes/implicitlist.hxx
scilab/modules/types/includes/int.hxx
scilab/modules/types/includes/int16.hxx [new file with mode: 0644]
scilab/modules/types/includes/int32.hxx [new file with mode: 0644]
scilab/modules/types/includes/int64.hxx [new file with mode: 0644]
scilab/modules/types/includes/int8.hxx [new file with mode: 0644]
scilab/modules/types/includes/internal.hxx
scilab/modules/types/includes/intt.hxx [deleted file]
scilab/modules/types/includes/list.hxx
scilab/modules/types/includes/listdelete.hxx
scilab/modules/types/includes/listinsert.hxx
scilab/modules/types/includes/listoperation.hxx
scilab/modules/types/includes/listundefined.hxx
scilab/modules/types/includes/macro.hxx
scilab/modules/types/includes/macrofile.hxx
scilab/modules/types/includes/matrixpoly.hxx [deleted file]
scilab/modules/types/includes/mlist.hxx
scilab/modules/types/includes/polynom.hxx [new file with mode: 0644]
scilab/modules/types/includes/singlepoly.hxx [moved from scilab/modules/types/includes/poly.hxx with 64% similarity]
scilab/modules/types/includes/string.hxx
scilab/modules/types/includes/struct.hxx
scilab/modules/types/includes/threadId.hxx
scilab/modules/types/includes/tlist.hxx
scilab/modules/types/includes/tostring_common.hxx
scilab/modules/types/includes/types.hxx
scilab/modules/types/includes/types_tools.hxx [new file with mode: 0644]
scilab/modules/types/includes/uint16.hxx [new file with mode: 0644]
scilab/modules/types/includes/uint32.hxx [new file with mode: 0644]
scilab/modules/types/includes/uint64.hxx [new file with mode: 0644]
scilab/modules/types/includes/uint8.hxx [new file with mode: 0644]
scilab/modules/types/includes/user.hxx
scilab/modules/types/sci_gateway/cpp/sci_cell.cpp
scilab/modules/types/sci_gateway/cpp/sci_isfield.cpp
scilab/modules/types/sci_gateway/cpp/sci_makecell.cpp
scilab/modules/types/sci_gateway/cpp/sci_struct.cpp
scilab/modules/types/sci_gateway/cpp/sci_tlist.cpp
scilab/modules/types/sci_gateway/cpp/sci_tlist_or_mlist.hxx
scilab/modules/types/sci_gateway/cpp/sci_typeof.cpp
scilab/modules/types/sci_gateway/cpp/sci_usertype.cpp
scilab/modules/types/src/cpp/arrayof.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/bool.cpp
scilab/modules/types/src/cpp/cell.cpp
scilab/modules/types/src/cpp/double.cpp
scilab/modules/types/src/cpp/float.cpp
scilab/modules/types/src/cpp/function.cpp
scilab/modules/types/src/cpp/implicitlist.cpp
scilab/modules/types/src/cpp/int.cpp [deleted file]
scilab/modules/types/src/cpp/int16.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/int32.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/int64.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/int8.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/list.cpp
scilab/modules/types/src/cpp/listdelete.cpp
scilab/modules/types/src/cpp/listinsert.cpp
scilab/modules/types/src/cpp/listoperation.cpp
scilab/modules/types/src/cpp/listundefined.cpp
scilab/modules/types/src/cpp/macro.cpp
scilab/modules/types/src/cpp/macrofile.cpp
scilab/modules/types/src/cpp/matrixpoly.cpp [deleted file]
scilab/modules/types/src/cpp/mlist.cpp
scilab/modules/types/src/cpp/polynom.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/singlepoly.cpp [moved from scilab/modules/types/src/cpp/poly.cpp with 58% similarity]
scilab/modules/types/src/cpp/string.cpp
scilab/modules/types/src/cpp/struct.cpp
scilab/modules/types/src/cpp/threadId.cpp
scilab/modules/types/src/cpp/tlist.cpp
scilab/modules/types/src/cpp/tostring_common.cpp
scilab/modules/types/src/cpp/types.cpp
scilab/modules/types/src/cpp/types_tools.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/uint16.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/uint32.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/uint64.cpp [new file with mode: 0644]
scilab/modules/types/src/cpp/uint8.cpp [new file with mode: 0644]
scilab/modules/types/types.vcproj
scilab/modules/windows_tools/src/c/windows_tools.vcproj

index eae88a5..4639763 100644 (file)
@@ -71,6 +71,7 @@ Debug
 *.suo
 *.ncb
 VTune
+*.pdb
 
 #
 # F2C files (windows)
index 1041855..9ef4910 100644 (file)
@@ -1156,6 +1156,7 @@ EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "api_scilab", "modules\api_scilab\api_scilab.vcproj", "{43C5BAB1-1DCA-4743-A183-77E0D42FE7D0}"
        ProjectSection(ProjectDependencies) = postProject
                {E1284D3E-4B3F-446B-B541-F661A8A166A7} = {E1284D3E-4B3F-446B-B541-F661A8A166A7}
+               {1F4A0344-99ED-461B-BD53-1593788FB34D} = {1F4A0344-99ED-461B-BD53-1593788FB34D}
                {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E} = {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E}
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}
                {A5911CD7-F8E8-440C-A23E-4843A0636F3A} = {A5911CD7-F8E8-440C-A23E-4843A0636F3A}
@@ -1262,18 +1263,21 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "parse", "modules\parse\pars
                {0D3FA25B-8116-44EC-A45E-260789DAA3D9} = {0D3FA25B-8116-44EC-A45E-260789DAA3D9}
                {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E} = {6A84AD8C-BA18-4A3F-9C72-EC3DF0939E9E}
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}
+               {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF} = {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF}
                {7CA60AEF-9AFA-4D06-AF28-613C0AA27640} = {7CA60AEF-9AFA-4D06-AF28-613C0AA27640}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symbol", "modules\symbol\symbol.vcproj", "{2C60033B-0DBD-4CA4-80D3-176C9BE9CE2F}"
        ProjectSection(ProjectDependencies) = postProject
                {E1284D3E-4B3F-446B-B541-F661A8A166A7} = {E1284D3E-4B3F-446B-B541-F661A8A166A7}
+               {1F4A0344-99ED-461B-BD53-1593788FB34D} = {1F4A0344-99ED-461B-BD53-1593788FB34D}
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}
                {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF} = {64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "types", "modules\types\types.vcproj", "{64E090DA-DCB5-4F4D-93D7-E88DDEC9C2EF}"
        ProjectSection(ProjectDependencies) = postProject
+               {1F4A0344-99ED-461B-BD53-1593788FB34D} = {1F4A0344-99ED-461B-BD53-1593788FB34D}
                {5B110267-7C18-437C-B87D-DBA2B50729E9} = {5B110267-7C18-437C-B87D-DBA2B50729E9}
                {3170E4C2-1173-4264-A222-7EE8CCB3DDF7} = {3170E4C2-1173-4264-A222-7EE8CCB3DDF7}
        EndProjectSection
index 35e4c14..473f8bb 100644 (file)
                        UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
                        >
                </Filter>
+               <File
+                       RelativePath="..\..\bin\blasplus.lib"
+                       >
+               </File>
+               <File
+                       RelativePath="..\..\bin\lapack.lib"
+                       >
+               </File>
        </Files>
        <Globals>
        </Globals>
index 2237dbf..bc56587 100644 (file)
@@ -41,7 +41,7 @@ namespace ast
         virtual CommentExp* clone()
         {
             Location* newloc = const_cast<Location*>(&location_get())->clone();
-            return new CommentExp(location_get(), &comment_get());
+            return new CommentExp(*newloc, &comment_get());
         }
 
         /** \name Visitors entry point.
index 681e25e..9f733c2 100644 (file)
@@ -45,7 +45,7 @@ namespace ast
         virtual DollarVar* clone()
         {
             Location* newloc = const_cast<Location*>(&location_get())->clone();
-            return new DollarVar(location_get());
+            return new DollarVar(*newloc);
         }
 
         /** \name Visitors entry point.
index 0e4f951..0d05444 100644 (file)
@@ -71,7 +71,7 @@ public:
     }
     /** \} */
 
-    std::wstring location_string_get() const
+    std::wstring location_getString() const
     {
         std::wostringstream os;
         os << L" (" << first_line << L"," << first_column << L")";
index 84ba007..66a6ffc 100644 (file)
@@ -18,7 +18,6 @@
 
 void visitprivate(const AssignExp  &e)
 {
-    symbol::Context *pcontext = symbol::Context::getInstance();
     /*Create local exec visitor*/
     T execMeR;
     try
@@ -34,11 +33,10 @@ void visitprivate(const AssignExp  &e)
         {
             T execVar;
             InternalType *pIT;
-            bool bSeeAsVector   = false;
             bool bRet           = true;
             bool bNew           = false;
-            int iProductElem    = (int)pCell->args_get().size();
 
+            //retrieve variable
             pVar = dynamic_cast<const SimpleVar*>(&pCell->name_get());
             if(pVar == NULL)
             {//manage a.b{1} = x
@@ -52,7 +50,7 @@ void visitprivate(const AssignExp  &e)
                 {//never append ?
                     std::wostringstream os;
                     os << _W("Unable to extract left part expression.\n");
-                    //os << ((Location)e.left_exp_get().location_get()).location_string_get() << std::endl;
+                    //os << ((Location)e.left_exp_get().location_get()).location_getString() << std::endl;
                     throw ScilabError(os.str(), 999, e.left_exp_get().location_get());
                 }
             }
@@ -61,8 +59,6 @@ void visitprivate(const AssignExp  &e)
                 pIT = symbol::Context::getInstance()->get(pVar->name_get());
             }
 
-            bSeeAsVector       = iProductElem == 1;
-
             /*getting what to assign*/
             e.right_exp_get().accept(execMeR);
             if(pIT == NULL)
@@ -78,54 +74,48 @@ void visitprivate(const AssignExp  &e)
                 }
             }
 
-            int *piIndexSeq     = NULL;
-            int *piMaxDim       = NULL;
-            int *piDimSize      = new int[iProductElem];
-            int iTotalCombi            = GetIndexList(pIT, pCall->args_get(), &piIndexSeq, &piMaxDim, pIT, piDimSize);
-            /*We have the indexlist expanded and the max index*/
-
-            //check we don't have bad indexes like "< 1"
-            for(int i = 0 ; i < iTotalCombi * iProductElem; i++)
-            {
-                if(piIndexSeq[i] < 1)
-                {
-                    //manage error
-                    std::wostringstream os;
-                    os << _W("Indexes must be positive .\n");
-                    //os << ((Location)e.left_exp_get().location_get()).location_string_get() << std::endl;
-                    throw ScilabError(os.str(), 999, e.left_exp_get().location_get());
-                }
-            }
-
             InternalType *pOut = NULL;
+            typed_list *pArgs = GetArgumentList(pCall->args_get());
 
             //fisrt extract implicit list
             if(execMeR.result_get()->isImplicitList())
             {
-                InternalType *pIL = execMeR.result_get()->getAsImplicitList()->extract_matrix();
+                InternalType *pIL = execMeR.result_get()->getAsImplicitList()->extractFullMatrix();
                 execMeR.result_set(pIL);
             }
-            else if(execMeR.result_get()->isContainer())
+            else if(execMeR.result_get()->isContainer() && execMeR.result_get()->isRef())
             {
                 InternalType* pIL = execMeR.result_get()->clone();
                 execMeR.result_set(pIL);
             }
 
+
             if(pIT == NULL)
             {//call static insert function
-                pOut = Cell::insert_new(iTotalCombi, piIndexSeq, piMaxDim, dynamic_cast<GenericType*>(execMeR.result_get()), bSeeAsVector);
+                pOut = Cell::insertNewCell(pArgs, execMeR.result_get());
             }
             else
             {//call type insert function
-                bRet = pIT->getAsCell()->insert_cell(iTotalCombi, piIndexSeq, piMaxDim, dynamic_cast<GenericType*>(execMeR.result_get()), bSeeAsVector);
-                pOut = pIT;
+                pOut = pIT->getAs<Cell>()->insertCell(pArgs, execMeR.result_get());
+
+                if(pOut && pOut != pIT)
+                {
+                    //variable change
+                    pIT->DecreaseRef();
+                    if(pIT->isDeletable())
+                    {
+                        delete pIT;
+                    }
+                    bNew = true;
+                }
             }
 
-            if(pOut != NULL && bRet == true)
+
+            if(pOut != NULL)
             {
                 if(bNew)
                 {
-                    symbol::Context::getInstance()->put(pVar->name_get(), *((GenericType*)pOut));
+                    symbol::Context::getInstance()->put(pVar->name_get(), *pOut);
                 }
 
                 if(e.is_verbose())
@@ -149,22 +139,17 @@ void visitprivate(const AssignExp  &e)
                 //manage error
                 std::wostringstream os;
                 os << _W("Submatrix incorrectly defined.\n");
-                //os << ((Location)e.right_exp_get().location_get()).location_string_get() << std::endl;
+                //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;
+//            delete piMaxDim;
+//            delete[] piDimSize;
         }
         else if(pCall)
         {//x(?) = ?
             T execVar;
             InternalType *pIT;
-            InternalType *pOut;
-            bool bNew           = false;
-            bool bSeeAsVector   = false;
-            int iProductElem    = (int)pCall->args_get().size();
-
-
+            bool bNew   = false;
 
             pVar = dynamic_cast<const SimpleVar*>(&pCall->name_get());
             if(pVar == NULL)
@@ -179,7 +164,7 @@ void visitprivate(const AssignExp  &e)
                 {//never append ?
                     std::wostringstream os;
                     os << _W("Unable to extract left part expression.\n");
-                    //os << ((Location)e.left_exp_get().location_get()).location_string_get() << std::endl;
+                    //os << ((Location)e.left_exp_get().location_get()).location_getString() << std::endl;
                     throw ScilabError(os.str(), 999, e.left_exp_get().location_get());
                 }
             }
@@ -188,8 +173,6 @@ void visitprivate(const AssignExp  &e)
                 pIT = symbol::Context::getInstance()->get(pVar->name_get());
             }
 
-            bSeeAsVector    = iProductElem == 1;
-
             /*getting what to assign*/
             e.right_exp_get().accept(execMeR);
             if(pIT == NULL)
@@ -205,175 +188,200 @@ void visitprivate(const AssignExp  &e)
                 }
             }
 
-            if(pIT->isStruct())
+            typed_list *pArgs = GetArgumentList(pCall->args_get());
+            InternalType *pOut = NULL;
+
+            //fisrt extract implicit list
+            if(execMeR.result_get()->isImplicitList())
             {
-                // Don't know how to manage struc array now.
-                if(pCall->args_get().size() != 1)
+                InternalType *pIL = execMeR.result_get()->getAsImplicitList()->extractFullMatrix();
+                execMeR.result_set(pIL);
+            }
+            else if(execMeR.result_get()->isContainer() && execMeR.result_get()->isRef())
+            {
+                //std::cout << "assign container type during insertion" << std::endl;
+                InternalType* pIL = execMeR.result_get()->clone();
+                execMeR.result_set(pIL);
+            }
+
+            //insert in a new variable or []
+            if(pIT == NULL || (pIT->isDouble() && pIT->getAs<Double>()->getSize() == 0))
+            {//call static insert function
+                //special case for insertion in [] 
+                if(pIT != NULL && pIT->isDouble() && pIT->getAs<Double>()->getSize() == 0)
                 {
-                    throw ScilabError(_W("Don't know how to extract Struct Array."), 999, e.left_exp_get().location_get());
+                    bNew = true;
                 }
 
-                T execMeArg;
-                std::list<Exp *>::const_iterator       it;
-                for(it = pCall->args_get().begin() ; it != pCall->args_get().end() ; it++)
+                switch(execMeR.result_get()->getType())
                 {
-                    (*it)->accept(execMeArg);
-                    if(execMeArg.result_get()->isDouble() == true)
+                case InternalType::RealDouble :
+                    pOut = Double::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealString :
+                    pOut = String::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealCell :
+                    pOut = Cell::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealBool :
+                    pOut = Bool::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealPoly :
+                    pOut = Polynom::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealInt8 :
+                    pOut = Int8::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealUInt8 :
+                    pOut = UInt8::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealInt16 :
+                    pOut = Int16::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealUInt16 :
+                    pOut = UInt16::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealInt32 :
+                    pOut = Int32::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealUInt32 :
+                    pOut = UInt32::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealInt64 :
+                    pOut = Int64::insertNew(pArgs, execMeR.result_get());
+                    break;
+                case InternalType::RealUInt64 :
+                    pOut = UInt64::insertNew(pArgs, execMeR.result_get());
+                    break;
+                default :
                     {
-                        throw ScilabError(_W("Don't know how to extract Struct Array."), 999, e.left_exp_get().location_get());
-                    }
-
-                    if(execMeArg.result_get()->isString() == false)
-                    {
-                        throw ScilabError(_W("Don't know how to insert non-string field of Struct Array."), 999, e.left_exp_get().location_get());
-                    }
-
-                    T execRight;
-                    e.right_exp_get().accept(execRight);
-                    if(execMeArg.result_get()->getAsString()->size_get() != execRight.result_size_get())
-                    {
-                        throw ScilabError(_W("Incompatible dimensions for multiple Struct fields insertion."), 999, e.left_exp_get().location_get());
-                    }
-                    else
-                    {
-                        for(int i = 0 ; i <  execRight.result_size_get() ; ++i)
-                        {
-                            pIT->getAsStruct()->add(std::wstring(execMeArg.result_get()->getAsString()->string_get(i)), execRight.result_get(i));
-                        }
+                        //manage error
+                        std::wostringstream os;
+                        os << _W("Operation not yet managed.\n");
+                        //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
+                        throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
+                        break;
                     }
                 }
-
-                pOut = pIT;
-
             }
             else
-            {
-                int *piIndexSeq     = NULL;
-                int *piMaxDim       = NULL;
-                int *piDimSize      = new int[iProductElem];
-                int iTotalCombi                = GetIndexList(pIT, pCall->args_get(), &piIndexSeq, &piMaxDim, pIT, piDimSize);
+            {//call type insert function
+                InternalType* pRet = NULL;
+                InternalType* pInsert = execMeR.result_get();
+                //check types compatibilties
 
-                if(iTotalCombi == 0)
-                {//nothing to do
-                    return;
+                if(pIT->isDouble() && pInsert->isDouble())
+                {
+                    pRet = pIT->getAs<Double>()->insert(pArgs, pInsert);
                 }
-                /*We have the indexlist expanded and the max index*/
-
-                //check we don't have bad indexes like "< 1"
-                for(int i = 0 ; i < iTotalCombi * iProductElem; i++)
+                else if(pIT->isString() && pInsert->isString())
                 {
-                    if(piIndexSeq[i] < 1)
-                    {
-                        //manage error
-                        std::wostringstream os;
-                        os << _W("Indexes must be positive .\n");
-                        //os << ((Location)e.left_exp_get().location_get()).location_string_get() << std::endl;
-                        throw ScilabError(os.str(), 999, e.left_exp_get().location_get());
-                    }
+                    pRet = pIT->getAs<String>()->insert(pArgs, pInsert);
                 }
-
-                //fisrt extract implicit list
-                if(execMeR.result_get()->isImplicitList())
+                else if(pIT->isCell() && pInsert->isCell())
                 {
-                    InternalType *pIL = execMeR.result_get()->getAsImplicitList()->extract_matrix();
-                    execMeR.result_set(pIL);
+                    pRet = pIT->getAs<Cell>()->insert(pArgs, pInsert);
                 }
-                else if(execMeR.result_get()->isContainer())
+                else if(pIT->isBool() && pInsert->isBool())
                 {
-                    //std::cout << "assign container type during insertion" << std::endl;
-                    InternalType* pIL = execMeR.result_get()->clone();
-                    execMeR.result_set(pIL);
+                    pRet = pIT->getAs<Bool>()->insert(pArgs, pInsert);
                 }
-
-                if(pIT == NULL || (pIT->isDouble() && pIT->getAsDouble()->size_get() == 0))
-                {//call static insert function
-                    if(pIT != NULL && pIT->isDouble() && pIT->getAsDouble()->size_get() == 0)
+                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->isList())
+                {
+                    pRet = pIT->getAsList()->insert(pArgs, pInsert);
+                }
+                else
+                {//overloading
+                    T execMe;
+                    types::typed_list in;
+                    types::typed_list out;
+
+                    //overload insertion
+                    //%x_i_x(i1, i2, ..., in, origin, inserted)
+                    //i1, ..., in : indexes
+                    //origin : variable where to insert data
+                    //inserted : data to insert
+
+                    for(int i = 0 ; i < pArgs->size() ; i++)
                     {
-                        bNew = true;
+                        (*pArgs)[i]->IncreaseRef();
+                        in.push_back((*pArgs)[i]);
                     }
 
-                    switch(execMeR.result_get()->getType())
+                    pInsert->IncreaseRef();
+                    in.push_back(pInsert);
+
+                    pIT->IncreaseRef();
+                    in.push_back(pIT);
+
+                    //build function name
+                    //a_i_b
+                    //a : type to insert
+                    //b : type that receive data
+                    std::wstring function_name;
+                    function_name = L"%" + pInsert->getShortTypeStr() + L"_i_" + pIT->getShortTypeStr();
+                    Overload::call(function_name, in, 1, out, &execMe);
+
+                    pIT->DecreaseRef();
+                    pInsert->DecreaseRef();
+                    for(int i = 0 ; i < pArgs->size() ; i++)
                     {
-                    case InternalType::RealDouble :
-                        pOut = Double::insert_new(iTotalCombi, piIndexSeq, piMaxDim, execMeR.result_get()->getAsDouble(), bSeeAsVector);
-                        break;
-                    case InternalType::RealBool :
-                        pOut = Bool::insert_new(iTotalCombi, piIndexSeq, piMaxDim, execMeR.result_get()->getAsBool(), bSeeAsVector);
-                        break;
-                    case InternalType::RealString :
-                        pOut = String::insert_new(iTotalCombi, piIndexSeq, piMaxDim, execMeR.result_get()->getAsString(), bSeeAsVector);
-                        break;
-                    case InternalType::RealInt :
-                        pOut = Int::insert_new(iTotalCombi, piIndexSeq, piMaxDim, execMeR.result_get()->getAsInt(), bSeeAsVector);
-                        break;
-                    case InternalType::RealList :
-                        //never occur !
-                        break;
-                    case InternalType::RealCell :
-                        //never occur !
-                        break;
-                    default :
-                        //TOTO YaSp : overlaoding insertion
-                        break;
+                        (*pArgs)[i]->DecreaseRef();
                     }
-                }
-                else
-                {//call type insert function
-                    InternalType* pRet = NULL;
-                    switch(pIT->getType())
+
+                    if(out.size() != 0)
                     {
-                    case InternalType::RealDouble :
-                        pRet = pIT->getAsDouble()->insert(iTotalCombi, piIndexSeq, piMaxDim, (GenericType*)execMeR.result_get(), bSeeAsVector);
-                        break;
-                    case InternalType::RealBool :
-                        pRet = pIT->getAsBool()->insert(iTotalCombi, piIndexSeq, piMaxDim, (GenericType*)execMeR.result_get(), bSeeAsVector);
-                        break;
-                    case InternalType::RealString :
-                        pRet = pIT->getAsString()->insert(iTotalCombi, piIndexSeq, piMaxDim, (GenericType*)execMeR.result_get(), bSeeAsVector);
-                        break;
-                    case InternalType::RealInt :
-                        pRet = pIT->getAsInt()->insert(iTotalCombi, piIndexSeq, piMaxDim, (GenericType*)execMeR.result_get(), bSeeAsVector);
-                        break;
-                    case InternalType::RealList :
-                        pRet = pIT->getAsList()->insert(iTotalCombi, piIndexSeq, piMaxDim, execMeR.result_list_get(), bSeeAsVector);
-                        break;
-                    case InternalType::RealTList :
-                        pRet = pIT->getAsTList()->insert(iTotalCombi, piIndexSeq, piMaxDim, execMeR.result_list_get(), bSeeAsVector);
-                        break;
-                    case InternalType::RealCell :
-                        if(execMeR.result_get()->isCell() == true)
-                        {
-                            pRet = pIT->getAsCell()->insert(iTotalCombi, piIndexSeq, piMaxDim, (GenericType*)execMeR.result_get(), bSeeAsVector);
-                        }
-                        else
-                        {
-                            //manage error
-                            std::wostringstream os;
-                            os << _W("Right hand argument must be a cell.\n");
-                            //os << ((Location)e.right_exp_get().location_get()).location_string_get() << std::endl;
-                            throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
-                        }
-                        break;
-                    default :
-                        //TODO YaSp : overlaoding insertion
-                        break;
+                        pRet = out[0];
                     }
-
-                    if(pRet && pRet != pIT)
+                    else
                     {
-                        //variable change
-                        pIT->DecreaseRef();
-                        if(pIT->isDeletable())
-                        {
-                            delete pIT;
-                        }
-                        bNew = true;
+                        pRet = NULL;
                     }
+                }
 
-                    pOut = pRet;
+                if(pRet && pRet != pIT)
+                {
+                    bNew = true;
                 }
-                delete piMaxDim;
-                delete[] piDimSize;
+                
+                pOut = pRet;
             }
 
             if(pOut != NULL)
@@ -404,30 +412,32 @@ void visitprivate(const AssignExp  &e)
                 //manage error
                 std::wostringstream os;
                 os << _W("Submatrix incorrectly defined.\n");
-                //os << ((Location)e.right_exp_get().location_get()).location_string_get() << std::endl;
+                //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;
+        }
         else if(pVar)
         {// x = ?
             /*getting what to assign*/
             execMeR.expected_size_set(1);
             e.right_exp_get().accept(execMeR);
 
-            if(execMeR.result_size_get() != 1)
+            if(execMeR.result_getSize() != 1)
             {
                 std::wostringstream os;
                 os << L"Lhs != Rhs";
-                //os << ((Location)e.right_exp_get().location_get()).location_string_get() << std::endl;
+                //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
                 throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
 
             InternalType *pIT  =       execMeR.result_get();
             if(pIT->isImplicitList())
             {
-                if(pIT->getAsImplicitList()->computable())
+                if(pIT->getAsImplicitList()->isComputable())
                 {
-                    InternalType *pTemp = pIT->getAsImplicitList()->extract_matrix();
+                    InternalType *pTemp = pIT->getAsImplicitList()->extractFullMatrix();
                     delete pIT;
                     execMeR.result_set(NULL);
                     pIT = pTemp;
@@ -462,7 +472,7 @@ void visitprivate(const AssignExp  &e)
             execMeR.expected_size_set(iLhsCount);
             e.right_exp_get().accept(execMeR);
 
-            if(execMeR.result_size_get() != execMeR.expected_size_get())
+            if(execMeR.result_getSize() != execMeR.expected_getSize())
             {
                 std::wostringstream os;
                 os << L"Lhs != Rhs";
@@ -499,12 +509,12 @@ void visitprivate(const AssignExp  &e)
             else
             {
                 //a is not a struct
-                const SimpleVar* pVar =  dynamic_cast<const SimpleVar*>(pField->head_get());
+                const SimpleVar* pListVar =  dynamic_cast<const SimpleVar*>(pField->head_get());
                 if(pVar == NULL)
                 {
                     std::cout << "Houston ..." << std::endl;
                 }
-                pHead = symbol::Context::getInstance()->get(pVar->name_get());
+                pHead = symbol::Context::getInstance()->get(pListVar->name_get());
             }
 
             //if a is already assign, make a copy and replace it
@@ -519,20 +529,20 @@ void visitprivate(const AssignExp  &e)
             e.right_exp_get().accept(execMeR);
 
             //we can assign only one value
-            if(execMeR.result_size_get() != 1)
+            if(execMeR.result_getSize() != 1)
             {
                 std::wostringstream os;
                 os << L"Lhs != Rhs";
-                //os << ((Location)e.right_exp_get().location_get()).location_string_get() << std::endl;
+                //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
                 throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
             }
 
             InternalType *pIT = execMeR.result_get();
             if(pIT->isImplicitList())
             {
-                if(pIT->getAsImplicitList()->computable())
+                if(pIT->getAsImplicitList()->isComputable())
                 {
-                    InternalType *pTemp = pIT->getAsImplicitList()->extract_matrix();
+                    InternalType *pTemp = pIT->getAsImplicitList()->extractFullMatrix();
                     delete pIT;
                     execMeR.result_set(NULL);
                     pIT = pTemp;
@@ -584,7 +594,7 @@ void visitprivate(const AssignExp  &e)
         {//Houston ...
             std::wostringstream os;
             os << L"unknow script form";
-            //os << ((Location)e.right_exp_get().location_get()).location_string_get() << std::endl;
+            //os << ((Location)e.right_exp_get().location_get()).location_getString() << std::endl;
             throw ScilabError(os.str(), 999, e.right_exp_get().location_get());
         }
     }
index 6c5f3c1..23bd647 100644 (file)
@@ -41,18 +41,18 @@ void visitprivate(const CallExp &e)
                 continue;
             }
 
-            if(execVar[j].result_get()->getType() == InternalType::RealImplicitList)
+            if(execVar[j].result_get()->isImplicitList())
             {
                 ImplicitList* pIL = execVar[j].result_get()->getAsImplicitList();
-                if(pIL->computable() == false)
+                if(pIL->isComputable() == false)
                 {
                     Double* pVal = new Double(-1, -1);
-                    pVal->real_get()[0] = 1;
+                    pVal->getReal()[0] = 1;
                     execVar[j].result_set(pVal);
                 }
                 else
                 {
-                    execVar[j].result_set(pIL->extract_matrix());
+                    execVar[j].result_set(pIL->extractFullMatrix());
                 }
             }
 
@@ -63,7 +63,7 @@ void visitprivate(const CallExp &e)
             }
             else
             {
-                for(int i = 0 ; i < execVar[j].result_size_get() ; i++)
+                for(int i = 0 ; i < execVar[j].result_getSize() ; i++)
                 {
                     in.push_back(execVar[j].result_get(i));
                     execVar[j].result_get(i)->IncreaseRef();
@@ -71,7 +71,7 @@ void visitprivate(const CallExp &e)
             }
         }
 
-        int iRetCount = Max(1, expected_size_get());
+        int iRetCount = Max(1, expected_getSize());
 
         try
         {
@@ -80,12 +80,12 @@ void visitprivate(const CallExp &e)
 
             if(Ret == Callable::OK)
             {
-                if(expected_size_get() == 1 && out.size() == 0) //to manage ans
+                if(expected_getSize() == 1 && out.size() == 0) //to manage ans
                 {
-                    if(static_cast<int>(out.size()) < expected_size_get())
+                    if(static_cast<int>(out.size()) < expected_getSize())
                     {
                         std::wostringstream os;
-                        os << L"bad lhs, expected : " << expected_size_get() << L" returned : " << out.size() << std::endl;
+                        os << L"bad lhs, expected : " << expected_getSize() << L" returned : " << out.size() << std::endl;
                         throw ScilabError(os.str(), 999, e.location_get());
                     }
                 }
@@ -187,10 +187,11 @@ void visitprivate(const CallExp &e)
                 (*it1)->accept(execArg);
                 if(execArg.result_get()->isString())
                 {
-                    String *pString = execArg.result_get()->getAsString();
-                    for(int i = 0 ; i < pString->size_get() ; i++)
+                    InternalType* pVar  = execArg.result_get();
+                    String *pString = pVar->getAs<types::String>();
+                    for(int i = 0 ; i < pString->getSize() ; i++)
                     {
-                        stFields.push_back(pString->string_get(i));
+                        stFields.push_back(pString->get(i));
                     }
                 }
                 else
@@ -225,10 +226,11 @@ void visitprivate(const CallExp &e)
                 {
                     rtIndex = InternalType::RealString;
                     bTypeSet = true;
-                    String *pString = execArg.result_get()->getAsString();
-                    for(int i = 0 ; i < pString->size_get() ; i++)
+                    InternalType* pVar  = execArg.result_get();
+                    String *pString = pVar->getAs<types::String>();
+                    for(int i = 0 ; i < pString->getSize() ; i++)
                     {
-                        stFields.push_back(pString->string_get(i));
+                        stFields.push_back(pString->get(i));
                     }
                 }
                 else if(execArg.result_get()->isDouble())
@@ -242,29 +244,33 @@ void visitprivate(const CallExp &e)
             if(rtIndex  == InternalType::RealDouble)
             {
                 //Create list of indexes
-                bool bSeeAsVector   = iArgDim == 1;
-                int *piIndexSeq                = NULL;
-                int *piMaxDim       = NULL;
-                int *piDimSize         = new int[iArgDim];
-                int iTotalCombi                = GetIndexList(pIT, e.args_get(), &piIndexSeq, &piMaxDim, pIT, piDimSize);
+                //ArrayOf<double>* pArray = pIT->getAs<ArrayOf<double> >();
+                //bool bSeeAsVector   = iArgDim < pArray->getDims();
+                //int *piIndexSeq              = NULL;
+                //int *piMaxDim       = NULL;
+                //int *piDimSize               = new int[iArgDim];
+                //int iDims           = 0;
+                //int iTotalCombi              = GetIndexList(pIT, e.args_get(), &piIndexSeq, &piMaxDim, &iDims, pIT, piDimSize);
 
-                //check we don't have bad indexes like "< 1"
-                for(int i = 0 ; i < iTotalCombi * iArgDim; i++)
-                {
-                    if(piIndexSeq[i] < 1)
-                    {
-                        //manage error
-                        std::wostringstream os;
-                        os << _W("Indexes must be positive .\n");
-                        os << ((Location)e.name_get().location_get()).location_string_get() << std::endl;
-                        throw ScilabError(os.str(), 999, e.name_get().location_get());
-                    }
-                }
-                ResultList = pIT->getAsTList()->extract(iTotalCombi, piIndexSeq, piMaxDim, piDimSize, bSeeAsVector);
+                ////typed_list *pArgs = GetArgumentList(e.args_get());
+
+                ////check we don't have bad indexes like "< 1"
+                //for(int i = 0 ; i < iTotalCombi * iArgDim; i++)
+                //{
+                //    if(piIndexSeq[i] < 1)
+                //    {
+                //        //manage error
+                //        std::wostringstream os;
+                //        os << _W("Indexes must be positive .\n");
+                //        os << ((Location)e.name_get().location_get()).location_getString() << std::endl;
+                //        throw ScilabError(os.str(), 999, e.name_get().location_get());
+                //    }
+                //}
+                //ResultList = pIT->getAsTList()->extract(iTotalCombi, piIndexSeq, piMaxDim, iDims, piDimSize, bSeeAsVector);
             }
             else if(rtIndex  == InternalType::RealString)
             {
-                ResultList = pIT->getAsTList()->extract_string(stFields);
+                ResultList = pIT->getAsTList()->extractStrings(stFields);
             }
 
             if(ResultList.size() == 1)
@@ -282,65 +288,77 @@ void visitprivate(const CallExp &e)
         else
         {
             //Create list of indexes
-            bool bSeeAsVector   = iArgDim == 1;
-            int *piIndexSeq            = NULL;
-            int *piMaxDim       = NULL;
-            int *piDimSize             = new int[iArgDim];
-            int iTotalCombi            = GetIndexList(pIT, e.args_get(), &piIndexSeq, &piMaxDim, pIT, piDimSize);
-
-            //check we don't have bad indexes like "< 1"
-            for(int i = 0 ; i < iTotalCombi * iArgDim; i++)
-            {
-                if(piIndexSeq[i] < 1)
-                {
-                    //manage error
-                    std::wostringstream os;
-                    os << _W("Indexes must be positive .\n");
-                    //os << ((Location)e.name_get().location_get()).location_string_get() << std::endl;
-                    throw ScilabError(os.str(), 999, e.name_get().location_get());
-                }
-            }
+            typed_list *pArgs = GetArgumentList(e.args_get());
 
             switch(pIT->getType())
             {
             case InternalType::RealDouble :
-                pOut = pIT->getAsDouble()->extract(iTotalCombi, piIndexSeq, piMaxDim, piDimSize, bSeeAsVector);
+                pOut = pIT->getAs<Double>()->extract(pArgs);
+                break;
+            case InternalType::RealString :
+                pOut = pIT->getAs<String>()->extract(pArgs);
                 break;
             case InternalType::RealBool :
-                pOut = pIT->getAsBool()->extract(iTotalCombi, piIndexSeq, piMaxDim, piDimSize, bSeeAsVector);
+                pOut = pIT->getAs<Bool>()->extract(pArgs);
                 break;
-            case InternalType::RealInt :
-                pOut = pIT->getAsInt()->extract(iTotalCombi, piIndexSeq, piMaxDim, piDimSize, bSeeAsVector);
+            case InternalType::RealPoly :
+                pOut = pIT->getAs<Polynom>()->extract(pArgs);
                 break;
-            case InternalType::RealString :
-                pOut = pIT->getAsString()->extract(iTotalCombi, piIndexSeq, piMaxDim, piDimSize, bSeeAsVector);
+            case InternalType::RealInt8 :
+                pOut = pIT->getAs<Int8>()->extract(pArgs);
+                break;
+            case InternalType::RealUInt8 :
+                pOut = pIT->getAs<UInt8>()->extract(pArgs);
+                break;
+            case InternalType::RealInt16 :
+                pOut = pIT->getAs<Int16>()->extract(pArgs);
+                break;
+            case InternalType::RealUInt16 :
+                pOut = pIT->getAs<UInt16>()->extract(pArgs);
+                break;
+            case InternalType::RealInt32 :
+                pOut = pIT->getAs<Int32>()->extract(pArgs);
+                break;
+            case InternalType::RealUInt32 :
+                pOut = pIT->getAs<UInt32>()->extract(pArgs);
+                break;
+            case InternalType::RealInt64 :
+                pOut = pIT->getAs<Int64>()->extract(pArgs);
+                break;
+            case InternalType::RealUInt64 :
+                pOut = pIT->getAs<UInt64>()->extract(pArgs);
                 break;
             case InternalType::RealList :
-            {
-                ResultList = pIT->getAsList()->extract(iTotalCombi, piIndexSeq, piMaxDim, piDimSize, bSeeAsVector);
-                if(ResultList.size() == 1)
-                {
-                    result_set(ResultList[0]);
-                }
-                else
                 {
-                    for(int i = 0 ; i < static_cast<int>(ResultList.size()) ; i++)
+                    ResultList = pIT->getAsList()->extract(pArgs);
+
+                    switch(ResultList.size())
                     {
-                        result_set(i, ResultList[i]);
+                    case 0 :
+                        {
+                            std::wostringstream os;
+                            os << L"inconsistent dimensions\n";
+                            throw ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
+                        }
+                        break;
+                    case 1 :
+                        result_set(ResultList[0]);
+                        break;
+                    default :
+                        for(int i = 0 ; i < static_cast<int>(ResultList.size()) ; i++)
+                        {
+                            result_set(i, ResultList[i]);
+                        }
+                        break;
                     }
                 }
                 break;
-            }
             case InternalType::RealCell :
-                pOut = pIT->getAsCell()->extract(iTotalCombi, piIndexSeq, piMaxDim, piDimSize, bSeeAsVector);
+                pOut = pIT->getAs<Cell>()->extract(pArgs);
                 break;
             default :
                 break;
             }
-
-            delete[] piDimSize;
-            delete[] piIndexSeq;
-            delete[] piMaxDim;
         }
 
         //List extraction can return multiple items
@@ -349,7 +367,7 @@ void visitprivate(const CallExp &e)
             if(pOut == NULL)
             {
                 // Special case, try to extract from an empty matrix.
-                if (pIT->isDouble() && pIT->getAs<Double>()->size_get() == 0)
+                if (pIT->isDouble() && pIT->getAs<Double>()->getSize() == 0)
                 {
                     pOut = Double::Empty();
                 }
@@ -357,7 +375,7 @@ void visitprivate(const CallExp &e)
                 {
                     std::wostringstream os;
                     os << L"inconsistent row/column dimensions\n";
-                    //os << ((*e.args_get().begin())->location_get()).location_string_get() << std::endl;
+                    //os << ((*e.args_get().begin())->location_get()).location_getString() << std::endl;
                     throw ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
                 }
             }
@@ -375,7 +393,7 @@ void visitprivate(const CallExp &e)
                 {
                     std::wostringstream os;
                     os << L"inconsistent row/column dimensions\n";
-                    //os << ((*e.args_get().begin())->location_get()).location_string_get() << std::endl;
+                    //os << ((*e.args_get().begin())->location_get()).location_getString() << std::endl;
                     throw ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
                 }
             }
index 541daf1..084a88c 100644 (file)
@@ -57,12 +57,12 @@ void visitprivate(const MatrixExp &e)
                         (*col)->accept (*execMe);
                     }
 
-                    if(execMe->result_get()->getType() == InternalType::RealImplicitList)
+                    if(execMe->result_get()->isImplicitList())
                     {
-                        if(execMe->result_get()->getAsImplicitList()->computable() == true)
+                        if(execMe->result_get()->getAsImplicitList()->isComputable() == true)
                         {
-                            execMe->result_set(execMe->result_get()->getAsImplicitList()->extract_matrix());
-                            iCurCol += ((GenericType*)execMe->result_get())->cols_get();
+                            execMe->result_set(execMe->result_get()->getAsImplicitList()->extractFullMatrix());
+                            iCurCol += ((GenericType*)execMe->result_get())->getCols();
                         }
                         else
                         {
@@ -71,22 +71,22 @@ void visitprivate(const MatrixExp &e)
                     }
                     else
                     {
-                        iCurCol += ((GenericType*)execMe->result_get())->cols_get();
+                        iCurCol += ((GenericType*)execMe->result_get())->getCols();
                     }
 
                     if(iCurRow == -1)
                     {
-                        iCurRow = ((GenericType*)execMe->result_get())->rows_get();
+                        iCurRow = ((GenericType*)execMe->result_get())->getRows();
                         if(iCurRow == 0)
                         {//to manage [] in MatrixExp
                             iCurRow = -1;
                         }
                     }
-                    else if(iCurRow != ((GenericType*)execMe->result_get())->rows_get() && ((GenericType*)execMe->result_get())->rows_get() != 0)
+                    else if(iCurRow != ((GenericType*)execMe->result_get())->getRows() && ((GenericType*)execMe->result_get())->getRows() != 0)
                     {
                         std::wostringstream os;
                         os << L"inconsistent row/column dimensions\n";
-                        //os << ((Location)(*row)->location_get()).location_string_get() << std::endl;
+                        //os << ((Location)(*row)->location_get()).location_getString() << std::endl;
                         throw ScilabError(os.str(), 999, (*row)->location_get());
                     }
 
@@ -114,7 +114,7 @@ void visitprivate(const MatrixExp &e)
                     {
                         std::wostringstream os;
                         os << L"inconsistent row/column dimensions\n";
-                        //os << ((Location)(*row)->location_get()).location_string_get() << std::endl;
+                        //os << ((Location)(*row)->location_get()).location_getString() << std::endl;
                         throw ScilabError(os.str(), 999, (*row)->location_get());
                     }
 
@@ -140,7 +140,7 @@ void visitprivate(const MatrixExp &e)
                 int iAddCol = 0;
                 for(it_RL = (*it_ML).begin() ; it_RL != (*it_ML).end() ; it_RL++)
                 {
-                    if((*it_RL)->isDouble() && (*it_RL)->getAsDouble()->isEmpty())
+                    if((*it_RL)->isDouble() && (*it_RL)->getAs<Double>()->isEmpty())
                     {//manage []
                         continue;
                     }
@@ -151,14 +151,7 @@ void visitprivate(const MatrixExp &e)
 
                         if((*it_RL)->isDeletable() == true)
                         {
-                            if((*it_RL)->getType() == InternalType::RealDouble)
-                            {
-                                delete (*it_RL)->getAsDouble();
-                            }
-                            else
-                            {
-                                delete (*it_RL);
-                            }
+                            delete (*it_RL);
                         }
                         iCurCol += iAddCol;
                     }
@@ -167,14 +160,7 @@ void visitprivate(const MatrixExp &e)
                         poResult = AddElementToVariable(poResult, *it_RL, iCurRow, iCurCol, &iAddRow, &iAddCol);
                         if((*it_RL)->isDeletable() == true)
                         {
-                            if((*it_RL)->getType() == InternalType::RealDouble)
-                            {
-                                delete (*it_RL)->getAsDouble();
-                            }
-                            else
-                            {
-                                delete (*it_RL);
-                            }
+                            delete (*it_RL);
                         }
                         iCurCol += iAddCol;
                     }
index ca5cf9e..8da4aae 100644 (file)
@@ -29,15 +29,18 @@ void visitprivate(const OpExp &e)
         e.left_get().accept(execMeL);
         /*getting what to assign*/
         e.right_get().accept(execMeR);
-        GenericType::RealType TypeL = execMeL.result_get()->getType();
-        GenericType::RealType TypeR = execMeR.result_get()->getType();
+
+        InternalType *pITL          = execMeL.result_get();
+        InternalType *pITR          = execMeR.result_get();
+        GenericType::RealType TypeL = pITL->getType();
+        GenericType::RealType TypeR = pITR->getType();
 
         if(TypeL == GenericType::RealImplicitList)
         {
-            ImplicitList* pIL = execMeL.result_get()->getAsImplicitList();
-            if(pIL->computable())
+            ImplicitList* pIL = pITL->getAsImplicitList();
+            if(pIL->isComputable())
             {
-                InternalType *pIT = pIL->extract_matrix();
+                InternalType *pIT = pIL->extractFullMatrix();
                 execMeL.result_set(pIT);
                 TypeL = pIT->getType();
             }
@@ -45,57 +48,96 @@ void visitprivate(const OpExp &e)
 
         if(TypeR == GenericType::RealImplicitList)
         {
-            ImplicitList* pIL = execMeR.result_get()->getAsImplicitList();
-            if(pIL->computable())
+            ImplicitList* pIL = pITR->getAsImplicitList();
+            if(pIL->isComputable())
             {
-                InternalType *pIT = pIL->extract_matrix();
+                InternalType *pIT = pIL->extractFullMatrix();
                 execMeR.result_set(pIT);
                 TypeR = pIT->getType();
             }
         }
 
-        InternalType *pResult = NULL;
+        InternalType *pResult   = NULL;
+        
         switch(e.oper_get())
         {
         case OpExp::plus :
             {
-                pResult = GenericPlus(execMeL.result_get(), execMeR.result_get());
+                try
+                {
+                    pResult = GenericPlus(pITL, pITR);
+                }
+                catch (ScilabException *pSE)
+                {
+                    pSE->SetErrorLocation(e.right_get().location_get());
+                    throw pSE;
+                }
+
                 if (pResult == NULL)
                 {
                     // We did not have any algorithm matching, so we try to call OverLoad
                     pResult = callOverload(e.oper_get(), &execMeL, &execMeR);
 
                 }
+
                 result_set(pResult);
                 break;
             }
         case OpExp::minus :
             {
-                pResult = GenericMinus(execMeL.result_get(), execMeR.result_get());
+                try
+                {
+                    pResult = GenericMinus(pITL, pITR);
+                }
+                catch (ScilabException *pSE)
+                {
+                    pSE->SetErrorLocation(e.right_get().location_get());
+                    throw pSE;
+                }
+
                 if (pResult == NULL)
                 {
                     // We did not have any algorithm matching, so we try to call OverLoad
                     pResult = callOverload(e.oper_get(), &execMeL, &execMeR);
 
                 }
+
                 result_set(pResult);
                 break;
             }
         case OpExp::times:
-              {
-                  pResult = GenericTimes(execMeL.result_get(), execMeR.result_get());
-                  if (pResult == NULL)
-                  {
-                      // We did not have any algorithm matching, so we try to call OverLoad
-                      pResult = callOverload(e.oper_get(), &execMeL, &execMeR);
-
-                  }
-                  result_set(pResult);
-                  break;
-              }
+            {
+                try
+                {
+                    pResult = GenericTimes(pITL, pITR);
+                }
+                catch (ScilabException *pSE)
+                {
+                    pSE->SetErrorLocation(e.right_get().location_get());
+                    throw pSE;
+                }
+
+                if (pResult == NULL)
+                {
+                    // We did not have any algorithm matching, so we try to call OverLoad
+                    pResult = callOverload(e.oper_get(), &execMeL, &execMeR);
+
+                }
+                result_set(pResult);
+                break;
+            }
         case OpExp::rdivide:
             {
-                pResult = GenericRDivide(execMeL.result_get(), execMeR.result_get());
+                try
+                {
+                    pResult = GenericRDivide(pITL, pITR);
+                }
+                catch (ScilabException *pSE)
+                {
+                    pSE->SetErrorLocation(e.right_get().location_get());
+                    throw pSE;
+                }
+
                 if (pResult == NULL)
                 {
                     // We did not have any algorithm matching, so we try to call OverLoad
@@ -107,18 +149,28 @@ void visitprivate(const OpExp &e)
             }
         case OpExp::dottimes :
             {
-                pResult = GenericDotTimes(execMeL.result_get(), execMeR.result_get());
+                try
+                {
+                    pResult = GenericDotTimes(execMeL.result_get(), execMeR.result_get());
+                }
+                catch (ScilabException *pSE)
+                {
+                    pSE->SetErrorLocation(e.right_get().location_get());
+                    throw pSE;
+                }
+
                 if (pResult == NULL)
                 {
                     // We did not have any algorithm matching, so we try to call OverLoad
                     pResult = callOverload(e.oper_get(), &execMeL, &execMeR);
+
                 }
                 result_set(pResult);
                 break;
             }
         case OpExp::eq :
             {
-                if(TypeL == GenericType::RealDouble && execMeL.result_get()->getAsDouble()->size_get() == 0)
+                if(TypeL == GenericType::RealDouble && pITL->getAs<Double>()->getSize() == 0)
                 {//[] == xx
                     if(TypeR != InternalType::RealDouble)
                     {
@@ -127,7 +179,7 @@ void visitprivate(const OpExp &e)
                     }
                 }
 
-                if(TypeR == GenericType::RealDouble && execMeR.result_get()->getAsDouble()->size_get() == 0)
+                if(TypeR == GenericType::RealDouble && pITR->getAs<Double>()->getSize() == 0)
                 {//xx == []
                     if(TypeL != InternalType::RealDouble)
                     {
@@ -138,49 +190,49 @@ void visitprivate(const OpExp &e)
 
                 if(TypeL == GenericType::RealDouble && TypeR == GenericType::RealDouble)
                 {
-                    Double *pL                 = execMeL.result_get()->getAsDouble();
-                    Double *pR                 = execMeR.result_get()->getAsDouble();
+                    Double *pL                 = pITL->getAs<Double>();
+                    Double *pR                 = pITR->getAs<Double>();
 
-                    if(pR->size_get() == 0 && pL->size_get() == 0)
+                    if(pR->getSize() == 0 && pL->getSize() == 0)
                     {
                         pResult = new Bool(true);
                     }
-                    else if(pL->size_get() == 0  || pR->size_get() == 0)
+                    else if(pL->getSize() == 0  || pR->getSize() == 0)
                     {
                         pResult = new Bool(false);
                     }
-                    else if(pR->size_get() == 1)
+                    else if(pR->getSize() == 1)
                     {
-                        pResult                                = new Bool(pL->rows_get(), pL->cols_get());
-                        double dblRef  = pR->real_get(0,0);
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        pResult                                = new Bool(pL->getRows(), pL->getCols());
+                        double dblRef  = pR->getReal(0,0);
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) == dblRef);
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) == dblRef);
                             }
                         }
                     }
-                    else if(pL->size_get() == 1)
+                    else if(pL->getSize() == 1)
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        double dblRef  = pL->real_get(0,0);
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        double dblRef  = pL->getReal(0,0);
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, dblRef == pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, dblRef == pR->getReal(i, j));
                             }
                         }
                     }
-                    else if(pR->rows_get() == pL->rows_get() && pR->cols_get() == pL->cols_get())
+                    else if(pR->getRows() == pL->getRows() && pR->getCols() == pL->getCols())
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) == pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) == pR->getReal(i, j));
                             }
                         }
                     }
@@ -193,68 +245,68 @@ void visitprivate(const OpExp &e)
                 }
                 else if(TypeL == GenericType::RealString && TypeR == GenericType::RealString)
                 {
-                    String *pL                 = execMeL.result_get()->getAsString();
-                    String *pR                 = execMeR.result_get()->getAsString();
+                    String *pL                 = pITL->getAs<types::String>();
+                    String *pR                 = pITR->getAs<types::String>();
 
-                    if(pL->size_get() == 1)
+                    if(pL->getSize() == 1)
                     {
-                        pResult = new Bool(pR->rows_get(), pR->cols_get());
+                        pResult = new Bool(pR->getRows(), pR->getCols());
 
-                        wchar_t* pstL = pL->string_get()[0];
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        wchar_t* pstL = pL->get()[0];
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                wchar_t* pstR = pR->string_get(i,j);
+                                wchar_t* pstR = pR->get(i,j);
                                 if(wcscmp(pstL, pstR) == 0)
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                             }
                         }
                     }
-                    else if(pR->size_get() == 1)
+                    else if(pR->getSize() == 1)
                     {
-                        pResult = new Bool(pL->rows_get(), pL->cols_get());
+                        pResult = new Bool(pL->getRows(), pL->getCols());
 
-                        wchar_t* pstR = pR->string_get()[0];
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        wchar_t* pstR = pR->get()[0];
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                wchar_t* pstL = pL->string_get(i,j);
+                                wchar_t* pstL = pL->get(i,j);
                                 if(wcscmp(pstL, pstR) == 0)
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                             }
                         }
                     }
-                    else if(pL->rows_get() == pR->rows_get() && pL->cols_get() == pR->cols_get())
+                    else if(pL->getRows() == pR->getRows() && pL->getCols() == pR->getCols())
                     {
-                        pResult = new Bool(pL->rows_get(), pL->cols_get());
+                        pResult = new Bool(pL->getRows(), pL->getCols());
 
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                wchar_t* pstR = pR->string_get(i,j);
-                                wchar_t* pstL = pL->string_get(i,j);
+                                wchar_t* pstR = pR->get(i,j);
+                                wchar_t* pstL = pL->get(i,j);
                                 if(wcscmp(pstL, pstR) == 0)
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                             }
                         }
@@ -267,64 +319,64 @@ void visitprivate(const OpExp &e)
                 }
                 else if(TypeL == GenericType::RealBool && TypeR == GenericType::RealBool)
                 {
-                    Bool *pL                   = execMeL.result_get()->getAsBool();
-                    Bool *pR                   = execMeR.result_get()->getAsBool();
+                    Bool *pL                   = pITL->getAs<types::Bool>();
+                    Bool *pR                   = pITR->getAs<types::Bool>();
 
-                    if(pL->size_get() == 1)
+                    if(pL->getSize() == 1)
                     {
-                        pResult = new Bool(pR->rows_get(), pR->cols_get());
+                        pResult = new Bool(pR->getRows(), pR->getCols());
 
-                        int iL = pL->bool_get()[0];
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        int iL = pL->get()[0];
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                if(iL == pR->bool_get(i,j))
+                                if(iL == pR->get(i,j))
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                             }
                         }
                     }
-                    else if(pR->size_get() == 1)
+                    else if(pR->getSize() == 1)
                     {
-                        pResult = new Bool(pL->rows_get(), pL->cols_get());
+                        pResult = new Bool(pL->getRows(), pL->getCols());
 
-                        int iR = pR->bool_get()[0];
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        int iR = pR->get()[0];
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                if(iR == pL->bool_get(i,j))
+                                if(iR == pL->get(i,j))
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                             }
                         }
                     }
-                    else if(pL->rows_get() == pR->rows_get() && pL->cols_get() == pR->cols_get())
+                    else if(pL->getRows() == pR->getRows() && pL->getCols() == pR->getCols())
                     {
-                        pResult = new Bool(pL->rows_get(), pL->cols_get());
+                        pResult = new Bool(pL->getRows(), pL->getCols());
 
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                if(pL->bool_get(i,j) == pR->bool_get(i,j))
+                                if(pL->get(i,j) == pR->get(i,j))
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                             }
                         }
@@ -343,7 +395,7 @@ void visitprivate(const OpExp &e)
             }
         case OpExp::ne :
             {
-                if(TypeL == GenericType::RealDouble && execMeL.result_get()->getAsDouble()->size_get() == 0)
+                if(TypeL == GenericType::RealDouble && pITL->getAs<Double>()->getSize() == 0)
                 {//[] <> xx
                     if(TypeR != InternalType::RealDouble)
                     {
@@ -352,7 +404,7 @@ void visitprivate(const OpExp &e)
                     }
                 }
 
-                if(TypeR == GenericType::RealDouble && execMeR.result_get()->getAsDouble()->size_get() == 0)
+                if(TypeR == GenericType::RealDouble && pITR->getAs<Double>()->getSize() == 0)
                 {//xx <> []
                     if(TypeL != InternalType::RealDouble)
                     {
@@ -363,49 +415,49 @@ void visitprivate(const OpExp &e)
 
                 if(TypeL == GenericType::RealDouble && TypeR == GenericType::RealDouble)
                 {
-                    Double *pL                 = execMeL.result_get()->getAsDouble();
-                    Double *pR                 = execMeR.result_get()->getAsDouble();
+                    Double *pL                 = pITL->getAs<Double>();
+                    Double *pR                 = pITR->getAs<Double>();
 
-                    if(pR->size_get() == 0 && pL->size_get() == 0)
+                    if(pR->getSize() == 0 && pL->getSize() == 0)
                     {
                         pResult = new Bool(false);
                     }
-                    else if(pL->size_get() == 0  || pR->size_get() == 0)
+                    else if(pL->getSize() == 0  || pR->getSize() == 0)
                     {
                         pResult = new Bool(true);
                     }
-                    else if(pR->size_get() == 1)
+                    else if(pR->getSize() == 1)
                     {
-                        pResult                                = new Bool(pL->rows_get(), pL->cols_get());
-                        double dblRef  = pR->real_get(0,0);
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        pResult                                = new Bool(pL->getRows(), pL->getCols());
+                        double dblRef  = pR->getReal(0,0);
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) != dblRef);
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) != dblRef);
                             }
                         }
                     }
-                    else if(pL->size_get() == 1)
+                    else if(pL->getSize() == 1)
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        double dblRef  = pL->real_get(0,0);
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        double dblRef  = pL->getReal(0,0);
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, dblRef != pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, dblRef != pR->getReal(i, j));
                             }
                         }
                     }
-                    else if(pR->rows_get() == pL->rows_get() && pR->cols_get() == pL->cols_get())
+                    else if(pR->getRows() == pL->getRows() && pR->getCols() == pL->getCols())
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) != pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) != pR->getReal(i, j));
                             }
                         }
                     }
@@ -418,68 +470,68 @@ void visitprivate(const OpExp &e)
                 }
                 else if(TypeL == GenericType::RealString && TypeR == GenericType::RealString)
                 {
-                    String *pL                 = execMeL.result_get()->getAsString();
-                    String *pR                 = execMeR.result_get()->getAsString();
+                    String *pL                 = pITL->getAs<types::String>();
+                    String *pR                 = pITR->getAs<types::String>();
 
-                    if(pL->size_get() == 1)
+                    if(pL->getSize() == 1)
                     {
-                        pResult = new Bool(pR->rows_get(), pR->cols_get());
+                        pResult = new Bool(pR->getRows(), pR->getCols());
 
-                        wchar_t* pstL = pL->string_get()[0];
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        wchar_t* pstL = pL->get()[0];
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                wchar_t* pstR = pR->string_get(i,j);
+                                wchar_t* pstR = pR->get(i,j);
                                 if(wcscmp(pstL, pstR) == 0)
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                             }
                         }
                     }
-                    else if(pR->size_get() == 1)
+                    else if(pR->getSize() == 1)
                     {
-                        pResult = new Bool(pL->rows_get(), pL->cols_get());
+                        pResult = new Bool(pL->getRows(), pL->getCols());
 
-                        wchar_t* pstR = pR->string_get()[0];
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        wchar_t* pstR = pR->get()[0];
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                wchar_t* pstL = pL->string_get(i,j);
+                                wchar_t* pstL = pL->get(i,j);
                                 if(wcscmp(pstL, pstR) == 0)
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                             }
                         }
                     }
-                    else if(pL->rows_get() == pR->rows_get() && pL->cols_get() == pR->cols_get())
+                    else if(pL->getRows() == pR->getRows() && pL->getCols() == pR->getCols())
                     {
-                        pResult = new Bool(pL->rows_get(), pL->cols_get());
+                        pResult = new Bool(pL->getRows(), pL->getCols());
 
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                wchar_t* pstR = pR->string_get(i,j);
-                                wchar_t* pstL = pL->string_get(i,j);
+                                wchar_t* pstR = pR->get(i,j);
+                                wchar_t* pstL = pL->get(i,j);
                                 if(wcscmp(pstL, pstR) == 0)
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,false);
+                                    pResult->getAs<types::Bool>()->set(i,j,false);
                                 }
                                 else
                                 {
-                                    pResult->getAsBool()->bool_set(i,j,true);
+                                    pResult->getAs<types::Bool>()->set(i,j,true);
                                 }
                             }
                         }
@@ -500,41 +552,41 @@ void visitprivate(const OpExp &e)
             {
                 if(TypeL == GenericType::RealDouble && TypeR == GenericType::RealDouble)
                 {
-                    Double *pL                 = execMeL.result_get()->getAsDouble();
-                    Double *pR                 = execMeR.result_get()->getAsDouble();
+                    Double *pL                 = pITL->getAs<Double>();
+                    Double *pR                 = pITR->getAs<Double>();
 
-                    if(pR->size_get() == 1)
+                    if(pR->getSize() == 1)
                     {
-                        pResult                                = new Bool(pL->rows_get(), pL->cols_get());
-                        double dblRef  = pR->real_get(0,0);
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        pResult                                = new Bool(pL->getRows(), pL->getCols());
+                        double dblRef  = pR->getReal(0,0);
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) < dblRef);
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) < dblRef);
                             }
                         }
                     }
-                    else if(pL->size_get() == 1)
+                    else if(pL->getSize() == 1)
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        double dblRef  = pL->real_get(0,0);
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        double dblRef  = pL->getReal(0,0);
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, dblRef < pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, dblRef < pR->getReal(i, j));
                             }
                         }
                     }
-                    else if(pR->rows_get() == pL->rows_get() && pR->cols_get() == pL->cols_get())
+                    else if(pR->getRows() == pL->getRows() && pR->getCols() == pL->getCols())
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) < pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) < pR->getReal(i, j));
                             }
                         }
                     }
@@ -555,41 +607,41 @@ void visitprivate(const OpExp &e)
             {
                 if(TypeL == GenericType::RealDouble && TypeR == GenericType::RealDouble)
                 {
-                    Double *pL                 = execMeL.result_get()->getAsDouble();
-                    Double *pR                 = execMeR.result_get()->getAsDouble();
+                    Double *pL                 = pITL->getAs<Double>();
+                    Double *pR                 = pITR->getAs<Double>();
 
-                    if(pR->size_get() == 1)
+                    if(pR->getSize() == 1)
                     {
-                        pResult                                = new Bool(pL->rows_get(), pL->cols_get());
-                        double dblRef  = pR->real_get(0,0);
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        pResult                                = new Bool(pL->getRows(), pL->getCols());
+                        double dblRef  = pR->getReal(0,0);
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) <= dblRef);
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) <= dblRef);
                             }
                         }
                     }
-                    else if(pL->size_get() == 1)
+                    else if(pL->getSize() == 1)
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        double dblRef  = pL->real_get(0,0);
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        double dblRef  = pL->getReal(0,0);
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, dblRef <= pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, dblRef <= pR->getReal(i, j));
                             }
                         }
                     }
-                    else if(pR->rows_get() == pL->rows_get() && pR->cols_get() == pL->cols_get())
+                    else if(pR->getRows() == pL->getRows() && pR->getCols() == pL->getCols())
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) <= pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) <= pR->getReal(i, j));
                             }
                         }
                     }
@@ -610,42 +662,42 @@ void visitprivate(const OpExp &e)
             {
                 if(TypeL == GenericType::RealDouble && TypeR == GenericType::RealDouble)
                 {
-                    Double *pL                 = execMeL.result_get()->getAsDouble();
-                    Double *pR                 = execMeR.result_get()->getAsDouble();
+                    Double *pL                 = pITL->getAs<Double>();
+                    Double *pR                 = pITR->getAs<Double>();
 
-                    if(pR->size_get() == 1)
+                    if(pR->getSize() == 1)
                     {
-                        pResult                                = new Bool(pL->rows_get(), pL->cols_get());
-                        double dblRef  = pR->real_get(0,0);
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        pResult                                = new Bool(pL->getRows(), pL->getCols());
+                        double dblRef  = pR->getReal(0,0);
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) > dblRef);
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) > dblRef);
                             }
                         }
                     }
-                    else if(pL->size_get() == 1)
+                    else if(pL->getSize() == 1)
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        double dblRef  = pL->real_get(0,0);
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        double dblRef  = pL->getReal(0,0);
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, dblRef > pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, dblRef > pR->getReal(i, j));
                             }
                         }
                     }
-                    else if(pR->rows_get() == pL->rows_get() && pR->cols_get() == pL->cols_get())
+                    else if(pR->getRows() == pL->getRows() && pR->getCols() == pL->getCols())
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
 
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) > pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) > pR->getReal(i, j));
                             }
                         }
                     }
@@ -666,41 +718,41 @@ void visitprivate(const OpExp &e)
             {
                 if(TypeL == GenericType::RealDouble && TypeR == GenericType::RealDouble)
                 {
-                    Double *pL                 = execMeL.result_get()->getAsDouble();
-                    Double *pR                 = execMeR.result_get()->getAsDouble();
+                    Double *pL                 = pITL->getAs<Double>();
+                    Double *pR                 = pITR->getAs<Double>();
 
-                    if(pR->size_get() == 1)
+                    if(pR->getSize() == 1)
                     {
-                        pResult                                = new Bool(pL->rows_get(), pL->cols_get());
-                        double dblRef  = pR->real_get(0,0);
-                        for(int i = 0 ; i < pL->rows_get() ; i++)
+                        pResult                                = new Bool(pL->getRows(), pL->getCols());
+                        double dblRef  = pR->getReal(0,0);
+                        for(int i = 0 ; i < pL->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pL->cols_get() ; j++)
+                            for(int j = 0 ; j < pL->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) >= dblRef);
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) >= dblRef);
                             }
                         }
                     }
-                    else if(pL->size_get() == 1)
+                    else if(pL->getSize() == 1)
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        double dblRef  = pL->real_get(0,0);
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        double dblRef  = pL->getReal(0,0);
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, dblRef >= pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, dblRef >= pR->getReal(i, j));
                             }
                         }
                     }
-                    else if(pR->rows_get() == pL->rows_get() && pR->cols_get() == pL->cols_get())
+                    else if(pR->getRows() == pL->getRows() && pR->getCols() == pL->getCols())
                     {
-                        pResult                                = new Bool(pR->rows_get(), pR->cols_get());
-                        for(int i = 0 ; i < pR->rows_get() ; i++)
+                        pResult                                = new Bool(pR->getRows(), pR->getCols());
+                        for(int i = 0 ; i < pR->getRows() ; i++)
                         {
-                            for(int j = 0 ; j < pR->cols_get() ; j++)
+                            for(int j = 0 ; j < pR->getCols() ; j++)
                             {
-                                pResult->getAsBool()->bool_set(i, j, pL->real_get(i, j) >= pR->real_get(i, j));
+                                pResult->getAs<types::Bool>()->set(i, j, pL->getReal(i, j) >= pR->getReal(i, j));
                             }
                         }
                     }
@@ -721,30 +773,30 @@ void visitprivate(const OpExp &e)
             {
                 if(TypeL == GenericType::RealDouble && TypeR == GenericType::RealDouble)
                 {
-                    Double *pL                 = execMeL.result_get()->getAsDouble();
-                    Double *pR                 = execMeR.result_get()->getAsDouble();
+                    Double *pL                 = pITL->getAs<Double>();
+                    Double *pR                 = pITR->getAs<Double>();
 
                     int iResult = PowerDoubleByDouble(pL, pR, (Double**)&pResult);
                     if(iResult != 0)
                     {
                         std::wostringstream os;
                         os << _W("Inconsistent row/column dimensions.\n");
-                        //os << ((Location)e.right_get().location_get()).location_string_get() << std::endl;
+                        //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
                         throw ScilabError(os.str(), 999, e.right_get().location_get());
                     }
                     result_set(pResult);
                 }
                 else if(TypeL == GenericType::RealPoly && TypeR == GenericType::RealDouble)
                 {
-                    MatrixPoly *pL     = execMeL.result_get()->getAsPoly();
-                    Double *pR                 = execMeR.result_get()->getAsDouble();
+                    Polynom *pL        = pITL->getAs<types::Polynom>();
+                    Double *pR                 = pITR->getAs<Double>();
 
-                    int iResult = PowerPolyByDouble(pL, pR, (MatrixPoly**)&pResult);
+                    int iResult = PowerPolyByDouble(pL, pR, (Polynom**)&pResult);
                     if(iResult != 0)
                     {
                         std::wostringstream os;
                         os << _W("Inconsistent row/column dimensions.\n");
-                        //os << ((Location)e.right_get().location_get()).location_string_get() << std::endl;
+                        //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
                         throw ScilabError(os.str(), 999, e.right_get().location_get());
                     }
                     result_set(pResult);
@@ -774,12 +826,15 @@ void visitprivate(const LogicalOpExp &e)
     T execMeR;
 
     e.left_get().accept(execMeL);
-    GenericType::RealType TypeL = execMeL.result_get()->getType();
+    InternalType *pITL          = execMeL.result_get();
+    InternalType *pITR          = execMeR.result_get();
+    
+    GenericType::RealType TypeL = pITL->getType();
     Bool *pL   = NULL;
 
     if(TypeL == GenericType::RealBool)
     {
-        pL     = execMeL.result_get()->getAsBool();
+        pL     = pITL->getAs<types::Bool>();
     }
     else
     {
@@ -795,6 +850,8 @@ void visitprivate(const LogicalOpExp &e)
         case LogicalOpExp::logicalAnd :
             result_set(callOverload(e.oper_get(), &execMeL, &execMeR));
             break;
+        default :
+            break;
         }
         return;
     }
@@ -804,12 +861,12 @@ void visitprivate(const LogicalOpExp &e)
     {
     case LogicalOpExp::logicalShortCutOr :
         {
-            Bool *pL   = execMeL.result_get()->getAsBool();
-            int *piL   = pL->bool_get();
+            Bool *pB   = pITL->getAs<types::Bool>();
+            int *piL   = pB->get();
             bool iL     = true;
             // Check if all values are true
             // true || <something is always true>
-            for(int i = 0 ; i < pL->size_get() ; i++)
+            for(int i = 0 ; i < pB->getSize() ; i++)
             {
                 if(piL[i] == false)
                 {
@@ -829,20 +886,20 @@ void visitprivate(const LogicalOpExp &e)
     case LogicalOpExp::logicalOr :
         {
             e.right_get().accept(execMeR);
-            GenericType::RealType TypeR = execMeR.result_get()->getType();
+            GenericType::RealType TypeR = pITR->getType();
 
             if(TypeR == GenericType::RealBool)
             {
-                Bool *pR       = execMeR.result_get()->getAsBool();
-                int* piR = pR->bool_get();
-                int* piL = pL->bool_get();
+                Bool *pR       = pITR->getAs<types::Bool>();
+                int* piR = pR->get();
+                int* piL = pL->get();
                 int* piB       = NULL;
 
                 // M | scalar
-                if(pR->size_get() == 1)
+                if(pR->getSize() == 1)
                 {
-                    pResult = new Bool(pL->rows_get(), pL->cols_get(), &piB);
-                    for(int i = 0 ; i < pL->size_get(); i++)
+                    pResult = new Bool(pL->getRows(), pL->getCols(), &piB);
+                    for(int i = 0 ; i < pL->getSize(); i++)
                     {
                         piB[i] = (piR[0] == 1) || (piL[i] == 1);
                     }
@@ -851,10 +908,10 @@ void visitprivate(const LogicalOpExp &e)
                 }
 
                 // scalar | M
-                if(pL->size_get() == 1)
+                if(pL->getSize() == 1)
                 {
-                    pResult = new Bool(pR->rows_get(), pR->cols_get(), &piB);
-                    for(int i = 0 ; i < pR->size_get(); i++)
+                    pResult = new Bool(pR->getRows(), pR->getCols(), &piB);
+                    for(int i = 0 ; i < pR->getSize(); i++)
                     {
                         piB[i] = (piR[i] == 1) || (piL[0] == 1);
                     }
@@ -863,14 +920,10 @@ void visitprivate(const LogicalOpExp &e)
                 }
 
                 // M | N (generic case)
-                if(pR->rows_get() == pL->rows_get() && pR->cols_get() == pL->cols_get())
+                if(pR->getRows() == pL->getRows() && pR->getCols() == pL->getCols())
                 {
-                    int* piB   = NULL;
-                    int* piR   = pR->bool_get();
-                    int* piL   = pL->bool_get();
-
-                    pResult = new Bool(pR->rows_get(), pR->cols_get(), &piB);
-                    for(int i = 0 ; i < pL->size_get(); i++)
+                    pResult = new Bool(pR->getRows(), pR->getCols(), &piB);
+                    for(int i = 0 ; i < pL->getSize(); i++)
                     {
                         piB[i] = (piR[i] == 1) || (piL[i] == 1);
                     }
@@ -880,7 +933,7 @@ void visitprivate(const LogicalOpExp &e)
                 {
                     std::wostringstream os;
                     os << _W("Inconsistent row/column dimensions.\n");
-                    //os << ((Location)e.right_get().location_get()).location_string_get() << std::endl;
+                    //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
                     throw ScilabError(os.str(), 999, e.right_get().location_get());
                 }
             }
@@ -892,11 +945,11 @@ void visitprivate(const LogicalOpExp &e)
         }
     case LogicalOpExp::logicalShortCutAnd :
         {
-            Bool *pL   = execMeL.result_get()->getAsBool();
-            int *piL   = pL->bool_get();
+            Bool *pB   = pITL->getAs<types::Bool>();
+            int *piL   = pB->get();
             // Check if one value is false
             // false && <something> is always false
-            for(int i = 0 ; i < pL->size_get() ; i++)
+            for(int i = 0 ; i < pB->getSize() ; i++)
             {
                 if(piL[i] == false)
                 {
@@ -910,20 +963,20 @@ void visitprivate(const LogicalOpExp &e)
     case LogicalOpExp::logicalAnd :
         {
             e.right_get().accept(execMeR);
-            GenericType::RealType TypeR = execMeR.result_get()->getType();
+            GenericType::RealType TypeR = pITR->getType();
 
             if(TypeR == GenericType::RealBool)
             {
-                Bool *pR       = execMeR.result_get()->getAsBool();
-                int* piR = pR->bool_get();
-                int* piL = pL->bool_get();
+                Bool *pR       = pITR->getAs<types::Bool>();
+                int* piR = pR->get();
+                int* piL = pL->get();
                 int* piB       = NULL;
 
                 // M & scalar
-                if(pR->size_get() == 1)
+                if(pR->getSize() == 1)
                 {
-                    pResult = new Bool(pL->rows_get(), pL->cols_get(), &piB);
-                    for(int i = 0 ; i < pL->size_get(); i++)
+                    pResult = new Bool(pL->getRows(), pL->getCols(), &piB);
+                    for(int i = 0 ; i < pL->getSize(); i++)
                     {
                         piB[i] = (piR[0] == 1) && (piL[i] == 1);
                     }
@@ -932,10 +985,10 @@ void visitprivate(const LogicalOpExp &e)
                 }
 
                 // scalar & M
-                if(pL->size_get() == 1)
+                if(pL->getSize() == 1)
                 {
-                    pResult = new Bool(pR->rows_get(), pR->cols_get(), &piB);
-                    for(int i = 0 ; i < pR->size_get(); i++)
+                    pResult = new Bool(pR->getRows(), pR->getCols(), &piB);
+                    for(int i = 0 ; i < pR->getSize(); i++)
                     {
                         piB[i] = (piR[i] == 1) && (piL[0] == 1);
                     }
@@ -944,14 +997,10 @@ void visitprivate(const LogicalOpExp &e)
                 }
 
                 // M & N (generic case)
-                if(pR->rows_get() == pL->rows_get() && pR->cols_get() == pL->cols_get())
+                if(pR->getRows() == pL->getRows() && pR->getCols() == pL->getCols())
                 {
-                    int* piB   = NULL;
-                    int* piR   = pR->bool_get();
-                    int* piL   = pL->bool_get();
-
-                    pResult = new Bool(pR->rows_get(), pR->cols_get(), &piB);
-                    for(int i = 0 ; i < pL->size_get(); i++)
+                    pResult = new Bool(pR->getRows(), pR->getCols(), &piB);
+                    for(int i = 0 ; i < pL->getSize(); i++)
                     {
                         piB[i] = (piR[i] == 1) && (piL[i] == 1);
                     }
@@ -961,7 +1010,7 @@ void visitprivate(const LogicalOpExp &e)
                 {
                     std::wostringstream os;
                     os << _W("Inconsistent row/column dimensions.\n");
-                    //os << ((Location)e.right_get().location_get()).location_string_get() << std::endl;
+                    //os << ((Location)e.right_get().location_get()).location_getString() << std::endl;
                     throw ScilabError(os.str(), 999, e.right_get().location_get());
                 }
             }
@@ -971,6 +1020,12 @@ void visitprivate(const LogicalOpExp &e)
             }
             break;
         }
+        
+    default :
+        {
+            result_set(callOverload(e.oper_get(), &execMeL, &execMeR));
+            break;
+        }
     }
 }
 
index f3e95e4..c93de6d 100644 (file)
 #include "shortcutvisitor.hxx"
 #include "printvisitor.hxx"
 
-#include "double.hxx"
-#include "implicitlist.hxx"
+#include "arrayof.hxx"
+#include "dollar.hxx"
 #include "tlist.hxx"
 #include "struct.hxx"
 #include "macro.hxx"
 #include "macrofile.hxx"
-#include "cell.hxx"
 
 // Needed by visitprivate(const OpExp &)
 // Needed by visitprivate(const LogicalOpExp &)
@@ -104,12 +103,12 @@ namespace ast
         }
 
     public:
-        int expected_size_get(void)
+        int expected_getSize(void)
         {
             return _excepted_result;
         }
 
-        int result_size_get(void)
+        int result_getSize(void)
         {
             if(is_single_result())
             {
@@ -161,7 +160,7 @@ namespace ast
 
         vector<types::InternalType*>* result_list_get()
         {
-            if(result_size_get() == 1)
+            if(result_getSize() == 1)
             {
                 vector<types::InternalType*>* pList = new vector<types::InternalType*>;
                 pList->push_back(_result);
@@ -217,199 +216,18 @@ namespace ast
     class RunVisitorT : public RunVisitor
     {
     protected :
-        int  GetIndexList(InternalType* _pRef, std::list<ast::Exp *>const& _plstArg, int** _piIndexSeq, int** _piMaxDim, InternalType *_pRefVar, int *_iDimSize)
-        {
-            //Create list of indexes
-            //std::vector<std::vector<int>> IndexList;
-            int iProductElem                           = static_cast<int>(_plstArg.size());
-            int **piIndexList                          = NULL;
-            int *piTabsize                                     = NULL;
-            int iTotalCombi                                    = 1;
-            int k                                                                              = 0;
-
-            piTabsize                  = new int[iProductElem];
-            piIndexList                = new int*[iProductElem];
-
-            (*_piMaxDim)       = new int[iProductElem];
-
-            T execMeArg;
-            std::list<Exp *>::const_iterator   i;
-            for(i = _plstArg.begin() ; i != _plstArg.end() ; i++,k++)
-            {
-                (*i)->accept(execMeArg);
-                InternalType *pIn = NULL;
-                Double *pDbl = NULL;
-                bool bDeleteDbl = false;
-
-                if(execMeArg.result_get()->getType() == InternalType::RealImplicitList)
-                {//a:b:c
-                    int iMaxDim = 0;
-                    if(_pRefVar != NULL)
-                    {
-                        iMaxDim = GetVarMaxDim(_pRefVar, k, iProductElem);
-                    }
-
-                    Double dbl(iMaxDim); // $
-                    ImplicitList *pIL = execMeArg.result_get()->getAsImplicitList();
-                    if(pIL->computable() == false)
-                    {
-                        if(pIL->start_type_get() == InternalType::RealPoly)
-                        {
-                            MatrixPoly *poPoly = pIL->start_get()->getAsPoly();
-                            pIL->start_set(poPoly->evaluate(&dbl));
-                        }
-                        if(pIL->step_type_get() == InternalType::RealPoly)
-                        {
-                            MatrixPoly *poPoly = pIL->step_get()->getAsPoly();
-                            pIL->step_set(poPoly->evaluate(&dbl));
-                        }
-                        if(pIL->end_type_get() == InternalType::RealPoly)
-                        {
-                            MatrixPoly *poPoly = pIL->end_get()->getAsPoly();
-                            pIL->end_set(poPoly->evaluate(&dbl));
-                        }
-                    }
-
-                    pDbl = pIL->extract_matrix()->getAsDouble();
-                    bDeleteDbl = true;
-                }
-                else if(execMeArg.result_get()->getType() == InternalType::RealBool)
-                {
-                    Bool *pB    = execMeArg.result_get()->getAsBool();
-                    int *piB    = pB->bool_get();
-
-                    //find true item count
-                    int iItemCount = 0;
-                    for(int j = 0 ; j < pB->size_get() ; j++)
-                    {
-                        if(piB[j])
-                        {
-                            iItemCount++;
-                        }
-                    }
-
-                    //allow new Double variable
-                    pDbl            = new Double(iItemCount, 1);
-                    double* pdbl    = pDbl->real_get();
-
-                    int j = 0;
-                    for(int l = 0 ; l < pB->size_get() ; l++)
-                    {
-                        if(piB[l])
-                        {
-                            pdbl[j++] = l + 1;
-                        }
-                    }
-
-                    bDeleteDbl         = true;
-                }
-                else if(execMeArg.result_get()->getType() == InternalType::RealPoly)
-                {
-                    MatrixPoly *pPoly = execMeArg.result_get()->getAsPoly();
-
-                    if(_pRefVar != NULL)
-                    {
-                        int iMaxDim = GetVarMaxDim(_pRefVar, k, iProductElem);
-                        Double dbl(iMaxDim); // $
-                        pDbl = pPoly->evaluate(&dbl);
-                        bDeleteDbl = true;
-                    }
-                    else
-                    {//houston we have a problem ...
-                        Double dbl(0);
-                        pDbl = pPoly->evaluate(&dbl);
-
-                    }
-                }
-                else if(execMeArg.result_get()->getType() == InternalType::RealString)
-                {
-                    String* pS = execMeArg.result_get()->getAsString();
-                    if(_pRef != NULL && _pRef->isTList())
-                    {
-                        TList* pTL      = _pRef->getAsTList();
-                        pDbl            = new Double(pS->size_get(), 1);
-                        double* pdbl    = pDbl->real_get();
-
-                        for(int i = 0 ; i < pS->size_get() ; i++)
-                        {
-                            pdbl[i] =  pTL->getIndexFromString(pS->string_get(i));
-
-                            if(pdbl[i] == -1)
-                            {//field not found
-                                return 0;
-                            }
-                            else
-                            {
-                                pdbl[i]++; //indexed at 1
-                            }
-                        }
-
-                        bDeleteDbl             = true;
-                    }
-                    else if(_pRef != NULL && _pRef->isStruct())
-                    {
-
-                    }
-                    else
-                    {//Heu ... ?
-                    }
-                }
-                else if(execMeArg.result_get()->getType() == InternalType::RealDouble)
-                {
-                    pDbl       = execMeArg.result_get()->getAsDouble();
-                }
-                else
-                {//Heu ... ?
-                }
-
-                double *pData = pDbl->real_get();
 
-                piTabsize[k] = pDbl->size_get();
-                piIndexList[k] = new int[piTabsize[k]];
-
-                (*_piMaxDim)[k] = static_cast<int>(pData[0] + 0.5);
-                int iSize = pDbl->size_get();
-                if(_iDimSize != NULL)
-                {
-                    _iDimSize[k] = iSize;
-                }
-
-                for(int j = 0 ; j < iSize ; j++)
-                {
-                    piIndexList[k][j] = static_cast<int>(pData[j] + 0.5);
-                    if(piIndexList[k][j] > (*_piMaxDim)[k])
-                    {
-                        (*_piMaxDim)[k] = piIndexList[k][j];
-                    }
-                }
-                iTotalCombi *= iSize;
-
-                if(bDeleteDbl == true)
-                {
-                    delete pDbl;
-                }
-            }
-
-            int iTabsize       = iTotalCombi * iProductElem;
-            *_piIndexSeq       = new int[iTabsize];
-
-            if(iTabsize > 1)
-            {
-                ExpandList(piIndexList, piTabsize, iProductElem, *_piIndexSeq);
-            }
-            else
-            {
-                _piIndexSeq[0][0] = piIndexList[0][0];
-            }
-
-            delete [] piTabsize;
-
-            for(int l = 0 ; l < iProductElem ; l++)
+        typed_list* GetArgumentList(std::list<ast::Exp *>const& _plstArg)
+        {
+            typed_list* pArgs = new typed_list();
+            std::list<ast::Exp *>::const_iterator it;
+            for(it = _plstArg.begin() ; it != _plstArg.end() ; it++)
             {
-                delete[] piIndexList[l];
+                T execMeArg;
+                (*it)->accept(execMeArg);
+                pArgs->push_back(execMeArg.result_get()->clone());
             }
-            delete[] piIndexList;
-            return iTotalCombi;
+            return pArgs;
         }
 
     public :
@@ -425,12 +243,12 @@ namespace ast
         {
             std::list<MatrixLineExp *>::const_iterator row;
             std::list<Exp *>::const_iterator col;
-            int iColMax = -1;
+            int iColMax = 0;
 
             //check dimmension
             for (row = e.lines_get().begin() ; row != e.lines_get().end() ; ++row )
             {
-                if(iColMax == -1)
+                if(iColMax == 0)
                 {
                     iColMax = static_cast<int>((*row)->columns_get().size());
                 }
@@ -439,7 +257,7 @@ namespace ast
                 {
                     std::wostringstream os;
                     os << L"inconsistent row/column dimensions\n";
-                    //os << ((Location)(*row)->location_get()).location_string_get() << std::endl;
+                    //os << ((Location)(*row)->location_get()).location_getString() << std::endl;
                     throw ScilabError(os.str(), 999, (*row)->location_get());
                 }
             }
@@ -548,20 +366,22 @@ namespace ast
 
         void visitprivate(const ColonVar &e)
         {
-            int pRank[1] = {2};
-            Double dblCoef(1,2);
-            dblCoef.val_set(0, 0, 0);
-            dblCoef.val_set(0, 1, 1);
-
-            MatrixPoly *pVar = new MatrixPoly(L"$", 1, 1, pRank);
-            Poly *poPoly = pVar->poly_get(0,0);
-            poPoly->coef_set(&dblCoef);
-
-            ImplicitList *pIL = new ImplicitList();
-            pIL->start_set(new Double(1));
-            pIL->step_set(new Double(1));
-            pIL->end_set(pVar);
-            result_set(pIL);
+            //int pRank[1] = {2};
+            //Double dblCoef(1,2);
+            //dblCoef.set(0, 0, 0);
+            //dblCoef.set(0, 1, 1);
+
+            //Polynom *pVar = new Polynom(L"$", 1, 1, pRank);
+            //SinglePoly *poPoly = pVar->get(0,0);
+            //poPoly->setCoef(&dblCoef);
+
+            //ImplicitList *pIL = new ImplicitList();
+            //pIL->setStart(new Double(1));
+            //pIL->setStep(new Double(1));
+            //pIL->setEnd(pVar);
+
+            Colon *pC = new Colon();
+            result_set(pC);
             /*
             : = 1:$
             */
@@ -570,14 +390,16 @@ namespace ast
 
         void visitprivate(const DollarVar &e)
         {
-            int pRank[1] = {2};
-            Double dblCoef(1,2);
-            dblCoef.val_set(0, 0, 0);
-            dblCoef.val_set(0, 1, 1);
-
-            MatrixPoly *pVar = new MatrixPoly(L"$", 1, 1, pRank);
-            Poly *poPoly = pVar->poly_get(0,0);
-            poPoly->coef_set(&dblCoef);
+            //int pRank[1] = {2};
+            //Double dblCoef(1,2);
+            //dblCoef.set(0, 0, 0);
+            //dblCoef.set(0, 1, 1);
+
+            //Polynom *pVar = new Polynom(L"$", 1, 1, pRank);
+            //SinglePoly *poPoly = pVar->get(0,0);
+            //poPoly->setCoef(&dblCoef);
+
+            Dollar* pVar = new Dollar();
             result_set(pVar);
         }
 
@@ -678,47 +500,20 @@ namespace ast
 
                 if(pIT)
                 {
-                    int iArgDim = static_cast<int>(e.args_get().size());
-                    std::vector<InternalType*> ResultList;
-
                     //Create list of indexes
-                    bool bSeeAsVector   = iArgDim == 1;
-                    int *piIndexSeq            = NULL;
-                    int *piMaxDim       = NULL;
-                    int *piDimSize             = new int[iArgDim];
-                    int iTotalCombi            = GetIndexList(pIT, e.args_get(), &piIndexSeq, &piMaxDim, pIT, piDimSize);
-
-                    //check we don't have bad indexes like "< 1"
-                    for(int i = 0 ; i < iTotalCombi * iArgDim; i++)
-                    {
-                        if(piIndexSeq[i] < 1)
-                        {
-                            //manage error
-                            std::wostringstream os;
-                            os << _W("Indexes must be positive .\n");
-                            //os << ((Location)e.name_get().location_get()).location_string_get() << std::endl;
-                            throw ScilabError(os.str(), 999, e.location_get());
-                        }
-                    }
-
-                    ResultList = pIT->getAsCell()->extract_cell(iTotalCombi, piIndexSeq, piMaxDim, piDimSize, bSeeAsVector);
+                    typed_list *pArgs = GetArgumentList(e.args_get());
 
-                    delete[] piDimSize;
-                    delete[] piIndexSeq;
-                    delete[] piMaxDim;
+                    List* pList = pIT->getAs<Cell>()->extractCell(pArgs);
 
-                    if(ResultList.size() == 0)
+                    if(pList == NULL)
                     {
                         std::wostringstream os;
                         os << L"inconsistent row/column dimensions\n";
-                        //os << ((*e.args_get().begin())->location_get()).location_string_get() << std::endl;
+                        //os << ((*e.args_get().begin())->location_get()).location_getString() << std::endl;
                         throw ScilabError(os.str(), 999, (*e.args_get().begin())->location_get());
                     }
 
-                    for(int i = 0 ; i < static_cast<int>(ResultList.size()) ; i++)
-                    {
-                        result_set(i, ResultList[i]);
-                    }
+                    result_set(pList);
                 }
             }
             else
@@ -899,18 +694,18 @@ namespace ast
                 (&e.body_get())->is_returnable();
             }
 
-            if(execVar.result_get()->getType() == InternalType::RealImplicitList)
+            if(execVar.result_get()->isImplicitList())
             {
                 T execBody;
                 ImplicitList* pVar = execVar.result_get()->getAsImplicitList();
                 //                     std::cout << "ImplicitList references : " << pVar->getRef() << std::endl;
 
                 InternalType *pIT = NULL;
-                pIT = pVar->extract_value(0);
+                pIT = pVar->extractValue(0);
                 wstring varName = e.vardec_get().name_get();
                 symbol::Context::getInstance()->put(varName, *pIT);
 
-                for(int i = 0 ; i < pVar->size_get() ; i++)
+                for(int i = 0 ; i < pVar->getSize() ; i++)
                 {
                     bool bNew = false;
                     if(pIT->isRef(1))
@@ -919,19 +714,68 @@ namespace ast
                         bNew = true;
                     }
 
-                    if(pIT->getAsDouble())
+                    if(pIT->isDouble())
                     {
-                        Double *pDouble = pIT->getAsDouble();
-                        pDouble->real_get()[0] = pVar->extract_value_double(i);
+                        Double *pDouble = pIT->getAs<Double>();
+                        pDouble->getReal()[0] = pVar->extractValueInDouble(i);
                     }
-                    else if(pIT->getAsInt())
+                    else if(pIT->isInt())
                     {
-                        Int *pInt = pIT->getAsInt();
-                        pInt->data_set(0, 0,  pVar->extract_value_int(i));
+                        switch(pIT->getType())
+                        {
+                        case InternalType::RealInt8 :
+                            {
+                                Int8* pI = pIT->getAs<Int8>();
+                                pI->set(0, (char)pVar->extractValueInInteger(i));
+                                break;
+                            }
+                        case InternalType::RealUInt8 :
+                            {
+                                UInt8* pI = pIT->getAs<UInt8>();
+                                pI->set(0, (unsigned char)pVar->extractValueInInteger(i));
+                                break;
+                            }
+                        case InternalType::RealInt16 :
+                            {
+                                Int16* pI = pIT->getAs<Int16>();
+                                pI->set(0, (short)pVar->extractValueInInteger(i));
+                                break;
+                            }
+                        case InternalType::RealUInt16 :
+                            {
+                                UInt16* pI = pIT->getAs<UInt16>();
+                                pI->set(0, (unsigned short)pVar->extractValueInInteger(i));
+                                break;
+                            }
+                        case InternalType::RealInt32 :
+                            {
+                                Int32* pI = pIT->getAs<Int32>();
+                                pI->set(0, (int)pVar->extractValueInInteger(i));
+                                break;
+                            }
+                        case InternalType::RealUInt32 :
+                            {
+                                UInt32* pI = pIT->getAs<UInt32>();
+                                pI->set(0, (unsigned int)pVar->extractValueInInteger(i));
+                                break;
+                            }
+                        case InternalType::RealInt64 :
+                            {
+                                Int64* pI = pIT->getAs<Int64>();
+                                pI->set(0, (long long)pVar->extractValueInInteger(i));
+                                break;
+                            }
+                        case InternalType::RealUInt64 :
+                            {
+                                UInt64* pI = pIT->getAs<UInt64>();
+                                pI->set(0, (unsigned long long)pVar->extractValueInInteger(i));
+                                break;
+                            }
+                        }
                     }
                     else
                     {
-                        pIT = pVar->extract_value(i);
+                        pIT = pVar->extractValue(i);
                         symbol::Context::getInstance()->put(varName, *pIT);
                     }
 
@@ -965,9 +809,14 @@ namespace ast
             {//Matrix i = [1,3,2,6] or other type
                 T execBody;
                 GenericType* pVar = static_cast<GenericType*>(execVar.result_get());
-                for(int i = 0 ; i < pVar->cols_get() ; i++)
+                if(pVar->getAs<Double>()->getDims() > 2)
                 {
-                    GenericType* pNew = pVar->get_col_value(i);
+                    throw ScilabError(_W("for expression can only manage 1 or 2 dimensions variables\n"), 999, e.vardec_get().location_get());
+                }
+
+                for(int i = 0 ; i < pVar->getCols() ; i++)
+                {
+                    GenericType* pNew = pVar->getColumnValues(i);
                     symbol::Context::getInstance()->put(e.vardec_get().name_get(), *pNew);
                     e.body_get().accept(execBody);
                     if(e.body_get().is_break())
@@ -1007,7 +856,7 @@ namespace ast
                 T execVar;
                 e.exp_get().accept(execVar);
 
-                if(execVar.result_size_get() == 1)
+                if(execVar.result_getSize() == 1)
                 {
                     //protect variable
                     InternalType *pIT = execVar.result_get();
@@ -1016,7 +865,7 @@ namespace ast
                 }
                 else
                 {
-                    for(int i = 0 ; i < execVar.result_size_get() ; i++)
+                    for(int i = 0 ; i < execVar.result_getSize() ; i++)
                     {
                         //protect variable
                         InternalType *pIT = execVar.result_get(i);
@@ -1026,14 +875,14 @@ namespace ast
                 }
             }
 
-            if(result_size_get() == 1)
+            if(result_getSize() == 1)
             {
                 //unprotect variable
                 result_get()->DecreaseRef();
             }
             else
             {
-                for(int i = 0 ; i < result_size_get() ; i++)
+                for(int i = 0 ; i < result_getSize() ; i++)
                 {
                     //unprotect variable
                     result_get(i)->DecreaseRef();
@@ -1125,7 +974,7 @@ namespace ast
                             types::typed_list in;
 
                             T execCall;
-                            Function::ReturnValue Ret = pCall->call(in, expected_size_get(), out, &execCall);
+                            Function::ReturnValue Ret = pCall->call(in, expected_getSize(), out, &execCall);
 
                             if(Ret == Callable::OK)
                             {
@@ -1262,7 +1111,7 @@ namespace ast
                                 throw ScilabMessage(os.str(), 0, (*itExp)->location_get());
                             }
                         }
-                        catch(ScilabError se)
+                        catch(ScilabError se2)
                         {//just to catch exception, do nothing
                         }
                     }
@@ -1290,6 +1139,7 @@ namespace ast
 
         void visitprivate(const AssignListExp  &e)
         {
+            
         }
         /** \} */
 
@@ -1306,11 +1156,12 @@ namespace ast
 
             if(execMe.result_get()->isDouble())
             {
-                Double *pdbl   = execMe.result_get()->getAsDouble();
-                Bool *pReturn  = new Bool(pdbl->rows_get(), pdbl->cols_get());
-                double *pR             = pdbl->real_get();
-                int *piB                       = pReturn->bool_get();
-                for(int i = 0 ; i < pdbl->size_get() ; i++)
+                InternalType* pVar  = execMe.result_get();
+                Double *pdbl        = pVar->getAs<Double>();
+                Bool *pReturn       = new Bool(pdbl->getRows(), pdbl->getCols());
+                double *pR                 = pdbl->getReal();
+                int *piB            = pReturn->get();
+                for(int i = 0 ; i < pdbl->getSize() ; i++)
                 {
                     piB[i] = pR[i] == 0 ? 1 : 0;
                 }
@@ -1318,12 +1169,13 @@ namespace ast
             }
             else if(execMe.result_get()->isBool())
             {
-                Bool *pb                       = execMe.result_get()->getAsBool();
-                Bool *pReturn  = new Bool(pb->rows_get(), pb->cols_get());
-                int *piR                       = pb->bool_get();
-                int *piB                       = pReturn->bool_get();
+                InternalType* pIT      = execMe.result_get();
+                Bool *pb                       = pIT->getAs<types::Bool>();
+                Bool *pReturn  = new Bool(pb->getRows(), pb->getCols());
+                int *piR                       = pb->get();
+                int *piB                       = pReturn->get();
 
-                for(int i = 0 ; i < pb->size_get() ; i++)
+                for(int i = 0 ; i < pb->getSize() ; i++)
                 {
                     piB[i] = piR[i] == 1 ? 0 : 1;
                 }
@@ -1344,63 +1196,65 @@ namespace ast
 
             if(execMe.result_get()->isImplicitList())
             {
-                InternalType *pIT = execMe.result_get()->getAsImplicitList()->extract_matrix();
+                InternalType *pIT = execMe.result_get()->getAsImplicitList()->extractFullMatrix();
                 execMe.result_set(pIT);
             }
 
             if(execMe.result_get()->isDouble())
             {
-                Double *pdbl           = execMe.result_get()->getAsDouble();
-                Double *pReturn        = NULL;
+                InternalType* pVar  = execMe.result_get();
+                Double *pdbl           = pVar->getAs<Double>();
+                Double *pReturn            = NULL;
 
                 if(pdbl->isComplex())
                 {
-                    pReturn                            = new Double(pdbl->cols_get(), pdbl->rows_get(), true);
-                    double *pInR       =       pdbl->real_get();
-                    double *pInI       =       pdbl->img_get();
-                    double *pOutR      =       pReturn->real_get();
-                    double *pOutI      =       pReturn->img_get();
+                    pReturn                            = new Double(pdbl->getCols(), pdbl->getRows(), true);
+                    double *pInR       =       pdbl->getReal();
+                    double *pInI       =       pdbl->getImg();
+                    double *pOutR      =       pReturn->getReal();
+                    double *pOutI      =       pReturn->getImg();
 
-                    vTransposeComplexMatrix(pInR, pInI, pdbl->rows_get(), pdbl->cols_get(), pOutR, pOutI, bConjug);
+                    vTransposeComplexMatrix(pInR, pInI, pdbl->getRows(), pdbl->getCols(), pOutR, pOutI, bConjug);
                 }
                 else
                 {
-                    pReturn                            = new Double(pdbl->cols_get(), pdbl->rows_get(), false);
-                    double *pInR       =       pdbl->real_get();
-                    double *pOutR      =       pReturn->real_get();
+                    pReturn                            = new Double(pdbl->getCols(), pdbl->getRows(), false);
+                    double *pInR       =       pdbl->getReal();
+                    double *pOutR      =       pReturn->getReal();
 
-                    vTransposeRealMatrix(pInR, pdbl->rows_get(), pdbl->cols_get(), pOutR);
+                    vTransposeRealMatrix(pInR, pdbl->getRows(), pdbl->getCols(), pOutR);
                 }
                 result_set(pReturn);
             }
             else if(execMe.result_get()->isPoly())
             {
-                MatrixPoly *pMP                        = execMe.result_get()->getAsPoly();
-                MatrixPoly *pReturn    = NULL;
+                InternalType *pIT          = execMe.result_get();
+                Polynom *pMP                   = pIT->getAs<types::Polynom>();
+                Polynom *pReturn           = NULL;
 
                 //prepare rank array
-                int* piRank = new int[pMP->size_get()];
+                int* piRank = new int[pMP->getSize()];
 
-                for(int i = 0 ; i < pMP->rows_get() ; i++)
+                for(int i = 0 ; i < pMP->getRows() ; i++)
                 {
-                    for(int j = 0 ; j < pMP->cols_get() ; j++)
+                    for(int j = 0 ; j < pMP->getCols() ; j++)
                     {
-                        piRank[i * pMP->cols_get() + j] = pMP->poly_get(i,j)->rank_get();
+                        piRank[i * pMP->getCols() + j] = pMP->get(i,j)->getRank();
                     }
                 }
 
-                pReturn = new MatrixPoly(pMP->var_get(), pMP->cols_get(), pMP->rows_get(), piRank);
-                pReturn->complex_set(pMP->isComplex());
+                pReturn = new Polynom(pMP->getVariableName(), pMP->getCols(), pMP->getRows(), piRank);
+                pReturn->setComplex(pMP->isComplex());
 
                 if(pMP->isComplex() && bConjug)
                 {
-                    for(int i = 0 ; i < pMP->rows_get() ; i++)
+                    for(int i = 0 ; i < pMP->getRows() ; i++)
                     {
-                        for(int j = 0 ; j < pMP->cols_get() ; j++)
+                        for(int j = 0 ; j < pMP->getCols() ; j++)
                         {
-                            pReturn->poly_set(j, i, pMP->poly_get(i,j)->coef_get());
-                            double *pdblImg = pReturn->poly_get(j, i)->coef_img_get();
-                            for(int k = 0 ; k < pReturn->poly_get(j, i)->rank_get() ; k++)
+                            pReturn->setCoef(j, i, pMP->get(i,j)->getCoef());
+                            double *pdblImg = pReturn->get(j, i)->getCoefImg();
+                            for(int k = 0 ; k < pReturn->get(j, i)->getRank() ; k++)
                             {
                                 pdblImg[k] *= -1;
                             }
@@ -1409,11 +1263,11 @@ namespace ast
                 }
                 else
                 {
-                    for(int i = 0 ; i < pMP->rows_get() ; i++)
+                    for(int i = 0 ; i < pMP->getRows() ; i++)
                     {
-                        for(int j = 0 ; j < pMP->cols_get() ; j++)
+                        for(int j = 0 ; j < pMP->getCols() ; j++)
                         {
-                            pReturn->poly_set(j, i, pMP->poly_get(i,j)->coef_get());
+                            pReturn->setCoef(j, i, pMP->get(i,j)->getCoef());
                         }
                     }
                 }
@@ -1422,14 +1276,15 @@ namespace ast
             }
             else if(execMe.result_get()->isString())
             {
-                String *pS      = execMe.result_get()->getAsString();
-                String* pReturn = new String(pS->cols_get(), pS->rows_get());
+                InternalType* pVar  = execMe.result_get();
+                String *pS          = pVar->getAs<types::String>();
+                String* pReturn     = new String(pS->getCols(), pS->getRows());
 
-                for(int i = 0 ; i < pS->rows_get() ; i++)
+                for(int i = 0 ; i < pS->getRows() ; i++)
                 {
-                    for(int j = 0 ; j < pS->cols_get() ; j++)
+                    for(int j = 0 ; j < pS->getCols() ; j++)
                     {
-                        pReturn->string_set(j,i, pS->string_get(i,j));
+                        pReturn->set(j,i, pS->get(i,j));
                     }
                 }
                 result_set(pReturn);
@@ -1505,7 +1360,7 @@ namespace ast
             {
                 e.start_get().accept(execMeStart);
                 GenericType* pITStart = static_cast<GenericType*>(execMeStart.result_get());
-                if(pITStart->rows_get() != 1 || pITStart->cols_get() != 1)
+                if(pITStart->getRows() != 1 || pITStart->getCols() != 1)
                 {
                     throw 1;
                 }
@@ -1513,76 +1368,72 @@ namespace ast
 
                 e.step_get().accept(execMeStep);
                 GenericType* pITStep = static_cast<GenericType*>(execMeStep.result_get());
-                if(pITStep->rows_get() != 1 || pITStep->cols_get() != 1)
+                if(pITStep->getRows() != 1 || pITStep->getCols() != 1)
                 {
                     throw 2;
                 }
 
                 e.end_get().accept(execMeEnd);
                 GenericType* pITEnd = static_cast<GenericType*>(execMeEnd.result_get());
-                if(pITEnd->rows_get() != 1 || pITEnd->cols_get() != 1)
+                if(pITEnd->getRows() != 1 || pITEnd->getCols() != 1)
                 {
                     throw 3;
                 }
 
                 //check compatibility
 
-                if(execMeStart.result_get()->getType() == InternalType::RealInt)
+                if(execMeStart.result_get()->isInt())
                 {//if Step or End are Int too, they must have the same precision
-                    Int::IntType IT = execMeStart.result_get()->getAsInt()->getIntType();
-
-                    if(execMeStep.result_get()->getType() == InternalType::RealInt)
+                    if(execMeStep.result_get()->isInt())
                     {
-                        if(execMeStep.result_get()->getAsInt()->getIntType() != IT)
+                        if(execMeStep.result_get()->getType() != execMeStart.result_get()->getType())
                         {
                             throw ScilabError(_W("Undefined operation for the given operands.\n"), 999, e.step_get().location_get());
                         }
                     }
-                    else if(execMeStep.result_get()->getType() == InternalType::RealPoly)
+                    else if(execMeStep.result_get()->isPoly())
                     {
                         throw ScilabError(_W("Undefined operation for the given operands.\n"), 999, e.step_get().location_get());
                     }
 
 
-                    if(execMeEnd.result_get()->getType() == InternalType::RealInt)
+                    if(execMeEnd.result_get()->isInt())
                     {
-                        if(execMeEnd.result_get()->getAsInt()->getIntType() != IT)
+                        if(execMeEnd.result_get()->getType() != execMeStart.result_get()->getType())
                         {
                             throw ScilabError(_W("Undefined operation for the given operands.\n"), 999, e.end_get().location_get());
                         }
                     }
-                    else if(execMeEnd.result_get()->getType() == InternalType::RealPoly)
+                    else if(execMeEnd.result_get()->isPoly())
                     {
                             throw ScilabError(_W("Undefined operation for the given operands.\n"), 999, e.end_get().location_get());
                     }
                 }
-                else if(execMeStart.result_get()->getType() == InternalType::RealPoly)
+                else if(execMeStart.result_get()->isPoly())
                 {
-                    if(execMeStep.result_get()->getType() == InternalType::RealInt)
+                    if(execMeStep.result_get()->isInt())
                     {
                         throw ScilabError(_W("Undefined operation for the given operands.\n"), 999, e.step_get().location_get());
                     }
 
-                    if(execMeEnd.result_get()->getType() == InternalType::RealInt)
+                    if(execMeEnd.result_get()->isInt())
                     {
                         throw ScilabError(_W("Undefined operation for the given operands.\n"), 999, e.end_get().location_get());
                     }
                 }
-                else if(execMeStep.result_get()->getType() == InternalType::RealInt)
-                {//if End are Int too, they must have the same precision
-                    Int::IntType IT = execMeStep.result_get()->getAsInt()->getIntType();
-
-                    if(execMeEnd.result_get()->getType() == InternalType::RealInt)
+                else if(execMeStep.result_get()->isInt())
+                {//if End is Int too, they must have the same precision
+                    if(execMeEnd.result_get()->isInt())
                     {
-                        if(execMeEnd.result_get()->getAsInt()->getIntType() != IT)
+                        if(execMeEnd.result_get()->getType() != execMeStep.result_get()->getType())
                         {
                             throw ScilabError(_W("Undefined operation for the given operands.\n"), 999, e.end_get().location_get());
                         }
                     }
                 }
-                else if(execMeStep.result_get()->getType() == InternalType::RealPoly)
+                else if(execMeStep.result_get()->isPoly())
                 {
-                    if(execMeEnd.result_get()->getType() == InternalType::RealInt)
+                    if(execMeEnd.result_get()->isInt())
                     {
                         throw ScilabError(_W("Undefined operation for the given operands.\n"), 999, e.step_get().location_get());
                     }
index b7d3878..f2755b7 100644 (file)
 #include "exp.hxx"
 
 #define bsiz   4096
+
 EXTERN_AST bool bConditionState(types::InternalType *_pITResult);
 
-EXTERN_AST void ExpandList(int ** _piList, int *_piListSize, int _iListSizeSize, int *_piResultList);
-EXTERN_AST int GetVarMaxDim(types::InternalType *_pIT, int _iCurrentDim, int _iMaxDim);
+//EXTERN_AST void ExpandList(int ** _piList, int *_piListSize, int _iListSizeSize, int *_piResultList);
 
 EXTERN_AST types::InternalType* AddElementToVariable(
                                                types::InternalType* _poDest,
@@ -37,7 +37,6 @@ EXTERN_AST types::InternalType* AddElementToVariableFromRow(
                         types::InternalType* _poSource,
                         int _iRows, int _iCols, int *_piRows);
 
-
 EXTERN_AST const std::wstring* getStructNameFromExp(const ast::Exp* _pExp);
 
 EXTERN_AST types::Struct* getStructFromExp(const ast::Exp* _pExp);
index 3caf496..e2a2fd2 100644 (file)
 *
 */
 
+#include <string>
 #include <numeric>
 #include "visitor_common.hxx"
-#include "context.hxx"
-#include "internal.hxx"
 #include "exp.hxx"
 #include "fieldexp.hxx"
-#include "callexp.hxx"
 #include "simplevar.hxx"
-#include "double.hxx"
-#include "string.hxx"
-#include "implicitlist.hxx"
+#include "callexp.hxx"
 #include "struct.hxx"
-#include "matrixpoly.hxx"
+#include "context.hxx"
+
+#include "arrayof.hxx"
 
 bool bConditionState(types::InternalType *_pITResult)
 {
        if(_pITResult->isDouble() &&
-       _pITResult->getAsDouble()->isComplex() == false)
+        _pITResult->getAs<types::Double>()->isComplex() == false)
        {
-               types::Double *pR = _pITResult->getAsDouble();
-               double *pReal = pR->real_get();
+               types::Double *pR = _pITResult->getAs<types::Double>();
+               double *pReal = pR->getReal();
 
-               for(int i = 0 ; i < pR->size_get() ; i++)
+               for(int i = 0 ; i < pR->getSize() ; i++)
                {
                        if(pReal[i] == 0)
                        {
@@ -42,10 +40,10 @@ bool bConditionState(types::InternalType *_pITResult)
        }
        else if(_pITResult->isBool())
        {
-               types::Bool *pB         = _pITResult->getAsBool();
-               int *piData     = pB->bool_get();
+               types::Bool *pB         = _pITResult->getAs<types::Bool>();
+               int *piData     = pB->get();
 
-               for(int i = 0 ; i < pB->size_get() ; i++)
+               for(int i = 0 ; i < pB->getSize() ; i++)
                {
                        if(piData[i] == 0)
                        {
@@ -64,101 +62,6 @@ bool bConditionState(types::InternalType *_pITResult)
        return true;
 }
 
-void ExpandList(int ** _piList, int *_piListSize, int _iListSizeSize, int *_piResultList)
-{
-#define ORIGINAL_IMPLEM
-#ifdef ORIGINAL_IMPLEM
-       for(int i = _iListSizeSize - 1 ; i >= 0 ; i--)
-       {
-               int iPreOcc = 1;
-               int iPostOcc = 1;
-               for(int k = 0 ; k < i ; k++)
-               {
-                       if(k != i)
-                       {
-                               iPreOcc *= _piListSize[k];
-                       }
-               }
-
-               for(int k = i + 1 ; k < _iListSizeSize ; k++)
-               {
-                       if(k != i)
-                       {
-                               iPostOcc *= _piListSize[k];
-                       }
-               }
-
-               int iSize = _piListSize[i];
-               for(int m = iSize - 1 ; m >= 0  ; m--)
-               {
-                       for(int j1 = iPreOcc - 1 ; j1 >= 0 ; j1--)
-                       {
-                               for(int j2 = iPostOcc - 1 ; j2 >= 0 ; j2--)
-                               {
-                                       //Bloc Offset                           -> j1 * ( iPostOcc * iSize) * _iListSizeSize
-                                       //Offset in Bloc                -> m * iPostOcc * _iListSizeSize
-                                       //Offset in SubBloc -> j2 * _iListSizeSize + i
-                                       int iPos = j1 * ( iPostOcc * iSize) * _iListSizeSize + m * iPostOcc * _iListSizeSize + j2 * _iListSizeSize + i;
-                                       _piResultList[iPos] = _piList[i][m];
-
-                               }
-                       }
-               }
-       }
-#else
-       int iPreOcc= 1;
-       int iPostOcc= std::accumulate(_piListSize, _piListSize + _iListSizeSize, 1, multiplies<int>());
-       for(int i =0; i!= _iListSizeSize;++i)
-       {
-               int const iSize = _piListSize[i];
-               int const delta(iPostOcc * _iListSizeSize);
-               int* ptr = _piResultList + i;
-
-               iPostOcc /= iSize;
-
-               for(int m(0); m != iSize; ++m,ptr += delta)
-               {
-                       int const data=_piList[i][m];
-                       for(int j1(0); j1 != iPreOcc; ++j1, ptr +=  delta * iSize)
-                       {
-                               for(int j2(0); j2!= iPostOcc ; ++j2, ptr+=  _iListSizeSize)
-                               {
-                                       *ptr= data;
-                               }
-                       }
-               }
-               iPreOcc *= iSize;
-       }
-#endif
-}
-
-int GetVarMaxDim(types::InternalType *_pIT, int _iCurrentDim, int _iMaxDim)
-{
-       if(_pIT == NULL)
-       {
-               return 0;
-       }
-       if(_iCurrentDim == 0)
-       {
-               if(_iMaxDim != 1)
-               {
-                       return static_cast<types::GenericType*>(_pIT)->rows_get();
-               }
-               else
-               {
-                       return static_cast<types::GenericType*>(_pIT)->size_get();
-               }
-       }
-       else if(_iCurrentDim == 1)
-       {
-               return static_cast<types::GenericType*>(_pIT)->cols_get();
-       }
-       else
-       {//more than 2 dimensions ? :(
-               return static_cast<types::GenericType*>(_pIT)->size_get();
-       }
-}
-
 /*
  * Generate destination variable from _poSource type and size parameters
  */
@@ -173,8 +76,29 @@ types::InternalType* allocDest(types::InternalType* _poSource, int _iRows, int _
     case types::GenericType::RealBool :
         poResult = new types::Bool(_iRows, _iCols);
         break;
-    case types::GenericType::RealInt :
-        poResult = types::Int::createInt(_iRows, _iCols, _poSource->getAsInt()->getIntType());
+    case types::GenericType::RealInt8 :
+        poResult = new types::Int8(_iRows, _iCols);
+        break;
+    case types::GenericType::RealUInt8 :
+        poResult = new types::UInt8(_iRows, _iCols);
+        break;
+    case types::GenericType::RealInt16 :
+        poResult = new types::Int16(_iRows, _iCols);
+        break;
+    case types::GenericType::RealUInt16 :
+        poResult = new types::UInt16(_iRows, _iCols);
+        break;
+    case types::GenericType::RealInt32 :
+        poResult = new types::Int32(_iRows, _iCols);
+        break;
+    case types::GenericType::RealUInt32 :
+        poResult = new types::UInt32(_iRows, _iCols);
+        break;
+    case types::GenericType::RealInt64 :
+        poResult = new types::Int64(_iRows, _iCols);
+        break;
+    case types::GenericType::RealUInt64 :
+        poResult = new types::UInt64(_iRows, _iCols);
         break;
     case types::GenericType::RealString :
         poResult = new types::String(_iRows, _iCols);
@@ -186,7 +110,7 @@ types::InternalType* allocDest(types::InternalType* _poSource, int _iRows, int _
             {
                 piRank[i] = 1;
             }
-            poResult = new types::MatrixPoly(_poSource->getAsPoly()->var_get(), _iRows, _iCols, piRank);
+            poResult = new types::Polynom(_poSource->getAs<types::Polynom>()->getVariableName(), _iRows, _iCols, piRank);
             break;
         }
     case types::InternalType::RealImplicitList :
@@ -229,13 +153,13 @@ types::InternalType* AddElementToVariableFromCol(types::InternalType* _poDest, t
         switch(TypeDest)
         {
         case types::GenericType::RealDouble :
-            if(poResult->getAsDouble()->isComplex() == false && _poSource->getAsDouble()->isComplex() == true)
+            if(poResult->getAs<types::Double>()->isComplex() == false && _poSource->getAs<types::Double>()->isComplex() == true)
             {
-                poResult->getAsDouble()->complex_set(true);
+                poResult->getAs<types::Double>()->setComplex(true);
             }
 
-            poResult->getAsDouble()->fillFromCol(*_piCols, _poSource->getAsDouble());
-            *_piCols += _poSource->getAsDouble()->cols_get();
+            poResult->getAs<types::Double>()->fillFromCol(*_piCols, _poSource->getAs<types::Double>());
+            *_piCols += _poSource->getAs<types::Double>()->getCols();
 
             break;
         default:
@@ -276,13 +200,13 @@ types::InternalType* AddElementToVariableFromRow(types::InternalType* _poDest, t
         switch(TypeDest)
         {
         case types::GenericType::RealDouble :
-            if(poResult->getAsDouble()->isComplex() == false && _poSource->getAsDouble()->isComplex() == true)
+            if(poResult->getAs<types::Double>()->isComplex() == false && _poSource->getAs<types::Double>()->isComplex() == true)
             {
-                poResult->getAsDouble()->complex_set(true);
+                poResult->getAs<types::Double>()->setComplex(true);
             }
 
-            poResult->getAsDouble()->fillFromRow(*_piRows, _poSource->getAsDouble());
-            *_piRows += _poSource->getAsDouble()->rows_get();
+            poResult->getAs<types::Double>()->fillFromRow(*_piRows, _poSource->getAs<types::Double>());
+            *_piRows += _poSource->getAs<types::Double>()->getRows();
 
             break;
         default:
@@ -316,9 +240,30 @@ types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::I
                case types::GenericType::RealBool :
                        poResult = new types::Bool(_iRows, _iCols);
                        break;
-               case types::GenericType::RealInt :
-                       poResult = types::Int::createInt(_iRows, _iCols, _poSource->getAsInt()->getIntType());
-                       break;
+        case types::GenericType::RealInt8 :
+            poResult = new types::Int8(_iRows, _iCols);
+            break;
+        case types::GenericType::RealUInt8 :
+            poResult = new types::UInt8(_iRows, _iCols);
+            break;
+        case types::GenericType::RealInt16 :
+            poResult = new types::Int16(_iRows, _iCols);
+            break;
+        case types::GenericType::RealUInt16 :
+            poResult = new types::UInt16(_iRows, _iCols);
+            break;
+        case types::GenericType::RealInt32 :
+            poResult = new types::Int32(_iRows, _iCols);
+            break;
+        case types::GenericType::RealUInt32 :
+            poResult = new types::UInt32(_iRows, _iCols);
+            break;
+        case types::GenericType::RealInt64 :
+            poResult = new types::Int64(_iRows, _iCols);
+            break;
+        case types::GenericType::RealUInt64 :
+            poResult = new types::UInt64(_iRows, _iCols);
+            break;
                case types::GenericType::RealString :
                        poResult = new types::String(_iRows, _iCols);
                        break;
@@ -329,7 +274,7 @@ types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::I
                                {
                                        piRank[i] = 1;
                                }
-                               poResult = new types::MatrixPoly(_poSource->getAsPoly()->var_get(), _iRows, _iCols, piRank);
+                               poResult = new types::Polynom(_poSource->getAs<types::Polynom>()->getVariableName(), _iRows, _iCols, piRank);
                                break;
                        }
                case types::InternalType::RealImplicitList :
@@ -357,19 +302,19 @@ types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::I
                case types::GenericType::RealDouble :
                        if(TypeSource == types::GenericType::RealPoly)
                        {
-                               types::Double *poDest = _poDest->getAsDouble();
+                               types::Double *poDest = _poDest->getAs<types::Double>();
                                //Convert Dest to RealPoly
-                               int *piRank = new int[poDest->size_get()];
-                               for(int i = 0 ; i < poDest->size_get() ; i++)
+                               int *piRank = new int[poDest->getSize()];
+                               for(int i = 0 ; i < poDest->getSize() ; i++)
                                {
                                        piRank[i] = 1;
                                }
 
-                               poResult = new types::MatrixPoly(_poSource->getAsPoly()->var_get(), poDest->rows_get(), poDest->cols_get(),  piRank);
+                               poResult = new types::Polynom(_poSource->getAs<types::Polynom>()->getVariableName(), poDest->getRows(), poDest->getCols(),  piRank);
 
-                               double *pR = poDest->real_get();
-                               double *pI = poDest->img_get();
-                               for(int i = 0 ; i < poDest->size_get() ; i++)
+                               double *pR = poDest->getReal();
+                               double *pI = poDest->getImg();
+                               for(int i = 0 ; i < poDest->getSize() ; i++)
                                {
                                        types::Double *pdbl = NULL;
                                        if(poDest->isComplex())
@@ -381,21 +326,21 @@ types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::I
                                                pdbl = new types::Double(pR[i]);
                                        }
 
-                                       poResult->getAsPoly()->poly_set(i, pdbl);
+                                       poResult->getAs<types::Polynom>()->setCoef(i, pdbl);
                                        delete pdbl;
                                }
 
-                               poResult->getAsPoly()->poly_set(iCurRow, iCurCol, _poSource->getAsPoly()->poly_get(0)->coef_get());
+                               poResult->getAs<types::Polynom>()->setCoef(iCurRow, iCurCol, _poSource->getAs<types::Polynom>()->get(0)->getCoef());
                        }
                        break;
                case types::GenericType::RealPoly :
                        if(TypeSource == types::GenericType::RealDouble)
                        {
                                //Add Source like coef of the new element
-                               types::Poly* pPolyOut   = poResult->getAsPoly()->poly_get(iCurRow, iCurCol);
+                               types::SinglePoly* pPolyOut     = poResult->getAs<types::Polynom>()->get(iCurRow, iCurCol);
 
-                               pPolyOut->rank_set(1);
-                               pPolyOut->coef_set(_poSource->getAsDouble());
+                               pPolyOut->setRank(1);
+                pPolyOut->setCoef(_poSource->getAs<types::Double>());
                        }
                        break;
                default:
@@ -408,105 +353,92 @@ types::InternalType* AddElementToVariable(types::InternalType* _poDest, types::I
                switch(TypeDest)
                {
                case types::GenericType::RealDouble :
-                       if(poResult->getAsDouble()->isComplex() == false && _poSource->getAsDouble()->isComplex() == true)
-                       {
-                               poResult->getAsDouble()->complex_set(true);
-                       }
-
-                       if(_poSource->getAsDouble()->size_get() != 1)
-                       {
-                               poResult->getAsDouble()->append(iCurRow, iCurCol, _poSource->getAsDouble());
-                       }
-                       else
-                       {
-                               poResult->getAsDouble()->val_set(iCurRow, iCurCol, _poSource->getAsDouble()->real_get(0,0), _poSource->getAsDouble()->img_get(0,0));
-                       }
-
-                       *_piRows = _poSource->getAsDouble()->rows_get();
-                       *_piCols = _poSource->getAsDouble()->cols_get();
+                       poResult->getAs<types::Double>()->append(iCurRow, iCurCol, _poSource->getAs<types::Double>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
                        break;
                case types::GenericType::RealPoly :
-                       {
-                               if(_poSource->getAsPoly()->isComplex())
-                               {
-                                       poResult->getAsPoly()->complex_set(true);
-                               }
-
-                               if(_poSource->getAsPoly()->size_get() != 1)
-                               {
-                                       poResult->getAsPoly()->insert(iCurRow, iCurCol, _poSource->getAsPoly());
-                               }
-                               else
-                               {
-                                       types::Poly* pPolyOut   = poResult->getAsPoly()->poly_get(iCurRow, iCurCol);
-                                       types::Poly* pPolyIn            = _poSource->getAsPoly()->poly_get(0);
-
-                                       pPolyOut->rank_set(pPolyIn->rank_get());
-                                       pPolyOut->coef_set(pPolyIn->coef_get());
-                               }
-
-                               *_piRows = _poSource->getAsPoly()->rows_get();
-                               *_piCols = _poSource->getAsPoly()->cols_get();
-                               break;
-                       }
+                       poResult->getAs<types::Polynom>()->append(iCurRow, iCurCol, _poSource->getAs<types::Polynom>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
+                       break;
                case types::GenericType::RealBool:
-                       poResult->getAsBool()->bool_set(iCurRow, iCurCol, _poSource->getAsBool()->bool_get(0,0));
-                       *_piRows = _poSource->getAsBool()->rows_get();
-                       *_piCols = _poSource->getAsBool()->cols_get();
+                       poResult->getAs<types::Bool>()->append(iCurRow, iCurCol, _poSource->getAs<types::Bool>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
                        break;
-               case types::GenericType::RealInt :
-            if(_poSource->getAsInt()->size_get() != 1)
-            {
-                poResult->getAsInt()->append(iCurRow, iCurCol, _poSource->getAsInt());
-            }
-            else
-            {
-                poResult->getAsInt()->data_set(iCurRow, iCurCol, _poSource->getAsInt()->data_get(0,0));
-            }
-
-            *_piRows = _poSource->getAsInt()->rows_get();
-                       *_piCols = _poSource->getAsInt()->cols_get();
+               case types::GenericType::RealInt8 :
+                       poResult->getAs<types::Int8>()->append(iCurRow, iCurCol, _poSource->getAs<types::Int8>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
+                       break;
+               case types::GenericType::RealUInt8 :
+                       poResult->getAs<types::UInt8>()->append(iCurRow, iCurCol, _poSource->getAs<types::UInt8>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
+                       break;
+               case types::GenericType::RealInt16 :
+                       poResult->getAs<types::Int16>()->append(iCurRow, iCurCol, _poSource->getAs<types::Int16>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
+                       break;
+               case types::GenericType::RealUInt16 :
+                       poResult->getAs<types::UInt16>()->append(iCurRow, iCurCol, _poSource->getAs<types::UInt16>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
+                       break;
+               case types::GenericType::RealInt32 :
+                       poResult->getAs<types::Int32>()->append(iCurRow, iCurCol, _poSource->getAs<types::Int32>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
+                       break;
+               case types::GenericType::RealUInt32 :
+                       poResult->getAs<types::UInt32>()->append(iCurRow, iCurCol, _poSource->getAs<types::UInt32>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
+                       break;
+               case types::GenericType::RealInt64 :
+                       poResult->getAs<types::Int64>()->append(iCurRow, iCurCol, _poSource->getAs<types::Int64>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
+                       break;
+               case types::GenericType::RealUInt64 :
+                       poResult->getAs<types::UInt64>()->append(iCurRow, iCurCol, _poSource->getAs<types::UInt64>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
                        break;
                case types::GenericType::RealString :
-            if(_poSource->getAsString()->size_get() != 1)
-            {
-                poResult->getAsString()->append(iCurRow, iCurCol, _poSource->getAsString());
-            }
-            else
-            {
-                poResult->getAsString()->string_set(iCurRow, iCurCol, _poSource->getAsString()->string_get(0,0));
-            }
-
-            *_piRows = _poSource->getAsString()->rows_get();
-                       *_piCols = _poSource->getAsString()->cols_get();
+            poResult->getAs<types::String>()->append(iCurRow, iCurCol, _poSource->getAs<types::String>());
+                       *_piRows = _poSource->getAsGenericType()->getRows();
+                       *_piCols = _poSource->getAsGenericType()->getCols();
                        break;
                case types::GenericType::RealImplicitList :
                        {
-                               if(_poSource->getAsImplicitList()->start_type_get() == types::InternalType::RealPoly)
+                               if(_poSource->getAsImplicitList()->getStartType() == types::InternalType::RealPoly)
                                {
-                                       poResult->getAsImplicitList()->start_set(_poSource->getAsImplicitList()->start_get());
+                                       poResult->getAsImplicitList()->setStart(_poSource->getAsImplicitList()->getStart());
                                }
                                else
                                {
-                                       poResult->getAsImplicitList()->start_set(_poSource->getAsImplicitList()->start_get());
+                                       poResult->getAsImplicitList()->setStart(_poSource->getAsImplicitList()->getStart());
                                }
 
-                               if(_poSource->getAsImplicitList()->step_type_get() == types::InternalType::RealPoly)
+                               if(_poSource->getAsImplicitList()->getStepType() == types::InternalType::RealPoly)
                                {
-                                       poResult->getAsImplicitList()->step_set(_poSource->getAsImplicitList()->step_get());
+                                       poResult->getAsImplicitList()->setStep(_poSource->getAsImplicitList()->getStep());
                                }
                                else
                                {
-                                       poResult->getAsImplicitList()->step_set(_poSource->getAsImplicitList()->step_get());
+                                       poResult->getAsImplicitList()->setStep(_poSource->getAsImplicitList()->getStep());
                                }
 
-                               if(_poSource->getAsImplicitList()->end_type_get() == types::InternalType::RealPoly)
+                               if(_poSource->getAsImplicitList()->getEndType() == types::InternalType::RealPoly)
                                {
-                                       poResult->getAsImplicitList()->end_set(_poSource->getAsImplicitList()->end_get());
+                                       poResult->getAsImplicitList()->setEnd(_poSource->getAsImplicitList()->getEnd());
                                }
                                else
                                {
-                                       poResult->getAsImplicitList()->end_set(_poSource->getAsImplicitList()->end_get());
+                                       poResult->getAsImplicitList()->setEnd(_poSource->getAsImplicitList()->getEnd());
                                }
                                break;
                        }
@@ -577,7 +509,7 @@ types::Struct* getStructFromExp(const Exp* _pExp)
             //Add variable to scope
             symbol::Context::getInstance()->put(pVar->name_get(), *pStr);
         }
-        else if(pIT->getType() != types::InternalType::RealStruct)
+        else if(pIT->isStruct() == false)
         {
             return NULL;
         }
index 4eb5191..8a7a937 100644 (file)
@@ -16,7 +16,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-#include "bool.hxx"
+#include "arrayof.hxx"
 #include "function.hxx"
 
 extern "C"
@@ -65,7 +65,7 @@ SciErr getMatrixOfBoolean(void* _pvCtx, int* _piAddress, int* _piRows, int* _piC
 
        if(_piBool)
        {
-               *_piBool = ((InternalType*)_piAddress)->getAsBool()->bool_get();
+               *_piBool = ((InternalType*)_piAddress)->getAs<types::Bool>()->get();
        }
        return sciErr;
 }
@@ -95,7 +95,7 @@ SciErr allocMatrixOfBoolean(void* _pvCtx, int _iVar, int _iRows, int _iCols, int
 
        int rhs = _iVar - api_Rhs((int*)_pvCtx);
        out[rhs - 1] = pBool;
-       *_piBool = pBool->bool_get();
+       *_piBool = pBool->get();
        if(*_piBool == NULL)
        {
                addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocated variable"), "allocMatrixOfBoolean");
index 7a1e358..e866942 100644 (file)
@@ -15,9 +15,8 @@
 
 
 #include "internal.hxx"
-#include "double.hxx"
+#include "arrayof.hxx"
 #include "function.hxx"
-#include "matrixpoly.hxx"
 
 extern "C"
 {
@@ -60,8 +59,8 @@ SciErr getVarDimension(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols
     SciErr sciErr; sciErr.iErr = 0; sciErr.iMsgCount = 0;
     if(_piAddress != NULL && isVarMatrixType(_pvCtx, _piAddress))
     {
-        *_piRows        = ((types::InternalType*)_piAddress)->getAsGenericType()->rows_get();
-        *_piCols        = ((types::InternalType*)_piAddress)->getAsGenericType()->cols_get();
+        *_piRows        = ((types::InternalType*)_piAddress)->getAsGenericType()->getRows();
+        *_piCols        = ((types::InternalType*)_piAddress)->getAsGenericType()->getCols();
     }
     else
     {
@@ -217,7 +216,14 @@ SciErr getVarType(void* _pvCtx, int* _piAddress, int* _piType)
         //case GenericType::RealMatlabSparse :
         //    *_piType = sci_matlab_sparse;
         //    break;
-    case GenericType::RealInt :
+    case GenericType::RealInt8 :
+    case GenericType::RealUInt8 :
+    case GenericType::RealInt16 :
+    case GenericType::RealUInt16 :
+    case GenericType::RealInt32 :
+    case GenericType::RealUInt32 :
+    case GenericType::RealInt64 :
+    case GenericType::RealUInt64 :
         *_piType = sci_ints;
         break;
         //case GenericType::RealHandle :
@@ -308,7 +314,7 @@ int isVarComplex(void* _pvCtx, int* _piAddress)
   iComplex = ((types::InternalType*)(_piAddress))->getAsDouble()->isComplex();
   break;
   case sci_poly :
-  iComplex = ((types::InternalType*)_piAddress)->getAsPoly()->isComplex();
+  iComplex = ((types::InternalType*)_piAddress)->getAs<types::Polynom>()->isComplex();
   case sci_sparse :
   //iComplex = ((InternalType*)_piAddress)->getAsSparse()->isComplex();
   break;
index d20a027..fcec192 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 
 #include "function.hxx"
-#include "double.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -97,12 +97,12 @@ SciErr getCommonMatrixOfDouble(void* _pvCtx, int* _piAddress, int _iComplex, int
 
     if(_pdblReal != NULL)
        {
-               *_pdblReal      = ((InternalType*)_piAddress)->getAsDouble()->real_get();
+               *_pdblReal      = ((InternalType*)_piAddress)->getAs<Double>()->getReal();
        }
 
        if(_iComplex && _pdblImg != NULL)
        {
-               *_pdblImg               = ((InternalType*)_piAddress)->getAsDouble()->img_get();
+               *_pdblImg               = ((InternalType*)_piAddress)->getAs<Double>()->getImg();
        }
     return sciErr;
 }
@@ -167,7 +167,7 @@ SciErr allocCommonMatrixOfDouble(void* _pvCtx, int _iVar, int _iComplex, int _iR
 
     int rhs = _iVar - api_Rhs((int*)_pvCtx);
     out[rhs - 1] = pDbl;
-    *_pdblReal = pDbl->real_get();
+    *_pdblReal = pDbl->getReal();
     if(*_pdblReal == NULL)
     {
         addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocated variable"), _iComplex ? "allocComplexMatrixOfDouble" : "allocexMatrixOfDouble");
@@ -176,7 +176,7 @@ SciErr allocCommonMatrixOfDouble(void* _pvCtx, int _iVar, int _iComplex, int _iR
 
     if(_iComplex && _pdblImg != NULL)
     {
-        *_pdblImg      = pDbl->img_get();
+        *_pdblImg      = pDbl->getImg();
         if(*_pdblImg == NULL)
         {
             addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocated variable"), _iComplex ? "allocComplexMatrixOfDouble" : "allocexMatrixOfDouble");
index f4ac8e5..2707472 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include "function.hxx"
-#include "int.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -46,7 +46,33 @@ SciErr getMatrixOfIntegerPrecision(void* _pvCtx, int* _piAddress, int* _piPrecis
                return sciErr;
        }
 
-       *_piPrecision = ((InternalType*)_piAddress)->getAsInt()->getIntType();
+    switch(((InternalType*)_piAddress)->getType())
+    {
+    case GenericType::RealInt8 :
+        *_piPrecision = SCI_INT8;
+        break;
+    case GenericType::RealUInt8 :
+        *_piPrecision = SCI_UINT8;
+        break;
+    case GenericType::RealInt16 :
+        *_piPrecision = SCI_INT16;
+        break;
+    case GenericType::RealUInt16 :
+        *_piPrecision = SCI_UINT16;
+        break;
+    case GenericType::RealInt32 :
+        *_piPrecision = SCI_INT32;
+        break;
+    case GenericType::RealUInt32 :
+        *_piPrecision = SCI_UINT32;
+        break;
+    case GenericType::RealInt64 :
+        *_piPrecision = SCI_INT64;
+        break;
+    case GenericType::RealUInt64 :
+        *_piPrecision = SCI_UINT64;
+        break;
+    }
        return sciErr;
 }
 
@@ -125,7 +151,33 @@ SciErr getCommonMatrixOfInteger(void* _pvCtx, int* _piAddress, int _iPrecision,
                return sciErr;
        }
 
-       *_piData        = (void*)((InternalType*)_piAddress)->getAsInt()->data_get();
+    switch(((InternalType*)_piAddress)->getType())
+    {
+    case GenericType::RealInt8 :
+        *_piData       = (void*)((InternalType*)_piAddress)->getAs<types::Int8>()->get();
+        break;
+    case GenericType::RealUInt8 :
+        *_piData       = (void*)((InternalType*)_piAddress)->getAs<types::UInt8>()->get();
+        break;
+    case GenericType::RealInt16 :
+        *_piData       = (void*)((InternalType*)_piAddress)->getAs<types::Int16>()->get();
+        break;
+    case GenericType::RealUInt16 :
+        *_piData       = (void*)((InternalType*)_piAddress)->getAs<types::UInt16>()->get();
+        break;
+    case GenericType::RealInt32 :
+        *_piData       = (void*)((InternalType*)_piAddress)->getAs<types::Int32>()->get();
+        break;
+    case GenericType::RealUInt32 :
+        *_piData       = (void*)((InternalType*)_piAddress)->getAs<types::UInt32>()->get();
+        break;
+    case GenericType::RealInt64 :
+        *_piData       = (void*)((InternalType*)_piAddress)->getAs<types::Int64>()->get();
+        break;
+    case GenericType::RealUInt64 :
+        *_piData       = (void*)((InternalType*)_piAddress)->getAs<types::UInt64>()->get();
+        break;
+    }
        return sciErr;
 }
 
@@ -435,29 +487,55 @@ SciErr allocMatrixOfUnsignedInteger64(void* _pvCtx, int _iVar, int _iRows, int _
 
 SciErr allocCommonMatrixOfInteger(void* _pvCtx, int _iVar, int *_piAddress, int _iPrecision, int _iRows, int _iCols, void** _pvData)
 {
-       SciErr sciErr; sciErr.iErr = 0; sciErr.iMsgCount = 0;
-
-       if(_pvCtx == NULL)
-       {
-               addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "allocMatrixOfInteger");
-               return sciErr;
-       }
-
-       GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
-  InternalType** out = pStr->m_pOut;
-
-       Int *pI = Int::createInt(_iRows, _iCols, (Int::IntType)_iPrecision);
-       if(pI == NULL)
-       {
-               addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocated variable"), "allocMatrixOfInteger");
-               return sciErr;
-       }
-
-       int rhs = _iVar - api_Rhs((int*)_pvCtx);
-       out[rhs - 1] = pI;
+    SciErr sciErr; sciErr.iErr = 0; sciErr.iMsgCount = 0;
 
-       *_pvData = (void*)pI->data_get();
-       return sciErr;
+    if(_pvCtx == NULL)
+    {
+        addErrorMessage(&sciErr, API_ERROR_INVALID_POINTER, _("%s: Invalid argument address"), "allocMatrixOfInteger");
+        return sciErr;
+    }
+
+    GatewayStruct* pStr = (GatewayStruct*)_pvCtx;
+    InternalType** out = pStr->m_pOut;
+
+    InternalType *pIT;
+    switch(_iPrecision)
+    {
+    case SCI_INT8 :
+        pIT = new Int8(_iRows, _iCols, (char**)_pvData);
+        break;
+    case SCI_UINT8 :
+        pIT = new UInt8(_iRows, _iCols, (unsigned char**)_pvData);
+        break;
+    case SCI_INT16 :
+        pIT = new Int16(_iRows, _iCols, (short**)_pvData);
+        break;
+    case SCI_UINT16 :
+        pIT = new UInt16(_iRows, _iCols, (unsigned short**)_pvData);
+        break;
+    case SCI_INT32 :
+        pIT = new Int32(_iRows, _iCols, (int**)_pvData);
+        break;
+    case SCI_UINT32 :
+        pIT = new UInt32(_iRows, _iCols, (unsigned int**)_pvData);
+        break;
+    case SCI_INT64 :
+        pIT = new Int64(_iRows, _iCols, (long long**)_pvData);
+        break;
+    case SCI_UINT64 :
+        pIT = new UInt64(_iRows, _iCols, (unsigned long long**)_pvData);
+        break;
+    }
+
+    if(pIT == NULL)
+    {
+        addErrorMessage(&sciErr, API_ERROR_NO_MORE_MEMORY, _("%s: No more memory to allocated variable"), "allocMatrixOfInteger");
+        return sciErr;
+    }
+
+    int rhs = _iVar - api_Rhs((int*)_pvCtx);
+    out[rhs - 1] = pIT;
+    return sciErr;
 }
 
 SciErr fillCommonMatrixOfInteger(void* _pvCtx, int* _piAddress, int _iPrecision, int _iRows, int _iCols, void** _pvData)
index 62d1ee1..2dc870d 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 #include "function.hxx"
-#include "matrixpoly.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -51,11 +51,11 @@ SciErr getPolyVariableName(void* _pvCtx, int* _piAddress, char* _pstVarName, int
 
     if(_pstVarName == NULL || *_piVarNameLen == 0)
     {
-        *_piVarNameLen = (int)((InternalType*)_piAddress)->getAsPoly()->var_get().size();
+        *_piVarNameLen = (int)((InternalType*)_piAddress)->getAs<types::Polynom>()->getVariableName().size();
         return sciErr; //No error
     }
 
-    char* pstTemp = wide_string_to_UTF8(((InternalType*)_piAddress)->getAsPoly()->var_get().c_str());
+    char* pstTemp = wide_string_to_UTF8(((InternalType*)_piAddress)->getAs<types::Polynom>()->getVariableName().c_str());
     strcpy(_pstVarName, pstTemp);
     FREE(pstTemp);
     return sciErr;
@@ -119,8 +119,8 @@ SciErr getCommonMatrixOfPoly(void* _pvCtx, int* _piAddress, int _iComplex, int*
         return sciErr;
     }
 
-    MatrixPoly *pMP = ((InternalType*)_piAddress)->getAsPoly();
-    pMP->rank_get(_piNbCoef);
+    Polynom *pMP = ((InternalType*)_piAddress)->getAs<types::Polynom>();
+    pMP->getRank(_piNbCoef);
 
     if(_pdblReal == NULL)
     {
@@ -129,14 +129,14 @@ SciErr getCommonMatrixOfPoly(void* _pvCtx, int* _piAddress, int _iComplex, int*
 
     for(int i = 0 ; i < iSize ; i++)
     {
-        memcpy(_pdblReal[i], pMP->poly_get(i)->coef_real_get(), sizeof(double) * pMP->poly_get(i)->rank_get());
+        memcpy(_pdblReal[i], pMP->get(i)->getCoefReal(), sizeof(double) * pMP->get(i)->getRank());
     }
 
     if(_iComplex == 1)
     {
         for(int i = 0 ; i < iSize ; i++)
         {
-            memcpy(_pdblImg[i], pMP->poly_get(i)->coef_img_get(), sizeof(double) * _piNbCoef[i]);
+            memcpy(_pdblImg[i], pMP->get(i)->getCoefImg(), sizeof(double) * _piNbCoef[i]);
         }
     }
     return sciErr;
@@ -165,7 +165,7 @@ SciErr createCommonMatrixOfPoly(void* _pvCtx, int _iVar, int _iComplex, char* _p
     InternalType** out = pStr->m_pOut;
 
     wchar_t* pstTemp = to_wide_string(_pstVarName);
-    MatrixPoly* pP = new MatrixPoly(pstTemp, _iRows, _iCols, _piNbCoef);
+    Polynom* pP = new Polynom(pstTemp, _iRows, _iCols, _piNbCoef);
     FREE(pstTemp);
     if(pP == NULL)
     {
@@ -175,21 +175,21 @@ SciErr createCommonMatrixOfPoly(void* _pvCtx, int _iVar, int _iComplex, char* _p
 
     if(_iComplex)
     {
-        pP->complex_set(true);
+        pP->setComplex(true);
     }
 
     int rhs = _iVar - api_Rhs((int*)_pvCtx);
     out[rhs - 1] = pP;
 
-    for(int i = 0 ; i < pP->size_get() ; i++)
+    for(int i = 0 ; i < pP->getSize() ; i++)
     {
         Double* pD = new Double(_piNbCoef[i], 1, _iComplex == 1);
-        pD->real_set(_pdblReal[i]);
+        pD->set(_pdblReal[i]);
         if(_iComplex)
         {
-            pD->img_set(_pdblImg[i]);
+            pD->setImg(_pdblImg[i]);
         }
-        pP->poly_set(i, pD);
+        pP->setCoef(i, pD);
     }
 
     return sciErr;
index 5beedc3..d3732de 100644 (file)
@@ -16,7 +16,7 @@
 
 /*--------------------------------------------------------------------------*/
 #include "function.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -79,12 +79,12 @@ SciErr getMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCo
                return sciErr;
        }
 
-       String *pS = ((InternalType*)_piAddress)->getAsString();
+       String *pS = ((InternalType*)_piAddress)->getAs<types::String>();
 
        //non cummulative length
        for(int i = 0 ; i < *_piRows * *_piCols ; i++)
        {
-               _piLength[i] = (int)wcslen(pS->string_get(i));
+               _piLength[i] = (int)wcslen(pS->get(i));
        }
 
        if(_pstStrings == NULL || *_pstStrings == NULL)
@@ -100,7 +100,7 @@ SciErr getMatrixOfString(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCo
                        return sciErr;
                }
 
-        char* pstTemp = wide_string_to_UTF8(pS->string_get(i));
+        char* pstTemp = wide_string_to_UTF8(pS->get(i));
                strcpy(_pstStrings[i], pstTemp);
         FREE(pstTemp);
        }
@@ -121,10 +121,10 @@ SciErr createMatrixOfString(void* _pvCtx, int _iVar, int _iRows, int _iCols, con
                return sciErr;
        }
 
-       for(int i = 0 ; i < pS->size_get() ; i++)
+       for(int i = 0 ; i < pS->getSize() ; i++)
        {
         wchar_t* pstTemp = to_wide_string(_pstStrings[i]);
-               pS->string_set(i, pstTemp);
+               pS->set(i, pstTemp);
         FREE(pstTemp);
        }
 
index 4e1f45b..55c2b13 100644 (file)
                        UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
                        >
                </Filter>
+               <File
+                       RelativePath="..\..\..\..\bin\blasplus.lib"
+                       >
+               </File>
+               <File
+                       RelativePath="..\..\..\..\bin\lapack.lib"
+                       >
+               </File>
        </Files>
        <Globals>
        </Globals>
index 6060eb5..ebfad49 100644 (file)
@@ -98,7 +98,7 @@ int iGetListItemType(int _iVar, int* _piParentList, int *_piItemNumber, int *_pE
 int* iGetListItemList(int _iVar, int* _piParentList, int iItemPos);
 /* Get Sparse Item */
 int iGetListItemSparse(int _iVar, int _iItemNumber, int *_piRows, int *_piCols, int* _piTotalElem, int* _piElemByRow, double **_pdblReal, double **_pdblImg);
-/* Get Poly Item */
+/* Get SinglePoly Item */
 int iGetListItemPoly(int _iVar, int _iItemNumber, int **_pVarName, int *_piRows, int *_piCols, int *_piPow, double **_pdblReal, double **_pdblImg);
 /* Get Double Item */
 int iGetListItemDouble(int _iVar, int _iItemNumber, int *_piRows, int *_piCols, double **_pdblReal, double **_pdblImg);
index 34aa965..8cf0b3c 100644 (file)
@@ -12,9 +12,7 @@
 
 #include "function.hxx"
 #include "context.hxx"
-#include "types.hxx"
-#include "double.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -44,21 +42,21 @@ types::Function::ReturnValue sci_argn(types::typed_list &in, int _iRetCount, typ
     //check input arguments types
     for(int i = 0 ; i < in.size() ; i++)
     {
-        if(in[i]->getType() != InternalType::RealDouble)
+        if(in[i]->isDouble() == false)
         {
             Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), "argn", i + 1);
             return Function::Error;
         }
         else
         {
-            if(in[i]->getAsDouble()->size_get() != 1)
+            if(in[i]->getAs<Double>()->getSize() != 1)
             {
                 Scierror(999,_("%s: Wrong type for input argument #%d: A scalar expected.\n"), "argn", i + 1);
                 return Function::Error;
             }
             else
             {
-                if(in[i]->getAsDouble()->isComplex())
+                if(in[i]->getAs<Double>()->isComplex())
                 {
                     Scierror(999, _("%s: Wrong type for input argument #%d: A real expected.\n"), "argn", i + 1);
                     return Function::Error;
@@ -80,7 +78,7 @@ types::Function::ReturnValue sci_argn(types::typed_list &in, int _iRetCount, typ
     {
         if(iRhs == 1)
         {
-            double dblVal = in[0]->getAsDouble()->real_get(0,0);
+            double dblVal = in[0]->getAs<Double>()->getReal(0,0);
             if(dblVal == 1)
             {
                 out.push_back(pOut);
index 09fe4b2..9c9dbbc 100644 (file)
@@ -13,7 +13,7 @@
 #include "function.hxx"
 #include "callable.hxx"
 #include "context.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -32,7 +32,7 @@ Function::ReturnValue sci_clear(types::typed_list &in, int _iRetCount, types::ty
     // First check if all arguments are Single Strings.
     for (inIterator = in.begin() ; inIterator != in.end() ; iWrongType++, inIterator++)
     {
-        if(!(*inIterator)->isString() || (*inIterator)->getAsString()->size_get() != 1)
+        if(!(*inIterator)->isString() || (*inIterator)->getAs<types::String>()->getSize() != 1)
         {
             Scierror(999,_("%s: Wrong type for input argument #%d: Single string expected.\n"), "clear", iWrongType);
             return Function::Error;
@@ -42,7 +42,7 @@ Function::ReturnValue sci_clear(types::typed_list &in, int _iRetCount, types::ty
 
     for (inIterator = in.begin() ; inIterator != in.end() ; iWrongType++, inIterator++)
     {
-        symbol::Context::getInstance()->remove((*inIterator)->getAsString()->string_get(0,0));
+        symbol::Context::getInstance()->remove((*inIterator)->getAs<types::String>()->get(0,0));
     }
 
     return Function::OK;
index 4874630..c4baf0d 100644 (file)
@@ -13,7 +13,7 @@
 #include "function.hxx"
 #include "callable.hxx"
 #include "context.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -38,7 +38,7 @@ Function::ReturnValue sci_clearglobal(types::typed_list &in, int _iRetCount, typ
         // First check if all arguments are Single Strings.
         for (inIterator = in.begin() ; inIterator != in.end() ; iWrongType++, inIterator++)
         {
-            if(!(*inIterator)->isString() || (*inIterator)->getAsString()->size_get() != 1)
+            if(!(*inIterator)->isString() || (*inIterator)->getAs<String>()->getSize() != 1)
             {
                 Scierror(999,_("%s: Wrong type for input argument #%d: Single string expected.\n"), "clearglobal", iWrongType);
                 return Function::Error;
@@ -48,7 +48,7 @@ Function::ReturnValue sci_clearglobal(types::typed_list &in, int _iRetCount, typ
 
         for (inIterator = in.begin() ; inIterator != in.end() ; iWrongType++, inIterator++)
         {
-            symbol::Context::getInstance()->removeGlobal((*inIterator)->getAsString()->string_get(0,0));
+            symbol::Context::getInstance()->removeGlobal((*inIterator)->getAs<String>()->get(0,0));
         }
     }
     return Function::OK;
index 9c58f19..de4556c 100644 (file)
@@ -12,8 +12,7 @@
 
 #include "types.hxx"
 #include "function.hxx"
-#include "double.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -51,9 +50,9 @@ Function::ReturnValue sci_error(types::typed_list &in, int _iRetCount, types::ty
 
         if(in[0]->isString() == true)
         {
-            if(in[0]->getAs<String>()->size_get() == 1)
+            if(in[0]->getAs<types::String>()->getSize() == 1)
             {
-                ScierrorW(DEFAULT_ERROR_CODE, in[0]->getAs<String>()->string_get(0));
+                ScierrorW(DEFAULT_ERROR_CODE, in[0]->getAs<types::String>()->get(0));
                 return Function::Error;
             }
             else
@@ -64,13 +63,13 @@ Function::ReturnValue sci_error(types::typed_list &in, int _iRetCount, types::ty
         }
         else
         {
-            if(in[0]->getAs<Double>()->size_get() != 1)
+            if(in[0]->getAs<Double>()->getSize() != 1)
             {
                 ScierrorW(999, _W("%ls: Wrong size for input argument #%d: A scalar expected.\n"), L"error", 1);
                 return Function::Error;
             }
 
-            if(in[0]->getAs<Double>()->real_get(0, 0) <= 0 || in[0]->getAs<Double>()->isComplex())
+            if(in[0]->getAs<Double>()->getReal(0, 0) <= 0 || in[0]->getAs<Double>()->isComplex())
             {
                 ScierrorW(999,_W("%ls: Wrong value for input argument #%d: Value greater than 0 expected.\n"), L"error", 1);
                 return Function::Error;
@@ -78,9 +77,9 @@ Function::ReturnValue sci_error(types::typed_list &in, int _iRetCount, types::ty
 
 
             // FIXME : Find a way to retrieve error message from given ID.
-            ScierrorW(in[0]->getAs<Double>()->real_get(0, 0),
+            ScierrorW((int)in[0]->getAs<Double>()->getReal(0, 0),
                       L"[Error %d]: message given by ID... Should avoid this !!",
-                      (int) in[0]->getAs<Double>()->real_get(0, 0));
+                      (int) in[0]->getAs<Double>()->getReal(0, 0));
             return Function::Error;
         }
 
@@ -100,26 +99,26 @@ Function::ReturnValue sci_error(types::typed_list &in, int _iRetCount, types::ty
             return Function::Error;
         }
 
-        if(in[0]->getAs<Double>()->size_get() != 1)
+        if(in[0]->getAs<Double>()->getSize() != 1)
         {
             ScierrorW(999, _W("%ls: Wrong size for input argument #%d: A scalar expected.\n"), L"error", 1);
             return Function::Error;
         }
 
-        if(in[1]->getAs<String>()->size_get() != 1)
+        if(in[1]->getAs<types::String>()->getSize() != 1)
         {
             ScierrorW(999, _W("%ls: Wrong size for input argument #%d: A scalar expected.\n"), L"error", 2);
             return Function::Error;
         }
 
-        if(in[0]->getAs<Double>()->real_get(0, 0) <= 0 || in[0]->getAs<Double>()->isComplex())
+        if(in[0]->getAs<Double>()->getReal(0, 0) <= 0 || in[0]->getAs<Double>()->isComplex())
         {
             ScierrorW(999,_W("%ls: Wrong value for input argument #%d: Value greater than 0 expected.\n"), L"error", 1);
             return Function::Error;
         }
 
-        ScierrorW(in[0]->getAs<Double>()->real_get(0, 0),
-                  in[1]->getAs<String>()->string_get(0));
+        ScierrorW((int)in[0]->getAs<Double>()->getReal(0, 0),
+                  in[1]->getAs<types::String>()->get(0));
         return Function::Error;
 
     }
index 620b990..32a1874 100644 (file)
 
 #include "function.hxx"
 #include "context.hxx"
-#include "types.hxx"
-#include "double.hxx"
-#include "string.hxx"
-#include "bool.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -62,13 +59,13 @@ static PrivateResult sci_existsOrIsdef(types::typed_list &in, const char *fname)
         return FunctionFailed;
     }
 
-    if (!in[0]->isString() || in[0]->getAsString()->size_get() != 1)
+    if (!in[0]->isString() || in[0]->getAs<types::String>()->getSize() != 1)
     {
         Scierror(999,_("%s: Wrong type for input argument #%d: A single string expected.\n"), fname, 1);
         return FunctionFailed;
     }
 
-    if (in.size() == 2 && (!in[1]->isString() || in[1]->getAsString()->size_get() != 1))
+    if (in.size() == 2 && (!in[1]->isString() || in[1]->getAs<types::String>()->getSize() != 1))
     {
         Scierror(999,_("%s: Wrong type for input argument #%d: A single string expected.\n"), fname, 2);
         return FunctionFailed;
@@ -77,7 +74,7 @@ static PrivateResult sci_existsOrIsdef(types::typed_list &in, const char *fname)
     const wchar_t *psScope = NULL;
     if (in.size() == 2)
     {
-        psScope = in[1]->getAsString()->string_get(0,0);
+        psScope = in[1]->getAs<types::String>()->get(0,0);
     }
     else
     {
@@ -90,13 +87,13 @@ static PrivateResult sci_existsOrIsdef(types::typed_list &in, const char *fname)
     switch (getScopeFromOption(psScope))
     {
     case All:
-        pitReturn = symbol::Context::getInstance()->get(in[0]->getAsString()->string_get(0,0));
+        pitReturn = symbol::Context::getInstance()->get(in[0]->getAs<types::String>()->get(0,0));
         break;
     case Local:
-        pitReturn = symbol::Context::getInstance()->getCurrentLevel(in[0]->getAsString()->string_get(0,0));
+        pitReturn = symbol::Context::getInstance()->getCurrentLevel(in[0]->getAs<types::String>()->get(0,0));
         break;
     case NoLocal:
-        pitReturn = symbol::Context::getInstance()->getAllButCurrentLevel(in[0]->getAsString()->string_get(0,0));
+        pitReturn = symbol::Context::getInstance()->getAllButCurrentLevel(in[0]->getAs<types::String>()->get(0,0));
         break;
     default :
         Scierror(36, _("%s: Wrong input argument %d.\n"), fname, 2);
index ee3d944..7754f2c 100644 (file)
@@ -12,8 +12,7 @@
 
 #include "function.hxx"
 #include "configvariable.hxx"
-#include "types.hxx"
-#include "double.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -44,14 +43,14 @@ types::Function::ReturnValue sci_exit(types::typed_list &in, int _iRetCount, typ
         return types::Function::Error;
     }
     
-    if (in.front()->getAsDouble()->size_get() != 1)
+    if (in.front()->getAs<types::Double>()->getSize() != 1)
     {
         Scierror(999,_("%s: Wrong size for input argument #%d: A scalar expected.\n"), "exit", 1);
         return types::Function::Error;
     }
     
-    double dExit = in.front()->getAsDouble()->real_get(0,0);
-    int iExit = (int) in.front()->getAsDouble()->real_get(0,0);
+    double dExit = in.front()->getAs<types::Double>()->getReal(0,0);
+    int iExit = (int) in.front()->getAs<types::Double>()->getReal(0,0);
 
     if (dExit != (double) iExit)
     {
index b306c92..7d3b711 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "types.hxx"
 #include "function.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -56,7 +56,7 @@ Function::ReturnValue sci_getmd5(types::typed_list &in, int _iRetCount, types::t
 
     if(in.size() == 2)
     {
-        if(wcscmp(in[1]->getAs<String>()->string_get(0), L"string") == 0)
+        if(wcscmp(in[1]->getAs<types::String>()->get(0), L"string") == 0)
         {
             bStringMode = true;
         }
@@ -67,12 +67,12 @@ Function::ReturnValue sci_getmd5(types::typed_list &in, int _iRetCount, types::t
         }
     }
 
-    String *pIn = in[0]->getAs<String>();
-    String *pOutput = new String(in[0]->getAs<String>()->rows_get(), in[0]->getAs<String>()->cols_get());
+    String *pIn = in[0]->getAs<types::String>();
+    String *pOutput = new String(in[0]->getAs<types::String>()->getRows(), in[0]->getAs<types::String>()->getCols());
 
-    for(int i = 0 ; i < in[0]->getAs<String>()->size_get() ; ++i)
+    for(int i = 0 ; i < in[0]->getAs<types::String>()->getSize() ; ++i)
     {
-        wchar_t *wcsCurrentIn = pIn->string_get(i);
+        wchar_t *wcsCurrentIn = pIn->get(i);
         wchar_t *pstMD5 = NULL;
 
         if(bStringMode)
@@ -112,7 +112,7 @@ Function::ReturnValue sci_getmd5(types::typed_list &in, int _iRetCount, types::t
             }
         }
 
-        pOutput->string_set(i, pstMD5);
+        pOutput->set(i, pstMD5);
 
     }
 
index 741aa8a..bbdf0a2 100644 (file)
@@ -14,7 +14,7 @@
 #include "funcmanager.hxx"
 #include "context.hxx"
 #include "configvariable.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 using namespace types;
 
@@ -32,7 +32,7 @@ Function::ReturnValue sci_getmodules(types::typed_list &in, int _iRetCount, type
     list<wstring>::iterator it = sModuleList.begin();
     for(int i = 0; it != sModuleList.end() ; it++,i++)
     {
-        pOut->string_set(i, it->c_str());
+        pOut->set(i, it->c_str());
     }
 
     out.push_back(pOut);
index 189d56b..79f4635 100644 (file)
@@ -11,9 +11,7 @@
  */
 #include "function.hxx"
 #include "context.hxx"
-#include "types.hxx"
-#include "double.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
index f5f8e00..e801557 100644 (file)
@@ -12,7 +12,7 @@
 #include "funcmanager.hxx"
 #include "context.hxx"
 #include "core_gw.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
index a53abbc..3318359 100644 (file)
@@ -14,7 +14,7 @@
 /*--------------------------------------------------------------------------*/
 #include "funcmanager.hxx"
 #include "core_gw.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -59,7 +59,7 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
             int iOption = 0;
             wchar_t** pwstOption = getScilabVersionOptions(&iOption);
             String* pOut2 = new String(1, iOption);
-            pOut2->string_set(pwstOption);
+            pOut2->set(pwstOption);
             out.push_back(pOut2);
             FREE(pwstOption);
         }
@@ -67,7 +67,7 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
     }
     else if(in.size() == 1)
     {
-        if(in[0]->isString() == false || in[0]->getAsString()->size_get() != 1)
+        if(in[0]->isString() == false || in[0]->getAs<types::String>()->getSize() != 1)
         {
             ScierrorW(999, _W("%ls: Wrong size for input argument #%d: String expected.\n"), L"getversion", 1);
             return Function::Error;
@@ -79,7 +79,7 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
             return Function::Error;
        }
 
-        wchar_t* pwstModule = in[0]->getAsString()->string_get()[0];
+        wchar_t* pwstModule = in[0]->getAs<types::String>()->get()[0];
         if(with_module(pwstModule) || (wcscmp(pwstModule, L"scilab") == 0))
         {
             int versionSize = 0;
@@ -91,27 +91,27 @@ Function::ReturnValue sci_getversion(types::typed_list &in, int _iRetCount, type
             }
 
             Double* pOut = new Double(1, versionSize);
-            pOut->real_set(version);
+            pOut->setInt(version);
             out.push_back(pOut);
             FREE(version);
         }
     }
     else //in.size() == 2
     {
-        if(in[0]->isString() == false || in[0]->getAsString()->size_get() != 1)
+        if(in[0]->isString() == false || in[0]->getAs<types::String>()->getSize() != 1)
         {
             ScierrorW(999, _W("%ls: Wrong size for input argument #%d: String expected.\n"), L"getversion", 1);
             return Function::Error;
         }
 
-        if(in[1]->isString() == false || in[1]->getAsString()->size_get() != 1)
+        if(in[1]->isString() == false || in[1]->getAs<types::String>()->getSize() != 1)
         {
             ScierrorW(999, _W("%ls: Wrong size for input argument #%d: String expected.\n"), L"getversion", 2);
             return Function::Error;
         }
 
-        wchar_t* pwstModule = in[0]->getAsString()->string_get()[0];
-        wchar_t* pwstOption = in[1]->getAsString()->string_get()[0];
+        wchar_t* pwstModule = in[0]->getAs<types::String>()->get()[0];
+        wchar_t* pwstOption = in[1]->getAs<types::String>()->get()[0];
 
         if( with_module(pwstModule) || (wcscmp(pwstModule, L"scilab") == 0) )
         {
index 2cb258a..69512dd 100644 (file)
@@ -12,9 +12,7 @@
 
 #include "function.hxx"
 #include "context.hxx"
-#include "types.hxx"
-#include "double.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 #include "core_gw.hxx"
 
 extern "C"
@@ -30,13 +28,13 @@ types::Function::ReturnValue sci_global(types::typed_list &in, int _iRetCount, t
     //check input arguments
     for(int i = 0 ; i < in.size() ; i++)
     {
-        if(in[i]->getType() != InternalType::RealString)
+        if(in[i]->isString() == false)
         {
             Scierror(999,_("%s: Wrong type for input argument #%d: String expected.\n"), "global", i + 1);
             return Function::Error;
         }
 
-        if(in[i]->getAsString()->size_get() != 1)
+        if(in[i]->getAs<types::String>()->getSize() != 1)
         {
             Scierror(999, _("%s: Wrong type for input argument #%d: Single string expected.\n"), "global", i + 1);
             return Function::Error;
@@ -54,7 +52,7 @@ types::Function::ReturnValue sci_global(types::typed_list &in, int _iRetCount, t
 
     for(int i = 0 ; i < in.size() ; i++)
     {
-        wchar_t* pstVar = in[i]->getAsString()->string_get(0);
+        wchar_t* pstVar = in[i]->getAs<types::String>()->get(0);
 
         //does it visible in current global scope
         if(pCtx->isGlobalVisible(pstVar) == false)
index c2e7956..0a70a2d 100644 (file)
@@ -13,7 +13,7 @@
 #include "function.hxx"
 #include "callable.hxx"
 #include "context.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -35,20 +35,20 @@ Function::ReturnValue sci_isglobal(types::typed_list &in, int _iRetCount, types:
     }
     else
     {
-        if(in[0]->getType() != InternalType::RealString)
+        if(in[0]->isString() == false)
         {
             Scierror(999,_("%s: Wrong type for input argument #%d: Single string expected.\n"), "isglobal", 1);
             return Function::Error;
         }
 
-        String* pS = in[0]->getAsString();
-        if(pS->size_get() != 1)
+        String* pS = in[0]->getAs<types::String>();
+        if(pS->getSize() != 1)
         {
             Scierror(999,_("%s: Wrong type for input argument #%d: Single string expected.\n"), "isglobal", 1);
             return Function::Error;
         }
 
-        if(symbol::Context::getInstance()->isGlobalExists(pS->string_get(0)))
+        if(symbol::Context::getInstance()->isGlobalExists(pS->get(0)))
         {
             out.push_back(new Bool(1));
         }
index bb7a375..4ad9064 100644 (file)
@@ -11,9 +11,7 @@
  */
 #include "function.hxx"
 #include "context.hxx"
-#include "types.hxx"
-#include "double.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 #include "configvariable.hxx"
 
 extern "C"
@@ -42,12 +40,12 @@ types::Function::ReturnValue sci_lasterror(types::typed_list &in, int _iRetCount
 
     if(in.size() == 1)
     {
-        if(in[0]->isBool() == false || in[0]->getAsBool()->size_get() != 1)
+        if(in[0]->isBool() == false || in[0]->getAs<types::Bool>()->getSize() != 1)
         {
             ScierrorW(999, _W("%ls: Wrong type for input argument #%d: Boolean vector expected.\n"), L"lasterror", 1);
             return Function::Error;
         }
-        bClearError = in[0]->getAsBool()->bool_get()[0] == 1; //convert int to bool
+        bClearError = in[0]->getAs<types::Bool>()->get()[0] == 1; //convert int to bool
     }
 
     String* pErrorMessage = new String(ConfigVariable::getLastErrorMessage().c_str());
index c4e474b..287bf0f 100644 (file)
@@ -10,7 +10,7 @@
  *
  */
 #include "function.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 
 extern "C"
 {
@@ -45,24 +45,24 @@ types::Function::ReturnValue sci_warning(types::typed_list &in, int _iRetCount,
         return Function::Error;
     }
 
-    String *psInput = in[0]->getAs<String>();
+    String *psInput = in[0]->getAs<types::String>();
 
-    if (psInput->size_get() == 1)
+    if (psInput->getSize() == 1)
     {
         /* "on" "off" "query" */
-        if(wcscmp(psInput->string_get(0), L"on") == 0)
+        if(wcscmp(psInput->get(0), L"on") == 0)
         {
             setWarningMode(TRUE);
             return Function::OK;
         }
 
-        if(wcscmp(psInput->string_get(0), L"off") == 0)
+        if(wcscmp(psInput->get(0), L"off") == 0)
         {
             setWarningMode(FALSE);
             return Function::OK;
         }
 
-        if(wcscmp(psInput->string_get(0), L"query") == 0)
+        if(wcscmp(psInput->get(0), L"query") == 0)
         {
             if(getWarningMode())
             {
@@ -78,9 +78,9 @@ types::Function::ReturnValue sci_warning(types::typed_list &in, int _iRetCount,
 
     if (getWarningMode())
     {
-        for(int i = 0; i < psInput->size_get() ; ++i)
+        for(int i = 0; i < psInput->getSize() ; ++i)
         {
-            sciprintW(_W("WARNING: %ls\n"), psInput->string_get(i));
+            sciprintW(_W("WARNING: %ls\n"), psInput->get(i));
         }
         sciprintW(L"\n");
     }
index 41c63ec..83d463b 100644 (file)
@@ -13,8 +13,7 @@
 #include "core_gw.hxx"
 #include "funcmanager.hxx"
 #include "function.hxx"
-#include "bool.hxx"
-#include "string.hxx"
+#include "arrayof.hxx"
 #include "configvariable.hxx"
 
 
@@ -33,13 +32,13 @@ types::Function::ReturnValue sci_with_module(types::typed_list &in, int _iRetCou
         return types::Function::Error;
     }
 
-    if(in[0]->isString() == false || in[0]->getAsString()->size_get() != 1)
+    if(in[0]->isString() == false || in[0]->getAs<types::String>()->getSize() != 1)
     {
                ScierrorW(999, _W("%ls: Wrong type for input argument #%d: String expected.\n"), L"with_module", 1);
         return types::Function::Error;
     }
 
-    wchar_t* pwstModuleName = in[0]->getAsString()->string_get(0);
+    wchar_t* pwstModuleName = in[0]->getAs<types::String>()->get(0);
 
     types::Bool* pOut = new types::Bool(0);
     list<wstring> sModuleList = ConfigVariable::getModuleList();
@@ -48,7 +47,7 @@ types::Function::ReturnValue sci_with_module(types::typed_list &in, int _iRetCou
     {
         if(*it == pwstModuleName)
         {
-            pOut->bool_get()[0] = 1;
+            pOut->get()[0] = 1;
             break;
         }
     }
index cea0629..aebe0e0 100644 (file)
@@ -85,9 +85,7 @@ extern "C"
 
 #include "banner.hxx"
 
-#include "double.hxx"
-#include "string.hxx"
-#include "matrixpoly.hxx"
+#include "arrayof.hxx"
 
 #define INTERACTIVE     -1
 
@@ -615,8 +613,8 @@ void Add_i(void)
 void Add_s(void)
 {
     Double dblCoef(1,2);
-    dblCoef.val_set(0, 0, 0);
-    dblCoef.val_set(0, 1, 1);
+    dblCoef.set(0, 0, 0);
+    dblCoef.set(0, 1, 1);
 
     Add_Poly_Constant(L"%s",L"s", 2, &dblCoef);
 }
@@ -624,24 +622,25 @@ void Add_s(void)
 void Add_z(void)
 {
     Double dblCoef(1,2);
-    dblCoef.val_set(0, 0, 0);
-    dblCoef.val_set(0, 1, 1);
+    dblCoef.set(0, 0, 0);
+    dblCoef.set(0, 1, 1);
 
     Add_Poly_Constant(L"%z",L"z", 2, &dblCoef);
 }
 
 void Add_Poly_Constant(wstring _szName, wstring _szPolyVar, int _iRank, Double *_pdbl)
 {
-    types::MatrixPoly *pVar = new types::MatrixPoly(_szPolyVar, 1, 1, &_iRank);
-    Poly *poPoly = pVar->poly_get(0,0);
-    poPoly->coef_set(_pdbl);
+    types::Polynom *pVar = new types::Polynom(_szPolyVar, 1, 1, &_iRank);
+    SinglePoly *poPoly = pVar->get(0,0);
+    poPoly->setCoef(_pdbl);
     Context::getInstance()->put(_szName, *pVar);
 }
 
 void Add_Double_Constant(wstring _szName, double _dblReal, double _dblImg, bool _bComplex)
 {
     types::Double* pVal = new types::Double(1,1,_bComplex);
-    pVal->val_set(0,0,_dblReal,_dblImg);
+    pVal->set(0, 0, _dblReal);
+    pVal->setImg(0, 0, _dblImg);
     symbol::Context::getInstance()->put(_szName, *pVal);
 }
 
index c67eb88..da84504 100644 (file)
@@ -311,8 +311,6 @@ sci_gateway/c/sci_sin.c \
 sci_gateway/c/sci_sqrt.c \
 sci_gateway/c/sci_asin.c \
 sci_gateway/c/sci_sign.c \
-sci_gateway/c/sci_zeros.c \
-sci_gateway/c/sci_ones.c \
 sci_gateway/c/sci_rat.c \
 sci_gateway/c/gw_elementary_functions.c \
 sci_gateway/c/sci_number_properties.c \
@@ -388,7 +386,9 @@ GATEWAY_CPP_SOURCES =  \
        sci_gateway/cpp/sci_isequal.cpp \
        sci_gateway/cpp/elem_func_gw.cpp \
        sci_gateway/cpp/sci_size.cpp \
-       sci_gateway/cpp/sci_eye.cpp
+       sci_gateway/cpp/sci_eye.cpp \
+    sci_gateway/cpp/sci_zeros.cpp \
+    sci_gateway/cpp/sci_ones.cpp
 
 
 EISPACK_SOURCES = src/fortran/eispack/balbak.f
index 2e19dc4..a5178a3 100644 (file)
@@ -428,8 +428,6 @@ am__objects_6 = libscielementary_functions_la-sci_matrix.lo \
        libscielementary_functions_la-sci_sqrt.lo \
        libscielementary_functions_la-sci_asin.lo \
        libscielementary_functions_la-sci_sign.lo \
-       libscielementary_functions_la-sci_zeros.lo \
-       libscielementary_functions_la-sci_ones.lo \
        libscielementary_functions_la-sci_rat.lo \
        libscielementary_functions_la-gw_elementary_functions.lo \
        libscielementary_functions_la-sci_number_properties.lo \
@@ -458,7 +456,9 @@ am__objects_6 = libscielementary_functions_la-sci_matrix.lo \
 am__objects_7 = libscielementary_functions_la-sci_isequal.lo \
        libscielementary_functions_la-elem_func_gw.lo \
        libscielementary_functions_la-sci_size.lo \
-       libscielementary_functions_la-sci_eye.lo
+       libscielementary_functions_la-sci_eye.lo \
+       libscielementary_functions_la-sci_zeros.lo \
+       libscielementary_functions_la-sci_ones.lo
 am__objects_8 = libscielementary_functions_la-sci_f_isequal.lo \
        libscielementary_functions_la-sci_f_maxi.lo \
        libscielementary_functions_la-sci_f_testmatrix.lo \
@@ -1110,8 +1110,6 @@ sci_gateway/c/sci_sin.c \
 sci_gateway/c/sci_sqrt.c \
 sci_gateway/c/sci_asin.c \
 sci_gateway/c/sci_sign.c \
-sci_gateway/c/sci_zeros.c \
-sci_gateway/c/sci_ones.c \
 sci_gateway/c/sci_rat.c \
 sci_gateway/c/gw_elementary_functions.c \
 sci_gateway/c/sci_number_properties.c \
@@ -1187,7 +1185,9 @@ GATEWAY_CPP_SOURCES = \
        sci_gateway/cpp/sci_isequal.cpp \
        sci_gateway/cpp/elem_func_gw.cpp \
        sci_gateway/cpp/sci_size.cpp \
-       sci_gateway/cpp/sci_eye.cpp
+       sci_gateway/cpp/sci_eye.cpp \
+    sci_gateway/cpp/sci_zeros.cpp \
+    sci_gateway/cpp/sci_ones.cpp
 
 EISPACK_SOURCES = src/fortran/eispack/balbak.f
 
@@ -2000,20 +2000,6 @@ libscielementary_functions_la-sci_sign.lo: sci_gateway/c/sci_sign.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(libscielementary_functions_la_CFLAGS) $(CFLAGS) -c -o libscielementary_functions_la-sci_sign.lo `test -f 'sci_gateway/c/sci_sign.c' || echo '$(srcdir)/'`sci_gateway/c/sci_sign.c
 
-libscielementary_functions_la-sci_zeros.lo: sci_gateway/c/sci_zeros.c
-@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscielementary_functions_la_CPPFLAGS) $(CPPFLAGS) $(libscielementary_functions_la_CFLAGS) $(CFLAGS) -MT libscielementary_functions_la-sci_zeros.lo -MD -MP -MF $(DEPDIR)/libscielementary_functions_la-sci_zeros.Tpo -c -o libscielementary_functions_la-sci_zeros.lo `test -f 'sci_gateway/c/sci_zeros.c' || echo '$(srcdir)/'`sci_gateway/c/sci_zeros.c