blob: 7cdd3929a5619f93e84c80e9ca671b96524e481d (
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
|
#include "uscxml/config.h"
#include "uscxml/Interpreter.h"
#include <glog/logging.h>
#ifdef _WIN32
#include "XGetopt.h"
#endif
void printUsageAndExit() {
printf("mmi-browser version " USCXML_VERSION " (" CMAKE_BUILD_TYPE " build - " CMAKE_COMPILER_STRING ")\n");
printf("Usage\n");
printf("\tmmi-browser");
#ifdef BUILD_AS_PLUGINS
printf(" [-p pluginPath]");
#endif
printf(" URL\n");
printf("\n");
// printf("Options\n");
// printf("\t-l loglevel : loglevel to use\n");
exit(1);
}
int main(int argc, char** argv) {
using namespace uscxml;
if (argc < 2) {
printUsageAndExit();
}
#ifndef _WIN32
opterr = 0;
#endif
int option;
while ((option = getopt(argc, argv, "l:p:")) != -1) {
switch(option) {
case 'l':
google::InitGoogleLogging(optarg);
break;
case 'p':
uscxml::Factory::pluginPath = optarg;
break;
case '?':
break;
default:
printUsageAndExit();
break;
}
}
// for (int i = 0; i < argc; i++)
// std::cout << argv[i] << std::endl;
// std::cout << optind << std::endl;
Interpreter* interpreter = Interpreter::fromURI(argv[optind]);
if (interpreter) {
interpreter->setCmdLineOptions(argc, argv);
interpreter->start();
while(interpreter->runOnMainThread(25));
delete interpreter;
}
return EXIT_SUCCESS;
}
|