summaryrefslogtreecommitdiffstats
path: root/src/uscxml
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml')
-rw-r--r--src/uscxml/Interpreter.cpp10
-rw-r--r--src/uscxml/Interpreter.h32
-rw-r--r--src/uscxml/concurrency/Timer.cpp29
-rw-r--r--src/uscxml/concurrency/Timer.h6
-rw-r--r--src/uscxml/debug/Complexity.cpp2
-rw-r--r--src/uscxml/plugins/DataModel.h36
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp29
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp1
-rw-r--r--src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp1
-rw-r--r--src/uscxml/server/HTTPServer.cpp1
-rw-r--r--src/uscxml/transform/ChartToC.cpp25
-rw-r--r--src/uscxml/transform/ChartToPromela.cpp2
12 files changed, 99 insertions, 75 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 736a740..4e45599 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -57,12 +57,6 @@
# include "uscxml/interpreter/InterpreterRC.h"
#endif
-#ifdef BUILD_PROFILING
-#define TIME_BLOCK Measurement msm(&timer);
-#else
-#define TIME_BLOCK (0);
-#endif
-
#define VERBOSE 0
/// valid interpreter state transitions
@@ -778,7 +772,6 @@ NodeSet<std::string> InterpreterImpl::getDocumentInitialTransitions() {
}
InterpreterState InterpreterImpl::step(int waitForMS) {
- TIME_BLOCK
try {
tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
@@ -1369,9 +1362,6 @@ void InterpreterImpl::reset() {
_isInitialized = false;
_stable = false;
-#ifdef BUILD_PROFILING
- timer = Timer();
-#endif
_dataModel = DataModel();
setInterpreterState(USCXML_INSTANTIATED);
}
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index e442585..d857902 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -52,6 +52,9 @@
#ifdef BUILD_PROFILING
#include "uscxml/concurrency/Timer.h"
+#define TIME_BLOCK Measurement msm(&timer);
+#else
+#define TIME_BLOCK (0);
#endif
#define ERROR_PLATFORM_THROW(msg) \
@@ -412,10 +415,6 @@ public:
virtual void handleDOMEvent(Arabica::DOM::Events::Event<std::string>& event);
-#ifdef BUILD_PROFILING
- Timer timer;
-#endif
-
protected:
static void run(void*); // static method for thread to run
@@ -593,10 +592,14 @@ public:
}
virtual void writeTo(std::ostream& stream) {
+ TIME_BLOCK
return _impl->writeTo(stream);
}
void reset() {
+#ifdef BUILD_PROFILING
+ timer = Timer();
+#endif
return _impl->reset();
}
@@ -618,16 +621,19 @@ public:
};
InterpreterState step(int waitForMS = 0) {
+ TIME_BLOCK
return _impl->step(waitForMS);
};
InterpreterState step(bool blocking) {
+ TIME_BLOCK
if (blocking)
return _impl->step(-1);
return _impl->step(0);
};
std::list<InterpreterIssue> validate() {
+ TIME_BLOCK
return _impl->validate();
}
@@ -714,33 +720,41 @@ public:
return _impl->getFactory();
}
Arabica::XPath::NodeSet<std::string> getNodeSetForXPath(const std::string& xpathExpr) {
+ TIME_BLOCK
return _impl->getNodeSetForXPath(xpathExpr);
}
void inline receiveInternal(const Event& event) {
+ TIME_BLOCK
return _impl->receiveInternal(event);
}
void receive(const Event& event, bool toFront = false) {
+ TIME_BLOCK
return _impl->receive(event, toFront);
}
Event getCurrentEvent() {
+ TIME_BLOCK
return _impl->getCurrentEvent();
}
bool isInState(const std::string& stateId) {
+ TIME_BLOCK
return _impl->isInState(stateId);
}
Arabica::XPath::NodeSet<std::string> getConfiguration() {
+ TIME_BLOCK
return _impl->getConfiguration();
}
Arabica::XPath::NodeSet<std::string> getBasicConfiguration() {
+ TIME_BLOCK
return _impl->getBasicConfiguration();
}
void setInitalConfiguration(const std::list<std::string>& states) {
+ TIME_BLOCK
return _impl->setInitalConfiguration(states);
}
@@ -777,19 +791,23 @@ public:
}
bool runOnMainThread(int fps, bool blocking = true) {
+ TIME_BLOCK
return _impl->runOnMainThread(fps, blocking);
}
bool hasLegalConfiguration() {
+ TIME_BLOCK
return _impl->hasLegalConfiguration();
}
bool isLegalConfiguration(const Arabica::XPath::NodeSet<std::string>& config) {
+ TIME_BLOCK
return _impl->isLegalConfiguration(config);
}
bool isLegalConfiguration(const std::list<std::string>& config) {
- return _impl->isLegalConfiguration(config);
+ TIME_BLOCK
+ return _impl->isLegalConfiguration(config);
}
boost::shared_ptr<InterpreterImpl> getImpl() const {
@@ -799,6 +817,10 @@ public:
static std::map<std::string, boost::weak_ptr<InterpreterImpl> > getInstances();
static void addInstance(boost::shared_ptr<InterpreterImpl> instance);
+#ifdef BUILD_PROFILING
+ Timer timer;
+#endif
+
protected:
void setInvokeRequest(const InvokeRequest& req) {
diff --git a/src/uscxml/concurrency/Timer.cpp b/src/uscxml/concurrency/Timer.cpp
index b05a907..2835173 100644
--- a/src/uscxml/concurrency/Timer.cpp
+++ b/src/uscxml/concurrency/Timer.cpp
@@ -4,7 +4,10 @@
// see https://github.com/awreece/monotonic_timer
+#include "uscxml/config.h"
+#ifdef HAS_UNISTD_H
#include <unistd.h>
+#endif
#include "Timer.h"
#define NANOS_PER_SECF 1000000000.0
@@ -44,29 +47,25 @@
#elif defined(_MSC_VER)
// On Windows, use QueryPerformanceCounter and QueryPerformanceFrequency.
+#define NOMINMAX
#include <windows.h>
static double PCFreq = 0.0;
+__int64 CounterStart = 0;
- // According to http://stackoverflow.com/q/1113409/447288, this will
- // make this function a constructor.
- // TODO(awreece) Actually attempt to compile on windows.
- static void __cdecl init_pcfreq();
- __declspec(allocate(".CRT$XCU")) void (__cdecl*init_pcfreq_)() = init_pcfreq;
- static void __cdecl init_pcfreq() {
- // Accoring to http://stackoverflow.com/a/1739265/447288, this will
- // properly initialize the QueryPerformanceCounter.
- LARGE_INTEGER li;
- int has_qpc = QueryPerformanceFrequency(&li);
- assert(has_qpc);
+ double uscxml::Timer::monotonic_seconds() {
+ if (CounterStart == 0) {
+ // Accoring to http://stackoverflow.com/a/1739265/447288, this will
+ // properly initialize the QueryPerformanceCounter.
- PCFreq = ((double) li.QuadPart) / 1000.0;
- }
+ LARGE_INTEGER li;
+ int has_qpc = QueryPerformanceFrequency(&li);
- double uscxml::Timer::monotonic_seconds() {
+ PCFreq = ((double) li.QuadPart) / 1000.0;
+ }
LARGE_INTEGER li;
QueryPerformanceCounter(&li);
- return ((double) li.QuadPart) / PCFreq;
+ return double(li.QuadPart - CounterStart)/PCFreq;
}
#else
diff --git a/src/uscxml/concurrency/Timer.h b/src/uscxml/concurrency/Timer.h
index 60a20a3..217f68f 100644
--- a/src/uscxml/concurrency/Timer.h
+++ b/src/uscxml/concurrency/Timer.h
@@ -7,6 +7,8 @@
#ifndef MONOTONIC_TIMER_H_
#define MONOTONIC_TIMER_H_
+#include "uscxml/Common.h"
+
// Returns seconds since some unspecified start time (guaranteed to be
// monotonicly increasing).
@@ -31,6 +33,10 @@ public:
invocations++;
}
+ void reset() {
+ elapsed = 0;
+ }
+
void stop() {
if (invocations == 0)
return;
diff --git a/src/uscxml/debug/Complexity.cpp b/src/uscxml/debug/Complexity.cpp
index 8a7d8db..de01831 100644
--- a/src/uscxml/debug/Complexity.cpp
+++ b/src/uscxml/debug/Complexity.cpp
@@ -20,6 +20,8 @@
#include "Complexity.h"
#include "uscxml/DOMUtils.h"
+#include <boost/algorithm/string.hpp>
+
namespace uscxml {
using namespace Arabica::DOM;
diff --git a/src/uscxml/plugins/DataModel.h b/src/uscxml/plugins/DataModel.h
index 097fcfd..74277c8 100644
--- a/src/uscxml/plugins/DataModel.h
+++ b/src/uscxml/plugins/DataModel.h
@@ -26,6 +26,9 @@
#ifdef BUILD_PROFILING
#include "uscxml/concurrency/Timer.h"
+#define TIME_BLOCK Measurement msm(&timer);
+#else
+#define TIME_BLOCK (0);
#endif
#include <list>
@@ -107,10 +110,6 @@ public:
return "";
}
-#ifdef BUILD_PROFILING
- Timer timer;
-#endif
-
protected:
InterpreterInfo* _interpreter;
};
@@ -141,96 +140,123 @@ public:
}
virtual std::list<std::string> getNames() {
- return _impl->getNames();
+ TIME_BLOCK
+ return _impl->getNames();
}
virtual bool validate(const std::string& location, const std::string& schema) {
+ TIME_BLOCK
return _impl->validate(location, schema);
}
virtual bool isLocation(const std::string& expr) {
+ TIME_BLOCK
return _impl->isLocation(expr);
}
virtual bool isValidSyntax(const std::string& expr) {
+ TIME_BLOCK
return _impl->isValidSyntax(expr);
}
virtual void setEvent(const Event& event) {
+ TIME_BLOCK
return _impl->setEvent(event);
}
virtual Data getStringAsData(const std::string& content) {
+ TIME_BLOCK
return _impl->getStringAsData(content);
}
virtual void pushContext() {
+ TIME_BLOCK
return _impl->pushContext();
}
virtual void popContext() {
+ TIME_BLOCK
return _impl->popContext();
}
virtual void eval(const Arabica::DOM::Element<std::string>& scriptElem,
const std::string& expr) {
+ TIME_BLOCK
return _impl->eval(scriptElem, expr);
}
virtual std::string evalAsString(const std::string& expr) {
+ TIME_BLOCK
return _impl->evalAsString(expr);
}
virtual bool evalAsBool(const std::string& expr) {
+ TIME_BLOCK
return _impl->evalAsBool(expr);
}
virtual bool evalAsBool(const Arabica::DOM::Element<std::string>& scriptNode,
const std::string& expr) {
+ TIME_BLOCK
return _impl->evalAsBool(scriptNode, expr);
}
virtual uint32_t getLength(const std::string& expr) {
+ TIME_BLOCK
return _impl->getLength(expr);
}
virtual void setForeach(const std::string& item,
const std::string& array,
const std::string& index,
uint32_t iteration) {
+ TIME_BLOCK
return _impl->setForeach(item, array, index, iteration);
}
virtual void assign(const Arabica::DOM::Element<std::string>& assignElem,
const Arabica::DOM::Node<std::string>& node,
const std::string& content) {
+ TIME_BLOCK
return _impl->assign(assignElem, node, content);
}
virtual void assign(const std::string& location, const Data& data) {
+ TIME_BLOCK
return _impl->assign(location, data);
}
virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
const Arabica::DOM::Node<std::string>& node,
const std::string& content) {
+ TIME_BLOCK
return _impl->init(dataElem, node, content);
}
virtual void init(const std::string& location, const Data& data) {
+ TIME_BLOCK
return _impl->init(location, data);
}
virtual bool isDeclared(const std::string& expr) {
+ TIME_BLOCK
return _impl->isDeclared(expr);
}
size_t replaceExpressions(std::string& content) {
+ TIME_BLOCK
return _impl->replaceExpressions(content);
}
std::string andExpressions(std::list<std::string> expressions) {
+ TIME_BLOCK
return _impl->andExpressions(expressions);
}
virtual void setInterpreter(InterpreterInfo* interpreter) {
+ TIME_BLOCK
_impl->setInterpreter(interpreter);
}
virtual void addExtension(DataModelExtension* ext) {
+ TIME_BLOCK
_impl->addExtension(ext);
}
+#ifdef BUILD_PROFILING
+ Timer timer;
+#endif
+
protected:
boost::shared_ptr<DataModelImpl> _impl;
};
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
index 9a71ab0..40b6cc2 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
@@ -44,12 +44,6 @@
#include "uscxml/DOMUtils.h"
#include <glog/logging.h>
-#ifdef BUILD_PROFILING
-#define TIME_BLOCK Measurement msm(&timer);
-#else
-#define TIME_BLOCK (0);
-#endif
-
#ifdef BUILD_AS_PLUGINS
#include <Pluma/Connector.hpp>
#endif
@@ -93,7 +87,6 @@ JSCDataModel::~JSCDataModel() {
}
void JSCDataModel::addExtension(DataModelExtension* ext) {
- TIME_BLOCK
if (_extensions.find(ext) != _extensions.end())
return;
@@ -199,7 +192,6 @@ JSClassDefinition JSCDataModel::jsInvokersClassDef = { 0, 0, "invokers", 0, 0, 0
boost::shared_ptr<DataModelImpl> JSCDataModel::create(InterpreterInfo* interpreter) {
boost::shared_ptr<JSCDataModel> dm = boost::shared_ptr<JSCDataModel>(new JSCDataModel());
- TIME_BLOCK
dm->_ctx = JSGlobalContextCreate(NULL);
dm->_interpreter = interpreter;
@@ -284,7 +276,6 @@ void JSCDataModel::popContext() {
}
void JSCDataModel::setEvent(const Event& event) {
- TIME_BLOCK
JSCSCXMLEvent::JSCSCXMLEventPrivate* privData = new JSCSCXMLEvent::JSCSCXMLEventPrivate();
privData->nativeObj = new Event(event);
privData->dom = _dom;
@@ -367,14 +358,12 @@ void JSCDataModel::setEvent(const Event& event) {
}
Data JSCDataModel::getStringAsData(const std::string& content) {
- TIME_BLOCK
JSValueRef result = evalAsValue(content);
Data data = getValueAsData(result);
return data;
}
JSValueRef JSCDataModel::getDataAsValue(const Data& data) {
- TIME_BLOCK
JSValueRef exception = NULL;
if (data.node) {
@@ -440,7 +429,6 @@ JSValueRef JSCDataModel::getDataAsValue(const Data& data) {
}
Data JSCDataModel::getValueAsData(const JSValueRef value) {
- TIME_BLOCK
Data data;
JSValueRef exception = NULL;
switch(JSValueGetType(_ctx, value)) {
@@ -529,12 +517,10 @@ Data JSCDataModel::getValueAsData(const JSValueRef value) {
}
bool JSCDataModel::validate(const std::string& location, const std::string& schema) {
- TIME_BLOCK
return true;
}
uint32_t JSCDataModel::getLength(const std::string& expr) {
- TIME_BLOCK
JSValueRef result;
result = evalAsValue("(" + expr + ").length");
@@ -555,7 +541,6 @@ void JSCDataModel::setForeach(const std::string& item,
const std::string& array,
const std::string& index,
uint32_t iteration) {
- TIME_BLOCK
if (!isDeclared(item)) {
assign(item, Data());
}
@@ -572,13 +557,11 @@ void JSCDataModel::setForeach(const std::string& item,
}
bool JSCDataModel::isLocation(const std::string& expr) {
- TIME_BLOCK
// location needs to be LHS and ++ is only valid for LHS
return isValidSyntax(expr + "++");
}
bool JSCDataModel::isValidSyntax(const std::string& expr) {
- TIME_BLOCK
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
JSValueRef exception = NULL;
bool valid = JSCheckScriptSyntax(_ctx, scriptJS, NULL, 0, &exception);
@@ -591,7 +574,6 @@ bool JSCDataModel::isValidSyntax(const std::string& expr) {
}
bool JSCDataModel::isDeclared(const std::string& expr) {
- TIME_BLOCK
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
JSValueRef exception = NULL;
JSValueRef result = JSEvaluateScript(_ctx, scriptJS, NULL, NULL, 0, &exception);
@@ -605,18 +587,15 @@ bool JSCDataModel::isDeclared(const std::string& expr) {
void JSCDataModel::eval(const Element<std::string>& scriptElem,
const std::string& expr) {
- TIME_BLOCK
evalAsValue(expr);
}
bool JSCDataModel::evalAsBool(const Arabica::DOM::Element<std::string>& node, const std::string& expr) {
- TIME_BLOCK
JSValueRef result = evalAsValue(expr);
return JSValueToBoolean(_ctx, result);
}
std::string JSCDataModel::evalAsString(const std::string& expr) {
- TIME_BLOCK
JSValueRef result = evalAsValue(expr);
JSValueRef exception = NULL;
@@ -635,7 +614,6 @@ std::string JSCDataModel::evalAsString(const std::string& expr) {
}
JSValueRef JSCDataModel::evalAsValue(const std::string& expr, bool dontThrow) {
- TIME_BLOCK
JSStringRef scriptJS = JSStringCreateWithUTF8CString(expr.c_str());
JSValueRef exception = NULL;
JSValueRef result = JSEvaluateScript(_ctx, scriptJS, NULL, NULL, 0, &exception);
@@ -650,7 +628,6 @@ JSValueRef JSCDataModel::evalAsValue(const std::string& expr, bool dontThrow) {
void JSCDataModel::assign(const Element<std::string>& assignElem,
const Node<std::string>& node,
const std::string& content) {
- TIME_BLOCK
std::string key;
JSValueRef exception = NULL;
if (HAS_ATTR(assignElem, "id")) {
@@ -693,7 +670,6 @@ void JSCDataModel::assign(const Element<std::string>& assignElem,
}
JSValueRef JSCDataModel::getNodeAsValue(const Node<std::string>& node) {
- TIME_BLOCK
switch (node.getNodeType()) {
case Node_base::ELEMENT_NODE: {
TO_JSC_DOMVALUE(Element);
@@ -714,7 +690,6 @@ JSValueRef JSCDataModel::getNodeAsValue(const Node<std::string>& node) {
}
void JSCDataModel::assign(const std::string& location, const Data& data) {
- TIME_BLOCK
std::stringstream ssJSON;
ssJSON << data;
evalAsValue(location + " = " + ssJSON.str());
@@ -723,7 +698,6 @@ void JSCDataModel::assign(const std::string& location, const Data& data) {
void JSCDataModel::init(const Element<std::string>& dataElem,
const Node<std::string>& node,
const std::string& content) {
- TIME_BLOCK
try {
assign(dataElem, node, content);
} catch (Event e) {
@@ -740,7 +714,6 @@ void JSCDataModel::init(const Element<std::string>& dataElem,
}
void JSCDataModel::init(const std::string& location, const Data& data) {
- TIME_BLOCK
try {
assign(location, data);
} catch (Event e) {
@@ -751,8 +724,6 @@ void JSCDataModel::init(const std::string& location, const Data& data) {
}
std::string JSCDataModel::andExpressions(std::list<std::string> expressions) {
- TIME_BLOCK
-
if (expressions.size() == 0)
return "";
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
index 19d109a..b1fb141 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
@@ -34,6 +34,7 @@
#include <boost/algorithm/string.hpp>
#ifdef _WIN32
+#define NOMINMAX
#include <winsock2.h>
#include <windows.h>
#endif
diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
index 9ba3e63..6905e22 100644
--- a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
@@ -20,6 +20,7 @@
#include <boost/algorithm/string.hpp>
#ifdef _WIN32
+#define NOMINMAX
#include <winsock2.h>
#include <windows.h>
#endif
diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp
index 57c1e4f..90ce242 100644
--- a/src/uscxml/server/HTTPServer.cpp
+++ b/src/uscxml/server/HTTPServer.cpp
@@ -20,6 +20,7 @@
#include "uscxml/config.h"
#ifdef _WIN32
+#define NOMINMAX
#include <winsock2.h>
#include <windows.h>
#endif
diff --git a/src/uscxml/transform/ChartToC.cpp b/src/uscxml/transform/ChartToC.cpp
index 02c1e91..3944b92 100644
--- a/src/uscxml/transform/ChartToC.cpp
+++ b/src/uscxml/transform/ChartToC.cpp
@@ -122,8 +122,13 @@ void ChartToC::writeMacros(std::ostream& stream) {
stream << "#define CLEARBIT(idx, bitset) bitset[idx >> 3] &= (1 << (idx & 7)) ^ 0xFF;" << std::endl;
stream << std::endl;
- stream << "#define likely(x) (__builtin_expect (!!(x), 1))" << std::endl;
- stream << "#define unlikely(x) (__builtin_expect (!!(x), 0))" << std::endl;
+ stream << "#ifdef __GNUC__" << std::endl;
+ stream << "#define likely(x) __builtin_expect(!!(x), 1)" << std::endl;
+ stream << "#define unlikely(x) __builtin_expect(!!(x), 0)" << std::endl;
+ stream << "#else" << std::endl;
+ stream << "#define likely(x) (x)" << std::endl;
+ stream << "#define unlikely(x) (x)" << std::endl;
+ stream << "#endif" << std::endl;
stream << std::endl;
stream << "// error return codes" << std::endl;
@@ -666,7 +671,7 @@ void ChartToC::writeExecContent(std::ostream& stream, const Arabica::DOM::Node<s
stream << padding;
stream << "if likely(ctx->exec_content_raise != NULL) {" << std::endl;
stream << padding;
- stream << " if ((ctx->exec_content_raise(ctx, ";
+ stream << " if unlikely((ctx->exec_content_raise(ctx, ";
stream << (HAS_ATTR(elem, "event") ? "\"" + escape(ATTR(elem, "event")) + "\"" : "NULL");
stream << ")) != SCXML_ERR_OK) return err;" << std::endl;
stream << padding << "} else {" << std::endl;
@@ -1231,7 +1236,7 @@ void ChartToC::writeFSM(std::ostream& stream) {
stream << "#endif" << std::endl;
stream << std::endl;
- stream << "MACRO_STEP:" << std::endl;
+ stream << "// MACRO_STEP:" << std::endl;
stream << " ctx->flags &= ~SCXML_CTX_TRANSITION_FOUND;" << std::endl;
stream << std::endl;
@@ -1321,7 +1326,7 @@ void ChartToC::writeFSM(std::ostream& stream) {
stream << "#endif" << std::endl;
stream << std::endl;
- stream << "REMEMBER_HISTORY:" << std::endl;
+ stream << "// REMEMBER_HISTORY:" << std::endl;
stream << " for (int i = 0; i < SCXML_NUMBER_STATES; i++) {" << std::endl;
stream << " if unlikely(scxml_states[i].type == SCXML_STATE_HISTORY_SHALLOW || scxml_states[i].type == SCXML_STATE_HISTORY_DEEP) {" << std::endl;
stream << " // a history state whose parent is about to be exited" << std::endl;
@@ -1353,7 +1358,7 @@ void ChartToC::writeFSM(std::ostream& stream) {
stream << "#endif" << std::endl;
stream << std::endl;
- stream << "EXIT_STATES:" << std::endl;
+ stream << "// EXIT_STATES:" << std::endl;
stream << " for (int i = SCXML_NUMBER_STATES - 1; i >= 0; i--) {" << std::endl;
stream << " if (IS_SET(i, exit_set) && IS_SET(i, ctx->config)) {" << std::endl;
stream << " // call all on exit handlers" << std::endl;
@@ -1378,7 +1383,7 @@ void ChartToC::writeFSM(std::ostream& stream) {
stream << " }" << std::endl;
stream << std::endl;
- stream << "ADD_DESCENDANTS:" << std::endl;
+ stream << "// ADD_DESCENDANTS:" << std::endl;
stream << " // iterate for descendants" << std::endl;
stream << " for (int i = 0; i < SCXML_NUMBER_STATES; i++) {" << std::endl;
stream << " if (IS_SET(i, entry_set)) {" << std::endl;
@@ -1438,7 +1443,7 @@ void ChartToC::writeFSM(std::ostream& stream) {
stream << "#endif" << std::endl;
stream << std::endl;
- stream << "TAKE_TRANSITIONS:" << std::endl;
+ stream << "// TAKE_TRANSITIONS:" << std::endl;
stream << " for (int i = 0; i < SCXML_NUMBER_TRANSITIONS; i++) {" << std::endl;
stream << " if (IS_SET(i, trans_set) && (scxml_transitions[i].type & SCXML_TRANS_HISTORY) == 0) {" << std::endl;
stream << " // call executable content in transition" << std::endl;
@@ -1458,7 +1463,7 @@ void ChartToC::writeFSM(std::ostream& stream) {
stream << "#endif" << std::endl;
stream << std::endl;
- stream << "ENTER_STATES:" << std::endl;
+ stream << "// ENTER_STATES:" << std::endl;
stream << " for (int i = 0; i < SCXML_NUMBER_STATES; i++) {" << std::endl;
stream << " if (IS_SET(i, entry_set) && !IS_SET(i, ctx->config)) {" << std::endl;
stream << " // these are no proper states" << std::endl;
@@ -1549,7 +1554,7 @@ void ChartToC::writeFSM(std::ostream& stream) {
stream << " }" << std::endl;
stream << std::endl;
- stream << "HISTORY_TRANSITIONS:" << std::endl;
+ stream << "// HISTORY_TRANSITIONS:" << std::endl;
stream << " for (int i = 0; i < SCXML_NUMBER_TRANSITIONS; i++) {" << std::endl;
stream << " if unlikely(IS_SET(i, trans_set) && (scxml_transitions[i].type & SCXML_TRANS_HISTORY)) {" << std::endl;
stream << " // call executable content in transition" << std::endl;
diff --git a/src/uscxml/transform/ChartToPromela.cpp b/src/uscxml/transform/ChartToPromela.cpp
index 965eebc..03178f0 100644
--- a/src/uscxml/transform/ChartToPromela.cpp
+++ b/src/uscxml/transform/ChartToPromela.cpp
@@ -2563,7 +2563,7 @@ void ChartToPromela::writeInsertWithDelay(std::ostream& stream, int indent) {
uint32_t maxExternalQueueLength = 1;
std::map<Arabica::DOM::Node<std::string>, ChartToPromela*>::iterator machineIter = _machinesAll->begin();
while(machineIter != _machinesAll->end()) {
- maxExternalQueueLength = std::max(maxExternalQueueLength, machineIter->second->_externalQueueLength);
+ maxExternalQueueLength = MAX(maxExternalQueueLength, machineIter->second->_externalQueueLength);
machineIter++;
}