annotate lib/swig/swigwin-2.0.11/Lib/cmalloc.i @ 2546:4087cbc62706

GameMenu logic moved to GUIWindow_GameMenu the same for game menu options
author a.parshin
date Mon, 11 May 2015 17:45:02 +0200
parents b3009adc0e2f
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 /* -----------------------------------------------------------------------------
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2 * cmalloc.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 *
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4 * SWIG library file containing macros that can be used to create objects using
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5 * the C malloc function.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6 * ----------------------------------------------------------------------------- */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8 %{
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 #include <stdlib.h>
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10 %}
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 /* %malloc(TYPE [, NAME = TYPE])
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13 %calloc(TYPE [, NAME = TYPE])
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14 %realloc(TYPE [, NAME = TYPE])
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 %free(TYPE [, NAME = TYPE])
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16 %allocators(TYPE [,NAME = TYPE])
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18 Creates functions for allocating/reallocating memory.
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20 TYPE *malloc_NAME(int nbytes = sizeof(TYPE);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21 TYPE *calloc_NAME(int nobj=1, int size=sizeof(TYPE));
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22 TYPE *realloc_NAME(TYPE *ptr, int nbytes);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 void free_NAME(TYPE *ptr);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25 */
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27 %define %malloc(TYPE,NAME...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 #if #NAME != ""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29 %rename(malloc_##NAME) ::malloc(int nbytes);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31 %rename(malloc_##TYPE) ::malloc(int nbytes);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 #if #TYPE != "void"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 %typemap(default) int nbytes "$1 = (int) sizeof(TYPE);"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37 TYPE *malloc(int nbytes);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38 %typemap(default) int nbytes;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41 %define %calloc(TYPE,NAME...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42 #if #NAME != ""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 %rename(calloc_##NAME) ::calloc(int nobj, int sz);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 %rename(calloc_##TYPE) ::calloc(int nobj, int sz);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 #if #TYPE != "void"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48 %typemap(default) int sz "$1 = (int) sizeof(TYPE);"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50 %typemap(default) int sz "$1 = 1;"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52 %typemap(default) int nobj "$1 = 1;"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53 TYPE *calloc(int nobj, int sz);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54 %typemap(default) int sz;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55 %typemap(default) int nobj;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 %define %realloc(TYPE,NAME...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59 %insert("header") {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 #if #NAME != ""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61 TYPE *realloc_##NAME(TYPE *ptr, int nitems)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63 TYPE *realloc_##TYPE(TYPE *ptr, int nitems)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65 {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 #if #TYPE != "void"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67 return (TYPE *) realloc(ptr, nitems*sizeof(TYPE));
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69 return (TYPE *) realloc(ptr, nitems);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73 #if #NAME != ""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74 TYPE *realloc_##NAME(TYPE *ptr, int nitems);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76 TYPE *realloc_##TYPE(TYPE *ptr, int nitems);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80 %define %free(TYPE,NAME...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81 #if #NAME != ""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
82 %rename(free_##NAME) ::free(TYPE *ptr);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
83 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
84 %rename(free_##TYPE) ::free(TYPE *ptr);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
85 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
86 void free(TYPE *ptr);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
87 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
88
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
89 %define %sizeof(TYPE,NAME...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
90 #if #NAME != ""
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
91 %constant int sizeof_##NAME = sizeof(TYPE);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
92 #else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
93 %constant int sizeof_##TYPE = sizeof(TYPE);
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
94 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
95 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
96
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
97 %define %allocators(TYPE,NAME...)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
98 %malloc(TYPE,NAME)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
99 %calloc(TYPE,NAME)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
100 %realloc(TYPE,NAME)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
101 %free(TYPE,NAME)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
102 #if #TYPE != "void"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
103 %sizeof(TYPE,NAME)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
104 #endif
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
105 %enddef
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
106
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
107
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
108
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
109
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
110