blob: ac52a0ba39d7292fd881f455a2ea2dfc9dd0eca7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMLSSerializer.hpp>
#include <xercesc/dom/DOMImplementationLS.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include "uscxml/Interpreter.h"
#include "uscxml/interpreter/InterpreterMonitor.h"
#include "uscxml/util/DOM.h"
#include "uscxml/util/String.h"
#include "uscxml/util/UUID.h"
#include "uscxml/util/Predicates.h"
#include "uscxml/util/Convenience.h" // iequals
#include "easylogging++.h"
#include "uscxml/messages/Event.h"
#include "uscxml/server/HTTPServer.h"
#include <iostream>
#include <queue>
#include <condition_variable>
#include <event2/util.h> // for evutil_socket_t
#include <event2/event.h>
#include <event2/thread.h>
#ifdef _WIN32
#include "XGetopt.h"
#include "XGetopt.cpp"
#else
#include <getopt.h>
#endif
using namespace std;
using namespace XERCESC_NS;
using namespace uscxml;
int main(int argc, char** argv) {
size_t iterations = 1;
std::string documentURI;
el::Loggers::reconfigureAllLoggers(el::ConfigurationType::Format, "%datetime %level %fbase:%line: %msg");
if (argc < 2) {
exit(EXIT_FAILURE);
}
int option;
while ((option = getopt(argc, argv, "n:")) != -1) {
switch(option) {
case 'n':
iterations = strTo<size_t>(optarg);
break;
default:
break;
}
}
documentURI = argv[optind];
HTTPServer::getInstance(7080, 7443);
while(iterations--) {
try {
Interpreter interpreter = Interpreter::fromURL(documentURI);
// ActionLanguage al;
// al.execContent = std::shared_ptr<ContentExecutorImpl>(new ContentExecutorBasic(interpreter.getImpl().get()));
// interpreter.setActionLanguage(al);
StateTransitionMonitor mon;
interpreter.setMonitor(&mon);
InterpreterState state = InterpreterState::USCXML_UNDEF;
while(state != USCXML_FINISHED) {
state = interpreter.step(true);
}
assert(interpreter.isInState("pass"));
} catch (Event e) {
std::cerr << "Thrown Event out of Interpreter: " << e;
return EXIT_FAILURE;
}
}
return 0;
}
|