autoc 0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README +13 -0
- data/lib/autoc.rb +12 -0
- data/lib/autoc/code_builder.rb +247 -0
- data/lib/autoc/data_struct_builder.rb +1794 -0
- data/lib/autoc/type_builder.rb +24 -0
- data/manual/manual.pdf +0 -0
- data/test/test.c +396 -0
- data/test/test.rb +27 -0
- data/test/test_auto.c +4042 -0
- data/test/test_auto.h +561 -0
- metadata +58 -0
data/test/test_auto.h
ADDED
@@ -0,0 +1,561 @@
|
|
1
|
+
|
2
|
+
/* AUTOMATICALLY GENERATED HEADER FILE. DO NOT MODIFY. */
|
3
|
+
#ifndef TEST_AUTO_H
|
4
|
+
#define TEST_AUTO_H
|
5
|
+
typedef struct Box Box;
|
6
|
+
#include <stddef.h>
|
7
|
+
#include <stdlib.h>
|
8
|
+
#include <malloc.h>
|
9
|
+
#include <assert.h>
|
10
|
+
#ifndef __DATA_STRUCT_INLINE
|
11
|
+
#if defined(_MSC_VER) || defined(__PGI)
|
12
|
+
#define __DATA_STRUCT_INLINE __inline static
|
13
|
+
#elif __STDC_VERSION__ >= 199901L && !defined(__DMC__)
|
14
|
+
#define __DATA_STRUCT_INLINE inline static
|
15
|
+
#else
|
16
|
+
#define __DATA_STRUCT_INLINE static
|
17
|
+
#endif
|
18
|
+
#endif
|
19
|
+
#ifndef __DATA_STRUCT_EXTERN
|
20
|
+
#if defined(__cplusplus)
|
21
|
+
#define __DATA_STRUCT_EXTERN extern "C"
|
22
|
+
#else
|
23
|
+
#define __DATA_STRUCT_EXTERN extern
|
24
|
+
#endif
|
25
|
+
#endif
|
26
|
+
|
27
|
+
typedef struct IntSetListNode IntSetListNode;
|
28
|
+
typedef struct IntSetList IntSetList;
|
29
|
+
typedef struct IntSetListIt IntSetListIt;
|
30
|
+
struct IntSetList {
|
31
|
+
IntSetListNode* head_node;
|
32
|
+
size_t node_count;
|
33
|
+
size_t ref_count;
|
34
|
+
};
|
35
|
+
struct IntSetListIt {
|
36
|
+
IntSetListNode* next_node;
|
37
|
+
};
|
38
|
+
struct IntSetListNode {
|
39
|
+
int element;
|
40
|
+
IntSetListNode* next_node;
|
41
|
+
};
|
42
|
+
|
43
|
+
typedef struct IntSet IntSet;
|
44
|
+
typedef struct IntSetIt IntSetIt;
|
45
|
+
struct IntSet {
|
46
|
+
IntSetList* buckets;
|
47
|
+
size_t bucket_count, min_bucket_count;
|
48
|
+
size_t size, min_size, max_size;
|
49
|
+
unsigned min_fill, max_fill, capacity_multiplier; /* ?*1e-2 */
|
50
|
+
size_t ref_count;
|
51
|
+
};
|
52
|
+
struct IntSetIt {
|
53
|
+
IntSet* set;
|
54
|
+
int bucket_index;
|
55
|
+
IntSetListIt it;
|
56
|
+
};
|
57
|
+
|
58
|
+
__DATA_STRUCT_EXTERN void IntSetCtor(IntSet*);
|
59
|
+
__DATA_STRUCT_EXTERN void IntSetDtor(IntSet*);
|
60
|
+
__DATA_STRUCT_EXTERN IntSet* IntSetNew(void);
|
61
|
+
__DATA_STRUCT_EXTERN void IntSetDestroy(IntSet*);
|
62
|
+
__DATA_STRUCT_EXTERN IntSet* IntSetAssign(IntSet*);
|
63
|
+
__DATA_STRUCT_EXTERN void IntSetPurge(IntSet*);
|
64
|
+
__DATA_STRUCT_EXTERN void IntSetRehash(IntSet*);
|
65
|
+
__DATA_STRUCT_EXTERN int IntSetContains(IntSet*, int);
|
66
|
+
__DATA_STRUCT_EXTERN int IntSetGet(IntSet*, int);
|
67
|
+
__DATA_STRUCT_EXTERN size_t IntSetSize(IntSet*);
|
68
|
+
__DATA_STRUCT_EXTERN int IntSetEmpty(IntSet*);
|
69
|
+
__DATA_STRUCT_EXTERN int IntSetPut(IntSet*, int);
|
70
|
+
__DATA_STRUCT_EXTERN void IntSetReplace(IntSet*, int);
|
71
|
+
__DATA_STRUCT_EXTERN int IntSetRemove(IntSet*, int);
|
72
|
+
__DATA_STRUCT_EXTERN void IntSetNot(IntSet*, IntSet*);
|
73
|
+
__DATA_STRUCT_EXTERN void IntSetAnd(IntSet*, IntSet*);
|
74
|
+
__DATA_STRUCT_EXTERN void IntSetOr(IntSet*, IntSet*);
|
75
|
+
__DATA_STRUCT_EXTERN void IntSetXor(IntSet*, IntSet*);
|
76
|
+
__DATA_STRUCT_EXTERN void IntSetItCtor(IntSetIt*, IntSet*);
|
77
|
+
__DATA_STRUCT_EXTERN int IntSetItHasNext(IntSetIt*);
|
78
|
+
__DATA_STRUCT_EXTERN int IntSetItNext(IntSetIt*);
|
79
|
+
size_t PCharHash(const char*);int PCharEqual(const char*,const char*);
|
80
|
+
typedef struct PCharSetListNode PCharSetListNode;
|
81
|
+
typedef struct PCharSetList PCharSetList;
|
82
|
+
typedef struct PCharSetListIt PCharSetListIt;
|
83
|
+
struct PCharSetList {
|
84
|
+
PCharSetListNode* head_node;
|
85
|
+
size_t node_count;
|
86
|
+
size_t ref_count;
|
87
|
+
};
|
88
|
+
struct PCharSetListIt {
|
89
|
+
PCharSetListNode* next_node;
|
90
|
+
};
|
91
|
+
struct PCharSetListNode {
|
92
|
+
const char* element;
|
93
|
+
PCharSetListNode* next_node;
|
94
|
+
};
|
95
|
+
|
96
|
+
typedef struct PCharSet PCharSet;
|
97
|
+
typedef struct PCharSetIt PCharSetIt;
|
98
|
+
struct PCharSet {
|
99
|
+
PCharSetList* buckets;
|
100
|
+
size_t bucket_count, min_bucket_count;
|
101
|
+
size_t size, min_size, max_size;
|
102
|
+
unsigned min_fill, max_fill, capacity_multiplier; /* ?*1e-2 */
|
103
|
+
size_t ref_count;
|
104
|
+
};
|
105
|
+
struct PCharSetIt {
|
106
|
+
PCharSet* set;
|
107
|
+
int bucket_index;
|
108
|
+
PCharSetListIt it;
|
109
|
+
};
|
110
|
+
|
111
|
+
__DATA_STRUCT_EXTERN void PCharSetCtor(PCharSet*);
|
112
|
+
__DATA_STRUCT_EXTERN void PCharSetDtor(PCharSet*);
|
113
|
+
__DATA_STRUCT_EXTERN PCharSet* PCharSetNew(void);
|
114
|
+
__DATA_STRUCT_EXTERN void PCharSetDestroy(PCharSet*);
|
115
|
+
__DATA_STRUCT_EXTERN PCharSet* PCharSetAssign(PCharSet*);
|
116
|
+
__DATA_STRUCT_EXTERN void PCharSetPurge(PCharSet*);
|
117
|
+
__DATA_STRUCT_EXTERN void PCharSetRehash(PCharSet*);
|
118
|
+
__DATA_STRUCT_EXTERN int PCharSetContains(PCharSet*, const char*);
|
119
|
+
__DATA_STRUCT_EXTERN const char* PCharSetGet(PCharSet*, const char*);
|
120
|
+
__DATA_STRUCT_EXTERN size_t PCharSetSize(PCharSet*);
|
121
|
+
__DATA_STRUCT_EXTERN int PCharSetEmpty(PCharSet*);
|
122
|
+
__DATA_STRUCT_EXTERN int PCharSetPut(PCharSet*, const char*);
|
123
|
+
__DATA_STRUCT_EXTERN void PCharSetReplace(PCharSet*, const char*);
|
124
|
+
__DATA_STRUCT_EXTERN int PCharSetRemove(PCharSet*, const char*);
|
125
|
+
__DATA_STRUCT_EXTERN void PCharSetNot(PCharSet*, PCharSet*);
|
126
|
+
__DATA_STRUCT_EXTERN void PCharSetAnd(PCharSet*, PCharSet*);
|
127
|
+
__DATA_STRUCT_EXTERN void PCharSetOr(PCharSet*, PCharSet*);
|
128
|
+
__DATA_STRUCT_EXTERN void PCharSetXor(PCharSet*, PCharSet*);
|
129
|
+
__DATA_STRUCT_EXTERN void PCharSetItCtor(PCharSetIt*, PCharSet*);
|
130
|
+
__DATA_STRUCT_EXTERN int PCharSetItHasNext(PCharSetIt*);
|
131
|
+
__DATA_STRUCT_EXTERN const char* PCharSetItNext(PCharSetIt*);
|
132
|
+
Box* BoxAssign(Box*);void BoxDestroy(Box*);size_t BoxHash(Box*);int BoxEqual(Box*,Box*);Box* BoxAssign(Box*);void BoxDestroy(Box*);
|
133
|
+
typedef struct Box2BoxMapEntry Box2BoxMapEntry;
|
134
|
+
struct Box2BoxMapEntry {
|
135
|
+
Box* key;
|
136
|
+
Box* value;
|
137
|
+
int valid_value;
|
138
|
+
};
|
139
|
+
|
140
|
+
typedef struct Box2BoxMapSetListNode Box2BoxMapSetListNode;
|
141
|
+
typedef struct Box2BoxMapSetList Box2BoxMapSetList;
|
142
|
+
typedef struct Box2BoxMapSetListIt Box2BoxMapSetListIt;
|
143
|
+
struct Box2BoxMapSetList {
|
144
|
+
Box2BoxMapSetListNode* head_node;
|
145
|
+
size_t node_count;
|
146
|
+
size_t ref_count;
|
147
|
+
};
|
148
|
+
struct Box2BoxMapSetListIt {
|
149
|
+
Box2BoxMapSetListNode* next_node;
|
150
|
+
};
|
151
|
+
struct Box2BoxMapSetListNode {
|
152
|
+
Box2BoxMapEntry element;
|
153
|
+
Box2BoxMapSetListNode* next_node;
|
154
|
+
};
|
155
|
+
|
156
|
+
typedef struct Box2BoxMapSet Box2BoxMapSet;
|
157
|
+
typedef struct Box2BoxMapSetIt Box2BoxMapSetIt;
|
158
|
+
struct Box2BoxMapSet {
|
159
|
+
Box2BoxMapSetList* buckets;
|
160
|
+
size_t bucket_count, min_bucket_count;
|
161
|
+
size_t size, min_size, max_size;
|
162
|
+
unsigned min_fill, max_fill, capacity_multiplier; /* ?*1e-2 */
|
163
|
+
size_t ref_count;
|
164
|
+
};
|
165
|
+
struct Box2BoxMapSetIt {
|
166
|
+
Box2BoxMapSet* set;
|
167
|
+
int bucket_index;
|
168
|
+
Box2BoxMapSetListIt it;
|
169
|
+
};
|
170
|
+
|
171
|
+
typedef struct Box2BoxMap Box2BoxMap;
|
172
|
+
typedef struct Box2BoxMapIt Box2BoxMapIt;
|
173
|
+
struct Box2BoxMap {
|
174
|
+
Box2BoxMapSet entries;
|
175
|
+
size_t ref_count;
|
176
|
+
};
|
177
|
+
struct Box2BoxMapIt {
|
178
|
+
Box2BoxMapSetIt it;
|
179
|
+
};
|
180
|
+
|
181
|
+
__DATA_STRUCT_EXTERN void Box2BoxMapCtor(Box2BoxMap*);
|
182
|
+
__DATA_STRUCT_EXTERN void Box2BoxMapDtor(Box2BoxMap*);
|
183
|
+
__DATA_STRUCT_EXTERN Box2BoxMap* Box2BoxMapNew(void);
|
184
|
+
__DATA_STRUCT_EXTERN void Box2BoxMapDestroy(Box2BoxMap*);
|
185
|
+
__DATA_STRUCT_EXTERN Box2BoxMap* Box2BoxMapAssign(Box2BoxMap*);
|
186
|
+
__DATA_STRUCT_EXTERN void Box2BoxMapPurge(Box2BoxMap*);
|
187
|
+
__DATA_STRUCT_EXTERN void Box2BoxMapRehash(Box2BoxMap*);
|
188
|
+
__DATA_STRUCT_EXTERN size_t Box2BoxMapSize(Box2BoxMap*);
|
189
|
+
__DATA_STRUCT_EXTERN int Box2BoxMapEmpty(Box2BoxMap*);
|
190
|
+
__DATA_STRUCT_EXTERN int Box2BoxMapContainsKey(Box2BoxMap*, Box*);
|
191
|
+
__DATA_STRUCT_EXTERN Box* Box2BoxMapGet(Box2BoxMap*, Box*);
|
192
|
+
__DATA_STRUCT_EXTERN int Box2BoxMapPut(Box2BoxMap*, Box*, Box*);
|
193
|
+
__DATA_STRUCT_EXTERN void Box2BoxMapReplace(Box2BoxMap*, Box*, Box*);
|
194
|
+
__DATA_STRUCT_EXTERN int Box2BoxMapRemove(Box2BoxMap*, Box*);
|
195
|
+
__DATA_STRUCT_EXTERN void Box2BoxMapItCtor(Box2BoxMapIt*, Box2BoxMap*);
|
196
|
+
__DATA_STRUCT_EXTERN int Box2BoxMapItHasNext(Box2BoxMapIt*);
|
197
|
+
__DATA_STRUCT_EXTERN Box* Box2BoxMapItNextKey(Box2BoxMapIt*);
|
198
|
+
__DATA_STRUCT_EXTERN Box* Box2BoxMapItNextValue(Box2BoxMapIt*);
|
199
|
+
__DATA_STRUCT_EXTERN Box2BoxMapEntry Box2BoxMapItNext(Box2BoxMapIt*);
|
200
|
+
size_t PCharHash(const char*);int PCharEqual(const char*,const char*);
|
201
|
+
typedef struct PChar2IntMapEntry PChar2IntMapEntry;
|
202
|
+
struct PChar2IntMapEntry {
|
203
|
+
const char* key;
|
204
|
+
int value;
|
205
|
+
int valid_value;
|
206
|
+
};
|
207
|
+
|
208
|
+
typedef struct PChar2IntMapSetListNode PChar2IntMapSetListNode;
|
209
|
+
typedef struct PChar2IntMapSetList PChar2IntMapSetList;
|
210
|
+
typedef struct PChar2IntMapSetListIt PChar2IntMapSetListIt;
|
211
|
+
struct PChar2IntMapSetList {
|
212
|
+
PChar2IntMapSetListNode* head_node;
|
213
|
+
size_t node_count;
|
214
|
+
size_t ref_count;
|
215
|
+
};
|
216
|
+
struct PChar2IntMapSetListIt {
|
217
|
+
PChar2IntMapSetListNode* next_node;
|
218
|
+
};
|
219
|
+
struct PChar2IntMapSetListNode {
|
220
|
+
PChar2IntMapEntry element;
|
221
|
+
PChar2IntMapSetListNode* next_node;
|
222
|
+
};
|
223
|
+
|
224
|
+
typedef struct PChar2IntMapSet PChar2IntMapSet;
|
225
|
+
typedef struct PChar2IntMapSetIt PChar2IntMapSetIt;
|
226
|
+
struct PChar2IntMapSet {
|
227
|
+
PChar2IntMapSetList* buckets;
|
228
|
+
size_t bucket_count, min_bucket_count;
|
229
|
+
size_t size, min_size, max_size;
|
230
|
+
unsigned min_fill, max_fill, capacity_multiplier; /* ?*1e-2 */
|
231
|
+
size_t ref_count;
|
232
|
+
};
|
233
|
+
struct PChar2IntMapSetIt {
|
234
|
+
PChar2IntMapSet* set;
|
235
|
+
int bucket_index;
|
236
|
+
PChar2IntMapSetListIt it;
|
237
|
+
};
|
238
|
+
|
239
|
+
typedef struct PChar2IntMap PChar2IntMap;
|
240
|
+
typedef struct PChar2IntMapIt PChar2IntMapIt;
|
241
|
+
struct PChar2IntMap {
|
242
|
+
PChar2IntMapSet entries;
|
243
|
+
size_t ref_count;
|
244
|
+
};
|
245
|
+
struct PChar2IntMapIt {
|
246
|
+
PChar2IntMapSetIt it;
|
247
|
+
};
|
248
|
+
|
249
|
+
__DATA_STRUCT_EXTERN void PChar2IntMapCtor(PChar2IntMap*);
|
250
|
+
__DATA_STRUCT_EXTERN void PChar2IntMapDtor(PChar2IntMap*);
|
251
|
+
__DATA_STRUCT_EXTERN PChar2IntMap* PChar2IntMapNew(void);
|
252
|
+
__DATA_STRUCT_EXTERN void PChar2IntMapDestroy(PChar2IntMap*);
|
253
|
+
__DATA_STRUCT_EXTERN PChar2IntMap* PChar2IntMapAssign(PChar2IntMap*);
|
254
|
+
__DATA_STRUCT_EXTERN void PChar2IntMapPurge(PChar2IntMap*);
|
255
|
+
__DATA_STRUCT_EXTERN void PChar2IntMapRehash(PChar2IntMap*);
|
256
|
+
__DATA_STRUCT_EXTERN size_t PChar2IntMapSize(PChar2IntMap*);
|
257
|
+
__DATA_STRUCT_EXTERN int PChar2IntMapEmpty(PChar2IntMap*);
|
258
|
+
__DATA_STRUCT_EXTERN int PChar2IntMapContainsKey(PChar2IntMap*, const char*);
|
259
|
+
__DATA_STRUCT_EXTERN int PChar2IntMapGet(PChar2IntMap*, const char*);
|
260
|
+
__DATA_STRUCT_EXTERN int PChar2IntMapPut(PChar2IntMap*, const char*, int);
|
261
|
+
__DATA_STRUCT_EXTERN void PChar2IntMapReplace(PChar2IntMap*, const char*, int);
|
262
|
+
__DATA_STRUCT_EXTERN int PChar2IntMapRemove(PChar2IntMap*, const char*);
|
263
|
+
__DATA_STRUCT_EXTERN void PChar2IntMapItCtor(PChar2IntMapIt*, PChar2IntMap*);
|
264
|
+
__DATA_STRUCT_EXTERN int PChar2IntMapItHasNext(PChar2IntMapIt*);
|
265
|
+
__DATA_STRUCT_EXTERN const char* PChar2IntMapItNextKey(PChar2IntMapIt*);
|
266
|
+
__DATA_STRUCT_EXTERN int PChar2IntMapItNextValue(PChar2IntMapIt*);
|
267
|
+
__DATA_STRUCT_EXTERN PChar2IntMapEntry PChar2IntMapItNext(PChar2IntMapIt*);
|
268
|
+
int PCharEqual(const char*,const char*);
|
269
|
+
typedef struct PCharQueueNode PCharQueueNode;
|
270
|
+
typedef struct PCharQueue PCharQueue;
|
271
|
+
typedef struct PCharQueueIt PCharQueueIt;
|
272
|
+
struct PCharQueue {
|
273
|
+
PCharQueueNode* head_node;
|
274
|
+
PCharQueueNode* tail_node;
|
275
|
+
size_t node_count;
|
276
|
+
size_t ref_count;
|
277
|
+
};
|
278
|
+
struct PCharQueueIt {
|
279
|
+
PCharQueueNode* next_node;
|
280
|
+
int forward;
|
281
|
+
};
|
282
|
+
struct PCharQueueNode {
|
283
|
+
const char* element;
|
284
|
+
PCharQueueNode* prev_node;
|
285
|
+
PCharQueueNode* next_node;
|
286
|
+
};
|
287
|
+
|
288
|
+
__DATA_STRUCT_EXTERN void PCharQueueCtor(PCharQueue*);
|
289
|
+
__DATA_STRUCT_EXTERN void PCharQueueDtor(PCharQueue*);
|
290
|
+
__DATA_STRUCT_EXTERN void PCharQueuePurge(PCharQueue*);
|
291
|
+
__DATA_STRUCT_EXTERN PCharQueue* PCharQueueNew(void);
|
292
|
+
__DATA_STRUCT_EXTERN void PCharQueueDestroy(PCharQueue*);
|
293
|
+
__DATA_STRUCT_EXTERN PCharQueue* PCharQueueAssign(PCharQueue*);
|
294
|
+
__DATA_STRUCT_EXTERN const char* PCharQueueHead(PCharQueue*);
|
295
|
+
__DATA_STRUCT_EXTERN const char* PCharQueueTail(PCharQueue*);
|
296
|
+
__DATA_STRUCT_EXTERN void PCharQueueAppend(PCharQueue*, const char*);
|
297
|
+
__DATA_STRUCT_EXTERN void PCharQueuePrepend(PCharQueue*, const char*);
|
298
|
+
__DATA_STRUCT_EXTERN void PCharQueueChopHead(PCharQueue*);
|
299
|
+
__DATA_STRUCT_EXTERN void PCharQueueChopTail(PCharQueue*);
|
300
|
+
__DATA_STRUCT_EXTERN int PCharQueueContains(PCharQueue*, const char*);
|
301
|
+
__DATA_STRUCT_EXTERN const char* PCharQueueFind(PCharQueue*, const char*);
|
302
|
+
__DATA_STRUCT_EXTERN int PCharQueueReplace(PCharQueue*, const char*, const char*);
|
303
|
+
__DATA_STRUCT_EXTERN int PCharQueueReplaceAll(PCharQueue*, const char*, const char*);
|
304
|
+
__DATA_STRUCT_EXTERN int PCharQueueRemove(PCharQueue*, const char*);
|
305
|
+
__DATA_STRUCT_EXTERN int PCharQueueRemoveAll(PCharQueue*, const char*);
|
306
|
+
__DATA_STRUCT_EXTERN size_t PCharQueueSize(PCharQueue*);
|
307
|
+
__DATA_STRUCT_EXTERN int PCharQueueEmpty(PCharQueue*);
|
308
|
+
__DATA_STRUCT_EXTERN void PCharQueueItCtor(PCharQueueIt*, PCharQueue*, int);
|
309
|
+
__DATA_STRUCT_EXTERN int PCharQueueItHasNext(PCharQueueIt*);
|
310
|
+
__DATA_STRUCT_EXTERN const char* PCharQueueItNext(PCharQueueIt*);
|
311
|
+
Box* BoxAssign(Box*);void BoxDestroy(Box*);int BoxEqual(Box*,Box*);
|
312
|
+
typedef struct BoxListNode BoxListNode;
|
313
|
+
typedef struct BoxList BoxList;
|
314
|
+
typedef struct BoxListIt BoxListIt;
|
315
|
+
struct BoxList {
|
316
|
+
BoxListNode* head_node;
|
317
|
+
size_t node_count;
|
318
|
+
size_t ref_count;
|
319
|
+
};
|
320
|
+
struct BoxListIt {
|
321
|
+
BoxListNode* next_node;
|
322
|
+
};
|
323
|
+
struct BoxListNode {
|
324
|
+
Box* element;
|
325
|
+
BoxListNode* next_node;
|
326
|
+
};
|
327
|
+
|
328
|
+
__DATA_STRUCT_EXTERN void BoxListCtor(BoxList*);
|
329
|
+
__DATA_STRUCT_EXTERN void BoxListDtor(BoxList*);
|
330
|
+
__DATA_STRUCT_EXTERN void BoxListPurge(BoxList*);
|
331
|
+
__DATA_STRUCT_EXTERN BoxList* BoxListNew(void);
|
332
|
+
__DATA_STRUCT_EXTERN void BoxListDestroy(BoxList*);
|
333
|
+
__DATA_STRUCT_EXTERN BoxList* BoxListAssign(BoxList*);
|
334
|
+
__DATA_STRUCT_EXTERN Box* BoxListGet(BoxList*);
|
335
|
+
__DATA_STRUCT_EXTERN void BoxListAdd(BoxList*, Box*);
|
336
|
+
__DATA_STRUCT_EXTERN void BoxListChop(BoxList*);
|
337
|
+
__DATA_STRUCT_EXTERN int BoxListContains(BoxList*, Box*);
|
338
|
+
__DATA_STRUCT_EXTERN Box* BoxListFind(BoxList*, Box*);
|
339
|
+
__DATA_STRUCT_EXTERN int BoxListReplace(BoxList*, Box*, Box*);
|
340
|
+
__DATA_STRUCT_EXTERN int BoxListReplaceAll(BoxList*, Box*, Box*);
|
341
|
+
__DATA_STRUCT_EXTERN int BoxListRemove(BoxList*, Box*);
|
342
|
+
__DATA_STRUCT_EXTERN int BoxListRemoveAll(BoxList*, Box*);
|
343
|
+
__DATA_STRUCT_EXTERN size_t BoxListSize(BoxList*);
|
344
|
+
__DATA_STRUCT_EXTERN int BoxListEmpty(BoxList*);
|
345
|
+
__DATA_STRUCT_EXTERN void BoxListItCtor(BoxListIt*, BoxList*);
|
346
|
+
__DATA_STRUCT_EXTERN int BoxListItHasNext(BoxListIt*);
|
347
|
+
__DATA_STRUCT_EXTERN Box* BoxListItNext(BoxListIt*);
|
348
|
+
|
349
|
+
typedef struct IntVector IntVector;
|
350
|
+
typedef struct IntVectorIt IntVectorIt;
|
351
|
+
struct IntVector {
|
352
|
+
int* values;
|
353
|
+
size_t element_count;
|
354
|
+
size_t ref_count;
|
355
|
+
};
|
356
|
+
struct IntVectorIt {
|
357
|
+
IntVector* vector;
|
358
|
+
size_t index;
|
359
|
+
};
|
360
|
+
|
361
|
+
__DATA_STRUCT_EXTERN void IntVectorCtor(IntVector*, size_t);
|
362
|
+
__DATA_STRUCT_EXTERN void IntVectorDtor(IntVector*);
|
363
|
+
__DATA_STRUCT_EXTERN IntVector* IntVectorNew(size_t);
|
364
|
+
__DATA_STRUCT_EXTERN void IntVectorDestroy(IntVector*);
|
365
|
+
__DATA_STRUCT_EXTERN IntVector* IntVectorAssign(IntVector*);
|
366
|
+
__DATA_STRUCT_EXTERN void IntVectorResize(IntVector*, size_t);
|
367
|
+
__DATA_STRUCT_EXTERN int IntVectorWithin(IntVector*, size_t);
|
368
|
+
__DATA_STRUCT_EXTERN void IntVectorItCtor(IntVectorIt*, IntVector*);
|
369
|
+
__DATA_STRUCT_EXTERN int IntVectorItHasNext(IntVectorIt*);
|
370
|
+
__DATA_STRUCT_EXTERN int IntVectorItNext(IntVectorIt*);
|
371
|
+
__DATA_STRUCT_INLINE int* IntVectorRef(IntVector* self, size_t index) {
|
372
|
+
assert(self);
|
373
|
+
assert(IntVectorWithin(self, index));
|
374
|
+
return &self->values[index];
|
375
|
+
}
|
376
|
+
__DATA_STRUCT_INLINE int IntVectorGet(IntVector* self, size_t index) {
|
377
|
+
assert(self);
|
378
|
+
assert(IntVectorWithin(self, index));
|
379
|
+
return *IntVectorRef(self, index);
|
380
|
+
}
|
381
|
+
__DATA_STRUCT_INLINE void IntVectorSet(IntVector* self, size_t index, int value) {
|
382
|
+
int* ref;
|
383
|
+
assert(self);
|
384
|
+
assert(IntVectorWithin(self, index));
|
385
|
+
ref = IntVectorRef(self, index);
|
386
|
+
;
|
387
|
+
*ref = (value);
|
388
|
+
}
|
389
|
+
__DATA_STRUCT_INLINE size_t IntVectorSize(IntVector* self) {
|
390
|
+
assert(self);
|
391
|
+
return self->element_count;
|
392
|
+
}
|
393
|
+
__DATA_STRUCT_EXTERN void IntVectorSort(IntVector*);Box* BoxAssign(Box*);Box* BoxNew(void);void BoxDestroy(Box*);
|
394
|
+
typedef struct BoxVector BoxVector;
|
395
|
+
typedef struct BoxVectorIt BoxVectorIt;
|
396
|
+
struct BoxVector {
|
397
|
+
Box** values;
|
398
|
+
size_t element_count;
|
399
|
+
size_t ref_count;
|
400
|
+
};
|
401
|
+
struct BoxVectorIt {
|
402
|
+
BoxVector* vector;
|
403
|
+
size_t index;
|
404
|
+
};
|
405
|
+
|
406
|
+
__DATA_STRUCT_EXTERN void BoxVectorCtor(BoxVector*, size_t);
|
407
|
+
__DATA_STRUCT_EXTERN void BoxVectorDtor(BoxVector*);
|
408
|
+
__DATA_STRUCT_EXTERN BoxVector* BoxVectorNew(size_t);
|
409
|
+
__DATA_STRUCT_EXTERN void BoxVectorDestroy(BoxVector*);
|
410
|
+
__DATA_STRUCT_EXTERN BoxVector* BoxVectorAssign(BoxVector*);
|
411
|
+
__DATA_STRUCT_EXTERN void BoxVectorResize(BoxVector*, size_t);
|
412
|
+
__DATA_STRUCT_EXTERN int BoxVectorWithin(BoxVector*, size_t);
|
413
|
+
__DATA_STRUCT_EXTERN void BoxVectorItCtor(BoxVectorIt*, BoxVector*);
|
414
|
+
__DATA_STRUCT_EXTERN int BoxVectorItHasNext(BoxVectorIt*);
|
415
|
+
__DATA_STRUCT_EXTERN Box* BoxVectorItNext(BoxVectorIt*);
|
416
|
+
__DATA_STRUCT_INLINE Box** BoxVectorRef(BoxVector* self, size_t index) {
|
417
|
+
assert(self);
|
418
|
+
assert(BoxVectorWithin(self, index));
|
419
|
+
return &self->values[index];
|
420
|
+
}
|
421
|
+
__DATA_STRUCT_INLINE Box* BoxVectorGet(BoxVector* self, size_t index) {
|
422
|
+
assert(self);
|
423
|
+
assert(BoxVectorWithin(self, index));
|
424
|
+
return *BoxVectorRef(self, index);
|
425
|
+
}
|
426
|
+
__DATA_STRUCT_INLINE void BoxVectorSet(BoxVector* self, size_t index, Box* value) {
|
427
|
+
Box** ref;
|
428
|
+
assert(self);
|
429
|
+
assert(BoxVectorWithin(self, index));
|
430
|
+
ref = BoxVectorRef(self, index);
|
431
|
+
BoxDestroy(*ref);
|
432
|
+
*ref = BoxAssign(value);
|
433
|
+
}
|
434
|
+
__DATA_STRUCT_INLINE size_t BoxVectorSize(BoxVector* self) {
|
435
|
+
assert(self);
|
436
|
+
return self->element_count;
|
437
|
+
}
|
438
|
+
Box* BoxAssign(Box*);void BoxDestroy(Box*);size_t BoxHash(Box*);int BoxEqual(Box*,Box*);
|
439
|
+
typedef struct BoxSetListNode BoxSetListNode;
|
440
|
+
typedef struct BoxSetList BoxSetList;
|
441
|
+
typedef struct BoxSetListIt BoxSetListIt;
|
442
|
+
struct BoxSetList {
|
443
|
+
BoxSetListNode* head_node;
|
444
|
+
size_t node_count;
|
445
|
+
size_t ref_count;
|
446
|
+
};
|
447
|
+
struct BoxSetListIt {
|
448
|
+
BoxSetListNode* next_node;
|
449
|
+
};
|
450
|
+
struct BoxSetListNode {
|
451
|
+
Box* element;
|
452
|
+
BoxSetListNode* next_node;
|
453
|
+
};
|
454
|
+
|
455
|
+
typedef struct BoxSet BoxSet;
|
456
|
+
typedef struct BoxSetIt BoxSetIt;
|
457
|
+
struct BoxSet {
|
458
|
+
BoxSetList* buckets;
|
459
|
+
size_t bucket_count, min_bucket_count;
|
460
|
+
size_t size, min_size, max_size;
|
461
|
+
unsigned min_fill, max_fill, capacity_multiplier; /* ?*1e-2 */
|
462
|
+
size_t ref_count;
|
463
|
+
};
|
464
|
+
struct BoxSetIt {
|
465
|
+
BoxSet* set;
|
466
|
+
int bucket_index;
|
467
|
+
BoxSetListIt it;
|
468
|
+
};
|
469
|
+
|
470
|
+
__DATA_STRUCT_EXTERN void BoxSetCtor(BoxSet*);
|
471
|
+
__DATA_STRUCT_EXTERN void BoxSetDtor(BoxSet*);
|
472
|
+
__DATA_STRUCT_EXTERN BoxSet* BoxSetNew(void);
|
473
|
+
__DATA_STRUCT_EXTERN void BoxSetDestroy(BoxSet*);
|
474
|
+
__DATA_STRUCT_EXTERN BoxSet* BoxSetAssign(BoxSet*);
|
475
|
+
__DATA_STRUCT_EXTERN void BoxSetPurge(BoxSet*);
|
476
|
+
__DATA_STRUCT_EXTERN void BoxSetRehash(BoxSet*);
|
477
|
+
__DATA_STRUCT_EXTERN int BoxSetContains(BoxSet*, Box*);
|
478
|
+
__DATA_STRUCT_EXTERN Box* BoxSetGet(BoxSet*, Box*);
|
479
|
+
__DATA_STRUCT_EXTERN size_t BoxSetSize(BoxSet*);
|
480
|
+
__DATA_STRUCT_EXTERN int BoxSetEmpty(BoxSet*);
|
481
|
+
__DATA_STRUCT_EXTERN int BoxSetPut(BoxSet*, Box*);
|
482
|
+
__DATA_STRUCT_EXTERN void BoxSetReplace(BoxSet*, Box*);
|
483
|
+
__DATA_STRUCT_EXTERN int BoxSetRemove(BoxSet*, Box*);
|
484
|
+
__DATA_STRUCT_EXTERN void BoxSetNot(BoxSet*, BoxSet*);
|
485
|
+
__DATA_STRUCT_EXTERN void BoxSetAnd(BoxSet*, BoxSet*);
|
486
|
+
__DATA_STRUCT_EXTERN void BoxSetOr(BoxSet*, BoxSet*);
|
487
|
+
__DATA_STRUCT_EXTERN void BoxSetXor(BoxSet*, BoxSet*);
|
488
|
+
__DATA_STRUCT_EXTERN void BoxSetItCtor(BoxSetIt*, BoxSet*);
|
489
|
+
__DATA_STRUCT_EXTERN int BoxSetItHasNext(BoxSetIt*);
|
490
|
+
__DATA_STRUCT_EXTERN Box* BoxSetItNext(BoxSetIt*);
|
491
|
+
size_t PCharHash(const char*);int PCharEqual(const char*,const char*);IntVector* IntVectorAssign(IntVector*);void IntVectorDestroy(IntVector*);
|
492
|
+
typedef struct PChar2IntVectorMapEntry PChar2IntVectorMapEntry;
|
493
|
+
struct PChar2IntVectorMapEntry {
|
494
|
+
const char* key;
|
495
|
+
IntVector* value;
|
496
|
+
int valid_value;
|
497
|
+
};
|
498
|
+
|
499
|
+
typedef struct PChar2IntVectorMapSetListNode PChar2IntVectorMapSetListNode;
|
500
|
+
typedef struct PChar2IntVectorMapSetList PChar2IntVectorMapSetList;
|
501
|
+
typedef struct PChar2IntVectorMapSetListIt PChar2IntVectorMapSetListIt;
|
502
|
+
struct PChar2IntVectorMapSetList {
|
503
|
+
PChar2IntVectorMapSetListNode* head_node;
|
504
|
+
size_t node_count;
|
505
|
+
size_t ref_count;
|
506
|
+
};
|
507
|
+
struct PChar2IntVectorMapSetListIt {
|
508
|
+
PChar2IntVectorMapSetListNode* next_node;
|
509
|
+
};
|
510
|
+
struct PChar2IntVectorMapSetListNode {
|
511
|
+
PChar2IntVectorMapEntry element;
|
512
|
+
PChar2IntVectorMapSetListNode* next_node;
|
513
|
+
};
|
514
|
+
|
515
|
+
typedef struct PChar2IntVectorMapSet PChar2IntVectorMapSet;
|
516
|
+
typedef struct PChar2IntVectorMapSetIt PChar2IntVectorMapSetIt;
|
517
|
+
struct PChar2IntVectorMapSet {
|
518
|
+
PChar2IntVectorMapSetList* buckets;
|
519
|
+
size_t bucket_count, min_bucket_count;
|
520
|
+
size_t size, min_size, max_size;
|
521
|
+
unsigned min_fill, max_fill, capacity_multiplier; /* ?*1e-2 */
|
522
|
+
size_t ref_count;
|
523
|
+
};
|
524
|
+
struct PChar2IntVectorMapSetIt {
|
525
|
+
PChar2IntVectorMapSet* set;
|
526
|
+
int bucket_index;
|
527
|
+
PChar2IntVectorMapSetListIt it;
|
528
|
+
};
|
529
|
+
|
530
|
+
typedef struct PChar2IntVectorMap PChar2IntVectorMap;
|
531
|
+
typedef struct PChar2IntVectorMapIt PChar2IntVectorMapIt;
|
532
|
+
struct PChar2IntVectorMap {
|
533
|
+
PChar2IntVectorMapSet entries;
|
534
|
+
size_t ref_count;
|
535
|
+
};
|
536
|
+
struct PChar2IntVectorMapIt {
|
537
|
+
PChar2IntVectorMapSetIt it;
|
538
|
+
};
|
539
|
+
|
540
|
+
__DATA_STRUCT_EXTERN void PChar2IntVectorMapCtor(PChar2IntVectorMap*);
|
541
|
+
__DATA_STRUCT_EXTERN void PChar2IntVectorMapDtor(PChar2IntVectorMap*);
|
542
|
+
__DATA_STRUCT_EXTERN PChar2IntVectorMap* PChar2IntVectorMapNew(void);
|
543
|
+
__DATA_STRUCT_EXTERN void PChar2IntVectorMapDestroy(PChar2IntVectorMap*);
|
544
|
+
__DATA_STRUCT_EXTERN PChar2IntVectorMap* PChar2IntVectorMapAssign(PChar2IntVectorMap*);
|
545
|
+
__DATA_STRUCT_EXTERN void PChar2IntVectorMapPurge(PChar2IntVectorMap*);
|
546
|
+
__DATA_STRUCT_EXTERN void PChar2IntVectorMapRehash(PChar2IntVectorMap*);
|
547
|
+
__DATA_STRUCT_EXTERN size_t PChar2IntVectorMapSize(PChar2IntVectorMap*);
|
548
|
+
__DATA_STRUCT_EXTERN int PChar2IntVectorMapEmpty(PChar2IntVectorMap*);
|
549
|
+
__DATA_STRUCT_EXTERN int PChar2IntVectorMapContainsKey(PChar2IntVectorMap*, const char*);
|
550
|
+
__DATA_STRUCT_EXTERN IntVector* PChar2IntVectorMapGet(PChar2IntVectorMap*, const char*);
|
551
|
+
__DATA_STRUCT_EXTERN int PChar2IntVectorMapPut(PChar2IntVectorMap*, const char*, IntVector*);
|
552
|
+
__DATA_STRUCT_EXTERN void PChar2IntVectorMapReplace(PChar2IntVectorMap*, const char*, IntVector*);
|
553
|
+
__DATA_STRUCT_EXTERN int PChar2IntVectorMapRemove(PChar2IntVectorMap*, const char*);
|
554
|
+
__DATA_STRUCT_EXTERN void PChar2IntVectorMapItCtor(PChar2IntVectorMapIt*, PChar2IntVectorMap*);
|
555
|
+
__DATA_STRUCT_EXTERN int PChar2IntVectorMapItHasNext(PChar2IntVectorMapIt*);
|
556
|
+
__DATA_STRUCT_EXTERN const char* PChar2IntVectorMapItNextKey(PChar2IntVectorMapIt*);
|
557
|
+
__DATA_STRUCT_EXTERN IntVector* PChar2IntVectorMapItNextValue(PChar2IntVectorMapIt*);
|
558
|
+
__DATA_STRUCT_EXTERN PChar2IntVectorMapEntry PChar2IntVectorMapItNext(PChar2IntVectorMapIt*);
|
559
|
+
|
560
|
+
#endif
|
561
|
+
|