2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2009-2010 - DIGITEO - Bruno JOFRET
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
22 #include "context.hxx"
24 #include "callable.hxx"
30 class EXTERN_AST Macro : public Callable
34 m_Nargin(symbol::Context::getInstance()->getOrCreate(symbol::Symbol(L"nargin"))),
35 m_Nargout(symbol::Context::getInstance()->getOrCreate(symbol::Symbol(L"nargout"))),
36 m_Varargin(symbol::Context::getInstance()->getOrCreate(symbol::Symbol(L"varargin"))),
37 m_Varargout(symbol::Context::getInstance()->getOrCreate(symbol::Symbol(L"varargout")))
41 Macro(const std::wstring& _stName, std::list<symbol::Variable*> &_inputArgs, std::list<symbol::Variable*> &_outputArgs, ast::SeqExp &_body, const std::wstring& _stModule);
44 // FIXME : Should not return NULL;
47 inline ScilabType getType(void)
51 inline ScilabId getId(void)
62 bool toString(std::wostringstream& ostr);
64 Callable::ReturnValue call(typed_list &in, optional_list &opt, int _iRetCount, typed_list &out) override;
66 inline void cleanCall(symbol::Context * pContext, int oldPromptMode);
68 ast::SeqExp* getBody();
70 /* return type as string ( double, int, cell, list, ... )*/
71 virtual std::wstring getTypeStr()
75 /* return type as short string ( s, i, ce, l, ... )*/
76 virtual std::wstring getShortTypeStr()
81 const std::wstring& getFileName()
86 void setFileName(const std::wstring& _fileName)
91 std::list<symbol::Variable*>* getInputs();
92 std::list<symbol::Variable*>* getOutputs();
94 virtual int getNbInputArgument(void);
95 virtual int getNbOutputArgument(void);
97 bool operator==(const InternalType& it);
99 void add_submacro(const symbol::Symbol& s, Macro* macro);
101 inline const std::map<symbol::Variable*, Macro*> & getSubMacros() const
106 inline const std::map<symbol::Variable*, Macro*> & getSubMacros()
112 std::list<symbol::Variable*>* m_inputArgs;
113 std::list<symbol::Variable*>* m_outputArgs;
116 symbol::Variable* m_Nargin;
117 symbol::Variable* m_Nargout;
118 symbol::Variable* m_Varargin;
119 symbol::Variable* m_Varargout;
121 Double* m_pDblArgOut;
122 std::map<symbol::Variable*, Macro*> m_submacro;
123 std::wstring m_stPath;
128 #endif /* !__MACRO_HXX__ */