27
28
GameJSParser * self = malloc (sizeof(GameJSParser));
28
29
if (file_name != NULL && stript != NULL) {
30
"============================================================================\n"
31
"You can not use both a script and a file when creating a GameJSParser.\n"
32
"Exacly ONE of these must be used.\n"
33
"============================================================================\n"
31
"You can not use both a script and a file when creating a GameJSParser."
32
"Exacly ONE of these must be used.\n"
35
34
game_js_parser_free (self);
37
36
} else if (file_name == NULL && stript == NULL) {
39
"============================================================================\n"
40
"WARNING: No script or file is set when constructing GameJSParser\n"
41
"============================================================================\n"
38
"WARNING: No script or file is set when constructing GameJSParser"
45
42
self->js_rt = JS_NewRuntime (JS_RUNTIME_SIZE);
47
44
if (!self->js_rt) {
49
"============================================================================\n"
50
"Could not contruct JSRunTime.\n"
51
"============================================================================\n"
45
print_error ("Could not contruct JSRunTime.");
56
49
self->js_cx = JS_NewContext (self->js_rt, 1024 * 8); /** Do not change. **/
58
51
if (!self->js_cx) {
60
"============================================================================\n"
61
"Could not contruct JSContext.\n"
62
"============================================================================\n"
52
print_error ("Could not contruct JSContext.");
64
53
game_js_parser_free (self);
67
56
self->js_global = JS_NewGlobalObject (self->js_cx, _js_global_class, NULL);
68
57
if (!self->js_global) {
70
"============================================================================\n"
71
"Could not contruct the JS runtime global object.\n"
72
"============================================================================\n"
58
print_error ( "Could not contruct the JS runtime global object.");
74
59
game_js_parser_free (self);