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
netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp object-script.cpp primitivetype.cpp process.cpp
- ringbuffer.cpp scripterror.cpp scriptfunction.cpp scriptfunctionwrapper.cpp scriptsignal.cpp
+ ringbuffer.cpp scripterror.cpp scriptframe.cpp scriptfunction.cpp scriptfunctionwrapper.cpp scriptsignal.cpp
scriptutils.cpp scriptvariable.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
#include "base/array.hpp"
#include "base/scriptfunction.hpp"
#include "base/scriptfunctionwrapper.hpp"
-#include "config/vmframe.hpp"
+#include "base/scriptframe.hpp"
using namespace icinga;
static double ArrayLen(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
return self->GetLength();
}
static void ArraySet(int index, const Value& value)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
self->Set(index, value);
}
static void ArrayAdd(const Value& value)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
self->Add(value);
}
static void ArrayRemove(int index)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
self->Remove(index);
}
static bool ArrayContains(const Value& value)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
return self->Contains(value);
}
static void ArrayClear(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
self->Clear();
}
static void ArrayClone(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Array::Ptr self = static_cast<Array::Ptr>(vframe->Self);
self->ShallowClone();
}
#include "base/convert.hpp"
#include "base/scriptfunction.hpp"
#include "base/scriptfunctionwrapper.hpp"
-#include "config/vmframe.hpp"
+#include "base/scriptframe.hpp"
using namespace icinga;
static String BooleanToString(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
bool self = vframe->Self;
return self ? "true" : "false";
}
#include "base/dictionary.hpp"
#include "base/scriptfunction.hpp"
#include "base/scriptfunctionwrapper.hpp"
-#include "config/vmframe.hpp"
+#include "base/scriptframe.hpp"
using namespace icinga;
static double DictionaryLen(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
return self->GetLength();
}
static void DictionarySet(const String& key, const Value& value)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
self->Set(key, value);
}
static void DictionaryRemove(const String& key)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
self->Remove(key);
}
static bool DictionaryContains(const String& key)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
return self->Contains(key);
}
static void DictionaryClone(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Dictionary::Ptr self = static_cast<Dictionary::Ptr>(vframe->Self);
self->ShallowClone();
}
#include "base/convert.hpp"
#include "base/scriptfunction.hpp"
#include "base/scriptfunctionwrapper.hpp"
-#include "config/vmframe.hpp"
+#include "base/scriptframe.hpp"
using namespace icinga;
static String NumberToString(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
double self = vframe->Self;
return Convert::ToString(self);
}
#include "base/dictionary.hpp"
#include "base/scriptfunction.hpp"
#include "base/scriptfunctionwrapper.hpp"
-#include "config/vmframe.hpp"
+#include "base/scriptframe.hpp"
using namespace icinga;
static String ObjectToString(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
Object::Ptr self = static_cast<Object::Ptr>(vframe->Self);
return self->ToString();
}
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "config/vmframe.hpp"
+#include "base/scriptframe.hpp"
using namespace icinga;
-boost::thread_specific_ptr<VMFrame *> VMFrame::m_CurrentFrame;
+boost::thread_specific_ptr<ScriptFrame *> ScriptFrame::m_CurrentFrame;
namespace icinga
{
-struct VMFrame
+struct I2_BASE_API ScriptFrame
{
Dictionary::Ptr Locals;
Value Self;
- VMFrame *NextFrame;
+ ScriptFrame *NextFrame;
- VMFrame(void)
+ ScriptFrame(void)
: Locals(new Dictionary()), Self(Locals)
{
NextFrame = GetCurrentFrame();
SetCurrentFrame(this);
}
- VMFrame(const Value& self)
+ ScriptFrame(const Value& self)
: Locals(new Dictionary()), Self(self)
{
NextFrame = GetCurrentFrame();
SetCurrentFrame(this);
}
- ~VMFrame(void)
+ ~ScriptFrame(void)
{
ASSERT(GetCurrentFrame() == this);
SetCurrentFrame(NextFrame);
}
- static inline VMFrame *GetCurrentFrame(void)
+ static inline ScriptFrame *GetCurrentFrame(void)
{
- VMFrame **pframe = m_CurrentFrame.get();
+ ScriptFrame **pframe = m_CurrentFrame.get();
if (pframe)
return *pframe;
}
private:
- static boost::thread_specific_ptr<VMFrame *> m_CurrentFrame;
+ static boost::thread_specific_ptr<ScriptFrame *> m_CurrentFrame;
- static inline void SetCurrentFrame(VMFrame *frame)
+ static inline void SetCurrentFrame(ScriptFrame *frame)
{
- m_CurrentFrame.reset(new VMFrame *(frame));
+ m_CurrentFrame.reset(new ScriptFrame *(frame));
}
};
}
-#endif /* VMOPS_H */
+#endif /* SCRIPTFRAME_H */
#include "base/dictionary.hpp"
#include "base/scriptfunction.hpp"
#include "base/scriptfunctionwrapper.hpp"
-#include "config/vmframe.hpp"
+#include "base/scriptframe.hpp"
using namespace icinga;
static int StringLen(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
String self = vframe->Self;
return self.GetLength();
}
static String StringToString(void)
{
- VMFrame *vframe = VMFrame::GetCurrentFrame();
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
return vframe->Self;
}
static void ExecuteExpression(Expression *expression)
{
try {
- VMFrame frame;
+ ScriptFrame frame;
expression->Evaluate(frame);
} catch (const ScriptError& ex) {
ConfigCompilerContext::GetInstance()->AddMessage(true, ex.what(), ex.GetDebugInfo());
*/
int ReplCommand::Run(const po::variables_map& vm, const std::vector<std::string>& ap) const
{
- VMFrame frame;
+ ScriptFrame frame;
while (std::cin.good()) {
std::cout << ConsoleColorTag(Console_ForegroundRed)
BOOST_FOREACH(boost::tie(fname, fragment), ConfigFragmentRegistry::GetInstance()->GetItems()) {
Expression *expression = ConfigCompiler::CompileText(fname, fragment);
if (expression) {
- VMFrame frame;
+ ScriptFrame frame;
expression->Evaluate(frame);
delete expression;
}
configcompilercontext.cpp configcompiler.cpp configitembuilder.cpp
configitem.cpp ${FLEX_config_lexer_OUTPUTS} ${BISON_config_parser_OUTPUTS}
configtype.cpp expression.cpp objectrule.cpp typerule.cpp typerulelist.cpp
- vmframe.cpp
)
if(ICINGA2_UNITY_BUILD)
m_Rules[sourceType].push_back(ApplyRule(targetType, name, expression, filter, fkvar, fvvar, fterm, di, scope));
}
-bool ApplyRule::EvaluateFilter(VMFrame& frame) const
+bool ApplyRule::EvaluateFilter(ScriptFrame& frame) const
{
return m_Filter->Evaluate(frame).ToBool();
}
void AddMatch(void);
bool HasMatches(void) const;
- bool EvaluateFilter(VMFrame& frame) const;
+ bool EvaluateFilter(ScriptFrame& frame) const;
static void AddRule(const String& sourceType, const String& targetType, const String& name, const boost::shared_ptr<Expression>& expression,
const boost::shared_ptr<Expression>& filter, const String& fkvar, const String& fvvar, const boost::shared_ptr<Expression>& fterm, const DebugInfo& di, const Dictionary::Ptr& scope);
constant: T_CONST identifier T_SET rterm
{
- VMFrame frame;
+ ScriptFrame frame;
ScriptVariable::Ptr sv = ScriptVariable::Set($2, $4->Evaluate(frame));
free($2);
delete $4;
DebugHint debugHints;
try {
- VMFrame frame(dobj);
+ ScriptFrame frame(dobj);
frame.Locals = m_Scope;
m_Expression->Evaluate(frame, &debugHints);
} catch (const ScriptError& ex) {
Expression::~Expression(void)
{ }
-Value Expression::Evaluate(VMFrame& frame, DebugHint *dhint) const
+Value Expression::Evaluate(ScriptFrame& frame, DebugHint *dhint) const
{
try {
#ifdef _DEBUG
: m_Value(value)
{ }
-Value LiteralExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value LiteralExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Value;
}
return m_DebugInfo;
}
-Value VariableExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value VariableExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return VMOps::Variable(frame, m_Variable, GetDebugInfo());
}
-Value NegateExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value NegateExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return ~(long)m_Operand->Evaluate(frame);
}
-Value LogicalNegateExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value LogicalNegateExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return !m_Operand->Evaluate(frame).ToBool();
}
-Value AddExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value AddExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) + m_Operand2->Evaluate(frame);
}
-Value SubtractExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value SubtractExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) - m_Operand2->Evaluate(frame);
}
-Value MultiplyExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value MultiplyExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) * m_Operand2->Evaluate(frame);
}
-Value DivideExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value DivideExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) / m_Operand2->Evaluate(frame);
}
-Value ModuloExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ModuloExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return (long)m_Operand1->Evaluate(frame) % (long)m_Operand2->Evaluate(frame);
}
-Value XorExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value XorExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return (long)m_Operand1->Evaluate(frame) ^ (long)m_Operand2->Evaluate(frame);
}
-Value BinaryAndExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value BinaryAndExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) & m_Operand2->Evaluate(frame);
}
-Value BinaryOrExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value BinaryOrExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) | m_Operand2->Evaluate(frame);
}
-Value ShiftLeftExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ShiftLeftExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) << m_Operand2->Evaluate(frame);
}
-Value ShiftRightExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ShiftRightExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) >> m_Operand2->Evaluate(frame);
}
-Value EqualExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value EqualExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) == m_Operand2->Evaluate(frame);
}
-Value NotEqualExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value NotEqualExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) != m_Operand2->Evaluate(frame);
}
-Value LessThanExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value LessThanExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) < m_Operand2->Evaluate(frame);
}
-Value GreaterThanExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value GreaterThanExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) > m_Operand2->Evaluate(frame);
}
-Value LessThanOrEqualExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value LessThanOrEqualExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) <= m_Operand2->Evaluate(frame);
}
-Value GreaterThanOrEqualExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value GreaterThanOrEqualExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame) >= m_Operand2->Evaluate(frame);
}
-Value InExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value InExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
Value right = m_Operand2->Evaluate(frame);
return arr->Contains(left);
}
-Value NotInExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value NotInExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
Value right = m_Operand2->Evaluate(frame);
return !arr->Contains(left);
}
-Value LogicalAndExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value LogicalAndExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame).ToBool() && m_Operand2->Evaluate(frame).ToBool();
}
-Value LogicalOrExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value LogicalOrExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Operand1->Evaluate(frame).ToBool() || m_Operand2->Evaluate(frame).ToBool();
}
-Value FunctionCallExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
Value self, funcName;
return VMOps::FunctionCall(frame, self, funcName, arguments);
}
-Value ArrayExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ArrayExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
Array::Ptr result = new Array();
return result;
}
-Value DictExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value DictExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
- VMFrame *dframe;
- VMFrame rframe;
+ ScriptFrame *dframe;
+ ScriptFrame rframe;
if (!m_Inline) {
dframe = &rframe;
return dframe->Self;
}
-Value SetExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value SetExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
DebugHint *psdhint = dhint;
DebugHint sdhint;
return right;
}
-Value ConditionalExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ConditionalExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
if (m_Condition->Evaluate(frame, dhint).ToBool())
return m_TrueBranch->Evaluate(frame, dhint);
return Empty;
}
-Value ReturnExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ReturnExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
BOOST_THROW_EXCEPTION(InterruptExecutionError(m_Operand->Evaluate(frame)));
}
-Value IndexerExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value IndexerExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return VMOps::Indexer(frame, m_Indexer, GetDebugInfo());
}
-Value ImportExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ImportExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
String type = VMOps::GetField(frame.Self, "type", GetDebugInfo());
Value name = m_Name->Evaluate(frame);
return Empty;
}
-Value FunctionExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value FunctionExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return VMOps::NewFunction(frame, m_Name, m_Args, m_ClosedVars, m_Expression);
}
-Value SlotExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value SlotExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return VMOps::NewSlot(frame, m_Signal, m_Slot->Evaluate(frame));
}
-Value ApplyExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ApplyExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return VMOps::NewApply(frame, m_Type, m_Target, m_Name->Evaluate(frame), m_Filter,
m_FKVar, m_FVVar, m_FTerm, m_ClosedVars, m_Expression, m_DebugInfo);
}
-Value ObjectExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ObjectExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
String name;
m_ClosedVars, m_Expression, m_DebugInfo);
}
-Value ForExpression::DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+Value ForExpression::DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
Value value = m_Value->Evaluate(frame, dhint);
#define EXPRESSION_H
#include "config/i2-config.hpp"
-#include "config/vmframe.hpp"
#include "base/debuginfo.hpp"
#include "base/array.hpp"
#include "base/dictionary.hpp"
#include "base/scriptfunction.hpp"
#include "base/scripterror.hpp"
+#include "base/scriptframe.hpp"
#include "base/convert.hpp"
#include <boost/foreach.hpp>
#include <boost/thread/future.hpp>
public:
virtual ~Expression(void);
- Value Evaluate(VMFrame& frame, DebugHint *dhint = NULL) const;
+ Value Evaluate(ScriptFrame& frame, DebugHint *dhint = NULL) const;
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const = 0;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const = 0;
virtual const DebugInfo& GetDebugInfo(void) const;
};
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Expression->DoEvaluate(frame, dhint);
}
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const
{
return m_Future.get()->DoEvaluate(frame, dhint);
}
LiteralExpression(const Value& value = Value());
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
Value m_Value;
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
String m_Variable;
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API LogicalNegateExpression : public UnaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API AddExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API SubtractExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API MultiplyExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API DivideExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API ModuloExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API XorExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API BinaryAndExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API BinaryOrExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API ShiftLeftExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API ShiftRightExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API EqualExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API NotEqualExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API LessThanExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API GreaterThanExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API LessThanOrEqualExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API GreaterThanOrEqualExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API InExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API NotInExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API LogicalAndExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API LogicalOrExpression : public BinaryExpression
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API FunctionCallExpression : public DebuggableExpression
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
public:
std::vector<Expression *> m_IName;
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
std::vector<Expression *> m_Expressions;
void MakeInline(void);
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
std::vector<Expression *> m_Expressions;
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
CombinedSetOp m_Op;
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
Expression *m_Condition;
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
};
class I2_CONFIG_API IndexerExpression : public DebuggableExpression
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
std::vector<Expression *> m_Indexer;
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
Expression *m_Name;
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
String m_Name;
{ }
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
String m_Signal;
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
String m_Type;
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
bool m_Abstract;
}
protected:
- virtual Value DoEvaluate(VMFrame& frame, DebugHint *dhint) const;
+ virtual Value DoEvaluate(ScriptFrame& frame, DebugHint *dhint) const;
private:
String m_FKVar;
class VMOps
{
public:
- static inline Value Variable(VMFrame& frame, const String& name, const DebugInfo& debugInfo = DebugInfo())
+ static inline Value Variable(ScriptFrame& frame, const String& name, const DebugInfo& debugInfo = DebugInfo())
{
if (name == "this")
return frame.Self;
return ScriptVariable::Get(name);
}
- static inline Value FunctionCall(VMFrame& frame, const Value& self, const Value& funcName, const std::vector<Value>& arguments)
+ static inline Value FunctionCall(ScriptFrame& frame, const Value& self, const Value& funcName, const std::vector<Value>& arguments)
{
ScriptFunction::Ptr func;
if (!func)
BOOST_THROW_EXCEPTION(ScriptError("Function '" + funcName + "' does not exist."));
- boost::shared_ptr<VMFrame> vframe;
+ boost::shared_ptr<ScriptFrame> vframe;
if (!self.IsEmpty())
- vframe = boost::make_shared<VMFrame>(self); /* passes self to the callee using a TLS variable */
+ vframe = boost::make_shared<ScriptFrame>(self); /* passes self to the callee using a TLS variable */
else
- vframe = boost::make_shared<VMFrame>();
+ vframe = boost::make_shared<ScriptFrame>();
return func->Invoke(arguments);
}
- static inline Value Indexer(VMFrame& frame, const std::vector<Expression *>& indexer, const DebugInfo& debugInfo = DebugInfo())
+ static inline Value Indexer(ScriptFrame& frame, const std::vector<Expression *>& indexer, const DebugInfo& debugInfo = DebugInfo())
{
Value result = indexer[0]->Evaluate(frame);
return result;
}
- static inline Value NewFunction(VMFrame& frame, const String& name, 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)
{
ScriptFunction::Ptr func = new ScriptFunction(boost::bind(&FunctionWrapper, _1, args,
return func;
}
- static inline Value NewSlot(VMFrame& frame, const String& signal, const Value& slot)
+ static inline Value NewSlot(ScriptFrame& frame, const String& signal, const Value& slot)
{
ScriptSignal::Ptr sig = ScriptSignal::GetByName(signal);
return Empty;
}
- static inline Value NewApply(VMFrame& frame, const String& type, const String& target, const String& name, const boost::shared_ptr<Expression>& filter,
+ static inline Value NewApply(ScriptFrame& frame, const String& type, const String& target, const String& name, const boost::shared_ptr<Expression>& filter,
const String& fkvar, const String& fvvar, const boost::shared_ptr<Expression>& fterm, std::map<String, Expression *> *closedVars,
const boost::shared_ptr<Expression>& expression, const DebugInfo& debugInfo = DebugInfo())
{
return Empty;
}
- static inline Value NewObject(VMFrame& frame, bool abstract, const String& type, const String& name, const boost::shared_ptr<Expression>& filter,
+ static inline Value NewObject(ScriptFrame& frame, bool abstract, const String& type, const String& name, const boost::shared_ptr<Expression>& filter,
const String& zone, std::map<String, Expression *> *closedVars, const boost::shared_ptr<Expression>& expression, const DebugInfo& debugInfo = DebugInfo())
{
ConfigItemBuilder::Ptr item = new ConfigItemBuilder(debugInfo);
return Empty;
}
- static inline Value For(VMFrame& frame, const String& fkvar, const String& fvvar, const Value& value, Expression *expression, const DebugInfo& debugInfo = DebugInfo())
+ static inline Value For(ScriptFrame& frame, const String& fkvar, const String& fvvar, const Value& value, Expression *expression, const DebugInfo& debugInfo = DebugInfo())
{
if (value.IsObjectType<Array>()) {
if (!fvvar.IsEmpty())
if (arguments.size() < funcargs.size())
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function"));
- VMFrame *vframe = VMFrame::GetCurrentFrame();
- VMFrame frame(vframe->Self);
+ ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
+ ScriptFrame frame(vframe->Self);
if (closedVars)
closedVars->CopyTo(frame.Locals);
func->Invoke(arguments);
}
- static inline Dictionary::Ptr EvaluateClosedVars(VMFrame& frame, std::map<String, Expression *> *closedVars)
+ static inline Dictionary::Ptr EvaluateClosedVars(ScriptFrame& frame, std::map<String, Expression *> *closedVars)
{
Dictionary::Ptr locals;
ApplyRule::RegisterType("Dependency", targets);
}
-void Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, VMFrame& frame, const ApplyRule& rule)
+void Dependency::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{
DebugInfo di = rule.GetDebugInfo();
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
- VMFrame frame;
+ ScriptFrame frame;
if (rule.GetScope())
rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);
{
class ApplyRule;
-struct VMFrame;
+struct ScriptFrame;
class Host;
class Service;
Checkable::Ptr m_Parent;
Checkable::Ptr m_Child;
- static void EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, VMFrame& frame, const ApplyRule& rule);
+ static void EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule);
static bool EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule);
};
CONTEXT("Evaluating rule for group '" + group_name + "'");
- VMFrame frame;
+ ScriptFrame frame;
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);
ApplyRule::RegisterType("Notification", targets);
}
-void Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, VMFrame& frame, const ApplyRule& rule)
+void Notification::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{
DebugInfo di = rule.GetDebugInfo();
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
- VMFrame frame;
+ ScriptFrame frame;
if (rule.GetScope())
rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);
class NotificationCommand;
class Checkable;
class ApplyRule;
-struct VMFrame;
+struct ScriptFrame;
class Host;
class Service;
private:
void ExecuteNotificationHelper(NotificationType type, const User::Ptr& user, const CheckResult::Ptr& cr, bool force, const String& author = "", const String& text = "");
- static void EvaluateApplyRuleInstance(const intrusive_ptr<Checkable>& checkable, const String& name, VMFrame& frame, const ApplyRule& rule);
+ static void EvaluateApplyRuleInstance(const intrusive_ptr<Checkable>& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule);
static bool EvaluateApplyRule(const intrusive_ptr<Checkable>& checkable, const ApplyRule& rule);
};
ApplyRule::RegisterType("ScheduledDowntime", targets);
}
-void ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, VMFrame& frame, const ApplyRule& rule)
+void ScheduledDowntime::EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{
DebugInfo di = rule.GetDebugInfo();
Service::Ptr service;
tie(host, service) = GetHostService(checkable);
- VMFrame frame;
+ ScriptFrame frame;
if (rule.GetScope())
rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);
{
class ApplyRule;
-struct VMFrame;
+struct ScriptFrame;
class Host;
class Service;
std::pair<double, double> FindNextSegment(void);
void CreateNextDowntime(void);
- static void EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, VMFrame& frame, const ApplyRule& rule);
+ static void EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule);
static bool EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule);
};
ApplyRule::RegisterType("Service", targets);
}
-void Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, VMFrame& frame, const ApplyRule& rule)
+void Service::EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule)
{
DebugInfo di = rule.GetDebugInfo();
msgbuf << "Evaluating 'apply' rule (" << di << ")";
CONTEXT(msgbuf.str());
- VMFrame frame;
+ ScriptFrame frame;
if (rule.GetScope())
rule.GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);
private:
Host::Ptr m_Host;
- static void EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, VMFrame& frame, const ApplyRule& rule);
+ static void EvaluateApplyRuleInstance(const Host::Ptr& host, const String& name, ScriptFrame& frame, const ApplyRule& rule);
static bool EvaluateApplyRule(const Host::Ptr& host, const ApplyRule& rule);
};
Host::Ptr host = service->GetHost();
- VMFrame frame;
+ ScriptFrame frame;
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("host", host);
CONTEXT("Evaluating rule for group '" + group_name + "'");
- VMFrame frame;
+ ScriptFrame frame;
if (group->GetScope())
group->GetScope()->CopyTo(frame.Locals);
frame.Locals->Set("user", user);