add runvisitor hierarchy
antoine ELIAS [Fri, 26 Mar 2010 10:04:49 +0000 (11:04 +0100)]
26 files changed:
scilab/modules/abstractSyntaxTree/abstractSyntaxTree.vcproj
scilab/modules/abstractSyntaxTree/includes/ast.hxx
scilab/modules/abstractSyntaxTree/includes/conditionvisitor.hxx
scilab/modules/abstractSyntaxTree/includes/execvisitor.hxx
scilab/modules/abstractSyntaxTree/includes/runvisitor.hxx [new file with mode: 0644]
scilab/modules/abstractSyntaxTree/includes/shortcutvisitor.hxx
scilab/modules/abstractSyntaxTree/includes/timedvisitor.hxx
scilab/modules/abstractSyntaxTree/src/cpp/conditionvisitor.cpp
scilab/modules/abstractSyntaxTree/src/cpp/execvisitor.cpp [new file with mode: 0644]
scilab/modules/abstractSyntaxTree/src/cpp/run/run_AssignExp.cpp [moved from scilab/modules/abstractSyntaxTree/src/cpp/exec/exec_AssignExp.cpp with 96% similarity]
scilab/modules/abstractSyntaxTree/src/cpp/run/run_MatrixExp.cpp [moved from scilab/modules/abstractSyntaxTree/src/cpp/exec/exec_MatrixExp.cpp with 97% similarity]
scilab/modules/abstractSyntaxTree/src/cpp/run/run_OpExp.cpp [moved from scilab/modules/abstractSyntaxTree/src/cpp/exec/exec_OpExp.cpp with 98% similarity]
scilab/modules/abstractSyntaxTree/src/cpp/run/runvisitor.cpp [moved from scilab/modules/abstractSyntaxTree/src/cpp/exec/execvisitor.cpp with 81% similarity]
scilab/modules/abstractSyntaxTree/src/cpp/shortcutvisitor.cpp
scilab/modules/abstractSyntaxTree/src/cpp/timedvisitor.cpp
scilab/modules/core/includes/tasks.hxx
scilab/modules/core/includes/timer.hxx
scilab/modules/core/src/cpp/scilab.cpp
scilab/modules/core/src/cpp/tasks.cpp
scilab/modules/types/includes/callable.hxx
scilab/modules/types/includes/function.hxx
scilab/modules/types/includes/macro.hxx
scilab/modules/types/includes/macrofile.hxx
scilab/modules/types/src/cpp/function.cpp
scilab/modules/types/src/cpp/macro.cpp
scilab/modules/types/src/cpp/macrofile.cpp

index 822b5d3..81efb91 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\src\cpp\execvisitor.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\src\cpp\libAst.cpp"
                                >
                        </File>
                                >
                        </File>
                        <Filter
-                               Name="exec"
+                               Name="run"
                                >
                                <File
-                                       RelativePath=".\src\cpp\exec\exec_AssignExp.cpp"
+                                       RelativePath=".\src\cpp\run\run_AssignExp.cpp"
                                        >
                                </File>
                                <File
-                                       RelativePath=".\src\cpp\exec\exec_MatrixExp.cpp"
+                                       RelativePath=".\src\cpp\run\run_MatrixExp.cpp"
                                        >
                                </File>
                                <File
-                                       RelativePath=".\src\cpp\exec\exec_OpExp.cpp"
+                                       RelativePath=".\src\cpp\run\run_OpExp.cpp"
                                        >
                                </File>
                                <File
-                                       RelativePath=".\src\cpp\exec\execvisitor.cpp"
+                                       RelativePath=".\src\cpp\run\runvisitor.cpp"
                                        >
                                </File>
                        </Filter>
                                >
                        </File>
                        <File
+                               RelativePath=".\includes\runvisitor.hxx"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\includes\selectexp.hxx"
                                >
                        </File>
index 129f317..44b9035 100644 (file)
@@ -20,7 +20,7 @@
 
 # include "location.hxx"
 # include "visitor.hxx"
-
+#include "timer.hxx"
 
 #ifdef _MSC_VER
        #if AST_EXPORTS
@@ -82,6 +82,8 @@ namespace ast
     virtual void accept (Visitor& v) = 0;
     /** \} */
 
+               Timer& timer_get(){return _timer;}
+
   private:
     /** \brief Construct an Ast by copy. */
     Ast (const Ast&);
@@ -89,6 +91,7 @@ namespace ast
     Ast& operator= (const Ast&);
 
     /** \brief Scanner position informations. */
+               Timer _timer;
     Location _location;
   };
 
index a1a4778..4287f94 100644 (file)
 #include <iostream>
 #include <sstream>
 
-#include "execvisitor.hxx"
-#include "visitor.hxx"
 #include "allexp.hxx"
 #include "allvar.hxx"
 #include "alldec.hxx"
 #include "alltypes.hxx"
