/+junk/c_sdl_joypad

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad

« back to all changes in this revision

Viewing changes to src/JSParser.c

  • Committer: Gustav Hartvigsson
  • Date: 2014-01-12 00:26:29 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140112002629-jsoprtfhefs89utd
* made the code compile.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <stdio.h>
2
2
#include <string.h>
 
3
#include <stdlib.h>
3
4
#include "game_utils.h"
4
5
#include "JSParser.h"
5
6
 
26
27
                                   char * file_name,
27
28
                                   char * script) {
28
29
  GameJSParser * self = malloc (sizeof(GameJSParser));
29
 
  if (file_name != NULL && stript != NULL) {
 
30
  if (file_name != NULL && script != NULL) {
30
31
    print_error (
31
32
      "You can not use both a script and a file when creating a GameJSParser.\n"
32
33
      "Exacly ONE of these must be used."
33
34
    );
34
35
    game_js_parser_free (self);
35
36
    return NULL;
36
 
  } else if (file_name == NULL && stript == NULL) {
 
37
  } else if (file_name == NULL && script == NULL) {
37
38
    print_error (
38
39
      "WARNING: No script or file is set when constructing GameJSParser"
39
40
    );
53
54
    game_js_parser_free (self);
54
55
    return NULL;
55
56
  }
56
 
  self->js_global = JS_NewGlobalObject (self->js_cx, _js_global_class, NULL);
 
57
  self->js_global = JS_NewGlobalObject (self->js_cx, &_js_global_class);
57
58
  if (!self->js_global) {
58
59
    print_error ( "Could not contruct the JS runtime global object.");
59
60
    game_js_parser_free (self);
92
93
  self->dump_data_func = func;
93
94
}
94
95
 
95
 
void * game_js_parser_load_settings (GameJSParser * self, void * data) {
96
 
  GameJSParserDumpDataFunc func = self->load_data_func;
 
96
void game_js_parser_load_settings (GameJSParser * self, void * data) {
 
97
  GameJSParserLoadDataFunc func = self->load_data_func;
97
98
  func (self, data);
98
99
}
99
100
void * game_js_parser_dump_settings (GameJSParser * self) {
100
101
  GameJSParserDumpDataFunc func = self->dump_data_func;
101
 
  return  func (self);
 
102
  return func (self);
102
103
}