ucx/ucx.h

Fri, 12 Oct 2012 10:54:55 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 12 Oct 2012 10:54:55 +0200
changeset 69
fb59270b1de3
parent 65
7b2f2cab6348
child 76
655020a30e77
permissions
-rw-r--r--

made the code work with VC++ compiler (use make CONF=windows)

olaf@5 1 /*
olaf@5 2 * File: ucx.h
olaf@5 3 * Author: olaf
olaf@5 4 *
olaf@5 5 * Created on 31. Dezember 2011, 17:17
olaf@5 6 */
olaf@5 7
olaf@5 8 #ifndef UCX_H
olaf@5 9 #define UCX_H
olaf@5 10
olaf@5 11 #include <stdlib.h>
olaf@5 12
olaf@5 13 #ifdef __cplusplus
universe@65 14 #ifndef _Bool
universe@65 15 #define _Bool bool
universe@69 16 #define restrict
universe@65 17 #endif
olaf@5 18 extern "C" {
olaf@5 19 #endif
olaf@5 20
universe@26 21 #define UCX_FOREACH(type,list,elem) \
universe@26 22 for (type elem = list ; elem != NULL ; elem = elem->next)
universe@69 23
universe@69 24 #ifdef __cplusplus
universe@69 25 #define ucx_dynarray_new(type,identifier,length)\
universe@69 26 type* identifier; identifier = new type[length]
universe@69 27 #define ucx_dynarray_free(identifier) delete [] identifier
universe@69 28 #else
universe@69 29 #define ucx_dynarray_new(type,identifier,length)\
universe@69 30 type identifier[length]
universe@69 31 #define ucx_dynarray_free(identifier)
universe@69 32 #endif
universe@26 33
universe@18 34 /* element1,element2,custom data -> {-1,0,1} */
universe@18 35 typedef int(*cmp_func)(void*,void*,void*);
universe@18 36
universe@18 37 /* element,custom data -> copy of element */
universe@18 38 typedef void*(*copy_func)(void*,void*);
universe@18 39
olaf@5 40 #ifdef __cplusplus
olaf@5 41 }
olaf@5 42 #endif
olaf@5 43
olaf@5 44 #endif /* UCX_H */
olaf@5 45

mercurial