+#include "execvisitor.hxx"
 
 namespace ast
 {
index 9c0c0b6..db35711 100644 (file)
 #include <iostream>
 #include <sstream>
 
-#include "visitor.hxx"
 #include "allexp.hxx"
 #include "allvar.hxx"
 #include "alldec.hxx"
 #include "alltypes.hxx"
-#include "context.hxx"
+#include "runvisitor.hxx"
 
 using namespace types;
 
-int GetIndexList(std::list<ast::Exp *>const& _plstArg, int** _piIndexSeq, int** _piMaxDim, InternalType *_pRefVar, int *_iDimSize);
 void ExpandList(int ** _piList, int *_piListSize, int _iListSizeSize, int *_piResultList);
 int GetVarMaxDim(types::InternalType *_pIT, int _iCurrentDim, int _iMaxDim);
 
 namespace ast
 {
-       class EXTERN_AST ExecVisitor : public GenVisitor<const_kind>
+       class EXTERN_AST ExecVisitor : public RunVisitorT<ExecVisitor>
        {
-       public:
-               ExecVisitor()
-               {
-                       _excepted_result = -1;
-                       _resultVect.push_back(NULL);
-                       _result = NULL;
-                       m_bSingleResult = true;
-               }
-
-               ~ExecVisitor()
-               {
-                       result_clear();
-               }
-
-               void result_clear()
-               {
-                       if(is_single_result())
-                       {
-                               if(_result != NULL && _result->isDeletable() == true)
-                               {
-//                                     std::cout << "before single delete : " << _result << std::endl;
-                                       delete _result;
-//                                     std::cout << "after single delete" << std::endl;
-                               }
-                       }
-                       else
-                       {
-                               for(int i = 0 ; i < _resultVect.size() ; i++)
-                               {
-                                       if(_resultVect[i] != NULL && _resultVect[i]->isDeletable() == true)
-                                       {
-                                               delete _resultVect[i];
-                                       }
-                               }
-                       }
-
-               }
-
                /** \name Visit Matrix Expressions nodes.
                ** \{ */
        public :
@@ -144,122 +104,6 @@ namespace ast
        public:
                virtual void visit(const ListExp &e);
                /** \} */
-
-
-
-               int expected_size_get(void)
-               {
-                       return _excepted_result;
-               }
-
-               int result_size_get(void)
-               {
-                       if(is_single_result())
-                       {
-                               if(_result == NULL)
-                               {
-                                       return 0;
-                               }
-                               else
-                               {
-                                       return 1;
-                               }
-                       }
-                       else
-                       {
-                               return (int)_resultVect.size();
-                       }
-               }
-
-               void expected_size_set(int _iSize)
-               {
-                       _excepted_result = _iSize;
-               }
-
-               InternalType* result_get(void)
-               {
-                       if(is_single_result())
-                       {
-                               return _result;
-                       }
-                       else
-                       {
-                               return _resultVect[0];
-                       }
-               }
-
-               types::InternalType* result_get(int _iPos)
-               {
-                       if(_iPos >= _resultVect.size())
-                       {
-                               return NULL;
-                       }
-                       return _resultVect[_iPos];
-               }
-
-               vector<types::InternalType*>* result_list_get()
-               {
-                       return &_resultVect;
-               }
-
-               void result_set(int _iPos, const types::InternalType *gtVal)
-               {
-                       m_bSingleResult = false;
-                       if(_iPos < _resultVect.size())
-                       {
-                               if(_resultVect[_iPos] != NULL && _resultVect[_iPos]->isDeletable())
-                               {
-                                       delete _resultVect[_iPos];
-                               }
-                       }
-
-                       if(_iPos >= _resultVect.size())
-                       {
-                               _resultVect.resize(_iPos + 1, NULL);
-                       }
-
-                       _resultVect[_iPos] = (InternalType *)gtVal;
-               }
-
-               void result_set(const InternalType *gtVal)
-               {
-                       m_bSingleResult = true;
-                       _result = const_cast<InternalType *>(gtVal);
-               }
-
-               bool is_single_result()
-               {
-                       return m_bSingleResult;
-               }
-
-
-               /*
-               int result_size_get(void);
-               int expected_size_get(void);
-               void expected_size_set(int _iSize);
-               types::InternalType*            result_get(void);
-               types::InternalType*            result_get(int _iPos);
-               vector<types::InternalType*>* result_list_get();
-               void    result_set(const types::InternalType *gtVal);
-               void    result_set(int _iPos, const types::InternalType *gtVal);
-               bool    is_single_result();
-               */
-
-               /*-------------.
-               | Attributes.  |
-               `-------------*/
-       protected:
-               vector<types::InternalType*>    _resultVect;
-               types::InternalType*    _result;
-               bool m_bSingleResult;
-               int _excepted_result;
-       private :
-               ExecVisitor(ExecVisitor const& e){}
-
-       public : 
-               static ExecVisitor* m_defaultVisitor;
-               static ExecVisitor& getDefaultVisitor(){return *m_defaultVisitor;}
-               static void setDefaultVisitor(ExecVisitor& visitor){m_defaultVisitor = &visitor;}
        };
 }
 #endif // !AST_EXECVISITOR_HXX
diff --git a/scilab/modules/abstractSyntaxTree/includes/runvisitor.hxx b/scilab/modules/abstractSyntaxTree/includes/runvisitor.hxx
new file mode 100644 (file)
index 0000000..0a207f1
--- /dev/null
@@ -0,0 +1,263 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2010-2010 - DIGITEO - Antoine ELIAS
+*
+*  This file must be used under the terms of the CeCILL.
+*  This source file is licensed as described in the file COPYING, which
+*  you should have received as part of this distribution.  The terms
+*  are also available at
+*  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+
+#ifndef AST_RUNVISITOR_HXX
+# define AST_RUNVISITOR_HXX
+
+#include <time.h>
+#include <string>
+#include <iostream>
+#include <sstream>
+
+#include "allexp.hxx"
+#include "allvar.hxx"
+#include "alldec.hxx"
+
+#include "alltypes.hxx"
+
+
+using namespace types;
+
+void ExpandList(int ** _piList, int *_piListSize, int _iListSizeSize, int *_piResultList);
+int GetVarMaxDim(types::InternalType *_pIT, int _iCurrentDim, int _iMaxDim);
+
+namespace ast
+{
+       class EXTERN_AST RunVisitor : public ConstVisitor
+       {
+       };
+
+       template <class T> class RunVisitorT : public RunVisitor
+       {
+       public:
+               RunVisitorT()
+               {
+                       _excepted_result = -1;
+                       _resultVect.push_back(NULL);
+                       _result = NULL;
+                       m_bSingleResult = true;
+               }
+
+               ~RunVisitorT()
+               {
+                       result_clear();
+               }
+
+               void result_clear()
+               {
+                       if(is_single_result())
+                       {
+                               if(_result != NULL && _result->isDeletable() == true)
+                               {
+//                                     std::cout << "before single delete : " << _result << std::endl;
+                                       delete _result;
+//                                     std::cout << "after single delete" << std::endl;
+                               }
+                       }
+                       else
+                       {
+                               for(int i = 0 ; i < _resultVect.size() ; i++)
+                               {
+                                       if(_resultVect[i] != NULL && _resultVect[i]->isDeletable() == true)
+                                       {
+                                               delete _resultVect[i];
+                                       }
+                               }
+                       }
+               }
+
+       protected :
+               int GetIndexList(std::list<ast::Exp *>const& _plstArg, int** _piIndexSeq, int** _piMaxDim, InternalType *_pRefVar, int *_iDimSize);
+
+               /** \name Visit Matrix Expressions nodes.
+               ** \{ */
+       public :
+                void visitprivate(const MatrixExp &e);
+                void visitprivate(const MatrixLineExp &e);
+               /** \} */
+
+               /** \name Visit Cell Expressions nodes.
+               ** \{ */
+       public :
+                void visitprivate(const CellExp &e);
+               /** \} */
+
+               /** \name Visit Constant Expressions nodes.
+               ** \{ */
+       public :
+                void visitprivate(const StringExp &e);
+                void visitprivate(const CommentExp &e);
+                void visitprivate(const IntExp  &e);
+                void visitprivate(const FloatExp  &e);
+                void visitprivate(const DoubleExp  &e);
+                void visitprivate(const BoolExp  &e);
+                void visitprivate(const NilExp &e);
+               /** \} */
+
+               /** \name Visit Variable related nodes.
+               ** \{ */
+                void visitprivate(const SimpleVar &e);
+                void visitprivate(const ColonVar &e);
+                void visitprivate(const DollarVar &e);
+                void visitprivate(const ArrayListVar &e);
+               /** \} */
+
+               /** \name Visit Control Expressions or Instructions nodes.
+               ** \{ */
+                void visitprivate(const FieldExp &e);
+                void visitprivate(const OpExp &e);
+                void visitprivate(const LogicalOpExp &e);
+                void visitprivate(const AssignExp  &e);
+                void visitprivate(const CallExp &e);
+                void visitprivate(const IfExp  &e);
+                void visitprivate(const TryCatchExp  &e);
+                void visitprivate(const WhileExp  &e);
+                void visitprivate(const ForExp  &e);
+                void visitprivate(const BreakExp &e);
+                void visitprivate(const ReturnExp &e);
+                void visitprivate(const SelectExp &e);
+                void visitprivate(const CaseExp &e);
+                void visitprivate(const SeqExp  &e);
+                void visitprivate(const ArrayListExp  &e);
+                void visitprivate(const AssignListExp  &e);
+               /** \} */
+
+               /** \name Visit Single Operation nodes.
+               ** \{ */
+                void visitprivate(const NotExp &e);
+                void visitprivate(const TransposeExp &e);
+               /** \} */
+
+               /** \name Visit Declaration nodes.
+               ** \{ */
+               /** \brief Visit Var declarations. */
+                void visitprivate(const VarDec  &e);
+                void visitprivate(const FunctionDec  &e);
+               /** \} */
+
+               /** \name Visit Type dedicated Expressions related node.
+               ** \{ */
+       public:
+               void visitprivate(const ListExp &e);
+               /** \} */
+
+               int expected_size_get(void)
+               {
+                       return _excepted_result;
+               }
+
+               int result_size_get(void)
+               {
+                       if(is_single_result())
+                       {
+                               if(_result == NULL)
+                               {
+                                       return 0;
+                               }
+                               else
+                               {
+                                       return 1;
+                               }
+                       }
+                       else
+                       {
+                               return (int)_resultVect.size();
+                       }
+               }
+
+               void expected_size_set(int _iSize)
+               {
+                       _excepted_result = _iSize;
+               }
+
+               InternalType* result_get(void)
+               {
+                       if(is_single_result())
+                       {
+                               return _result;
+                       }
+                       else
+                       {
+                               return _resultVect[0];
+                       }
+               }
+
+               types::InternalType* result_get(int _iPos)
+               {
+                       if(_iPos >= _resultVect.size())
+                       {
+                               return NULL;
+                       }
+                       return _resultVect[_iPos];
+               }
+
+               vector<types::InternalType*>* result_list_get()
+               {
+                       return &_resultVect;
+               }
+
+               void result_set(int _iPos, const types::InternalType *gtVal)
+               {
+                       m_bSingleResult = false;
+                       if(_iPos < _resultVect.size())
+                       {
+                               if(_resultVect[_iPos] != NULL && _resultVect[_iPos]->isDeletable())
+                               {
+                                       delete _resultVect[_iPos];
+                               }
+                       }
+
+                       if(_iPos >= _resultVect.size())
+                       {
+                               _resultVect.resize(_iPos + 1, NULL);
+                       }
+
+                       _resultVect[_iPos] = (InternalType *)gtVal;
+               }
+
+               void result_set(const InternalType *gtVal)
+               {
+                       m_bSingleResult = true;
+                       _result = const_cast<InternalType *>(gtVal);
+               }
+
+               bool is_single_result()
+               {
+                       return m_bSingleResult;
+               }
+
+               /*
+               int result_size_get(void);
+               int expected_size_get(void);
+               void expected_size_set(int _iSize);
+               types::InternalType*            result_get(void);
+               types::InternalType*            result_get(int _iPos);
+               vector<types::InternalType*>* result_list_get();
+               void    result_set(const types::InternalType *gtVal);
+               void    result_set(int _iPos, const types::InternalType *gtVal);
+               bool    is_single_result();
+               */
+
+               /*-------------.
+               | Attributes.  |
+               `-------------*/
+       protected:
+               vector<types::InternalType*>    _resultVect;
+               types::InternalType*    _result;
+               bool m_bSingleResult;
+               int _excepted_result;
+       //private :
+       //      RunVisitorT(RunVisitorT const& e){}
+       };
+}
+
+#endif // !AST_RUNVISITOR_HXX
index 5614c97..488cd8b 100644 (file)
 #include <iostream>
 #include <sstream>
 
-#include "visitor.hxx"
+#include "execvisitor.hxx"
 #include "allexp.hxx"
 #include "allvar.hxx"
 #include "alldec.hxx"
 
 namespace ast
 {
-       class EXTERN_AST ShortCutVisitor : public GenVisitor<const_kind>
+       class EXTERN_AST ShortCutVisitor : public ExecVisitor
        {
        public:
                ShortCutVisitor(){}
                ~ShortCutVisitor(){}
-               virtual void visit (const MatrixExp &e);
-               virtual void visit (const MatrixLineExp &e);
-               virtual void visit (const CellExp &e);
-               virtual void visit (const StringExp &e);
-               virtual void visit (const CommentExp &e);
-               virtual void visit (const IntExp  &e);
-               virtual void visit (const FloatExp  &e);
-               virtual void visit (const DoubleExp  &e);
-               virtual void visit (const BoolExp  &e);
-               virtual void visit (const NilExp &e);
-               virtual void visit (const SimpleVar &e);
-               virtual void visit (const ColonVar &e);
-               virtual void visit (const DollarVar &e);
-               virtual void visit (const ArrayListVar &e);
-               virtual void visit (const FieldExp &e);
-               virtual void visit (const OpExp &e);
                virtual void visit (const LogicalOpExp &e);
-               virtual void visit (const AssignExp  &e);
-               virtual void visit (const CallExp &e);
-               virtual void visit (const IfExp  &e);
-               virtual void visit (const TryCatchExp  &e);
-               virtual void visit (const WhileExp  &e);
-               virtual void visit (const ForExp  &e);
-               virtual void visit (const BreakExp &e);
-               virtual void visit (const ReturnExp &e);
-               virtual void visit (const SelectExp &e);
-               virtual void visit (const CaseExp &e);
-               virtual void visit (const SeqExp  &e);
-               virtual void visit (const ArrayListExp  &e);
-               virtual void visit (const AssignListExp  &e);
-               virtual void visit (const NotExp &e);
-               virtual void visit (const TransposeExp &e);
-               virtual void visit (const VarDec  &e);
-               virtual void visit (const FunctionDec  &e);
-               virtual void visit(const ListExp &e);
        };
 }
 #endif // !AST_SHORTCUTVISITOR_HXX
index 4ea229c..0599fac 100644 (file)
 #include <iostream>
 #include <sstream>
 
-#include "execvisitor.hxx"
-#include "visitor.hxx"
 #include "allexp.hxx"
 #include "allvar.hxx"
 #include "alldec.hxx"
 #include "alltypes.hxx"
+#include "runvisitor.hxx"
 
 namespace ast
 {
-       class EXTERN_AST TimedVisitor : public ExecVisitor
+       class EXTERN_AST TimedVisitor : public RunVisitorT<TimedVisitor>
        {
-       public:
-               TimedVisitor(){}
-               ~TimedVisitor(){}
-
+       public :
+               virtual void visit (const MatrixExp &e);
+               virtual void visit (const MatrixLineExp &e);
+               virtual void visit (const CellExp &e);
+               virtual void visit (const StringExp &e);
+               virtual void visit (const CommentExp &e);
+               virtual void visit (const IntExp  &e);
+               virtual void visit (const FloatExp  &e);
+               virtual void visit (const DoubleExp  &e);
+               virtual void visit (const BoolExp  &e);
+               virtual void visit (const NilExp &e);
+               virtual void visit (const SimpleVar &e);
+               virtual void visit (const ColonVar &e);
+               virtual void visit (const DollarVar &e);
+               virtual void visit (const ArrayListVar &e);
+               virtual void visit (const FieldExp &e);
+               virtual void visit (const OpExp &e);
+               virtual void visit (const LogicalOpExp &e);
+               virtual void visit (const AssignExp  &e);
                virtual void visit (const CallExp &e);
-
+               virtual void visit (const IfExp  &e);
+               virtual void visit (const TryCatchExp  &e);
+               virtual void visit (const WhileExp  &e);
+               virtual void visit (const ForExp  &e);
+               virtual void visit (const BreakExp &e);
+               virtual void visit (const ReturnExp &e);
+               virtual void visit (const SelectExp &e);
+               virtual void visit (const CaseExp &e);
+               virtual void visit (const SeqExp  &e);
+               virtual void visit (const ArrayListExp  &e);
+               virtual void visit (const AssignListExp  &e);
+               virtual void visit (const NotExp &e);
+               virtual void visit (const TransposeExp &e);
+               virtual void visit (const VarDec  &e);
+               virtual void visit (const FunctionDec  &e);
+               virtual void visit(const ListExp &e);
        };
 }
 #endif // !AST_TIMEDVISITOR_HXX
index 03a7b19..1afea51 100644 (file)
@@ -14,6 +14,7 @@
 #include "execvisitor.hxx"
 #include "timer.hxx"
 #include "localization.h"
+#include "context.hxx"
 
 #include "yaspio.hxx"
 
diff --git a/scilab/modules/abstractSyntaxTree/src/cpp/execvisitor.cpp b/scilab/modules/abstractSyntaxTree/src/cpp/execvisitor.cpp
new file mode 100644 (file)
index 0000000..e9eaa86
--- /dev/null
@@ -0,0 +1,240 @@
+/*
+*  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+*  Copyright (C) 2008-2008 - DIGITEO - Bruno JOFRET
+*
+*  This file must be used under the terms of the CeCILL.
+*  This source file is licensed as described in the file COPYING, which
+*  you should have received as part of this distribution.  The terms
+*  are also available at
+*  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+*
+*/
+
+#include <cstdio>
+#include <numeric>
+#include <iostream>
+#include "stack-def.h"
+
+#include "execvisitor.hxx"
+
+#include "timer.hxx"
+#include "localization.h"
+
+#include "yaspio.hxx"
+
+using std::string;
+
+namespace ast
+{
+       void ExecVisitor::visit (const SeqExp  &e)
+       {
+               std::cout << "ExecVisitor::SeqExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const MatrixExp &e)
+       {
+               std::cout << "ExecVisitor::MatrixExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const MatrixLineExp &e)
+       {
+               std::cout << "ExecVisitor::MatrixLineExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const CellExp &e)
+       {
+               std::cout << "ExecVisitor::CellExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const StringExp &e)
+       {
+               std::cout << "ExecVisitor::StringExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const CommentExp &e)
+       {
+               std::cout << "ExecVisitor::CommentExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const IntExp &e)
+       {
+               std::cout << "ExecVisitor::IntExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const FloatExp &e)
+       {
+               std::cout << "ExecVisitor::FloatExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const DoubleExp &e)
+       {
+               std::cout << "ExecVisitor::DoubleExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const BoolExp &e)
+       {
+               std::cout << "ExecVisitor::BoolExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const NilExp &e)
+       {
+               std::cout << "ExecVisitor::NilExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const SimpleVar &e)
+       {
+               std::cout << "ExecVisitor::SimpleVar" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const ColonVar &e)
+       {
+               std::cout << "ExecVisitor::ColonVar" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const DollarVar &e)
+       {
+               std::cout << "ExecVisitor::DollarVar" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const ArrayListVar &e)
+       {
+               std::cout << "ExecVisitor::ArrayListVar" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const FieldExp &e)
+       {
+               std::cout << "ExecVisitor::FieldExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const OpExp &e)
+       {
+               std::cout << "ExecVisitor::OpExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const LogicalOpExp &e)
+       {
+               std::cout << "ExecVisitor::LogicalOpExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const AssignExp &e)
+       {
+               std::cout << "ExecVisitor::AssignExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const CallExp &e)
+       {
+               std::cout << "ExecVisitor::CallExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const IfExp &e)
+       {
+               std::cout << "ExecVisitor::IfExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const TryCatchExp &e)
+       {
+               std::cout << "ExecVisitor::TryCatchExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const WhileExp &e)
+       {
+               std::cout << "ExecVisitor::SeqExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const ForExp &e)
+       {
+               std::cout << "ExecVisitor::ForExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const BreakExp &e)
+       {
+               std::cout << "ExecVisitor::BreakExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const ReturnExp &e)
+       {
+               std::cout << "ExecVisitor::ReturnExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const SelectExp &e)
+       {
+               std::cout << "ExecVisitor::SelectExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const CaseExp &e)
+       {
+               std::cout << "ExecVisitor::CaseExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const ArrayListExp &e)
+       {
+               std::cout << "ExecVisitor::ArrayListExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const AssignListExp &e)
+       {
+               std::cout << "ExecVisitor::AssignListExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const NotExp &e)
+       {
+               std::cout << "ExecVisitor::NotExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const TransposeExp &e)
+       {
+               std::cout << "ExecVisitor::TransposeExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const VarDec &e)
+       {
+               std::cout << "ExecVisitor::VarDec" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit (const FunctionDec &e)
+       {
+               std::cout << "ExecVisitor::FunctionDec" << std::endl;
+               visitprivate(e);
+       }
+
+       void ExecVisitor::visit(const ListExp &e)
+       {
+               std::cout << "ExecVisitor::ListExp" << std::endl;
+               visitprivate(e);
+       }
+
+/*protected real visit functions*/
+}
@@ -11,7 +11,9 @@
 */
 
 #include "localization.h"
+#include "runvisitor.hxx"
 #include "execvisitor.hxx"
+#include "timedvisitor.hxx"
 #include "context.hxx"
 #include <string>
 
 
 using std::string;
 using ast::Exp;
-using ast::ExecVisitor;
+using ast::RunVisitor;
 
 namespace ast
 {
-       void ExecVisitor::visit (const AssignExp  &e)
+       template class RunVisitorT<ExecVisitor>;
+       template class RunVisitorT<TimedVisitor>;
+
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const AssignExp  &e)
        {
                symbol::Context *pcontext = symbol::Context::getInstance();
                /*Create local exec visitor*/
-               ExecVisitor execMeR;
+               T execMeR;
                try
                {
                        /*get king of left hand*/
@@ -10,7 +10,9 @@
 *
 */
 
+#include "runvisitor.hxx"
 #include "execvisitor.hxx"
+#include "timedvisitor.hxx"
 
 using std::string;
 
@@ -19,10 +21,14 @@ InternalType* AddElementToVariable(InternalType* _poDest, InternalType* _poSourc
 
 namespace ast
 {
+       template class RunVisitorT<ExecVisitor>;
+       template class RunVisitorT<TimedVisitor>;
+
        /*
        [1,2;3,4] with/without special character $ and :
        */
-       void ExecVisitor::visit (const MatrixExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const MatrixExp &e)
        {
                try
                {
@@ -49,7 +55,7 @@ namespace ast
                                        list<InternalType*> RowList;
                                        for (col = (*row)->columns_get().begin() ; col != (*row)->columns_get().end() ; ++col)
                                        {
-                                               ExecVisitor* execMe = new ast::ExecVisitor();
+                                               T* execMe = new T();
                                                (*col)->accept (*execMe);
                                                if(execMe->result_get()->getType() == InternalType::RealImplicitList)
                                                {
@@ -13,7 +13,9 @@
 #pragma comment(lib,"../../bin/libintl.lib")
 
 #include "timer.hxx"
+#include "runvisitor.hxx"
 #include "execvisitor.hxx"
+#include "timedvisitor.hxx"
 #include "core_math.h"
 
 #include "types_multiplication.hxx"
@@ -22,6 +24,7 @@
 #include "types_divide.hxx"
 #include "types_power.hxx"
 
+#include "context.hxx"
 extern "C"
 {
        #include "localization.h"
@@ -31,7 +34,11 @@ using std::string;
 
 namespace ast
 {
-       void ExecVisitor::visit(const OpExp &e)
+       template class RunVisitorT<ExecVisitor>;
+       template class RunVisitorT<TimedVisitor>;
+
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const OpExp &e)
        {
                ExecVisitor execMeL;
                ExecVisitor execMeR;
@@ -807,10 +814,11 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit(const LogicalOpExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const LogicalOpExp &e)
        {
-               ExecVisitor execMeL;
-               ExecVisitor execMeR;
+               T execMeL;
+               T execMeR;
 
                symbol::Context *pContext = symbol::Context::getInstance();
                e.left_get().accept(execMeL);
@@ -15,7 +15,9 @@
 #include <iostream>
 #include "stack-def.h"
 
+#include "runvisitor.hxx"
 #include "execvisitor.hxx"
+#include "timedvisitor.hxx"
 #include "shortcutvisitor.hxx"
 #include "conditionvisitor.hxx"
 
@@ -23,6 +25,7 @@
 #include "localization.h"
 
 #include "yaspio.hxx"
+#include "context.hxx"
 
 using std::string;
 
@@ -40,16 +43,19 @@ void vTransposeComplexMatrix(
 
 namespace ast
 {
-       ExecVisitor* ExecVisitor::m_defaultVisitor;
+       template class RunVisitorT<ExecVisitor>;
+       template class RunVisitorT<TimedVisitor>;
 
-       void ExecVisitor::visit (const MatrixLineExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const MatrixLineExp &e)
        {
        /*
                All processes are done in MatrixExp
        */
        }
 
-       void ExecVisitor::visit (const CellExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const CellExp &e)
        {
                /*
                        FIXME : container type
@@ -58,53 +64,61 @@ namespace ast
 
        /** \name Visit Constant Expressions nodes.
        ** \{ */
-       void ExecVisitor::visit (const StringExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const StringExp &e)
        {
                String *psz = new String(e.value_get().c_str());
                result_set(psz);
        }
 
-       void ExecVisitor::visit (const CommentExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const CommentExp &e)
        {
                /*
                Nothing to do
                */
        }
 
-       void ExecVisitor::visit (const IntExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const IntExp  &e)
        {
                /*
                Int does not exist, Int8 - 16 - 32 - 64 functions
                */
        }
 
-       void ExecVisitor::visit (const FloatExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const FloatExp  &e)
        {
                /*
                Float does not exist, float function
                */
        }
 
-       void ExecVisitor::visit (const DoubleExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const DoubleExp  &e)
        {
                Double *pdbl = new Double(e.value_get());
                result_set(pdbl);
        }
 
-       void ExecVisitor::visit (const BoolExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const BoolExp  &e)
        {
                Bool *pb = new Bool(e.value_get());
                result_set(pb);
        }
 
-       void ExecVisitor::visit (const NilExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const NilExp &e)
        {
                /*
                FIXME :
                */
        }
 
-       void ExecVisitor::visit (const SimpleVar &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const SimpleVar &e)
        {
                InternalType *pI = symbol::Context::getInstance()->get(e.name_get());
                if(pI != NULL)
@@ -132,7 +146,8 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const ColonVar &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const ColonVar &e)
        {
                int pRank[1] = {2};
                Double dblCoef(1,2);
@@ -153,7 +168,8 @@ namespace ast
                */
        }
 
-       void ExecVisitor::visit (const DollarVar &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const DollarVar &e)
        {
                int pRank[1] = {2};
                Double dblCoef(1,2);
@@ -166,14 +182,16 @@ namespace ast
                result_set(pVar);
        }
 
-       void ExecVisitor::visit (const ArrayListVar &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const ArrayListVar &e)
        {
                /*
 
                */
        }
 
-       void ExecVisitor::visit (const FieldExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const FieldExp &e)
        {
                /*
                a.b
@@ -235,9 +253,10 @@ namespace ast
                  }
        }
 
-       void ExecVisitor::visit(const CallExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const CallExp &e)
        {
-               ExecVisitor execFunc;
+               T execFunc;
                std::list<Exp *>::const_iterator        i;
 
                e.name_get().accept(execFunc);
@@ -276,7 +295,9 @@ namespace ast
                        }
                        
                        int iRetCount = Max(1, expected_size_get());
-                       Function::ReturnValue Ret = pCall->call(in, iRetCount, out);
+
+                       T execCall;
+                       Function::ReturnValue Ret = pCall->call(in, iRetCount, out, &execCall);
                        
                        if(Ret == Callable::OK)
                        {
@@ -420,7 +441,8 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const IfExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const IfExp  &e)
        {
                //Create local exec visitor
                ConditionVisitor execMeTest;
@@ -481,11 +503,13 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const TryCatchExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const TryCatchExp  &e)
        {
        }
 
-       void ExecVisitor::visit (const WhileExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const WhileExp  &e)
        {
                ConditionVisitor execMeTest;
                ExecVisitor execMeAction;
@@ -518,7 +542,8 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const ForExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const ForExp  &e)
        {
                ExecVisitor execVar;
                e.vardec_get().accept(execVar);
@@ -598,12 +623,14 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const BreakExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const BreakExp &e)
        {
                ((BreakExp*)&e)->break_set();
        }
 
-       void ExecVisitor::visit (const ReturnExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const ReturnExp &e)
        {
                if(e.is_global() == false)
                {//return(x)
@@ -618,7 +645,8 @@ namespace ast
                ((Exp*)&e)->return_set();
        }
 
-       void ExecVisitor::visit (const SelectExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const SelectExp &e)
        {
          // FIXME : exec select ... case ... else ... end
                ExecVisitor execMe;
@@ -656,19 +684,20 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit(const CaseExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const CaseExp &e)
        {
-         // FIXME : case ... 
        }
 
-
-       void ExecVisitor::visit (const SeqExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const SeqExp  &e)
        {
+               T execMe;
                std::list<Exp *>::const_iterator        i;
 
                for (i = e.exps_get().begin (); i != e.exps_get().end (); ++i)
                {
-                       ExecVisitor execMe;
+                       //ExecVisitor *execMe = getDefaultVisitor();
                        if(e.is_breakable())
                        {
                                (*i)->breakable_set();
@@ -689,7 +718,8 @@ namespace ast
                                        types::typed_list out;
                                        types::typed_list in;
 
-                                       Function::ReturnValue Ret = pCall->call(in, (int)expected_size_get(), out);
+                                       T execCall;
+                                       Function::ReturnValue Ret = pCall->call(in, (int)expected_size_get(), out, &execCall);
 
                                        if(Ret == Callable::OK)
                                        {
@@ -753,7 +783,8 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const ArrayListExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const ArrayListExp  &e)
        {
                std::list<Exp *>::const_iterator it;
                int i = 0;
@@ -766,14 +797,16 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const AssignListExp  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const AssignListExp  &e)
        {
        }
        /** \} */
 
        /** \name Visit Single Operation nodes.
        ** \{ */
-       void ExecVisitor::visit (const NotExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const NotExp &e)
        {
                /*
                @ or ~= !
@@ -808,7 +841,8 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const TransposeExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const TransposeExp &e)
        {
                /*
                '
@@ -896,13 +930,14 @@ namespace ast
 
                        result_set(pReturn);
                }
-}
+       }
        /** \} */
 
        /** \name Visit Declaration nodes.
        ** \{ */
        /** \brief Visit Var declarations. */
-       void ExecVisitor::visit (const VarDec  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const VarDec  &e)
        {
                /*Create local exec visitor*/
                ExecVisitor execMe;
@@ -919,7 +954,8 @@ namespace ast
                }
        }
 
-       void ExecVisitor::visit (const FunctionDec  &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const FunctionDec  &e)
        {
                /*
                function foo
@@ -951,7 +987,8 @@ namespace ast
 
        /** \name Visit Type dedicated Expressions related node.
        ** \{ */
-       void ExecVisitor::visit(const ListExp &e)
+       template <class T>
+       void RunVisitorT<T>::visitprivate(const ListExp &e)
        {
                ExecVisitor     execMeStart;
                ExecVisitor     execMeStep;
@@ -1069,7 +1106,174 @@ namespace ast
        }
        /** \} */
 
-                       
+       template <class T>
+       int RunVisitorT<T>::GetIndexList(std::list<ast::Exp *>const& _plstArg, int** _piIndexSeq, int** _piMaxDim, InternalType *_pRefVar, int *_iDimSize)
+       {
+               //Create list of indexes
+               //std::vector<std::vector<int>> IndexList;
+               symbol::Context *pcontext = symbol::Context::getInstance();
+               int iProductElem                                = (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      = (MatrixPoly*)pIL->start_get();
+                                               pIL->start_set(poPoly->evaluate(&dbl));
+                                       }
+                                       if(pIL->step_type_get() == InternalType::RealPoly)
+                                       {
+                                               MatrixPoly *poPoly      = (MatrixPoly*)pIL->step_get();
+                                               pIL->step_set(poPoly->evaluate(&dbl));
+                                       }
+                                       if(pIL->end_type_get() == InternalType::RealPoly)
+                                       {
+                                               MatrixPoly *poPoly      = (MatrixPoly*)pIL->end_get();
+                                               pIL->end_set(poPoly->evaluate(&dbl));
+                                       }
+                               }
+
+                               pDbl = (Double*)pIL->extract_matrix();
+                               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 i = 0 ; i < pB->size_get() ; i++)
+                               {
+                                       if(piB[i])
+                                       {
+                                               iItemCount++;
+                                       }
+                               }
+
+                               //allow new Double variable
+                               pDbl                                    = new Double(iItemCount, 1);
+                               double* pdbl    = pDbl->real_get();
+
+                               int j = 0;
+                               for(int i = 0 ; i < pB->size_get() ; i++)
+                               {
+                                       if(piB[i])
+                                       {
+                                               pdbl[j++] = i + 1;
+                                       }
+                               }
+
+                               bDeleteDbl              = true;
+                       }
+                       else
+                       {
+                               pIn = execMeArg.result_get();
+
+                               if(pIn->getType() == InternalType::RealPoly)
+                               {//manage $
+                                       MatrixPoly *pPoly = pIn->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(pIn->getType() == InternalType::RealDouble)
+                               {
+                                       pDbl    = pIn->getAsDouble();//
+                               }
+                               else
+                               {//Heu ... ?
+                               }
+                       }
+
+                       double *pData = pDbl->real_get();
+
+                       piTabsize[k] = pDbl->size_get();
+                       piIndexList[k] = new int[piTabsize[k]];
+
+                       (*_piMaxDim)[k] = (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] = (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 i = 0 ; i < iProductElem ; i++)
+               {
+                       delete[] piIndexList[i];
+               }
+               delete[] piIndexList;
+               return iTotalCombi;
+       }
 }
 
 using namespace ast;
@@ -1155,178 +1359,9 @@ void vTransposeComplexMatrix(double *_pdblRealIn, double *_pdblImgIn, int _iRows
        }
 }
 
-
-int GetIndexList(std::list<ast::Exp *>const& _plstArg, int** _piIndexSeq, int** _piMaxDim, InternalType *_pRefVar, int *_iDimSize)
-{
-       //Create list of indexes
-       //std::vector<std::vector<int>> IndexList;
-       symbol::Context *pcontext = symbol::Context::getInstance();
-       int iProductElem                                = (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];
-
-       ExecVisitor 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      = (MatrixPoly*)pIL->start_get();
-                                       pIL->start_set(poPoly->evaluate(&dbl));
-                               }
-                               if(pIL->step_type_get() == InternalType::RealPoly)
-                               {
-                                       MatrixPoly *poPoly      = (MatrixPoly*)pIL->step_get();
-                                       pIL->step_set(poPoly->evaluate(&dbl));
-                               }
-                               if(pIL->end_type_get() == InternalType::RealPoly)
-                               {
-                                       MatrixPoly *poPoly      = (MatrixPoly*)pIL->end_get();
-                                       pIL->end_set(poPoly->evaluate(&dbl));
-                               }
-                       }
-
-                       pDbl = (Double*)pIL->extract_matrix();
-                       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 i = 0 ; i < pB->size_get() ; i++)
-                       {
-                               if(piB[i])
-                               {
-                                       iItemCount++;
-                               }
-                       }
-
-                       //allow new Double variable
-                       pDbl                                    = new Double(iItemCount, 1);
-                       double* pdbl    = pDbl->real_get();
-
-                       int j = 0;
-                       for(int i = 0 ; i < pB->size_get() ; i++)
-                       {
-                               if(piB[i])
-                               {
-                                       pdbl[j++] = i + 1;
-                               }
-                       }
-                       
-                       bDeleteDbl              = true;
-               }
-               else
-               {
-                       pIn = execMeArg.result_get();
-
-                       if(pIn->getType() == InternalType::RealPoly)
-                       {//manage $
-                               MatrixPoly *pPoly = pIn->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(pIn->getType() == InternalType::RealDouble)
-                       {
-                         pDbl  = pIn->getAsDouble();//
-                       }
-                       else
-                       {//Heu ... ?
-                       }
-               }
-
-               double *pData = pDbl->real_get();
-
-               piTabsize[k] = pDbl->size_get();
-               piIndexList[k] = new int[piTabsize[k]];
-
-               (*_piMaxDim)[k] = (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] = (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 i = 0 ; i < iProductElem ; i++)
-       {
-               delete[] piIndexList[i];
-       }
-       delete[] piIndexList;
-       return iTotalCombi;
-}
-
 void ExpandList(int ** _piList, int *_piListSize, int _iListSizeSize, int *_piResultList)
 {
-#define ORIGINAL_IMPLEM 
+//#define ORIGINAL_IMPLEM 
 #ifdef ORIGINAL_IMPLEM
        for(int i = _iListSizeSize - 1 ; i >= 0 ; i--)
        {
index 15cabe6..b1351a0 100644 (file)
@@ -20,223 +20,6 @@ using std::string;
 
 namespace ast
 {
-       void ShortCutVisitor::visit (const MatrixLineExp &e)
-       {
-               std::list<Exp*>::const_iterator it;
-               for(it = e.columns_get().begin() ; it != e.columns_get().end() ; it++)
-               {
-                       ShortCutVisitor SC;
-                       (*it)->accept(SC);
-               }
-       }
-
-       void ShortCutVisitor::visit (const CellExp &e)
-       {
-               std::list<MatrixLineExp*>::const_iterator it;
-               for(it = e.lines_get().begin() ; it != e.lines_get().end() ; it++)
-               {
-                       ShortCutVisitor SC;
-                       (*it)->accept(SC);
-               }
-       }
-
-       void ShortCutVisitor::visit (const StringExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const CommentExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const IntExp  &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const FloatExp  &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const DoubleExp  &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const BoolExp  &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const NilExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const SimpleVar &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const ColonVar &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const DollarVar &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const ArrayListVar &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const FieldExp &e)
-       {
-               ShortCutVisitor SCHead;
-               e.head_get()->accept(SCHead);
-
-               ShortCutVisitor SCTail;
-               e.tail_get()->accept(SCTail);
-       }
-
-       void ShortCutVisitor::visit(const CallExp &e)
-       {
-               std::list<Exp*>::const_iterator it;
-               for(it = e.args_get().begin() ; it != e.args_get().end() ; it++)
-               {
-                       ShortCutVisitor SC;
-                       (*it)->accept(SC);
-               }
-       }
-
-       void ShortCutVisitor::visit (const IfExp  &e)
-       {
-               ShortCutVisitor SCTest;
-               e.test_get().accept(SCTest);
-
-               ShortCutVisitor SCThen;
-               e.then_get().accept(SCThen);
-
-               if(e.has_else())
-               {
-                       ShortCutVisitor SCElse;
-                       e.else_get().accept(SCElse);
-               }
-       }
-
-       void ShortCutVisitor::visit (const TryCatchExp  &e)
-       {
-               ShortCutVisitor SCTry;
-               e.try_get().accept(SCTry);
-
-               ShortCutVisitor SCCatch;
-               e.catch_get().accept(SCCatch);
-       }
-
-       void ShortCutVisitor::visit (const WhileExp  &e)
-       {
-               ShortCutVisitor SCTest;
-               e.test_get().accept(SCTest);
-
-               ShortCutVisitor SCBody;
-               e.body_get().accept(SCBody);
-       }
-
-       void ShortCutVisitor::visit (const ForExp  &e)
-       {
-               ShortCutVisitor SCBody;
-               e.body_get().accept(SCBody);
-       }
-
-       void ShortCutVisitor::visit (const BreakExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const ReturnExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const SelectExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const CaseExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const SeqExp  &e)
-       {
-               std::list<Exp*>::const_iterator it;
-               for(it = e.exps_get().begin() ; it != e.exps_get().end() ; it++)
-               {
-                       ShortCutVisitor SC;
-                       (*it)->accept(SC);
-               }
-       }
-
-       void ShortCutVisitor::visit (const ArrayListExp  &e)
-       {
-               std::list<Exp*>::const_iterator it;
-               for(it = e.exps_get().begin() ; it != e.exps_get().end() ; it++)
-               {
-                       ShortCutVisitor SC;
-                       (*it)->accept(SC);
-               }
-       }
-
-       void ShortCutVisitor::visit (const AssignListExp  &e)
-       {
-               std::list<Exp*>::const_iterator it;
-               for(it = e.exps_get().begin() ; it != e.exps_get().end() ; it++)
-               {
-                       ShortCutVisitor SC;
-                       (*it)->accept(SC);
-               }
-       }
-
-       void ShortCutVisitor::visit (const NotExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const TransposeExp &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const VarDec  &e)
-       {
-       }
-
-       void ShortCutVisitor::visit (const FunctionDec  &e)
-       {
-               ShortCutVisitor SCBody;
-               e.body_get().accept(SCBody);
-       }
-
-       void ShortCutVisitor::visit(const ListExp &e)
-       {
-               ShortCutVisitor SCStart;
-               e.start_get().accept(SCStart);
-
-               ShortCutVisitor SCStep;
-               e.step_get().accept(SCStep);
-
-               ShortCutVisitor SCEnd;
-               e.end_get().accept(SCEnd);
-       }
-
-       void ShortCutVisitor::visit(const MatrixExp &e)
-       {
-               std::list<MatrixLineExp*>::const_iterator it;
-               for(it = e.lines_get().begin() ; it != e.lines_get().end() ; it++)
-               {
-                       ShortCutVisitor SC;
-                       (*it)->accept(SC);
-               }
-       }
-
-       void ShortCutVisitor::visit(const AssignExp &e)
-       {
-               ShortCutVisitor SCLeft;
-               e.left_exp_get().accept(SCLeft);
-
-               ShortCutVisitor SCRight;
-               e.right_exp_get().accept(SCRight);
-       }
-
        void ShortCutVisitor::visit(const LogicalOpExp &e)
        {
                ShortCutVisitor SCLeft;
@@ -255,13 +38,4 @@ namespace ast
                        break;
                }
        }
-
-       void ShortCutVisitor::visit(const OpExp &e)
-       {
-               ShortCutVisitor SCLeft;
-               e.left_get().accept(SCLeft);
-
-               ShortCutVisitor SCRight;
-               e.right_get().accept(SCRight);
-       }
 }
index 4f7d878..4bbc220 100644 (file)
@@ -11,6 +11,7 @@
 */
 
 #include "timedvisitor.hxx"
+
 #include "timer.hxx"
 #include "localization.h"
 
@@ -20,8 +21,213 @@ using std::string;
 
 namespace ast
 {
-       void TimedVisitor::visit(const CallExp &e)
+       void TimedVisitor::visit (const SeqExp  &e)
+       {
+               std::cout << "TimedVisitor::SeqExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const MatrixExp &e)
+       {
+               std::cout << "TimedVisitor::MatrixExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const MatrixLineExp &e)
+       {
+               std::cout << "TimedVisitor::MatrixLineExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const CellExp &e)
+       {
+               std::cout << "TimedVisitor::CellExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const StringExp &e)
+       {
+               std::cout << "TimedVisitor::StringExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const CommentExp &e)
+       {
+               std::cout << "TimedVisitor::CommentExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const IntExp &e)
+       {
+               std::cout << "TimedVisitor::IntExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const FloatExp &e)
+       {
+               std::cout << "TimedVisitor::FloatExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const DoubleExp &e)
+       {
+               std::cout << "TimedVisitor::DoubleExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const BoolExp &e)
+       {
+               std::cout << "TimedVisitor::BoolExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const NilExp &e)
+       {
+               std::cout << "TimedVisitor::NilExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const SimpleVar &e)
+       {
+               std::cout << "TimedVisitor::SimpleVar" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const ColonVar &e)
+       {
+               std::cout << "TimedVisitor::ColonVar" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const DollarVar &e)
+       {
+               std::cout << "TimedVisitor::DollarVar" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const ArrayListVar &e)
+       {
+               std::cout << "TimedVisitor::ArrayListVar" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const FieldExp &e)
+       {
+               std::cout << "TimedVisitor::FieldExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const OpExp &e)
+       {
+               std::cout << "TimedVisitor::OpExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const LogicalOpExp &e)
+       {
+               std::cout << "TimedVisitor::LogicalOpExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const AssignExp &e)
+       {
+               std::cout << "TimedVisitor::AssignExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const CallExp &e)
+       {
+               std::cout << "TimedVisitor::CallExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const IfExp &e)
+       {
+               std::cout << "TimedVisitor::IfExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const TryCatchExp &e)
+       {
+               std::cout << "TimedVisitor::TryCatchExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const WhileExp &e)
+       {
+               std::cout << "TimedVisitor::SeqExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const ForExp &e)
+       {
+               std::cout << "TimedVisitor::ForExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const BreakExp &e)
+       {
+               std::cout << "TimedVisitor::BreakExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const ReturnExp &e)
+       {
+               std::cout << "TimedVisitor::ReturnExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const SelectExp &e)
+       {
+               std::cout << "TimedVisitor::SelectExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const CaseExp &e)
+       {
+               std::cout << "TimedVisitor::CaseExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const ArrayListExp &e)
+       {
+               std::cout << "TimedVisitor::ArrayListExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const AssignListExp &e)
+       {
+               std::cout << "TimedVisitor::AssignListExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const NotExp &e)
+       {
+               std::cout << "TimedVisitor::NotExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const TransposeExp &e)
+       {
+               std::cout << "TimedVisitor::TransposeExp" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const VarDec &e)
+       {
+               std::cout << "TimedVisitor::VarDec" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit (const FunctionDec &e)
+       {
+               std::cout << "TimedVisitor::FunctionDec" << std::endl;
+               visitprivate(e);
+       }
+
+       void TimedVisitor::visit(const ListExp &e)
        {
-               std::cout << "TIMED !!!" << std::endl;
+               std::cout << "TimedVisitor::ListExp" << std::endl;
+               visitprivate(e);
        }
 }
index 775e79c..fb94130 100644 (file)
@@ -48,7 +48,7 @@ void printAstTask(bool timed);
 **
 ** Execute the stored AST.
 */
-void execAstTask(bool timed);
+void execAstTask(bool timed, bool ASTtimed);
 
 /*
 ** Dump Stack Trace
index 5b8e747..93cc417 100644 (file)
@@ -22,7 +22,7 @@
 #include <iostream>
 #include <iomanip>
 
-class timer
+class Timer
 {
 
 private:
@@ -71,7 +71,7 @@ public:
                return dblTime;
   } // timer::elapsed_time
 public:
-       timer()
+       Timer()
        {
 #ifndef _MSC_VER
                start_hour      = 0;
@@ -140,7 +140,7 @@ public:
   // for an ostream 'os' and a timer 't'.  For example, "cout << t" will
   // print out the total amount of time 't' has been "running".
 
-  inline std::ostream& operator<<(std::ostream& os, timer& t)
+  inline std::ostream& operator<<(std::ostream& os, Timer& t)
   {
     os << std::setprecision(3)
        << std::setiosflags(std::ios::fixed)
index 4a1a107..495cb20 100644 (file)
@@ -77,6 +77,7 @@ bool execAst = true;
 bool dumpAst = false;
 bool dumpStack = false;
 bool timed = false;
+bool ASTtimed = false;
 bool consoleMode = false;
 
 using symbol::Context;
@@ -109,6 +110,7 @@ static void usage (void)
        std::cerr << "--display-tree : Display Syntax tree formated as understood scilab code." << std::endl;
        std::cerr << "--context-dump : Display what is stored in scilab at the end." << std::endl;
        std::cerr << "--timed : Enable timer." << std::endl;
+       std::cerr << "--AST-timed : Enable AST timer." << std::endl;
        std::cerr << "--no-exec : Do not run the scilab code." << std::endl;
        std::cerr << "--debug : Print the AST nodes." << std::endl;
        std::cerr << "-f file : Batch mode on the given file." << std::endl;
@@ -155,6 +157,9 @@ static int  get_option (const int argc, char *argv[], int *_piFileIndex, int *_pi
                else if (!strcmp("--timed", argv[i])) {
                        timed = true;
                }
+               else if (!strcmp("--AST-timed", argv[i])) {
+                       ASTtimed = true;
+               }
                else if (!strcmp("-f", argv[i])) {
                        i++;
                        *_piFileIndex = i;
@@ -222,7 +227,7 @@ static int batchMain (void)
        /*
        ** -*- EXECUTING TREE -*-
        */
-       if (execAst == true) { execAstTask(timed); }
+       if (execAst == true) { execAstTask(timed, ASTtimed); }
 
        /*
        ** -*- DUMPING STACK AFTER EXECUTION -*-
@@ -369,7 +374,7 @@ static int interactiveMain (void)
                                /*
                                ** -*- EXECUTING TREE -*-
                                */
-                               if (execAst == true) { execAstTask(timed); }
+                               if (execAst == true) { execAstTask(timed, ASTtimed); }
 
                                /*
                                ** -*- DUMPING STACK AFTER EXECUTION -*-
index 0499fd0..ea501cc 100644 (file)
@@ -24,7 +24,7 @@
 
 #define SCILAB_START "/etc/scilab.start"
 
-timer _timer;
+Timer _timer;
 
 //#define DEBUG
 
@@ -133,17 +133,26 @@ void printAstTask(bool timed)
 **
 ** Execute the stored AST.
 */
-void execAstTask(bool timed)
+void execAstTask(bool timed, bool ASTtimed)
 {
+       ast::ExecVisitor *exec;
        if(timed)
        {
                _timer.start();
-               ast::ExecVisitor::setDefaultVisitor(ast::TimedVisitor());
+       }
+
+       if(ASTtimed)
+       {
+               exec = (ast::ExecVisitor*)new ast::TimedVisitor();
+       }
+       else
+       {
+               exec = new ast::ExecVisitor();
        }
 
        try
        {
-               Parser::getInstance()->getTree()->accept(ast::ExecVisitor::getDefaultVisitor());
+               Parser::getInstance()->getTree()->accept(*exec);
                //Parser::getInstance()->freeTree();
        }
        catch(string sz)
@@ -152,6 +161,8 @@ void execAstTask(bool timed)
          YaspWrite("\n");
        }
 
+       delete exec;
+
        if(timed)
        {
                _timer.check("Execute AST");
@@ -196,5 +207,5 @@ void execScilabStartTask(void)
                return;
        }
 
-       execAstTask(false);
+       execAstTask(false, false);
 }
index 649dd9a..bdefe2e 100644 (file)
@@ -17,6 +17,8 @@
 #include <string>
 #include "types.hxx"
 
+#include "runvisitor.hxx"
+
 namespace types
 {
   class Callable : public InternalType
@@ -35,7 +37,7 @@ namespace types
     Callable *         getAsCallable() { return this; }
     bool isCallable() { return true; }
 
-    virtual ReturnValue call(typed_list &in, int _iRetCount, typed_list &out) = 0;
+               virtual ReturnValue call(typed_list &in, int _iRetCount, typed_list &out, ast::RunVisitor* execFunc) = 0;
     
     void setName(std::string _stName) { m_stName = _stName; }
     std::string getName() { return m_stName; }
index 6dce5bc..5a7cc2d 100644 (file)
@@ -50,7 +50,7 @@ namespace types
 
     std::string toString(int _iPrecision, int _iLineLen);
 
-    virtual ReturnValue call(typed_list &in, int _iRetCount, typed_list &out);
+               virtual ReturnValue call(typed_list &in, int _iRetCount, typed_list &out, ast::RunVisitor* execFunc);
 
 
   private :
@@ -61,7 +61,8 @@ namespace types
   {
   public :
     WrapFunction(std::string _szName, OLDGW_FUNC _pFunc, std::string _szModule);
-    Callable::ReturnValue call(typed_list &in, int _iRetCount, typed_list &out);
+
+               Callable::ReturnValue call(typed_list &in, int _iRetCount, typed_list &out, ast::RunVisitor* execFunc);
   private :
     OLDGW_FUNC m_pOldFunc;
                InternalType* m_pTempOut[MAX_OUTPUT_VARIABLE];
index 02d4b3b..a29fbb3 100644 (file)
@@ -14,8 +14,8 @@
 #define __MACRO_HXX__
 
 #include <list>
-#include "callable.hxx"
 #include "types.hxx"
+#include "callable.hxx"
 #include "symbol.hxx"
 #include "seqexp.hxx"
 
@@ -38,7 +38,7 @@ namespace types
 
     std::string toString(int _iPrecision, int _iLineLen);
     
-    Callable::ReturnValue call(typed_list &in, int _iRetCount, typed_list &out);
+               Callable::ReturnValue call(typed_list &in, int _iRetCount, typed_list &out, ast::RunVisitor* execFunc);
     
                ast::SeqExp* body_get();
 
index 335c708..ee115a3 100644 (file)
@@ -37,7 +37,7 @@ namespace types
 
     std::string toString(int _iPrecision, int _iLineLen);
 
-    Callable::ReturnValue call(typed_list &in, int _iRetCount, typed_list &out);
+               Callable::ReturnValue call(typed_list &in, int _iRetCount, typed_list &out, ast::RunVisitor* execFunc);
                bool parse(void);
   
                Macro* macro_get(void);
index e159414..35b6e88 100644 (file)
@@ -47,7 +47,7 @@ namespace types
     return this; 
   }
 
-  Function::ReturnValue Function::call(typed_list &in, int _iRetCount, typed_list &out)
+       Function::ReturnValue Function::call(typed_list &in, int _iRetCount, typed_list &out, RunVisitor* execFunc)
   {
     return this->m_pFunc(in, _iRetCount, out);
   }
@@ -67,7 +67,7 @@ namespace types
     m_stModule = _stModule;
   }
 
-  Function::ReturnValue WrapFunction::call(typed_list &in, int _iRetCount, typed_list &out) 
+       Function::ReturnValue WrapFunction::call(typed_list &in, int _iRetCount, typed_list &out, ast::RunVisitor* execFunc) 
   {
     ReturnValue retVal = Callable::OK;
     GatewayStruct* pStr = new GatewayStruct();
index fc430f7..3958f0f 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "macro.hxx"
 #include "context.hxx"
-#include "execvisitor.hxx"
 #include "stack-def.h"
 #include "localization.h"
 #include "yaspio.hxx"
@@ -73,7 +72,7 @@ namespace types
          return ostr.str();
        }
        
-       Callable::ReturnValue Macro::call(typed_list &in, int _iRetCount, typed_list &out)
+       Callable::ReturnValue Macro::call(typed_list &in, int _iRetCount, typed_list &out, ast::RunVisitor* execFunc)
        {
                ReturnValue RetVal = Callable::OK;
                //check excepted and input/output parameters numbers
@@ -84,7 +83,7 @@ namespace types
 
                std::list<std::string>::const_iterator i;
                typed_list::const_iterator j;
-               ast::ExecVisitor execFunc;
+               //ast::ExecVisitor execFunc;
 
                //open a new scope
                symbol::Context *pContext = symbol::Context::getInstance();
@@ -99,7 +98,7 @@ namespace types
                try
                {
                        m_body->returnable_set();
-                       m_body->accept(execFunc);
+                       m_body->accept(*execFunc);
                        if(m_body->is_return())
                        {
                                m_body->returnable_set();                               
index e870953..ba1f242 100644 (file)
@@ -14,7 +14,6 @@
 #include <sstream>
 #include "macrofile.hxx"
 #include "context.hxx"
-#include "execvisitor.hxx"
 #include "localization.h"
 #include "yaspio.hxx"
 #include "parser.hxx"
@@ -69,14 +68,14 @@ namespace types
          return ostr.str();
        }
 
-       Callable::ReturnValue MacroFile::call(typed_list &in, int _iRetCount, typed_list &out)
+       Callable::ReturnValue MacroFile::call(typed_list &in, int _iRetCount, typed_list &out, RunVisitor* execFunc)
        {
                ReturnValue RetVal = Callable::OK;
 
                parse();
                if(m_pMacro)
                {
-                       ReturnValue Val =  m_pMacro->call(in, _iRetCount, out);
+                       ReturnValue Val =  m_pMacro->call(in, _iRetCount, out, execFunc);
                        return Val;
                }
                else