compiler/libec: Improved template type checks to avoid arguments mix-up
[sdk] / compiler / bootstrap / ecere / bootstrap / memory.c
1 /* Code generated from eC source file: memory.ec */
2 #if defined(_WIN32)
3 #define __runtimePlatform 1
4 #elif defined(__APPLE__)
5 #define __runtimePlatform 3
6 #else
7 #define __runtimePlatform 2
8 #endif
9 #if defined(__GNUC__)
10 typedef long long int64;
11 typedef unsigned long long uint64;
12 #ifndef _WIN32
13 #define __declspec(x)
14 #endif
15 #elif defined(__TINYC__)
16 #include <stdarg.h>
17 #define __builtin_va_list va_list
18 #define __builtin_va_start va_start
19 #define __builtin_va_end va_end
20 #ifdef _WIN32
21 #define strcasecmp stricmp
22 #define strncasecmp strnicmp
23 #define __declspec(x) __attribute__((x))
24 #else
25 #define __declspec(x)
26 #endif
27 typedef long long int64;
28 typedef unsigned long long uint64;
29 #else
30 typedef __int64 int64;
31 typedef unsigned __int64 uint64;
32 #endif
33 #ifdef __BIG_ENDIAN__
34 #define __ENDIAN_PAD(x) (8 - (x))
35 #else
36 #define __ENDIAN_PAD(x) 0
37 #endif
38 #if defined(_WIN32)
39 #   if defined(__GNUC__) || defined(__TINYC__)
40 #      define ecere_stdcall __attribute__((__stdcall__))
41 #      define ecere_gcc_struct __attribute__((gcc_struct))
42 #   else
43 #      define ecere_stdcall __stdcall
44 #      define ecere_gcc_struct
45 #   endif
46 #else
47 #   define ecere_stdcall
48 #   define ecere_gcc_struct
49 #endif
50 #include <stdint.h>
51 #include <sys/types.h>
52 void __ecereNameSpace__ecere__sys__FillBytesBy2(void * area, unsigned short value, unsigned int count)
53 {
54 unsigned short * dest = area;
55 int c;
56
57 for(c = 0; c < count; c++)
58 dest[c] = value;
59 }
60
61 void __ecereNameSpace__ecere__sys__FillBytesBy4(void * area, unsigned int value, unsigned int count)
62 {
63 unsigned int * dest = area;
64 int c;
65
66 for(c = 0; c < count; c++)
67 dest[c] = value;
68 }
69
70 struct __ecereNameSpace__ecere__sys__OldList
71 {
72 void *  first;
73 void *  last;
74 int count;
75 unsigned int offset;
76 unsigned int circ;
77 } ecere_gcc_struct;
78
79 struct __ecereNameSpace__ecere__sys__BTNode;
80
81 struct __ecereNameSpace__ecere__com__DataValue
82 {
83 union
84 {
85 char c;
86 unsigned char uc;
87 short s;
88 unsigned short us;
89 int i;
90 unsigned int ui;
91 void *  p;
92 float f;
93 double d;
94 long long i64;
95 uint64 ui64;
96 } ecere_gcc_struct __anon1;
97 } ecere_gcc_struct;
98
99 struct __ecereNameSpace__ecere__com__SerialBuffer
100 {
101 unsigned char *  _buffer;
102 unsigned int count;
103 unsigned int _size;
104 unsigned int pos;
105 } ecere_gcc_struct;
106
107 extern void *  __ecereNameSpace__ecere__com__eSystem_New(unsigned int size);
108
109 extern void *  __ecereNameSpace__ecere__com__eSystem_New0(unsigned int size);
110
111 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew(void *  memory, unsigned int size);
112
113 extern void *  __ecereNameSpace__ecere__com__eSystem_Renew0(void *  memory, unsigned int size);
114
115 extern void __ecereNameSpace__ecere__com__eSystem_Delete(void *  memory);
116
117 extern void *  memmove(void * , const void * , size_t size);
118
119 extern void *  memcpy(void * , const void * , size_t size);
120
121 extern void *  memset(void *  area, int value, size_t count);
122
123 struct __ecereNameSpace__ecere__com__GlobalFunction;
124
125 void __ecereNameSpace__ecere__sys__MoveBytes(void * dest, const void * source, unsigned int count)
126 {
127 memmove(dest, source, count);
128 }
129
130 void __ecereNameSpace__ecere__sys__CopyBytes(void * dest, const void * source, unsigned int count)
131 {
132 memcpy(dest, source, count);
133 }
134
135 void __ecereNameSpace__ecere__sys__CopyBytesBy2(void * dest, const void * source, unsigned int count)
136 {
137 memcpy(dest, source, count << 1);
138 }
139
140 void __ecereNameSpace__ecere__sys__CopyBytesBy4(void * dest, const void * source, unsigned int count)
141 {
142 memcpy(dest, source, count << 2);
143 }
144
145 void __ecereNameSpace__ecere__sys__FillBytes(void * area, unsigned char value, unsigned int count)
146 {
147 memset(area, value, count);
148 }
149
150 struct __ecereNameSpace__ecere__com__Class;
151
152 struct __ecereNameSpace__ecere__com__Instance
153 {
154 void * *  _vTbl;
155 struct __ecereNameSpace__ecere__com__Class * _class;
156 int _refCount;
157 } ecere_gcc_struct;
158
159 extern long long __ecereNameSpace__ecere__com__eClass_GetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name);
160
161 extern void __ecereNameSpace__ecere__com__eClass_SetProperty(struct __ecereNameSpace__ecere__com__Class * _class, const char *  name, long long value);
162
163 extern void __ecereNameSpace__ecere__com__eInstance_SetMethod(struct __ecereNameSpace__ecere__com__Instance * instance, const char *  name, void *  function);
164
165 extern void __ecereNameSpace__ecere__com__eInstance_IncRef(struct __ecereNameSpace__ecere__com__Instance * instance);
166
167 struct __ecereNameSpace__ecere__sys__BinaryTree;
168
169 struct __ecereNameSpace__ecere__sys__BinaryTree
170 {
171 struct __ecereNameSpace__ecere__sys__BTNode * root;
172 int count;
173 int (*  CompareKey)(struct __ecereNameSpace__ecere__sys__BinaryTree * tree, uintptr_t a, uintptr_t b);
174 void (*  FreeKey)(void *  key);
175 } ecere_gcc_struct;
176
177 struct __ecereNameSpace__ecere__com__DataMember;
178
179 struct __ecereNameSpace__ecere__com__DataMember
180 {
181 struct __ecereNameSpace__ecere__com__DataMember * prev;
182 struct __ecereNameSpace__ecere__com__DataMember * next;
183 const char *  name;
184 unsigned int isProperty;
185 int memberAccess;
186 int id;
187 struct __ecereNameSpace__ecere__com__Class * _class;
188 const char *  dataTypeString;
189 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
190 struct __ecereNameSpace__ecere__com__Instance * dataType;
191 int type;
192 int offset;
193 int memberID;
194 struct __ecereNameSpace__ecere__sys__OldList members;
195 struct __ecereNameSpace__ecere__sys__BinaryTree membersAlpha;
196 int memberOffset;
197 short structAlignment;
198 short pointerAlignment;
199 } ecere_gcc_struct;
200
201 struct __ecereNameSpace__ecere__com__Property;
202
203 struct __ecereNameSpace__ecere__com__Property
204 {
205 struct __ecereNameSpace__ecere__com__Property * prev;
206 struct __ecereNameSpace__ecere__com__Property * next;
207 const char *  name;
208 unsigned int isProperty;
209 int memberAccess;
210 int id;
211 struct __ecereNameSpace__ecere__com__Class * _class;
212 const char *  dataTypeString;
213 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
214 struct __ecereNameSpace__ecere__com__Instance * dataType;
215 void (*  Set)(void * , int);
216 int (*  Get)(void * );
217 unsigned int (*  IsSet)(void * );
218 void *  data;
219 void *  symbol;
220 int vid;
221 unsigned int conversion;
222 unsigned int watcherOffset;
223 const char *  category;
224 unsigned int compiled;
225 unsigned int selfWatchable;
226 unsigned int isWatchable;
227 } ecere_gcc_struct;
228
229 extern void __ecereNameSpace__ecere__com__eInstance_FireSelfWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
230
231 extern void __ecereNameSpace__ecere__com__eInstance_StopWatching(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property, struct __ecereNameSpace__ecere__com__Instance * object);
232
233 extern void __ecereNameSpace__ecere__com__eInstance_Watch(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property, void *  object, void (*  callback)(void * , void * ));
234
235 extern void __ecereNameSpace__ecere__com__eInstance_FireWatchers(struct __ecereNameSpace__ecere__com__Instance * instance, struct __ecereNameSpace__ecere__com__Property * _property);
236
237 struct __ecereNameSpace__ecere__com__Method;
238
239 struct __ecereNameSpace__ecere__com__ClassTemplateArgument
240 {
241 union
242 {
243 struct
244 {
245 const char *  dataTypeString;
246 struct __ecereNameSpace__ecere__com__Class * dataTypeClass;
247 } ecere_gcc_struct __anon1;
248 struct __ecereNameSpace__ecere__com__DataValue expression;
249 struct
250 {
251 const char *  memberString;
252 union
253 {
254 struct __ecereNameSpace__ecere__com__DataMember * member;
255 struct __ecereNameSpace__ecere__com__Property * prop;
256 struct __ecereNameSpace__ecere__com__Method * method;
257 } ecere_gcc_struct __anon1;
258 } ecere_gcc_struct __anon2;
259 } ecere_gcc_struct __anon1;
260 } ecere_gcc_struct;
261
262 struct __ecereNameSpace__ecere__com__Method
263 {
264 const char *  name;
265 struct __ecereNameSpace__ecere__com__Method * parent;
266 struct __ecereNameSpace__ecere__com__Method * left;
267 struct __ecereNameSpace__ecere__com__Method * right;
268 int depth;
269 int (*  function)();
270 int vid;
271 int type;
272 struct __ecereNameSpace__ecere__com__Class * _class;
273 void *  symbol;
274 const char *  dataTypeString;
275 struct __ecereNameSpace__ecere__com__Instance * dataType;
276 int memberAccess;
277 } ecere_gcc_struct;
278
279 struct __ecereNameSpace__ecere__com__Module;
280
281 extern struct __ecereNameSpace__ecere__com__GlobalFunction * __ecereNameSpace__ecere__com__eSystem_RegisterFunction(const char *  name, const char *  type, void *  func, struct __ecereNameSpace__ecere__com__Instance * module, int declMode);
282
283 struct __ecereNameSpace__ecere__com__NameSpace;
284
285 struct __ecereNameSpace__ecere__com__NameSpace
286 {
287 const char *  name;
288 struct __ecereNameSpace__ecere__com__NameSpace *  btParent;
289 struct __ecereNameSpace__ecere__com__NameSpace *  left;
290 struct __ecereNameSpace__ecere__com__NameSpace *  right;
291 int depth;
292 struct __ecereNameSpace__ecere__com__NameSpace *  parent;
293 struct __ecereNameSpace__ecere__sys__BinaryTree nameSpaces;
294 struct __ecereNameSpace__ecere__sys__BinaryTree classes;
295 struct __ecereNameSpace__ecere__sys__BinaryTree defines;
296 struct __ecereNameSpace__ecere__sys__BinaryTree functions;
297 } ecere_gcc_struct;
298
299 struct __ecereNameSpace__ecere__com__Class
300 {
301 struct __ecereNameSpace__ecere__com__Class * prev;
302 struct __ecereNameSpace__ecere__com__Class * next;
303 const char *  name;
304 int offset;
305 int structSize;
306 void * *  _vTbl;
307 int vTblSize;
308 unsigned int (*  Constructor)(void * );
309 void (*  Destructor)(void * );
310 int offsetClass;
311 int sizeClass;
312 struct __ecereNameSpace__ecere__com__Class * base;
313 struct __ecereNameSpace__ecere__sys__BinaryTree methods;
314 struct __ecereNameSpace__ecere__sys__BinaryTree members;
315 struct __ecereNameSpace__ecere__sys__BinaryTree prop;
316 struct __ecereNameSpace__ecere__sys__OldList membersAndProperties;
317 struct __ecereNameSpace__ecere__sys__BinaryTree classProperties;
318 struct __ecereNameSpace__ecere__sys__OldList derivatives;
319 int memberID;
320 int startMemberID;
321 int type;
322 struct __ecereNameSpace__ecere__com__Instance * module;
323 struct __ecereNameSpace__ecere__com__NameSpace *  nameSpace;
324 const char *  dataTypeString;
325 struct __ecereNameSpace__ecere__com__Instance * dataType;
326 int typeSize;
327 int defaultAlignment;
328 void (*  Initialize)();
329 int memberOffset;
330 struct __ecereNameSpace__ecere__sys__OldList selfWatchers;
331 const char *  designerClass;
332 unsigned int noExpansion;
333 const char *  defaultProperty;
334 unsigned int comRedefinition;
335 int count;
336 int isRemote;
337 unsigned int internalDecl;
338 void *  data;
339 unsigned int computeSize;
340 short structAlignment;
341 short pointerAlignment;
342 int destructionWatchOffset;
343 unsigned int fixed;
344 struct __ecereNameSpace__ecere__sys__OldList delayedCPValues;
345 int inheritanceAccess;
346 const char *  fullName;
347 void *  symbol;
348 struct __ecereNameSpace__ecere__sys__OldList conversions;
349 struct __ecereNameSpace__ecere__sys__OldList templateParams;
350 struct __ecereNameSpace__ecere__com__ClassTemplateArgument *  templateArgs;
351 struct __ecereNameSpace__ecere__com__Class * templateClass;
352 struct __ecereNameSpace__ecere__sys__OldList templatized;
353 int numParams;
354 unsigned int isInstanceClass;
355 unsigned int byValueSystemClass;
356 void *  bindingsClass;
357 } ecere_gcc_struct;
358
359 struct __ecereNameSpace__ecere__com__Application
360 {
361 int argc;
362 const char * *  argv;
363 int exitCode;
364 unsigned int isGUIApp;
365 struct __ecereNameSpace__ecere__sys__OldList allModules;
366 char *  parsedCommand;
367 struct __ecereNameSpace__ecere__com__NameSpace systemNameSpace;
368 } ecere_gcc_struct;
369
370 struct __ecereNameSpace__ecere__com__Module
371 {
372 struct __ecereNameSpace__ecere__com__Instance * application;
373 struct __ecereNameSpace__ecere__sys__OldList classes;
374 struct __ecereNameSpace__ecere__sys__OldList defines;
375 struct __ecereNameSpace__ecere__sys__OldList functions;
376 struct __ecereNameSpace__ecere__sys__OldList modules;
377 struct __ecereNameSpace__ecere__com__Instance * prev;
378 struct __ecereNameSpace__ecere__com__Instance * next;
379 const char *  name;
380 void *  library;
381 void *  Unload;
382 int importType;
383 int origImportType;
384 struct __ecereNameSpace__ecere__com__NameSpace privateNameSpace;
385 struct __ecereNameSpace__ecere__com__NameSpace publicNameSpace;
386 } ecere_gcc_struct;
387
388 void __ecereRegisterModule_memory(struct __ecereNameSpace__ecere__com__Instance * module)
389 {
390 struct __ecereNameSpace__ecere__com__Class __attribute__((unused)) * class;
391
392 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::MoveBytes", "void ecere::sys::MoveBytes(void * dest, const void * source, uint count)", __ecereNameSpace__ecere__sys__MoveBytes, module, 1);
393 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::CopyBytes", "void ecere::sys::CopyBytes(void * dest, const void * source, uint count)", __ecereNameSpace__ecere__sys__CopyBytes, module, 1);
394 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::CopyBytesBy2", "void ecere::sys::CopyBytesBy2(void * dest, const void * source, uint count)", __ecereNameSpace__ecere__sys__CopyBytesBy2, module, 1);
395 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::CopyBytesBy4", "void ecere::sys::CopyBytesBy4(void * dest, const void * source, uint count)", __ecereNameSpace__ecere__sys__CopyBytesBy4, module, 1);
396 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::FillBytes", "void ecere::sys::FillBytes(void * area, byte value, uint count)", __ecereNameSpace__ecere__sys__FillBytes, module, 1);
397 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::FillBytesBy2", "void ecere::sys::FillBytesBy2(void * area, uint16 value, uint count)", __ecereNameSpace__ecere__sys__FillBytesBy2, module, 1);
398 __ecereNameSpace__ecere__com__eSystem_RegisterFunction("ecere::sys::FillBytesBy4", "void ecere::sys::FillBytesBy4(void * area, uint value, uint count)", __ecereNameSpace__ecere__sys__FillBytesBy4, module, 1);
399 }
400
401 void __ecereUnregisterModule_memory(struct __ecereNameSpace__ecere__com__Instance * module)
402 {
403
404 }
405