@@ -45,6 +45,7 @@ def cdefs(features):
45
45
typedef guint32 GType;
46
46
'''
47
47
48
+ # ... means opaque
48
49
code += '''
49
50
typedef void (*GLogFunc) (const char* log_domain,
50
51
int log_level,
@@ -58,9 +59,7 @@ def cdefs(features):
58
59
59
60
void g_log_remove_handler (const char* log_domain, int handler_id);
60
61
61
- typedef struct _VipsImage VipsImage;
62
- typedef struct _VipsProgress VipsProgress;
63
- typedef struct _GValue GValue;
62
+ typedef ... VipsImage;
64
63
65
64
void* g_malloc (size_t size);
66
65
void g_free (void* data);
@@ -73,7 +72,7 @@ def cdefs(features):
73
72
const char* g_type_name (GType gtype);
74
73
GType g_type_from_name (const char* name);
75
74
76
- typedef void* (* VipsTypeMap2Fn) (GType type, void* a, void* b) ;
75
+ typedef ... VipsTypeMap2Fn;
77
76
void* vips_type_map (GType base, VipsTypeMap2Fn fn, void* a, void* b);
78
77
79
78
const char* vips_error_buffer (void);
@@ -83,7 +82,11 @@ def cdefs(features):
83
82
84
83
typedef struct _GValue {
85
84
GType g_type;
86
- guint64 data[2];
85
+ union {
86
+ guint64 v_uint64;
87
+
88
+ // more
89
+ } data[2];
87
90
} GValue;
88
91
89
92
void g_value_init (GValue* value, GType gtype);
@@ -134,16 +137,19 @@ def cdefs(features):
134
137
GType vips_saveable_get_type (void);
135
138
GType vips_image_type_get_type (void);
136
139
137
- typedef struct _GData GData;
140
+ typedef ... GData;
138
141
139
- typedef struct _GTypeClass GTypeClass;
142
+ typedef struct _GTypeClass {
143
+ GType g_type;
144
+ } GTypeClass;
140
145
141
146
typedef struct _GTypeInstance {
142
147
GTypeClass *g_class;
143
148
} GTypeInstance;
144
149
145
150
typedef struct _GObject {
146
151
GTypeInstance g_type_instance;
152
+
147
153
unsigned int ref_count;
148
154
GData *qdata;
149
155
} GObject;
@@ -173,7 +179,7 @@ def cdefs(features):
173
179
} GEnumValue;
174
180
175
181
typedef struct _GEnumClass {
176
- GTypeClass * g_type_class;
182
+ GTypeClass g_type_class;
177
183
178
184
int minimum;
179
185
int maximum;
@@ -189,7 +195,7 @@ def cdefs(features):
189
195
} GFlagsValue;
190
196
191
197
typedef struct _GFlagsClass {
192
- GTypeClass * g_type_class;
198
+ GTypeClass g_type_class;
193
199
194
200
unsigned int mask;
195
201
unsigned int n_values;
@@ -224,6 +230,8 @@ def cdefs(features):
224
230
void vips_image_set_progress (VipsImage* image, int progress);
225
231
void vips_image_set_kill (VipsImage* image, int kill);
226
232
233
+ typedef ... GTimer;
234
+
227
235
typedef struct _VipsProgress {
228
236
VipsImage* im;
229
237
@@ -232,35 +240,12 @@ def cdefs(features):
232
240
gint64 tpels;
233
241
gint64 npels;
234
242
int percent;
235
- void * start;
243
+ GTimer * start;
236
244
} VipsProgress;
237
245
238
- typedef struct _VipsObject {
239
- '''
246
+ typedef ... VipsObject;
240
247
241
- # this field changed name in libvips 8.4
242
- if _at_least (features , 8 , 4 ):
243
- code += '''
244
- GObject parent_instance;
245
- '''
246
- else :
247
- code += '''
248
- GObject parent_object;
249
- '''
250
-
251
- code += '''
252
- int constructed;
253
- int static_object;
254
- void *argument_table;
255
- char *nickname;
256
- char *description;
257
- int preclose;
258
- int close;
259
- int postclose;
260
- size_t local_memory;
261
- } VipsObject;
262
-
263
- typedef struct _VipsObjectClass VipsObjectClass;
248
+ typedef ... VipsObjectClass;
264
249
265
250
typedef struct _VipsArgument {
266
251
GParamSpec *pspec;
@@ -307,23 +292,6 @@ def cdefs(features):
307
292
308
293
const char* g_param_spec_get_blurb (GParamSpec* pspec);
309
294
310
- typedef struct _VipsImage {
311
- '''
312
-
313
- # this field changed name in libvips 8.4
314
- if _at_least (features , 8 , 4 ):
315
- code += '''
316
- VipsObject parent_instance;
317
- '''
318
- else :
319
- code += '''
320
- VipsObject parent_object;
321
- '''
322
-
323
- code += '''
324
- // more
325
- } VipsImage;
326
-
327
295
const char* vips_foreign_find_load (const char* name);
328
296
const char* vips_foreign_find_load_buffer (const void* data,
329
297
size_t size);
@@ -353,19 +321,11 @@ def cdefs(features):
353
321
int vips_image_write (VipsImage* image, VipsImage* out);
354
322
void* vips_image_write_to_memory (VipsImage* in, size_t* size_out);
355
323
356
- typedef struct _VipsInterpolate {
357
- VipsObject parent_object;
358
-
359
- // more
360
- } VipsInterpolate;
324
+ typedef ... VipsInterpolate;
361
325
362
326
VipsInterpolate* vips_interpolate_new (const char* name);
363
327
364
- typedef struct _VipsOperation {
365
- VipsObject parent_instance;
366
-
367
- // more
368
- } VipsOperation;
328
+ typedef ... VipsOperation;
369
329
370
330
VipsOperation* vips_operation_new (const char* name);
371
331
@@ -378,11 +338,7 @@ def cdefs(features):
378
338
void* vips_argument_map (VipsObject* object,
379
339
VipsArgumentMapFn fn, void* a, void* b);
380
340
381
- typedef struct _VipsRegion {
382
- VipsObject parent_object;
383
-
384
- // more
385
- } VipsRegion;
341
+ typedef ... VipsRegion;
386
342
387
343
VipsRegion* vips_region_new (VipsImage*);
388
344
@@ -448,31 +404,19 @@ def cdefs(features):
448
404
449
405
if _at_least (features , 8 , 9 ):
450
406
code += '''
451
- typedef struct _VipsConnection {
452
- VipsObject parent_object;
453
-
454
- // more
455
- } VipsConnection;
407
+ typedef ... VipsConnection;
456
408
457
409
const char* vips_connection_filename (VipsConnection* stream);
458
410
const char* vips_connection_nick (VipsConnection* stream);
459
411
460
- typedef struct _VipsSource {
461
- VipsConnection parent_object;
462
-
463
- // more
464
- } VipsSource;
412
+ typedef ... VipsSource;
465
413
466
414
VipsSource* vips_source_new_from_descriptor (int descriptor);
467
415
VipsSource* vips_source_new_from_file (const char* filename);
468
416
VipsSource* vips_source_new_from_memory (const void* data,
469
417
size_t size);
470
418
471
- typedef struct _VipsSourceCustom {
472
- VipsSource parent_object;
473
-
474
- // more
475
- } VipsSourceCustom;
419
+ typedef ... VipsSourceCustom;
476
420
477
421
VipsSourceCustom* vips_source_custom_new (void);
478
422
@@ -481,21 +425,13 @@ def cdefs(features):
481
425
extern "Python" gint64 _marshal_seek (VipsSource*,
482
426
gint64, int, void*);
483
427
484
- typedef struct _VipsTarget {
485
- VipsConnection parent_object;
486
-
487
- // more
488
- } VipsTarget;
428
+ typedef ... VipsTarget;
489
429
490
430
VipsTarget* vips_target_new_to_descriptor (int descriptor);
491
431
VipsTarget* vips_target_new_to_file (const char* filename);
492
432
VipsTarget* vips_target_new_to_memory (void);
493
433
494
- typedef struct _VipsTargetCustom {
495
- VipsTarget parent_object;
496
-
497
- // more
498
- } VipsTargetCustom;
434
+ typedef ... VipsTargetCustom;
499
435
500
436
VipsTargetCustom* vips_target_custom_new (void);
501
437
@@ -528,9 +464,11 @@ def cdefs(features):
528
464
'''
529
465
530
466
# ... means inherit from C defines
531
- code += '#define VIPS_MAJOR_VERSION ...\n '
532
- code += '#define VIPS_MINOR_VERSION ...\n '
533
- code += '#define VIPS_MICRO_VERSION ...\n '
467
+ code += '''
468
+ #define VIPS_MAJOR_VERSION ...
469
+ #define VIPS_MINOR_VERSION ...
470
+ #define VIPS_MICRO_VERSION ...
471
+ '''
534
472
535
473
# add contents of features as a comment ... handy for debugging
536
474
for key , value in features .items ():
0 commit comments