-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·38 lines (32 loc) · 783 Bytes
/
main.cpp
File metadata and controls
executable file
·38 lines (32 loc) · 783 Bytes
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
#include <v8.h>
#include "v8-gl.h"
#include <string>
using namespace v8;
void ParseOptions(int argc,
char* argv[],
string* file) {
for (int i = 1; i < argc; i++) {
std::string arg = argv[i];
size_t index = arg.find('=', 0);
if (index == std::string::npos) {
*file = arg;
} else {
std::string key = arg.substr(0, index);
std::string value = arg.substr(index+1);
}
}
}
int main(int argc, char* argv[]) {
string file;
ParseOptions(argc, argv, &file);
if (file.empty()) {
fprintf(stderr, "No script was specified.\n");
return 1;
}
V8GL v8gl;
if(!v8gl.initialize(&argc, argv, file)) {
fprintf(stderr, "Error initializing script.\n");
return 1;
}
return 0;
}