mirror of https://github.com/Icinga/icinga2.git
parent
604b080c59
commit
363f23b1d8
|
@ -27,7 +27,7 @@ set(base_SOURCES
|
|||
convert.cpp debuginfo.cpp dictionary.cpp dictionary-script.cpp dynamicobject.cpp dynamicobject.thpp dynamictype.cpp
|
||||
exception.cpp fifo.cpp filelogger.cpp filelogger.thpp initialize.cpp json.cpp logger.cpp logger.thpp math-script.cpp
|
||||
netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp object-script.cpp primitivetype.cpp process.cpp
|
||||
ringbuffer.cpp scriptframe.cpp scriptfunction.cpp scriptfunction-script.cpp scriptfunctionwrapper.cpp scriptglobal.cpp
|
||||
ringbuffer.cpp scriptframe.cpp function.cpp function-script.cpp functionwrapper.cpp scriptglobal.cpp
|
||||
scriptutils.cpp serializer.cpp socket.cpp stacktrace.cpp
|
||||
statsfunction.cpp stdiostream.cpp stream.cpp streamlogger.cpp streamlogger.thpp string.cpp string-script.cpp
|
||||
sysloglogger.cpp sysloglogger.thpp tcpsocket.cpp thinmutex.cpp threadpool.cpp timer.cpp
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "base/array.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
|
||||
|
@ -67,7 +67,7 @@ static void ArrayClear(void)
|
|||
self->Clear();
|
||||
}
|
||||
|
||||
static bool ArraySortCmp(const ScriptFunction::Ptr& cmp, const Value& a, const Value& b)
|
||||
static bool ArraySortCmp(const Function::Ptr& cmp, const Value& a, const Value& b)
|
||||
{
|
||||
std::vector<Value> args;
|
||||
args.push_back(a);
|
||||
|
@ -106,14 +106,14 @@ Object::Ptr Array::GetPrototype(void)
|
|||
|
||||
if (!prototype) {
|
||||
prototype = new Dictionary();
|
||||
prototype->Set("len", new ScriptFunction(WrapScriptFunction(ArrayLen)));
|
||||
prototype->Set("set", new ScriptFunction(WrapScriptFunction(ArraySet)));
|
||||
prototype->Set("add", new ScriptFunction(WrapScriptFunction(ArrayAdd)));
|
||||
prototype->Set("remove", new ScriptFunction(WrapScriptFunction(ArrayRemove)));
|
||||
prototype->Set("contains", new ScriptFunction(WrapScriptFunction(ArrayContains)));
|
||||
prototype->Set("clear", new ScriptFunction(WrapScriptFunction(ArrayClear)));
|
||||
prototype->Set("sort", new ScriptFunction(WrapScriptFunction(ArraySort)));
|
||||
prototype->Set("clone", new ScriptFunction(WrapScriptFunction(ArrayClone)));
|
||||
prototype->Set("len", new Function(WrapFunction(ArrayLen)));
|
||||
prototype->Set("set", new Function(WrapFunction(ArraySet)));
|
||||
prototype->Set("add", new Function(WrapFunction(ArrayAdd)));
|
||||
prototype->Set("remove", new Function(WrapFunction(ArrayRemove)));
|
||||
prototype->Set("contains", new Function(WrapFunction(ArrayContains)));
|
||||
prototype->Set("clear", new Function(WrapFunction(ArrayClear)));
|
||||
prototype->Set("sort", new Function(WrapFunction(ArraySort)));
|
||||
prototype->Set("clone", new Function(WrapFunction(ArrayClone)));
|
||||
}
|
||||
|
||||
return prototype;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include "base/boolean.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -38,7 +38,7 @@ Object::Ptr Boolean::GetPrototype(void)
|
|||
|
||||
if (!prototype) {
|
||||
prototype = new Dictionary();
|
||||
prototype->Set("to_string", new ScriptFunction(WrapScriptFunction(BooleanToString)));
|
||||
prototype->Set("to_string", new Function(WrapFunction(BooleanToString)));
|
||||
}
|
||||
|
||||
return prototype;
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "base/dictionary.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -65,11 +65,11 @@ Object::Ptr Dictionary::GetPrototype(void)
|
|||
|
||||
if (!prototype) {
|
||||
prototype = new Dictionary();
|
||||
prototype->Set("len", new ScriptFunction(WrapScriptFunction(DictionaryLen)));
|
||||
prototype->Set("set", new ScriptFunction(WrapScriptFunction(DictionarySet)));
|
||||
prototype->Set("remove", new ScriptFunction(WrapScriptFunction(DictionaryRemove)));
|
||||
prototype->Set("contains", new ScriptFunction(WrapScriptFunction(DictionaryContains)));
|
||||
prototype->Set("clone", new ScriptFunction(WrapScriptFunction(DictionaryClone)));
|
||||
prototype->Set("len", new Function(WrapFunction(DictionaryLen)));
|
||||
prototype->Set("set", new Function(WrapFunction(DictionarySet)));
|
||||
prototype->Set("remove", new Function(WrapFunction(DictionaryRemove)));
|
||||
prototype->Set("contains", new Function(WrapFunction(DictionaryContains)));
|
||||
prototype->Set("clone", new Function(WrapFunction(DictionaryClone)));
|
||||
}
|
||||
|
||||
return prototype;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "base/objectlock.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/workqueue.hpp"
|
||||
#include "base/context.hpp"
|
||||
|
|
|
@ -17,31 +17,31 @@
|
|||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/exception.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
static Value ScriptFunctionCall(const std::vector<Value>& args)
|
||||
static Value FunctionCall(const std::vector<Value>& args)
|
||||
{
|
||||
if (args.size() < 1)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for call()"));
|
||||
|
||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||
ScriptFunction::Ptr self = static_cast<ScriptFunction::Ptr>(vframe->Self);
|
||||
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
|
||||
|
||||
ScriptFrame uframe(args[0]);
|
||||
std::vector<Value> uargs(args.begin() + 1, args.end());
|
||||
return self->Invoke(uargs);
|
||||
}
|
||||
|
||||
static Value ScriptFunctionCallV(const Value& thisArg, const Array::Ptr& args)
|
||||
static Value FunctionCallV(const Value& thisArg, const Array::Ptr& args)
|
||||
{
|
||||
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
|
||||
ScriptFunction::Ptr self = static_cast<ScriptFunction::Ptr>(vframe->Self);
|
||||
Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
|
||||
|
||||
ScriptFrame uframe(thisArg);
|
||||
std::vector<Value> uargs;
|
||||
|
@ -55,14 +55,14 @@ static Value ScriptFunctionCallV(const Value& thisArg, const Array::Ptr& args)
|
|||
}
|
||||
|
||||
|
||||
Object::Ptr ScriptFunction::GetPrototype(void)
|
||||
Object::Ptr Function::GetPrototype(void)
|
||||
{
|
||||
static Dictionary::Ptr prototype;
|
||||
|
||||
if (!prototype) {
|
||||
prototype = new Dictionary();
|
||||
prototype->Set("call", new ScriptFunction(WrapScriptFunction(ScriptFunctionCall)));
|
||||
prototype->Set("callv", new ScriptFunction(WrapScriptFunction(ScriptFunctionCallV)));
|
||||
prototype->Set("call", new Function(WrapFunction(FunctionCall)));
|
||||
prototype->Set("callv", new Function(WrapFunction(FunctionCallV)));
|
||||
}
|
||||
|
||||
return prototype;
|
|
@ -17,19 +17,19 @@
|
|||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/primitivetype.hpp"
|
||||
#include "base/dictionary.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
REGISTER_PRIMITIVE_TYPE(ScriptFunction, ScriptFunction::GetPrototype());
|
||||
REGISTER_PRIMITIVE_TYPE(Function, Function::GetPrototype());
|
||||
|
||||
ScriptFunction::ScriptFunction(const Callback& function)
|
||||
Function::Function(const Callback& function)
|
||||
: m_Callback(function)
|
||||
{ }
|
||||
|
||||
Value ScriptFunction::Invoke(const std::vector<Value>& arguments)
|
||||
Value Function::Invoke(const std::vector<Value>& arguments)
|
||||
{
|
||||
return m_Callback(arguments);
|
||||
}
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "base/i2-base.hpp"
|
||||
#include "base/value.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptglobal.hpp"
|
||||
#include <vector>
|
||||
#include <boost/function.hpp>
|
||||
|
@ -35,14 +35,14 @@ namespace icinga
|
|||
*
|
||||
* @ingroup base
|
||||
*/
|
||||
class I2_BASE_API ScriptFunction : public Object
|
||||
class I2_BASE_API Function : public Object
|
||||
{
|
||||
public:
|
||||
DECLARE_OBJECT(ScriptFunction);
|
||||
DECLARE_OBJECT(Function);
|
||||
|
||||
typedef boost::function<Value (const std::vector<Value>& arguments)> Callback;
|
||||
|
||||
ScriptFunction(const Callback& function);
|
||||
Function(const Callback& function);
|
||||
|
||||
Value Invoke(const std::vector<Value>& arguments);
|
||||
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
#define REGISTER_SCRIPTFUNCTION(name, callback) \
|
||||
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## name { \
|
||||
void RegisterFunction(void) { \
|
||||
ScriptFunction::Ptr sf = new icinga::ScriptFunction(WrapScriptFunction(callback)); \
|
||||
Function::Ptr sf = new icinga::Function(WrapFunction(callback)); \
|
||||
ScriptGlobal::Set(#name, sf); \
|
||||
} \
|
||||
INITIALIZE_ONCE(RegisterFunction); \
|
|
@ -17,25 +17,25 @@
|
|||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
******************************************************************************/
|
||||
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
Value icinga::ScriptFunctionWrapperVV(void (*function)(void), const std::vector<Value>&)
|
||||
Value icinga::FunctionWrapperVV(void (*function)(void), const std::vector<Value>&)
|
||||
{
|
||||
function();
|
||||
|
||||
return Empty;
|
||||
}
|
||||
|
||||
Value icinga::ScriptFunctionWrapperVA(void (*function)(const std::vector<Value>&), const std::vector<Value>& arguments)
|
||||
Value icinga::FunctionWrapperVA(void (*function)(const std::vector<Value>&), const std::vector<Value>& arguments)
|
||||
{
|
||||
function(arguments);
|
||||
|
||||
return Empty;
|
||||
}
|
||||
|
||||
boost::function<Value (const std::vector<Value>& arguments)> icinga::WrapScriptFunction(void (*function)(void))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> icinga::WrapFunction(void (*function)(void))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperVV, function, _1);
|
||||
return boost::bind(&FunctionWrapperVV, function, _1);
|
||||
}
|
|
@ -29,25 +29,25 @@
|
|||
namespace icinga
|
||||
{
|
||||
|
||||
Value ScriptFunctionWrapperVV(void (*function)(void), const std::vector<Value>& arguments);
|
||||
Value ScriptFunctionWrapperVA(void (*function)(const std::vector<Value>&), const std::vector<Value>& arguments);
|
||||
Value FunctionWrapperVV(void (*function)(void), const std::vector<Value>& arguments);
|
||||
Value FunctionWrapperVA(void (*function)(const std::vector<Value>&), const std::vector<Value>& arguments);
|
||||
|
||||
boost::function<Value (const std::vector<Value>& arguments)> I2_BASE_API WrapScriptFunction(void (*function)(void));
|
||||
boost::function<Value (const std::vector<Value>& arguments)> I2_BASE_API WrapFunction(void (*function)(void));
|
||||
|
||||
template<typename TR>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(void), const std::vector<Value>&)
|
||||
Value FunctionWrapperR(TR (*function)(void), const std::vector<Value>&)
|
||||
{
|
||||
return function();
|
||||
}
|
||||
|
||||
template<typename TR>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(void))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(void))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR>, function, _1);
|
||||
}
|
||||
|
||||
template<typename T0>
|
||||
Value ScriptFunctionWrapperV(void (*function)(T0), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperV(void (*function)(T0), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 1)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -58,13 +58,13 @@ Value ScriptFunctionWrapperV(void (*function)(T0), const std::vector<Value>& arg
|
|||
}
|
||||
|
||||
template<typename T0>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperV<T0>, function, _1);
|
||||
return boost::bind(&FunctionWrapperV<T0>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR, typename T0>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(T0), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperR(TR (*function)(T0), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 1)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -73,13 +73,13 @@ Value ScriptFunctionWrapperR(TR (*function)(T0), const std::vector<Value>& argum
|
|||
}
|
||||
|
||||
template<typename TR, typename T0>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR, T0>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR, T0>, function, _1);
|
||||
}
|
||||
|
||||
template<typename T0, typename T1>
|
||||
Value ScriptFunctionWrapperV(void (*function)(T0, T1), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperV(void (*function)(T0, T1), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 2)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -91,13 +91,13 @@ Value ScriptFunctionWrapperV(void (*function)(T0, T1), const std::vector<Value>&
|
|||
}
|
||||
|
||||
template<typename T0, typename T1>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperV<T0, T1>, function, _1);
|
||||
return boost::bind(&FunctionWrapperV<T0, T1>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(T0, T1), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperR(TR (*function)(T0, T1), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 2)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -107,13 +107,13 @@ Value ScriptFunctionWrapperR(TR (*function)(T0, T1), const std::vector<Value>& a
|
|||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR, T0, T1>, function, _1);
|
||||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2>
|
||||
Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperV(void (*function)(T0, T1, T2), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 3)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -126,13 +126,13 @@ Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2), const std::vector<Val
|
|||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2>, function, _1);
|
||||
return boost::bind(&FunctionWrapperV<T0, T1, T2>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperR(TR (*function)(T0, T1, T2), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 3)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -143,13 +143,13 @@ Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2), const std::vector<Value
|
|||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR, T0, T1, T2>, function, _1);
|
||||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3>
|
||||
Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperV(void (*function)(T0, T1, T2, T3), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 4)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -163,13 +163,13 @@ Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3), const std::vector
|
|||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3>, function, _1);
|
||||
return boost::bind(&FunctionWrapperV<T0, T1, T2, T3>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 4)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -181,13 +181,13 @@ Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3), const std::vector<V
|
|||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3>, function, _1);
|
||||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 5)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -202,13 +202,13 @@ Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4), const std::ve
|
|||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3, T4))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3, T4>, function, _1);
|
||||
return boost::bind(&FunctionWrapperV<T0, T1, T2, T3, T4>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 5)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -221,13 +221,13 @@ Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4), const std::vect
|
|||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3, T4))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3, T4>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3, T4>, function, _1);
|
||||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 6)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -243,13 +243,13 @@ Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5), const std
|
|||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3, T4, T5))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3, T4, T5>, function, _1);
|
||||
return boost::bind(&FunctionWrapperV<T0, T1, T2, T3, T4, T5>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 6)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -263,13 +263,13 @@ Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5), const std::
|
|||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3, T4, T5))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3, T4, T5>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3, T4, T5>, function, _1);
|
||||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 7)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -286,13 +286,13 @@ Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6), const
|
|||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3, T4, T5, T6>, function, _1);
|
||||
return boost::bind(&FunctionWrapperV<T0, T1, T2, T3, T4, T5, T6>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 7)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -307,13 +307,13 @@ Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6), const s
|
|||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3, T4, T5, T6>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3, T4, T5, T6>, function, _1);
|
||||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 8)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -331,13 +331,13 @@ Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7), c
|
|||
}
|
||||
|
||||
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3, T4, T5, T6, T7>, function, _1);
|
||||
return boost::bind(&FunctionWrapperV<T0, T1, T2, T3, T4, T5, T6, T7>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std::vector<Value>& arguments)
|
||||
Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std::vector<Value>& arguments)
|
||||
{
|
||||
if (arguments.size() < 8)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
|
||||
|
@ -353,20 +353,20 @@ Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7), con
|
|||
}
|
||||
|
||||
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7))
|
||||
boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3, T4, T5, T6, T7>, function, _1);
|
||||
return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3, T4, T5, T6, T7>, function, _1);
|
||||
}
|
||||
|
||||
template<typename TR>
|
||||
boost::function<TR (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(const std::vector<Value>&))
|
||||
boost::function<TR (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(const std::vector<Value>&))
|
||||
{
|
||||
return boost::bind<TR>(function, _1);
|
||||
}
|
||||
|
||||
inline boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(const std::vector<Value>&))
|
||||
inline boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(const std::vector<Value>&))
|
||||
{
|
||||
return boost::bind(&ScriptFunctionWrapperVA, function, _1);
|
||||
return boost::bind(&FunctionWrapperVA, function, _1);
|
||||
}
|
||||
|
||||
}
|
|
@ -18,8 +18,8 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "base/dictionary.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include <boost/math/special_functions/round.hpp>
|
||||
|
@ -174,27 +174,27 @@ static void InitializeMathObj(void)
|
|||
mathObj->Set("SQRT2", 1.41421356237309504880);
|
||||
|
||||
/* Methods */
|
||||
mathObj->Set("abs", new ScriptFunction(WrapScriptFunction(MathAbs)));
|
||||
mathObj->Set("acos", new ScriptFunction(WrapScriptFunction(MathAcos)));
|
||||
mathObj->Set("asin", new ScriptFunction(WrapScriptFunction(MathAsin)));
|
||||
mathObj->Set("atan", new ScriptFunction(WrapScriptFunction(MathAtan)));
|
||||
mathObj->Set("atan2", new ScriptFunction(WrapScriptFunction(MathAtan2)));
|
||||
mathObj->Set("ceil", new ScriptFunction(WrapScriptFunction(MathCeil)));
|
||||
mathObj->Set("cos", new ScriptFunction(WrapScriptFunction(MathCos)));
|
||||
mathObj->Set("exp", new ScriptFunction(WrapScriptFunction(MathExp)));
|
||||
mathObj->Set("floor", new ScriptFunction(WrapScriptFunction(MathFloor)));
|
||||
mathObj->Set("log", new ScriptFunction(WrapScriptFunction(MathLog)));
|
||||
mathObj->Set("max", new ScriptFunction(WrapScriptFunction(MathMax)));
|
||||
mathObj->Set("min", new ScriptFunction(WrapScriptFunction(MathMin)));
|
||||
mathObj->Set("pow", new ScriptFunction(WrapScriptFunction(MathPow)));
|
||||
mathObj->Set("random", new ScriptFunction(WrapScriptFunction(MathRandom)));
|
||||
mathObj->Set("round", new ScriptFunction(WrapScriptFunction(MathRound)));
|
||||
mathObj->Set("sin", new ScriptFunction(WrapScriptFunction(MathSin)));
|
||||
mathObj->Set("sqrt", new ScriptFunction(WrapScriptFunction(MathSqrt)));
|
||||
mathObj->Set("tan", new ScriptFunction(WrapScriptFunction(MathTan)));
|
||||
mathObj->Set("isnan", new ScriptFunction(WrapScriptFunction(MathIsnan)));
|
||||
mathObj->Set("isinf", new ScriptFunction(WrapScriptFunction(MathIsinf)));
|
||||
mathObj->Set("sign", new ScriptFunction(WrapScriptFunction(MathSign)));
|
||||
mathObj->Set("abs", new Function(WrapFunction(MathAbs)));
|
||||
mathObj->Set("acos", new Function(WrapFunction(MathAcos)));
|
||||
mathObj->Set("asin", new Function(WrapFunction(MathAsin)));
|
||||
mathObj->Set("atan", new Function(WrapFunction(MathAtan)));
|
||||
mathObj->Set("atan2", new Function(WrapFunction(MathAtan2)));
|
||||
mathObj->Set("ceil", new Function(WrapFunction(MathCeil)));
|
||||
mathObj->Set("cos", new Function(WrapFunction(MathCos)));
|
||||
mathObj->Set("exp", new Function(WrapFunction(MathExp)));
|
||||
mathObj->Set("floor", new Function(WrapFunction(MathFloor)));
|
||||
mathObj->Set("log", new Function(WrapFunction(MathLog)));
|
||||
mathObj->Set("max", new Function(WrapFunction(MathMax)));
|
||||
mathObj->Set("min", new Function(WrapFunction(MathMin)));
|
||||
mathObj->Set("pow", new Function(WrapFunction(MathPow)));
|
||||
mathObj->Set("random", new Function(WrapFunction(MathRandom)));
|
||||
mathObj->Set("round", new Function(WrapFunction(MathRound)));
|
||||
mathObj->Set("sin", new Function(WrapFunction(MathSin)));
|
||||
mathObj->Set("sqrt", new Function(WrapFunction(MathSqrt)));
|
||||
mathObj->Set("tan", new Function(WrapFunction(MathTan)));
|
||||
mathObj->Set("isnan", new Function(WrapFunction(MathIsnan)));
|
||||
mathObj->Set("isinf", new Function(WrapFunction(MathIsinf)));
|
||||
mathObj->Set("sign", new Function(WrapFunction(MathSign)));
|
||||
|
||||
ScriptGlobal::Set("Math", mathObj);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include "base/number.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -38,7 +38,7 @@ Object::Ptr Number::GetPrototype(void)
|
|||
|
||||
if (!prototype) {
|
||||
prototype = new Dictionary();
|
||||
prototype->Set("to_string", new ScriptFunction(WrapScriptFunction(NumberToString)));
|
||||
prototype->Set("to_string", new Function(WrapFunction(NumberToString)));
|
||||
}
|
||||
|
||||
return prototype;
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include "base/object.hpp"
|
||||
#include "base/dictionary.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -38,7 +38,7 @@ Object::Ptr Object::GetPrototype(void)
|
|||
|
||||
if (!prototype) {
|
||||
prototype = new Dictionary();
|
||||
prototype->Set("to_string", new ScriptFunction(WrapScriptFunction(ObjectToString)));
|
||||
prototype->Set("to_string", new Function(WrapFunction(ObjectToString)));
|
||||
}
|
||||
|
||||
return prototype;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "base/scriptutils.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/json.hpp"
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
#include "base/object.hpp"
|
||||
#include "base/dictionary.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/scriptfunctionwrapper.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/functionwrapper.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
@ -126,14 +126,14 @@ Object::Ptr String::GetPrototype(void)
|
|||
|
||||
if (!prototype) {
|
||||
prototype = new Dictionary();
|
||||
prototype->Set("len", new ScriptFunction(WrapScriptFunction(StringLen)));
|
||||
prototype->Set("to_string", new ScriptFunction(WrapScriptFunction(StringToString)));
|
||||
prototype->Set("substr", new ScriptFunction(WrapScriptFunction(StringSubstr)));
|
||||
prototype->Set("upper", new ScriptFunction(WrapScriptFunction(StringUpper)));
|
||||
prototype->Set("lower", new ScriptFunction(WrapScriptFunction(StringLower)));
|
||||
prototype->Set("split", new ScriptFunction(WrapScriptFunction(StringSplit)));
|
||||
prototype->Set("find", new ScriptFunction(WrapScriptFunction(StringFind)));
|
||||
prototype->Set("replace", new ScriptFunction(WrapScriptFunction(StringReplace)));
|
||||
prototype->Set("len", new Function(WrapFunction(StringLen)));
|
||||
prototype->Set("to_string", new Function(WrapFunction(StringToString)));
|
||||
prototype->Set("substr", new Function(WrapFunction(StringSubstr)));
|
||||
prototype->Set("upper", new Function(WrapFunction(StringUpper)));
|
||||
prototype->Set("lower", new Function(WrapFunction(StringLower)));
|
||||
prototype->Set("split", new Function(WrapFunction(StringSplit)));
|
||||
prototype->Set("find", new Function(WrapFunction(StringFind)));
|
||||
prototype->Set("replace", new Function(WrapFunction(StringReplace)));
|
||||
}
|
||||
|
||||
return prototype;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "base/convert.hpp"
|
||||
#include "base/application.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/statsfunction.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "base/serializer.hpp"
|
||||
#include "base/json.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "base/objectlock.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/singleton.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
@ -172,7 +172,7 @@ void ConfigType::ValidateObject(const Object::Ptr& object,
|
|||
String validator = ruleList->GetValidator();
|
||||
|
||||
if (!validator.IsEmpty()) {
|
||||
ScriptFunction::Ptr func = ScriptGlobal::Get(validator, &Empty);
|
||||
Function::Ptr func = ScriptGlobal::Get(validator, &Empty);
|
||||
|
||||
if (!func)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Validator function '" + validator + "' does not exist."));
|
||||
|
@ -229,7 +229,7 @@ void ConfigType::ValidateArray(const Array::Ptr& array,
|
|||
String validator = ruleList->GetValidator();
|
||||
|
||||
if (!validator.IsEmpty()) {
|
||||
ScriptFunction::Ptr func = ScriptGlobal::Get(validator, &Empty);
|
||||
Function::Ptr func = ScriptGlobal::Get(validator, &Empty);
|
||||
|
||||
if (!func)
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("Validator function '" + validator + "' does not exist."));
|
||||
|
|
|
@ -267,10 +267,10 @@ Value FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) c
|
|||
else
|
||||
vfunc = m_FName->Evaluate(frame);
|
||||
|
||||
if (!vfunc.IsObjectType<ScriptFunction>())
|
||||
if (!vfunc.IsObjectType<Function>())
|
||||
BOOST_THROW_EXCEPTION(ScriptError("Argument is not a callable object.", m_DebugInfo));
|
||||
|
||||
ScriptFunction::Ptr func = vfunc;
|
||||
Function::Ptr func = vfunc;
|
||||
|
||||
std::vector<Value> arguments;
|
||||
BOOST_FOREACH(Expression *arg, m_Args) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "base/debuginfo.hpp"
|
||||
#include "base/array.hpp"
|
||||
#include "base/dictionary.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include "base/scriptframe.hpp"
|
||||
#include "base/convert.hpp"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "base/debuginfo.hpp"
|
||||
#include "base/array.hpp"
|
||||
#include "base/dictionary.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/scriptglobal.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include "base/convert.hpp"
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
return ScriptGlobal::Get(name);
|
||||
}
|
||||
|
||||
static inline Value FunctionCall(ScriptFrame& frame, const Value& self, const ScriptFunction::Ptr& func, const std::vector<Value>& arguments)
|
||||
static inline Value FunctionCall(ScriptFrame& frame, const Value& self, const Function::Ptr& func, const std::vector<Value>& arguments)
|
||||
{
|
||||
boost::shared_ptr<ScriptFrame> vframe;
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
static inline Value NewFunction(ScriptFrame& frame, const std::vector<String>& args,
|
||||
std::map<String, Expression *> *closedVars, const boost::shared_ptr<Expression>& expression)
|
||||
{
|
||||
return new ScriptFunction(boost::bind(&FunctionWrapper, _1, args,
|
||||
return new Function(boost::bind(&FunctionWrapper, _1, args,
|
||||
EvaluateClosedVars(frame, closedVars), expression));
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "base/utility.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "icinga/checkable.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/bind/apply.hpp>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "icinga/command.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/exception.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "icinga/customvarobject.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ abstract class Command : CustomVarObject
|
|||
default {{{ return 60; }}}
|
||||
};
|
||||
[config] Dictionary::Ptr env;
|
||||
[config] ScriptFunction::Ptr execute;
|
||||
[config] Function::Ptr execute;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "icinga/dependency.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "icinga/legacytimeperiod.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "base/exception.hpp"
|
||||
#include "base/initialize.hpp"
|
||||
#include "base/scriptglobal.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "icinga/customvarobject.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ class TimePeriod : CustomVarObject
|
|||
}}}
|
||||
};
|
||||
[config] Dictionary::Ptr ranges;
|
||||
[config] ScriptFunction::Ptr update;
|
||||
[config] Function::Ptr update;
|
||||
[state] Value valid_begin;
|
||||
[state] Value valid_end;
|
||||
[state] Array::Ptr segments;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "icinga/usergroup.hpp"
|
||||
#include "icinga/notification.hpp"
|
||||
#include "icinga/usergroup.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "base/unixsocket.hpp"
|
||||
#include "base/networkstream.hpp"
|
||||
#include "base/application.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/statsfunction.hpp"
|
||||
#include "base/convert.hpp"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "icinga/icingaapplication.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/process.hpp"
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "base/objectlock.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "remote/apilistener.hpp"
|
||||
#include "remote/endpoint.hpp"
|
||||
#include "remote/zone.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "base/application.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "icinga/perfdatavalue.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "methods/nulleventtask.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "icinga/icingaapplication.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/process.hpp"
|
||||
#include "base/convert.hpp"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "icinga/icingaapplication.hpp"
|
||||
#include "base/dynamictype.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/process.hpp"
|
||||
#include "base/convert.hpp"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "icinga/service.hpp"
|
||||
#include "icinga/macroprocessor.hpp"
|
||||
#include "icinga/icingaapplication.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/process.hpp"
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "icinga/perfdatavalue.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
#include "base/logger.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "methods/timeperiodtask.hpp"
|
||||
#include "base/scriptfunction.hpp"
|
||||
#include "base/function.hpp"
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
|
Loading…
Reference in New Issue