/+junk/c_sdl_joypad_ducktape

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

« back to all changes in this revision

Viewing changes to src/DynamicArray.h

  • Committer: Gustav Hartvigsson
  • Date: 2014-09-02 20:15:48 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140902201548-h1kss1wdocqhs8df
* Fixed Makefile
* Changed all void * to _pointer in DynamicArray.[h,c].
* Fixed GameObject to work with the new base-type.
* Made the Object stuffs...
* added string_new_printf utility function in utils.[h,c]

* Derp.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 * @returns data to be put in a new \c DynamicArray, if used with
49
49
 *          <tt>dynamic_array_for_each_with_return</tt>.
50
50
 */
51
 
typedef void * (* ForEachFunc)(DynamicArray * self, void * item, void * data);
 
51
typedef _pointer (* ForEachFunc)(DynamicArray * self, _pointer item, _pointer data);
52
52
 
53
53
/**
54
54
 * Represents a function to be used when freeing some item in a dynamic array.
55
55
 *
56
56
 * @param obj The object to be freed.
57
57
 */
58
 
typedef void * (* FreeFunc)(void * obj);
 
58
typedef _pointer (* FreeFunc)(_pointer obj);
59
59
 
60
60
#endif /* __H_DEFS__ */
61
61
#endif /* #if 0*/
69
69
 *       <tt>free()</tt>.
70
70
 *        
71
71
 *        Normally a function with the signature <tt> (DynamicArray * self,
72
 
          void * item, void * data) </tt> should be used but cast to FreeFunc.
 
72
          _pointer item, _pointer data) </tt> should be used but cast to FreeFunc.
73
73
 */
74
74
DynamicArray * dynamic_array_new (size_t len, FreeFunc free_func);
75
75
 
84
84
/**
85
85
 * Get an item from the array.
86
86
 */
87
 
void * dynamic_array_get (DynamicArray * self, size_t index);
 
87
_pointer dynamic_array_get (DynamicArray * self, size_t index);
88
88
 
89
89
/**
90
90
 * Get the length of the array.
105
105
/**
106
106
 * Add an item to the array.
107
107
 */
108
 
void dynamic_array_add (DynamicArray * self, void * item);
 
108
void dynamic_array_add (DynamicArray * self, _pointer item);
109
109
 
110
110
/**
111
111
 * Dumps a copy of the array. Must be cast.
114
114
 * 
115
115
 * Is null-terminated.
116
116
 */
117
 
void ** dynamic_array_dump_array (DynamicArray * self);
 
117
_pointer* dynamic_array_dump_array (DynamicArray * self);
118
118
 
119
119
/**
120
120
 * Use a function on the array.
121
121
 */
122
122
void dynamic_array_for_each (DynamicArray * self, ForEachFunc func,
123
 
                             void * data);
 
123
                             _pointer data);
124
124
 
125
125
/** TODO
126
126
 * same as dynamic_array_for_each (), with the difference that it returns a new
128
128
 */
129
129
DynamicArray * dynamic_array_for_each_with_return (DynamicArray * self,
130
130
                                                   ForEachFunc func,
131
 
                                                   void * data);
 
131
                                                   _pointer data);
132
132
 
133
133
#endif /* #define __H_DYNAMIC_ARRAY__ */