Sat, 17 Sep 2016 19:57:55 +0200
fixes stultus commit
0 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
124
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
4 | * Copyright 2015 Olaf Wintermann. All rights reserved. |
0 | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | /** | |
29 | * Main UCX Header providing most common definitions. | |
30 | * | |
31 | * @file ucx.h | |
32 | * @author Mike Becker | |
33 | * @author Olaf Wintermann | |
34 | */ | |
35 | ||
36 | #ifndef UCX_H | |
37 | #define UCX_H | |
38 | ||
39 | /** Major UCX version as integer constant. */ | |
124
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
40 | #define UCX_VERSION_MAJOR 0 |
0 | 41 | |
42 | /** Minor UCX version as integer constant. */ | |
124
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
43 | #define UCX_VERSION_MINOR 9 |
0 | 44 | |
45 | /** The UCX version in format [major].[minor] */ | |
46 | #define UCX_VERSION UCX_VERSION_MAJOR.UCX_VERSION_MINOR | |
47 | ||
48 | #include <stdlib.h> | |
49 | ||
50 | #ifdef _WIN32 | |
51 | #if !(defined __ssize_t_defined || defined _SSIZE_T_) | |
52 | #include <BaseTsd.h> | |
53 | typedef SSIZE_T ssize_t; | |
54 | #define __ssize_t_defined | |
55 | #define _SSIZE_T_ | |
56 | #endif /* __ssize_t_defined and _SSIZE_T */ | |
57 | #else /* !_WIN32 */ | |
58 | #include <sys/types.h> | |
59 | #endif /* _WIN32 */ | |
60 | ||
61 | #ifdef __cplusplus | |
62 | #ifndef _Bool | |
63 | #define _Bool bool | |
64 | #define restrict | |
65 | #endif | |
66 | /** Use C naming even when compiling with C++. */ | |
67 | #define UCX_EXTERN extern "C" | |
68 | extern "C" { | |
69 | #else | |
70 | /** Pointless in C. */ | |
71 | #define UCX_EXTERN | |
72 | #endif | |
124
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
73 | |
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
74 | |
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
75 | /** |
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
76 | * A function pointer to a destructor function. |
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
77 | * @see ucx_mempool_setdestr() |
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
78 | * @see ucx_mempool_regdestr() |
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
79 | */ |
80609f9675f1
added support for icons for the table widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
80 | typedef void(*ucx_destructor)(void*); |
0 | 81 | |
82 | /** | |
83 | * Function pointer to a compare function. | |
84 | * | |
85 | * The compare function shall take three arguments: the two values that shall be | |
86 | * compared and optional additional data. | |
87 | * The function shall then return -1 if the first argument is less than the | |
88 | * second argument, 1 if the first argument is greater than the second argument | |
89 | * and 0 if both arguments are equal. If the third argument is | |
90 | * <code>NULL</code>, it shall be ignored. | |
91 | */ | |
92 | typedef int(*cmp_func)(void*,void*,void*); | |
93 | ||
94 | /** | |
95 | * Function pointer to a copy function. | |
96 | * | |
97 | * The copy function shall create a copy of the first argument and may use | |
98 | * additional data provided by the second argument. If the second argument is | |
99 | * <code>NULL</code>, it shall be ignored. | |
100 | ||
101 | * <b>Attention:</b> if pointers returned by functions of this type may be | |
102 | * passed to <code>free()</code> depends on the implementation of the | |
103 | * respective <code>copy_func</code>. | |
104 | */ | |
105 | typedef void*(*copy_func)(void*,void*); | |
106 | ||
107 | /** | |
108 | * Function pointer to a write function. | |
109 | * | |
110 | * The signature of the write function shall be compatible to the signature | |
111 | * of standard <code>fwrite</code>, though it may use arbitrary data types for | |
112 | * source and destination. | |
113 | * | |
114 | * The arguments shall contain (in ascending order): a pointer to the source, | |
115 | * the length of one element, the element count and a pointer to the | |
116 | * destination. | |
117 | */ | |
118 | typedef size_t(*write_func)(const void*, size_t, size_t, void*); | |
119 | ||
120 | /** | |
121 | * Function pointer to a read function. | |
122 | * | |
123 | * The signature of the read function shall be compatible to the signature | |
124 | * of standard <code>fread</code>, though it may use arbitrary data types for | |
125 | * source and destination. | |
126 | * | |
127 | * The arguments shall contain (in ascending order): a pointer to the | |
128 | * destination, the length of one element, the element count and a pointer to | |
129 | * the source. | |
130 | */ | |
131 | typedef size_t(*read_func)(void*, size_t, size_t, void*); | |
132 | ||
133 | #ifdef __cplusplus | |
134 | } | |
135 | #endif | |
136 | ||
137 | #endif /* UCX_H */ | |
138 |