mkclass_target(configobject.ti configobject.tcpp configobject.thpp)
mkclass_target(datetime.ti datetime.tcpp datetime.thpp)
mkclass_target(filelogger.ti filelogger.tcpp filelogger.thpp)
+mkclass_target(function.ti function.tcpp function.thpp)
mkclass_target(logger.ti logger.tcpp logger.thpp)
mkclass_target(streamlogger.ti streamlogger.tcpp streamlogger.thpp)
mkclass_target(sysloglogger.ti sysloglogger.tcpp sysloglogger.thpp)
json-script.cpp loader.cpp logger.cpp logger.thpp math-script.cpp
netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp
object-script.cpp objecttype.cpp primitivetype.cpp process.cpp ringbuffer.cpp scriptframe.cpp
- function.cpp function-script.cpp functionwrapper.cpp scriptglobal.cpp
+ function.cpp function.thpp function-script.cpp functionwrapper.cpp scriptglobal.cpp
scriptutils.cpp serializer.cpp socket.cpp socketevents.cpp socketevents-epoll.cpp socketevents-poll.cpp stacktrace.cpp
statsfunction.cpp stdiostream.cpp stream.cpp streamlogger.cpp streamlogger.thpp string.cpp string-script.cpp
sysloglogger.cpp sysloglogger.thpp tcpsocket.cpp threadpool.cpp timer.cpp
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("len", new Function(WrapFunction(ArrayLen), true));
- prototype->Set("set", new Function(WrapFunction(ArraySet)));
- prototype->Set("get", new Function(WrapFunction(ArrayGet)));
- prototype->Set("add", new Function(WrapFunction(ArrayAdd)));
- prototype->Set("remove", new Function(WrapFunction(ArrayRemove)));
- prototype->Set("contains", new Function(WrapFunction(ArrayContains), true));
- prototype->Set("clear", new Function(WrapFunction(ArrayClear)));
- prototype->Set("sort", new Function(WrapFunction(ArraySort), true));
- prototype->Set("shallow_clone", new Function(WrapFunction(ArrayShallowClone), true));
- prototype->Set("join", new Function(WrapFunction(ArrayJoin), true));
- prototype->Set("reverse", new Function(WrapFunction(ArrayReverse), true));
- prototype->Set("map", new Function(WrapFunction(ArrayMap), true));
- prototype->Set("reduce", new Function(WrapFunction(ArrayReduce), true));
- prototype->Set("filter", new Function(WrapFunction(ArrayFilter), true));
- prototype->Set("unique", new Function(WrapFunction(ArrayUnique), true));
+ prototype->Set("len", new Function("Array#len", WrapFunction(ArrayLen), true));
+ prototype->Set("set", new Function("Array#set", WrapFunction(ArraySet)));
+ prototype->Set("get", new Function("Array#get", WrapFunction(ArrayGet)));
+ prototype->Set("add", new Function("Array#add", WrapFunction(ArrayAdd)));
+ prototype->Set("remove", new Function("Array#remove", WrapFunction(ArrayRemove)));
+ prototype->Set("contains", new Function("Array#contains", WrapFunction(ArrayContains), true));
+ prototype->Set("clear", new Function("Array#clear", WrapFunction(ArrayClear)));
+ prototype->Set("sort", new Function("Array#sort", WrapFunction(ArraySort), true));
+ prototype->Set("shallow_clone", new Function("Array#shallow_clone", WrapFunction(ArrayShallowClone), true));
+ prototype->Set("join", new Function("Array#join", WrapFunction(ArrayJoin), true));
+ prototype->Set("reverse", new Function("Array#reverse", WrapFunction(ArrayReverse), true));
+ prototype->Set("map", new Function("Array#map", WrapFunction(ArrayMap), true));
+ prototype->Set("reduce", new Function("Array#reduce", WrapFunction(ArrayReduce), true));
+ prototype->Set("filter", new Function("Array#filter", WrapFunction(ArrayFilter), true));
+ prototype->Set("unique", new Function("Array#unique", WrapFunction(ArrayUnique), true));
}
return prototype;
-}
\ No newline at end of file
+}
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("to_string", new Function(WrapFunction(BooleanToString), true));
+ prototype->Set("to_string", new Function("Boolean#to_string", WrapFunction(BooleanToString), true));
}
return prototype;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("modify_attribute", new Function(WrapFunction(ConfigObjectModifyAttribute), false));
- prototype->Set("restore_attribute", new Function(WrapFunction(ConfigObjectRestoreAttribute), false));
+ prototype->Set("modify_attribute", new Function("ConfigObject#modify_attribute", WrapFunction(ConfigObjectModifyAttribute), false));
+ prototype->Set("restore_attribute", new Function("ConfigObject#restore_attribute", WrapFunction(ConfigObjectRestoreAttribute), false));
}
return prototype;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("format", new Function(WrapFunction(DateTimeFormat)));
+ prototype->Set("format", new Function("DateTime#format", WrapFunction(DateTimeFormat)));
}
return prototype;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("len", new Function(WrapFunction(DictionaryLen), true));
- prototype->Set("set", new Function(WrapFunction(DictionarySet)));
- prototype->Set("get", new Function(WrapFunction(DictionaryGet)));
- prototype->Set("remove", new Function(WrapFunction(DictionaryRemove)));
- prototype->Set("contains", new Function(WrapFunction(DictionaryContains), true));
- prototype->Set("shallow_clone", new Function(WrapFunction(DictionaryShallowClone), true));
- prototype->Set("keys", new Function(WrapFunction(DictionaryKeys), true));
+ prototype->Set("len", new Function("Dictionary#len", WrapFunction(DictionaryLen), true));
+ prototype->Set("set", new Function("Dictionary#set", WrapFunction(DictionarySet)));
+ prototype->Set("get", new Function("Dictionary#get", WrapFunction(DictionaryGet)));
+ prototype->Set("remove", new Function("Dictionary#remove", WrapFunction(DictionaryRemove)));
+ prototype->Set("contains", new Function("Dictionary#contains", WrapFunction(DictionaryContains), true));
+ prototype->Set("shallow_clone", new Function("Dictionary#shallow_clone", WrapFunction(DictionaryShallowClone), true));
+ prototype->Set("keys", new Function("Dictionary#keys", WrapFunction(DictionaryKeys), true));
}
return prototype;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("call", new Function(WrapFunction(FunctionCall)));
- prototype->Set("callv", new Function(WrapFunction(FunctionCallV)));
+ prototype->Set("call", new Function("Function#call", WrapFunction(FunctionCall)));
+ prototype->Set("callv", new Function("Function#callv", WrapFunction(FunctionCallV)));
}
return prototype;
******************************************************************************/
#include "base/function.hpp"
-#include "base/primitivetype.hpp"
-#include "base/dictionary.hpp"
+#include "base/function.tcpp"
#include "base/scriptframe.hpp"
using namespace icinga;
-REGISTER_PRIMITIVE_TYPE_NOINST(Function, Object, Function::GetPrototype());
+REGISTER_TYPE_WITH_PROTOTYPE(Function, Function::GetPrototype());
-Function::Function(const Callback& function, bool side_effect_free)
- : m_Callback(function), m_SideEffectFree(side_effect_free)
-{ }
+Function::Function(const String& name, const Callback& function, bool side_effect_free, bool deprecated)
+ : m_Callback(function)
+{
+ SetName(name, true);
+ SetSideEffectFree(side_effect_free, true);
+ SetDeprecated(deprecated, true);
+}
Value Function::Invoke(const std::vector<Value>& arguments)
{
return m_Callback(arguments);
}
-bool Function::IsSideEffectFree(void) const
-{
- return m_SideEffectFree;
-}
-
Object::Ptr Function::Clone(void) const
{
return const_cast<Function *>(this);
#define SCRIPTFUNCTION_H
#include "base/i2-base.hpp"
+#include "base/function.thpp"
#include "base/value.hpp"
#include "base/functionwrapper.hpp"
#include "base/scriptglobal.hpp"
*
* @ingroup base
*/
-class I2_BASE_API Function : public Object
+class I2_BASE_API Function : public ObjectImpl<Function>
{
public:
DECLARE_OBJECT(Function);
typedef boost::function<Value (const std::vector<Value>& arguments)> Callback;
- Function(const Callback& function, bool side_effect_free = false);
+ Function(const String& name, const Callback& function, bool side_effect_free = false, bool deprecated = false);
Value Invoke(const std::vector<Value>& arguments = std::vector<Value>());
Value Invoke(const Value& otherThis, const std::vector<Value>& arguments = std::vector<Value>());
- bool IsSideEffectFree(void) const;
+
+ inline bool IsSideEffectFree(void) const
+ {
+ return GetSideEffectFree();
+ }
+
+ inline bool IsDeprecated(void) const
+ {
+ return GetDeprecated();
+ }
static Object::Ptr GetPrototype(void);
private:
Callback m_Callback;
- bool m_SideEffectFree;
};
#define REGISTER_SCRIPTFUNCTION(name, callback) \
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## name { \
void RegisterFunction(void) { \
- Function::Ptr sf = new icinga::Function(WrapFunction(callback)); \
+ Function::Ptr sf = new icinga::Function(#name, WrapFunction(callback)); \
ScriptGlobal::Set(#name, sf); \
} \
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
#define REGISTER_SCRIPTFUNCTION_NS(ns, name, callback) \
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## ns ## name { \
void RegisterFunction(void) { \
- Function::Ptr sf = new icinga::Function(WrapFunction(callback)); \
+ Function::Ptr sf = new icinga::Function(#ns "#" #name, WrapFunction(callback), false); \
ScriptGlobal::Set(#ns "." #name, sf); \
+ Function::Ptr dsf = new icinga::Function(#name " (deprecated)", WrapFunction(callback), false, true); \
+ ScriptGlobal::Set(#name, dsf); \
} \
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
} } }
#define REGISTER_SAFE_SCRIPTFUNCTION(name, callback) \
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## name { \
void RegisterFunction(void) { \
- Function::Ptr sf = new icinga::Function(WrapFunction(callback), true); \
+ Function::Ptr sf = new icinga::Function(#name, WrapFunction(callback), true); \
ScriptGlobal::Set(#name, sf); \
} \
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
#define REGISTER_SAFE_SCRIPTFUNCTION_NS(ns, name, callback) \
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## ns ## name { \
void RegisterFunction(void) { \
- Function::Ptr sf = new icinga::Function(WrapFunction(callback), true); \
+ Function::Ptr sf = new icinga::Function(#ns "#" #name, WrapFunction(callback), true); \
ScriptGlobal::Set(#ns "." #name, sf); \
+ Function::Ptr dsf = new icinga::Function(#name " (deprecated)", WrapFunction(callback), true, true); \
+ ScriptGlobal::Set(#name, dsf); \
} \
INITIALIZE_ONCE_WITH_PRIORITY(RegisterFunction, 10); \
} } }
--- /dev/null
+/******************************************************************************
+ * Icinga 2 *
+ * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/) *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License *
+ * as published by the Free Software Foundation; either version 2 *
+ * of the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software Foundation *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ******************************************************************************/
+
+#include "base/configobject.hpp"
+
+library base;
+
+namespace icinga
+{
+
+abstract class Function
+{
+ String "name";
+ bool side_effect_free;
+ bool deprecated;
+};
+
+}
Dictionary::Ptr jsonObj = new Dictionary();
/* Methods */
- jsonObj->Set("encode", new Function(WrapFunction(JsonEncodeShim), true));
- jsonObj->Set("decode", new Function(WrapFunction(JsonDecode), true));
+ jsonObj->Set("encode", new Function("Json#encode", WrapFunction(JsonEncodeShim), true));
+ jsonObj->Set("decode", new Function("Json#decode", WrapFunction(JsonDecode), true));
ScriptGlobal::Set("Json", jsonObj);
}
mathObj->Set("SQRT2", 1.41421356237309504880);
/* Methods */
- mathObj->Set("abs", new Function(WrapFunction(MathAbs), true));
- mathObj->Set("acos", new Function(WrapFunction(MathAcos), true));
- mathObj->Set("asin", new Function(WrapFunction(MathAsin), true));
- mathObj->Set("atan", new Function(WrapFunction(MathAtan), true));
- mathObj->Set("atan2", new Function(WrapFunction(MathAtan2), true));
- mathObj->Set("ceil", new Function(WrapFunction(MathCeil), true));
- mathObj->Set("cos", new Function(WrapFunction(MathCos), true));
- mathObj->Set("exp", new Function(WrapFunction(MathExp), true));
- mathObj->Set("floor", new Function(WrapFunction(MathFloor), true));
- mathObj->Set("log", new Function(WrapFunction(MathLog), true));
- mathObj->Set("max", new Function(WrapFunction(MathMax), true));
- mathObj->Set("min", new Function(WrapFunction(MathMin), true));
- mathObj->Set("pow", new Function(WrapFunction(MathPow), true));
- mathObj->Set("random", new Function(WrapFunction(MathRandom), true));
- mathObj->Set("round", new Function(WrapFunction(MathRound), true));
- mathObj->Set("sin", new Function(WrapFunction(MathSin), true));
- mathObj->Set("sqrt", new Function(WrapFunction(MathSqrt), true));
- mathObj->Set("tan", new Function(WrapFunction(MathTan), true));
- mathObj->Set("isnan", new Function(WrapFunction(MathIsnan), true));
- mathObj->Set("isinf", new Function(WrapFunction(MathIsinf), true));
- mathObj->Set("sign", new Function(WrapFunction(MathSign), true));
+ mathObj->Set("abs", new Function("Math#abs", WrapFunction(MathAbs), true));
+ mathObj->Set("acos", new Function("Math#acos", WrapFunction(MathAcos), true));
+ mathObj->Set("asin", new Function("Math#asin", WrapFunction(MathAsin), true));
+ mathObj->Set("atan", new Function("Math#atan", WrapFunction(MathAtan), true));
+ mathObj->Set("atan2", new Function("Math#atan2", WrapFunction(MathAtan2), true));
+ mathObj->Set("ceil", new Function("Math#ceil", WrapFunction(MathCeil), true));
+ mathObj->Set("cos", new Function("Math#cos", WrapFunction(MathCos), true));
+ mathObj->Set("exp", new Function("Math#exp", WrapFunction(MathExp), true));
+ mathObj->Set("floor", new Function("Math#floor", WrapFunction(MathFloor), true));
+ mathObj->Set("log", new Function("Math#log", WrapFunction(MathLog), true));
+ mathObj->Set("max", new Function("Math#max", WrapFunction(MathMax), true));
+ mathObj->Set("min", new Function("Math#min", WrapFunction(MathMin), true));
+ mathObj->Set("pow", new Function("Math#pow", WrapFunction(MathPow), true));
+ mathObj->Set("random", new Function("Math#random", WrapFunction(MathRandom), true));
+ mathObj->Set("round", new Function("Math#round", WrapFunction(MathRound), true));
+ mathObj->Set("sin", new Function("Math#sin", WrapFunction(MathSin), true));
+ mathObj->Set("sqrt", new Function("Math#sqrt", WrapFunction(MathSqrt), true));
+ mathObj->Set("tan", new Function("Math#tan", WrapFunction(MathTan), true));
+ mathObj->Set("isnan", new Function("Math#isnan", WrapFunction(MathIsnan), true));
+ mathObj->Set("isinf", new Function("Math#isinf", WrapFunction(MathIsinf), true));
+ mathObj->Set("sign", new Function("Math#sign", WrapFunction(MathSign), true));
ScriptGlobal::Set("Math", mathObj);
}
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("to_string", new Function(WrapFunction(NumberToString), true));
+ prototype->Set("to_string", new Function("Number#to_string", WrapFunction(NumberToString), true));
}
return prototype;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("to_string", new Function(WrapFunction(ObjectToString), true));
- prototype->Set("notify_attribute", new Function(WrapFunction(ObjectNotifyAttribute), false));
- prototype->Set("clone", new Function(WrapFunction(ObjectClone), true));
+ prototype->Set("to_string", new Function("Object#to_string", WrapFunction(ObjectToString), true));
+ prototype->Set("notify_attribute", new Function("Object#notify_attribute", WrapFunction(ObjectNotifyAttribute), false));
+ prototype->Set("clone", new Function("Object#clone", WrapFunction(ObjectClone), true));
}
return prototype;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("len", new Function(WrapFunction(StringLen), true));
- prototype->Set("to_string", new Function(WrapFunction(StringToString), true));
- prototype->Set("substr", new Function(WrapFunction(StringSubstr), true));
- prototype->Set("upper", new Function(WrapFunction(StringUpper), true));
- prototype->Set("lower", new Function(WrapFunction(StringLower), true));
- prototype->Set("split", new Function(WrapFunction(StringSplit), true));
- prototype->Set("find", new Function(WrapFunction(StringFind), true));
- prototype->Set("contains", new Function(WrapFunction(StringContains), true));
- prototype->Set("replace", new Function(WrapFunction(StringReplace), true));
- prototype->Set("reverse", new Function(WrapFunction(StringReverse), true));
- prototype->Set("trim", new Function(WrapFunction(StringTrim), true));
+ prototype->Set("len", new Function("String#len", WrapFunction(StringLen), true));
+ prototype->Set("to_string", new Function("String#to_string", WrapFunction(StringToString), true));
+ prototype->Set("substr", new Function("String#substr", WrapFunction(StringSubstr), true));
+ prototype->Set("upper", new Function("String#upper", WrapFunction(StringUpper), true));
+ prototype->Set("lower", new Function("String#lower", WrapFunction(StringLower), true));
+ prototype->Set("split", new Function("String#split", WrapFunction(StringSplit), true));
+ prototype->Set("find", new Function("String#find", WrapFunction(StringFind), true));
+ prototype->Set("contains", new Function("String#contains", WrapFunction(StringContains), true));
+ prototype->Set("replace", new Function("String#replace", WrapFunction(StringReplace), true));
+ prototype->Set("reverse", new Function("String#reverse", WrapFunction(StringReverse), true));
+ prototype->Set("trim", new Function("String#trim", WrapFunction(StringTrim), true));
}
return prototype;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("register_attribute_handler", new Function(WrapFunction(TypeRegisterAttributeHandler), false));
+ prototype->Set("register_attribute_handler", new Function("Type#register_attribute_handler", WrapFunction(TypeRegisterAttributeHandler), false));
}
return prototype;
{
EndFlowControlBlock(context);
- FunctionExpression *fexpr = new FunctionExpression(*$4, $6, $8, @$);
+ FunctionExpression *fexpr = new FunctionExpression(*$2, *$4, $6, $8, @$);
delete $4;
$$ = new SetExpression(MakeIndexer(ScopeThis, *$2), OpSetLiteral, fexpr, @$);
args.push_back(*$1);
delete $1;
- $$ = new FunctionExpression(args, new std::map<String, Expression *>(), $4, @$);
+ $$ = new FunctionExpression("<anonymous>", args, new std::map<String, Expression *>(), $4, @$);
}
| identifier T_FOLLOWS rterm %dprec 1
{
args.push_back(*$1);
delete $1;
- $$ = new FunctionExpression(args, new std::map<String, Expression *>(), $3, @$);
+ $$ = new FunctionExpression("<anonymous>", args, new std::map<String, Expression *>(), $3, @$);
}
| '(' identifier_items ')' T_FOLLOWS
{
{
EndFlowControlBlock(context);
- $$ = new FunctionExpression(*$2, new std::map<String, Expression *>(), $6, @$);
+ $$ = new FunctionExpression("<anonymous>", *$2, new std::map<String, Expression *>(), $6, @$);
delete $2;
}
| '(' identifier_items ')' T_FOLLOWS rterm %dprec 1
{
ASSERT(!dynamic_cast<DictExpression *>($5));
- $$ = new FunctionExpression(*$2, new std::map<String, Expression *>(), $5, @$);
+ $$ = new FunctionExpression("<anonymous>", *$2, new std::map<String, Expression *>(), $5, @$);
delete $2;
}
| rterm_array
{
EndFlowControlBlock(context);
- $$ = new FunctionExpression(*$3, $5, $7, @$);
+ $$ = new FunctionExpression("<anonymous>", *$3, $5, $7, @$);
delete $3;
}
| T_NULLARY_LAMBDA_BEGIN
DictExpression *aexpr = new DictExpression(dlist, @$);
aexpr->MakeInline();
- $$ = new FunctionExpression(std::vector<String>(), NULL, aexpr, @$);
+ $$ = new FunctionExpression("<anonymous>", std::vector<String>(), NULL, aexpr, @$);
}
;
ExpressionResult FunctionExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
- return VMOps::NewFunction(frame, m_Args, m_ClosedVars, m_Expression);
+ return VMOps::NewFunction(frame, m_Name, m_Args, m_ClosedVars, m_Expression);
}
ExpressionResult ApplyExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
class I2_CONFIG_API FunctionExpression : public DebuggableExpression
{
public:
- FunctionExpression(const std::vector<String>& args,
+ FunctionExpression(const String& name, const std::vector<String>& args,
std::map<String, Expression *> *closedVars, Expression *expression, const DebugInfo& debugInfo = DebugInfo())
: DebuggableExpression(debugInfo), m_Args(args), m_ClosedVars(closedVars), m_Expression(expression)
{ }
virtual ExpressionResult DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const override;
private:
+ String m_Name;
std::vector<String> m_Args;
std::map<String, Expression *> *m_ClosedVars;
boost::shared_ptr<Expression> m_Expression;
}
- static inline Value NewFunction(ScriptFrame& frame, const std::vector<String>& args,
+ static inline Value NewFunction(ScriptFrame& frame, const String& name, const std::vector<String>& args,
std::map<String, Expression *> *closedVars, const boost::shared_ptr<Expression>& expression)
{
- return new Function(boost::bind(&FunctionWrapper, _1, args,
+ return new Function(name, boost::bind(&FunctionWrapper, _1, args,
EvaluateClosedVars(frame, closedVars), expression));
}
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("process_check_result", new Function(WrapFunction(CheckableProcessCheckResult), false));
+ prototype->Set("process_check_result", new Function("Checkable#process_check_result", WrapFunction(CheckableProcessCheckResult), false));
}
return prototype;
resolvers_this->Set(resolver.first, resolver.second);
}
- resolvers_this->Set("macro", new Function(boost::bind(&MacroProcessor::InternalResolveMacrosShim,
+ resolvers_this->Set("macro", new Function("macro (temporary)", boost::bind(&MacroProcessor::InternalResolveMacrosShim,
_1, boost::cref(resolvers), cr, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros,
recursionLevel + 1)));
- resolvers_this->Set("resolve_arguments", new Function(boost::bind(&MacroProcessor::InternalResolveArgumentsShim,
+ resolvers_this->Set("resolve_arguments", new Function("resolve_arguments (temporary)", boost::bind(&MacroProcessor::InternalResolveArgumentsShim,
_1, boost::cref(resolvers), cr, resolvedMacros, useResolvedMacros,
recursionLevel + 1)));
} else
m_Impl << "\t" << "Value avalue = value;" << std::endl;
+ m_Impl << "\t" << "if (avalue.IsObjectType<Function>()) {" << std::endl
+ << "\t\t" << "Function::Ptr func = avalue;" << std::endl
+ << "\t\t" << "if (func->IsDeprecated())" << std::endl
+ << "\t\t\t" << "Log(LogWarning, \"" << klass.Name << "\") << \"Field '" << field.Name << "' for object '\" << dynamic_cast<ConfigObject *>(this)->GetName() << \"' of type '\" << dynamic_cast<ConfigObject *>(this)->GetType()->GetName() << \"' is set to a deprecated function: \" << func->GetName();" << std::endl
+ << "\t" << "}" << std::endl << std::endl;
+
std::string ftype = FieldTypeToIcingaName(field, true);
if (field.Type.IsName) {
<< "#include \"base/utility.hpp\"" << std::endl
<< "#include \"base/convert.hpp\"" << std::endl
<< "#include \"base/dependencygraph.hpp\"" << std::endl
+ << "#include \"base/logger.hpp\"" << std::endl
+ << "#include \"base/function.hpp\"" << std::endl
+ << "#include \"base/configtype.hpp\"" << std::endl
<< "#include <boost/foreach.hpp>" << std::endl
<< "#include <boost/assign/list_of.hpp>" << std::endl
<< "#ifdef _MSC_VER" << std::endl