/+junk/c_sdl_joypad_ducktape

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad_ducktape
29 by Gustav Hartvigsson
* Fixed Makefile
1
#include <assert.h>
2
#include <stdlib.h>
3
#include <stdio.h>
4
5
#include "Object.h"
6
#include "utils.h"
7
8
9
/* The standard to_string method */
10
char * _object_standard_to_string (Object * object) {
11
  return string_new_printf ("(Object:%s)", object->name);
12
}
13
14
void object_initialize (Object * object,
15
                        char * name,
16
                        _pointer klass) {
17
  object->name = name;
18
  object->klass = klass;
19
  
20
  object->reserved0 = NULL;
21
  object->reserved1 = NULL;
22
}
23
24
void object_class_initialize (ObjectClass * klass,
25
                              NewFunc new_func,
26
                              FreeFunc free_func,
27
                              ToStringFunc to_string_func) {
28
  assert (new_func != NULL);
29
  assert (free_func != NULL);
30
  
31
  if (to_string_func != NULL) {
32
    klass->to_string_func = to_string_func;
33
  } else {
34
    klass->to_string_func = _object_standard_to_string;
35
  }
36
  
37
  klass->new_func = new_func;
38
  klass->free_func = free_func;
39
}
40
41
void object_add_private (Object * object, _pointer priv_data) {
42
  object->priv = priv_data;
43
}
44
45
Object * object_new_from_object (Object * self) {
46
  return (Object *) self->klass->new_func (self);
47
}
48
49
char * object_to_string (Object * self) {
50
  return self->klass->to_string_func (self);
51
}