src/cpp/ast/consoledebugger.cpp \
src/cpp/ast/debuggervisitor.cpp \
src/cpp/ast/debugmanager.cpp \
+src/cpp/ast/FBlockListener.cpp \
src/cpp/ast/prettyprintvisitor.cpp \
src/cpp/operations/interface_addition.cpp \
src/cpp/operations/operations.cpp \
src/cpp/ast/treevisitor.cpp src/cpp/ast/visitor_common.cpp \
src/cpp/ast/consoledebugger.cpp \
src/cpp/ast/debuggervisitor.cpp src/cpp/ast/debugmanager.cpp \
+ src/cpp/ast/FBlockListener.cpp \
src/cpp/ast/prettyprintvisitor.cpp \
src/cpp/operations/interface_addition.cpp \
src/cpp/operations/operations.cpp \
src/cpp/ast/libsciast_la-consoledebugger.lo \
src/cpp/ast/libsciast_la-debuggervisitor.lo \
src/cpp/ast/libsciast_la-debugmanager.lo \
+ src/cpp/ast/libsciast_la-FBlockListener.lo \
src/cpp/ast/libsciast_la-prettyprintvisitor.lo \
src/cpp/operations/libsciast_la-interface_addition.lo \
src/cpp/operations/libsciast_la-operations.lo \
src/cpp/ast/treevisitor.cpp src/cpp/ast/visitor_common.cpp \
src/cpp/ast/consoledebugger.cpp \
src/cpp/ast/debuggervisitor.cpp src/cpp/ast/debugmanager.cpp \
+ src/cpp/ast/FBlockListener.cpp \
src/cpp/ast/prettyprintvisitor.cpp \
src/cpp/operations/interface_addition.cpp \
src/cpp/operations/operations.cpp \
src/cpp/ast/$(DEPDIR)/$(am__dirstamp)
src/cpp/ast/libsciast_la-debugmanager.lo: src/cpp/ast/$(am__dirstamp) \
src/cpp/ast/$(DEPDIR)/$(am__dirstamp)
+src/cpp/ast/libsciast_la-FBlockListener.lo: \
+ src/cpp/ast/$(am__dirstamp) \
+ src/cpp/ast/$(DEPDIR)/$(am__dirstamp)
src/cpp/ast/libsciast_la-prettyprintvisitor.lo: \
src/cpp/ast/$(am__dirstamp) \
src/cpp/ast/$(DEPDIR)/$(am__dirstamp)
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/analysis/$(DEPDIR)/libsciast_la-check_uint64.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/analysis/$(DEPDIR)/libsciast_la-check_uint8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/analysis/$(DEPDIR)/libsciast_la-check_zeros.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/ast/$(DEPDIR)/libsciast_la-FBlockListener.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/ast/$(DEPDIR)/libsciast_la-consoledebugger.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/ast/$(DEPDIR)/libsciast_la-debuggervisitor.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/ast/$(DEPDIR)/libsciast_la-debugmanager.Plo@am__quote@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/ast/libsciast_la-debugmanager.lo `test -f 'src/cpp/ast/debugmanager.cpp' || echo '$(srcdir)/'`src/cpp/ast/debugmanager.cpp
+src/cpp/ast/libsciast_la-FBlockListener.lo: src/cpp/ast/FBlockListener.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/ast/libsciast_la-FBlockListener.lo -MD -MP -MF src/cpp/ast/$(DEPDIR)/libsciast_la-FBlockListener.Tpo -c -o src/cpp/ast/libsciast_la-FBlockListener.lo `test -f 'src/cpp/ast/FBlockListener.cpp' || echo '$(srcdir)/'`src/cpp/ast/FBlockListener.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/ast/$(DEPDIR)/libsciast_la-FBlockListener.Tpo src/cpp/ast/$(DEPDIR)/libsciast_la-FBlockListener.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/ast/FBlockListener.cpp' object='src/cpp/ast/libsciast_la-FBlockListener.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/ast/libsciast_la-FBlockListener.lo `test -f 'src/cpp/ast/FBlockListener.cpp' || echo '$(srcdir)/'`src/cpp/ast/FBlockListener.cpp
+
src/cpp/ast/libsciast_la-prettyprintvisitor.lo: src/cpp/ast/prettyprintvisitor.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsciast_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/ast/libsciast_la-prettyprintvisitor.lo -MD -MP -MF src/cpp/ast/$(DEPDIR)/libsciast_la-prettyprintvisitor.Tpo -c -o src/cpp/ast/libsciast_la-prettyprintvisitor.lo `test -f 'src/cpp/ast/prettyprintvisitor.cpp' || echo '$(srcdir)/'`src/cpp/ast/prettyprintvisitor.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/ast/$(DEPDIR)/libsciast_la-prettyprintvisitor.Tpo src/cpp/ast/$(DEPDIR)/libsciast_la-prettyprintvisitor.Plo
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<ClInclude Include="includes\ast\dynlib_ast.h" />
<ClInclude Include="includes\ast\execvisitor.hxx" />
<ClInclude Include="includes\ast\expHistory.hxx" />
+ <ClInclude Include="includes\ast\FBlockListener.hxx" />
<ClInclude Include="includes\ast\prettyprintvisitor.hxx" />
<ClInclude Include="includes\ast\treevisitor.hxx" />
<ClInclude Include="includes\ast\macrovarvisitor.hxx" />
<ClCompile Include="src\cpp\ast\debuggervisitor.cpp" />
<ClCompile Include="src\cpp\ast\debugmanager.cpp" />
<ClCompile Include="src\cpp\ast\expHistory.cpp" />
+ <ClCompile Include="src\cpp\ast\FBlockListener.cpp" />
<ClCompile Include="src\cpp\ast\prettyprintvisitor.cpp" />
<ClCompile Include="src\cpp\ast\treevisitor.cpp" />
<ClCompile Include="src\cpp\ast\macrovarvisitor.cpp" />
<ClInclude Include="src\cpp\ast\run_SeqExp.hpp">
<Filter>Header Files\ast</Filter>
</ClInclude>
+ <ClInclude Include="includes\ast\FBlockListener.hxx">
+ <Filter>Header Files\ast</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\cpp\ast\expHistory.cpp">
<ClCompile Include="src\cpp\analysis\VisitWhileExp.cpp">
<Filter>Source Files\analysis</Filter>
</ClCompile>
+ <ClCompile Include="src\cpp\ast\FBlockListener.cpp">
+ <Filter>Source Files\ast</Filter>
+ </ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
--- /dev/null
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2017 - ESI - Antoine ELIAS
+*
+* Copyright (C) 2012 - 2016 - Scilab Enterprises
+*
+* This file is hereby licensed under the terms of the GNU GPL v2.0,
+* pursuant to article 5.3.4 of the CeCILL v.2.1.
+* This file was originally licensed under the terms of the CeCILL v2.1,
+* and continues to be available under such terms.
+* For more information, see the COPYING file which you should have received
+* along with this program.
+*
+*/
+
+#ifndef __FBLOCK_LISTENER_HXX__
+#define __FBLOCK_LISTENER_HXX__
+
+#include "dynlib_ast.h"
+#include "FBlockEmittedListener.hxx"
+
+class EXTERN_AST FBlockListener : public analysis::FBlockEmittedListener
+{
+
+ static std::unordered_map<uint64_t, ast::Exp*> functions;
+public:
+ FBlockListener();
+ virtual void action(analysis::FunctionBlock & fblock);
+ static ast::Exp* getExp(uint64_t functionId);
+};
+
+#endif // __FBLOCK_LISTENER_HXX__
+
+
#ifndef __CALLABLE_HXX__
#define __CALLABLE_HXX__
+#include <stdint.h>
#include <string>
#include "internal.hxx"
Error
};
- Callable(): InternalType()
- {
- m_iFirstLine = 0;
- m_iLastLine = 0;
- }
+ Callable() : InternalType(), m_iFirstLine(0), m_iLastLine(0), m_functionId(-1) {}
+
virtual ~Callable() {}
bool isCallable()
std::wstring m_wstModule;
int m_iFirstLine;
int m_iLastLine;
+ uint64_t m_functionId;
};
}
--- /dev/null
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2017 - ESI - Antoine ELIAS
+*
+* Copyright (C) 2012 - 2016 - Scilab Enterprises
+*
+* This file is hereby licensed under the terms of the GNU GPL v2.0,
+* pursuant to article 5.3.4 of the CeCILL v.2.1.
+* This file was originally licensed under the terms of the CeCILL v2.1,
+* and continues to be available under such terms.
+* For more information, see the COPYING file which you should have received
+* along with this program.
+*
+*/
+
+#include "FBlockListener.hxx"
+
+std::unordered_map<uint64_t, ast::Exp*> FBlockListener::functions;
+
+FBlockListener::FBlockListener()
+{
+}
+
+void FBlockListener::action(analysis::FunctionBlock & fblock)
+{
+ std::wcerr << L"Add function \"" << fblock.getName() << L"\" as " << fblock.getFunctionId() << std::endl;
+ functions[fblock.getFunctionId()] = fblock.getExp()->clone();
+}
+
+ast::Exp* FBlockListener::getExp(uint64_t functionId)
+{
+ auto it = functions.find(functionId);
+ if (it != functions.end())
+ {
+ return it->second;
+ }
+ else
+ {
+ return nullptr;
+ }
+}
\ No newline at end of file
#include "configvariable.hxx"
#include "exp.hxx"
#include "scilabexception.hxx"
+#include "FBlockListener.hxx"
namespace types
{
try
{
+ if (ConfigVariable::getAnalyzerOptions() == 1)
+ {
+ m_functionId = e.getDecorator().res.getFunctionId();
+ }
+
Ret = call(in, opt, _iRetCount, out);
ConfigVariable::where_end();
ConfigVariable::decreaseRecursion();
#include <sstream>
#include <cstdio>
+#include "AnalysisVisitor.hxx"
#include "macro.hxx"
#include "list.hxx"
#include "context.hxx"
#include "scilabWrite.hxx"
#include "configvariable.hxx"
#include "serializervisitor.hxx"
+#include "FBlockListener.hxx"
extern "C"
{
try
{
ConfigVariable::setPromptMode(-1);
- m_body->accept(*exec);
+
+ //use version from analyze
+ if (m_functionId != -1)
+ {
+ ast::Exp* exp = FBlockListener::getExp(m_functionId);
+ if (exp)
+ {
+ //std::wcerr << "exec new exp" << std::endl;
+ exp->accept(*exec);
+ }
+ else
+ {
+ m_body->accept(*exec);
+ }
+ }
+ else
+ {
+ m_body->accept(*exec);
+ }
+
//restore previous prompt mode
ConfigVariable::setPromptMode(oldVal);
}
*/
#include "AnalysisVisitor.hxx"
+#include "FBlockListener.hxx"
#include "tasks.hxx"
#include "timer.hxx"
#include "context.hxx"
//call analyzer visitor before exec visitor
if (ConfigVariable::getAnalyzerOptions() == 1)
{
+ FBlockListener fb;
analysis::AnalysisVisitor analysis;
+ analysis.registerFBlockEmittedListener(&fb);
newTree->accept(analysis);
}