1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
|
/* objects_fields.c generated by valac, the Vala compiler
* generated from objects_fields.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#if !defined(VALA_EXTERN)
#if defined(_WIN32) || defined(__CYGWIN__)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif
typedef struct _CompactFoo CompactFoo;
#define TYPE_FOO (foo_get_type ())
#define FOO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FOO, Foo))
#define FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FOO, FooClass))
#define IS_FOO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FOO))
#define IS_FOO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FOO))
#define FOO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FOO, FooClass))
typedef struct _Foo Foo;
typedef struct _FooClass FooClass;
typedef struct _FooPrivate FooPrivate;
typedef struct _ParamSpecFoo ParamSpecFoo;
#define TYPE_FAZ (faz_get_type ())
#define FAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FAZ, Faz))
#define FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FAZ, FazClass))
#define IS_FAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FAZ))
#define IS_FAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FAZ))
#define FAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FAZ, FazClass))
typedef struct _Faz Faz;
typedef struct _FazClass FazClass;
typedef struct _FazPrivate FazPrivate;
typedef struct _FazClassPrivate FazClassPrivate;
#define TYPE_BAR (bar_get_type ())
#define BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAR, Bar))
#define BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAR, BarClass))
#define IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAR))
#define IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAR))
#define BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAR, BarClass))
typedef struct _Bar Bar;
typedef struct _BarClass BarClass;
typedef struct _BarPrivate BarPrivate;
enum {
BAR_0_PROPERTY,
BAR_NUM_PROPERTIES
};
static GParamSpec* bar_properties[BAR_NUM_PROPERTIES];
#define TYPE_BAZ (baz_get_type ())
#define BAZ(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BAZ, Baz))
#define BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BAZ, BazClass))
#define IS_BAZ(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BAZ))
#define IS_BAZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BAZ))
#define BAZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BAZ, BazClass))
typedef struct _Baz Baz;
typedef struct _BazClass BazClass;
typedef struct _BazPrivate BazPrivate;
typedef struct _BazClassPrivate BazClassPrivate;
enum {
BAZ_0_PROPERTY,
BAZ_NUM_PROPERTIES
};
static GParamSpec* baz_properties[BAZ_NUM_PROPERTIES];
#define TYPE_MANAM (manam_get_type ())
#define MANAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MANAM, Manam))
#define MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MANAM, ManamClass))
#define IS_MANAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MANAM))
#define IS_MANAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MANAM))
#define MANAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MANAM, ManamClass))
typedef struct _Manam Manam;
typedef struct _ManamClass ManamClass;
typedef struct _ManamPrivate ManamPrivate;
typedef struct _ParamSpecManam ParamSpecManam;
#define _foo_unref0(var) ((var == NULL) ? NULL : (var = (foo_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _compact_foo_free0(var) ((var == NULL) ? NULL : (var = (compact_foo_free (var), NULL)))
#define _manam_unref0(var) ((var == NULL) ? NULL : (var = (manam_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
struct _CompactFoo {
gint initialized_field;
};
struct _Foo {
GTypeInstance parent_instance;
volatile int ref_count;
FooPrivate * priv;
gint public_base_field;
};
struct _FooClass {
GTypeClass parent_class;
void (*finalize) (Foo *self);
gint public_base_class_field;
};
struct _ParamSpecFoo {
GParamSpec parent_instance;
};
struct _Faz {
Foo parent_instance;
FazPrivate * priv;
gint public_field;
};
struct _FazClass {
FooClass parent_class;
gint public_class_field;
};
struct _FazPrivate {
GRecMutex __lock_public_field;
gint private_field;
GRecMutex __lock_private_field;
};
struct _FazClassPrivate {
GRecMutex __lock_public_class_field;
gint private_class_field;
GRecMutex __lock_private_class_field;
};
struct _Bar {
GObject parent_instance;
BarPrivate * priv;
gint public_base_field;
};
struct _BarClass {
GObjectClass parent_class;
gint public_base_class_field;
};
struct _Baz {
Bar parent_instance;
BazPrivate * priv;
gint public_field;
};
struct _BazClass {
BarClass parent_class;
gint public_class_field;
};
struct _BazPrivate {
GRecMutex __lock_public_field;
gint private_field;
GRecMutex __lock_private_field;
};
struct _BazClassPrivate {
GRecMutex __lock_public_class_field;
gint private_class_field;
GRecMutex __lock_private_class_field;
};
struct _Manam {
GTypeInstance parent_instance;
volatile int ref_count;
ManamPrivate * priv;
gpointer foo;
};
struct _ManamClass {
GTypeClass parent_class;
void (*finalize) (Manam *self);
};
struct _ManamPrivate {
GType t_type;
GBoxedCopyFunc t_dup_func;
GDestroyNotify t_destroy_func;
};
struct _ParamSpecManam {
GParamSpec parent_instance;
};
static gint compact_foo_private_static_field;
static gint compact_foo_private_static_field = 42;
VALA_EXTERN gint compact_foo_public_static_field;
gint compact_foo_public_static_field = 4711;
static gpointer foo_parent_class = NULL;
static gint Faz_private_offset;
static gpointer faz_parent_class = NULL;
VALA_EXTERN gint faz_public_static_field;
GRecMutex __lock_faz_faz_public_static_field = {0};
gint faz_public_static_field = 4711;
static gint faz_private_static_field;
static GRecMutex __lock_faz_faz_private_static_field = {0};
static gint faz_private_static_field = 4711;
static gpointer bar_parent_class = NULL;
static gint Baz_private_offset;
static gpointer baz_parent_class = NULL;
VALA_EXTERN gint baz_public_static_field;
GRecMutex __lock_baz_baz_public_static_field = {0};
gint baz_public_static_field = 4711;
static gint baz_private_static_field;
static GRecMutex __lock_baz_baz_private_static_field = {0};
static gint baz_private_static_field = 4711;
static gint Manam_private_offset;
static gpointer manam_parent_class = NULL;
VALA_EXTERN void compact_foo_free (CompactFoo * self);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CompactFoo, compact_foo_free)
static void compact_foo_instance_init (CompactFoo * self);
VALA_EXTERN CompactFoo* compact_foo_new (void);
VALA_EXTERN gpointer foo_ref (gpointer instance);
VALA_EXTERN void foo_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_foo (const gchar* name,
const gchar* nick,
const gchar* blurb,
GType object_type,
GParamFlags flags);
VALA_EXTERN void value_set_foo (GValue* value,
gpointer v_object);
VALA_EXTERN void value_take_foo (GValue* value,
gpointer v_object);
VALA_EXTERN gpointer value_get_foo (const GValue* value);
VALA_EXTERN GType foo_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Foo, foo_unref)
VALA_EXTERN Foo* foo_new (void);
VALA_EXTERN Foo* foo_construct (GType object_type);
static void foo_finalize (Foo * obj);
static GType foo_get_type_once (void);
VALA_EXTERN GType faz_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Faz, foo_unref)
#define FAZ_GET_CLASS_PRIVATE(klass) (G_TYPE_CLASS_GET_PRIVATE (klass, TYPE_FAZ, FazClassPrivate))
VALA_EXTERN void faz_action (Faz* self);
VALA_EXTERN void faz_action_class (Faz* self);
VALA_EXTERN void faz_lock_action (Faz* self);
VALA_EXTERN void faz_lock_action_class (Faz* self);
VALA_EXTERN Faz* faz_new (void);
VALA_EXTERN Faz* faz_construct (GType object_type);
static void faz_finalize (Foo * obj);
static GType faz_get_type_once (void);
VALA_EXTERN GType bar_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Bar, g_object_unref)
VALA_EXTERN Bar* bar_new (void);
VALA_EXTERN Bar* bar_construct (GType object_type);
static void bar_finalize (GObject * obj);
static GType bar_get_type_once (void);
VALA_EXTERN GType baz_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Baz, g_object_unref)
#define BAZ_GET_CLASS_PRIVATE(klass) (G_TYPE_CLASS_GET_PRIVATE (klass, TYPE_BAZ, BazClassPrivate))
VALA_EXTERN void baz_action (Baz* self);
VALA_EXTERN void baz_action_class (Baz* self);
VALA_EXTERN void baz_lock_action (Baz* self);
VALA_EXTERN void baz_lock_action_class (Baz* self);
VALA_EXTERN Baz* baz_new (void);
VALA_EXTERN Baz* baz_construct (GType object_type);
static void baz_finalize (GObject * obj);
static GType baz_get_type_once (void);
VALA_EXTERN gpointer manam_ref (gpointer instance);
VALA_EXTERN void manam_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_manam (const gchar* name,
const gchar* nick,
const gchar* blurb,
GType object_type,
GParamFlags flags);
VALA_EXTERN void value_set_manam (GValue* value,
gpointer v_object);
VALA_EXTERN void value_take_manam (GValue* value,
gpointer v_object);
VALA_EXTERN gpointer value_get_manam (const GValue* value);
VALA_EXTERN GType manam_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (Manam, manam_unref)
VALA_EXTERN Manam* manam_new (GType t_type,
GBoxedCopyFunc t_dup_func,
GDestroyNotify t_destroy_func);
VALA_EXTERN Manam* manam_construct (GType object_type,
GType t_type,
GBoxedCopyFunc t_dup_func,
GDestroyNotify t_destroy_func);
static void manam_finalize (Manam * obj);
static GType manam_get_type_once (void);
static void _vala_main (void);
CompactFoo*
compact_foo_new (void)
{
CompactFoo* self;
self = g_slice_new0 (CompactFoo);
compact_foo_instance_init (self);
return self;
}
static void
compact_foo_instance_init (CompactFoo * self)
{
self->initialized_field = 23;
}
void
compact_foo_free (CompactFoo * self)
{
g_slice_free (CompactFoo, self);
}
Foo*
foo_construct (GType object_type)
{
Foo* self = NULL;
self = (Foo*) g_type_create_instance (object_type);
return self;
}
Foo*
foo_new (void)
{
return foo_construct (TYPE_FOO);
}
static void
value_foo_init (GValue* value)
{
value->data[0].v_pointer = NULL;
}
static void
value_foo_free_value (GValue* value)
{
if (value->data[0].v_pointer) {
foo_unref (value->data[0].v_pointer);
}
}
static void
value_foo_copy_value (const GValue* src_value,
GValue* dest_value)
{
if (src_value->data[0].v_pointer) {
dest_value->data[0].v_pointer = foo_ref (src_value->data[0].v_pointer);
} else {
dest_value->data[0].v_pointer = NULL;
}
}
static gpointer
value_foo_peek_pointer (const GValue* value)
{
return value->data[0].v_pointer;
}
static gchar*
value_foo_collect_value (GValue* value,
guint n_collect_values,
GTypeCValue* collect_values,
guint collect_flags)
{
if (collect_values[0].v_pointer) {
Foo * object;
object = collect_values[0].v_pointer;
if (object->parent_instance.g_class == NULL) {
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
}
value->data[0].v_pointer = foo_ref (object);
} else {
value->data[0].v_pointer = NULL;
}
return NULL;
}
static gchar*
value_foo_lcopy_value (const GValue* value,
guint n_collect_values,
GTypeCValue* collect_values,
guint collect_flags)
{
Foo ** object_p;
object_p = collect_values[0].v_pointer;
if (!object_p) {
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
}
if (!value->data[0].v_pointer) {
*object_p = NULL;
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
*object_p = value->data[0].v_pointer;
} else {
*object_p = foo_ref (value->data[0].v_pointer);
}
return NULL;
}
GParamSpec*
param_spec_foo (const gchar* name,
const gchar* nick,
const gchar* blurb,
GType object_type,
GParamFlags flags)
{
ParamSpecFoo* spec;
g_return_val_if_fail (g_type_is_a (object_type, TYPE_FOO), NULL);
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
G_PARAM_SPEC (spec)->value_type = object_type;
return G_PARAM_SPEC (spec);
}
gpointer
value_get_foo (const GValue* value)
{
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO), NULL);
return value->data[0].v_pointer;
}
void
value_set_foo (GValue* value,
gpointer v_object)
{
Foo * old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
foo_ref (value->data[0].v_pointer);
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
foo_unref (old);
}
}
void
value_take_foo (GValue* value,
gpointer v_object)
{
Foo * old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_FOO));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_FOO));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
foo_unref (old);
}
}
static void
foo_class_init (FooClass * klass,
gpointer klass_data)
{
foo_parent_class = g_type_class_peek_parent (klass);
((FooClass *) klass)->finalize = foo_finalize;
klass->public_base_class_field = 42;
}
static void
foo_instance_init (Foo * self,
gpointer klass)
{
self->public_base_field = 23;
self->ref_count = 1;
}
static void
foo_finalize (Foo * obj)
{
Foo * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FOO, Foo);
g_signal_handlers_destroy (self);
}
static GType
foo_get_type_once (void)
{
static const GTypeValueTable g_define_type_value_table = { value_foo_init, value_foo_free_value, value_foo_copy_value, value_foo_peek_pointer, "p", value_foo_collect_value, "p", value_foo_lcopy_value };
static const GTypeInfo g_define_type_info = { sizeof (FooClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) foo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Foo), 0, (GInstanceInitFunc) foo_instance_init, &g_define_type_value_table };
static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
GType foo_type_id;
foo_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Foo", &g_define_type_info, &g_define_type_fundamental_info, 0);
return foo_type_id;
}
GType
foo_get_type (void)
{
static volatile gsize foo_type_id__once = 0;
if (g_once_init_enter (&foo_type_id__once)) {
GType foo_type_id;
foo_type_id = foo_get_type_once ();
g_once_init_leave (&foo_type_id__once, foo_type_id);
}
return foo_type_id__once;
}
gpointer
foo_ref (gpointer instance)
{
Foo * self;
self = instance;
g_atomic_int_inc (&self->ref_count);
return instance;
}
void
foo_unref (gpointer instance)
{
Foo * self;
self = instance;
if (g_atomic_int_dec_and_test (&self->ref_count)) {
FOO_GET_CLASS (self)->finalize (self);
g_type_free_instance ((GTypeInstance *) self);
}
}
static inline gpointer
faz_get_instance_private (Faz* self)
{
return G_STRUCT_MEMBER_P (self, Faz_private_offset);
}
void
faz_action (Faz* self)
{
g_return_if_fail (IS_FAZ (self));
_vala_assert (self->public_field == 23, "public_field == 23");
self->public_field = 32;
_vala_assert (self->public_field == 32, "public_field == 32");
_vala_assert (self->priv->private_field == 23, "private_field == 23");
self->priv->private_field = 32;
_vala_assert (self->priv->private_field == 32, "private_field == 32");
_vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->public_base_field == 23, "public_base_field == 23");
G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->public_base_field = 32;
_vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_FOO, Foo)->public_base_field == 32, "public_base_field == 32");
}
void
faz_action_class (Faz* self)
{
g_return_if_fail (IS_FAZ (self));
_vala_assert (FAZ_GET_CLASS (self)->public_class_field == 24, "public_class_field == 24");
FAZ_GET_CLASS (self)->public_class_field = 42;
_vala_assert (FAZ_GET_CLASS (self)->public_class_field == 42, "public_class_field == 42");
_vala_assert (FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field == 24, "private_class_field == 24");
FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field = 42;
_vala_assert (FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field == 42, "private_class_field == 42");
_vala_assert (FOO_GET_CLASS (self)->public_base_class_field == 42, "public_base_class_field == 42");
FOO_GET_CLASS (self)->public_base_class_field = 24;
_vala_assert (FOO_GET_CLASS (self)->public_base_class_field == 24, "public_base_class_field == 24");
}
void
faz_lock_action (Faz* self)
{
GError* _inner_error0_ = NULL;
g_return_if_fail (IS_FAZ (self));
{
g_rec_mutex_lock (&__lock_faz_faz_private_static_field);
{
faz_private_static_field = 1147;
_vala_assert (faz_private_static_field == 1147, "private_static_field == 1147");
}
__finally0:
{
g_rec_mutex_unlock (&__lock_faz_faz_private_static_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
{
g_rec_mutex_lock (&__lock_faz_faz_public_static_field);
{
faz_public_static_field = 1147;
_vala_assert (faz_public_static_field == 1147, "public_static_field == 1147");
}
__finally1:
{
g_rec_mutex_unlock (&__lock_faz_faz_public_static_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
{
g_rec_mutex_lock (&self->priv->__lock_private_field);
{
self->priv->private_field = 1147;
_vala_assert (self->priv->private_field == 1147, "private_field == 1147");
}
__finally2:
{
g_rec_mutex_unlock (&self->priv->__lock_private_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
{
g_rec_mutex_lock (&self->priv->__lock_public_field);
{
self->public_field = 1147;
_vala_assert (self->public_field == 1147, "public_field == 1147");
}
__finally3:
{
g_rec_mutex_unlock (&self->priv->__lock_public_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
}
void
faz_lock_action_class (Faz* self)
{
GError* _inner_error0_ = NULL;
g_return_if_fail (IS_FAZ (self));
{
g_rec_mutex_lock (&FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->__lock_private_class_field);
{
FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field = 1147;
_vala_assert (FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->private_class_field == 1147, "private_class_field == 1147");
}
__finally0:
{
g_rec_mutex_unlock (&FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->__lock_private_class_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
{
g_rec_mutex_lock (&FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->__lock_public_class_field);
{
FAZ_GET_CLASS (self)->public_class_field = 1147;
_vala_assert (FAZ_GET_CLASS (self)->public_class_field == 1147, "public_class_field == 1147");
}
__finally1:
{
g_rec_mutex_unlock (&FAZ_GET_CLASS_PRIVATE (FAZ_GET_CLASS (self))->__lock_public_class_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
}
Faz*
faz_construct (GType object_type)
{
Faz* self = NULL;
self = (Faz*) foo_construct (object_type);
return self;
}
Faz*
faz_new (void)
{
return faz_construct (TYPE_FAZ);
}
static void
faz_base_init (FazClass * klass)
{
klass->public_class_field = 42;
_vala_assert (klass->public_class_field == 42, "public_class_field == 42");
klass->public_class_field = 24;
_vala_assert (klass->public_class_field == 24, "public_class_field == 24");
FAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 42;
_vala_assert (FAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 42, "private_class_field == 42");
FAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 24;
_vala_assert (FAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 24, "private_class_field == 24");
_vala_assert (FOO_CLASS (klass)->public_base_class_field == 42, "public_base_class_field == 42");
FOO_CLASS (klass)->public_base_class_field = 24;
_vala_assert (FOO_CLASS (klass)->public_base_class_field == 24, "public_base_class_field == 24");
FOO_CLASS (klass)->public_base_class_field = 42;
}
static void
faz_class_init (FazClass * klass,
gpointer klass_data)
{
faz_parent_class = g_type_class_peek_parent (klass);
((FooClass *) klass)->finalize = faz_finalize;
g_type_class_adjust_private_offset (klass, &Faz_private_offset);
g_rec_mutex_init (&FAZ_GET_CLASS_PRIVATE (klass)->__lock_public_class_field);
klass->public_class_field = 42;
g_rec_mutex_init (&FAZ_GET_CLASS_PRIVATE (klass)->__lock_private_class_field);
FAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 42;
g_rec_mutex_init (&__lock_faz_faz_public_static_field);
g_rec_mutex_init (&__lock_faz_faz_private_static_field);
_vala_assert (klass->public_class_field == 42, "public_class_field == 42");
klass->public_class_field = 24;
_vala_assert (klass->public_class_field == 24, "public_class_field == 24");
_vala_assert (FAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 42, "private_class_field == 42");
FAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 24;
_vala_assert (FAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 24, "private_class_field == 24");
_vala_assert (FOO_CLASS (klass)->public_base_class_field == 42, "public_base_class_field == 42");
FOO_CLASS (klass)->public_base_class_field = 24;
_vala_assert (FOO_CLASS (klass)->public_base_class_field == 24, "public_base_class_field == 24");
FOO_CLASS (klass)->public_base_class_field = 42;
}
static void
faz_instance_init (Faz * self,
gpointer klass)
{
self->priv = faz_get_instance_private (self);
g_rec_mutex_init (&self->priv->__lock_public_field);
self->public_field = 23;
g_rec_mutex_init (&self->priv->__lock_private_field);
self->priv->private_field = 23;
}
static void
faz_finalize (Foo * obj)
{
Faz * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FAZ, Faz);
g_rec_mutex_clear (&self->priv->__lock_public_field);
g_rec_mutex_clear (&self->priv->__lock_private_field);
FOO_CLASS (faz_parent_class)->finalize (obj);
}
static GType
faz_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (FazClass), (GBaseInitFunc) faz_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) faz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Faz), 0, (GInstanceInitFunc) faz_instance_init, NULL };
GType faz_type_id;
faz_type_id = g_type_register_static (TYPE_FOO, "Faz", &g_define_type_info, 0);
g_type_add_class_private (faz_type_id, sizeof (FazClassPrivate));
Faz_private_offset = g_type_add_instance_private (faz_type_id, sizeof (FazPrivate));
return faz_type_id;
}
GType
faz_get_type (void)
{
static volatile gsize faz_type_id__once = 0;
if (g_once_init_enter (&faz_type_id__once)) {
GType faz_type_id;
faz_type_id = faz_get_type_once ();
g_once_init_leave (&faz_type_id__once, faz_type_id);
}
return faz_type_id__once;
}
Bar*
bar_construct (GType object_type)
{
Bar * self = NULL;
self = (Bar*) g_object_new (object_type, NULL);
return self;
}
Bar*
bar_new (void)
{
return bar_construct (TYPE_BAR);
}
static void
bar_class_init (BarClass * klass,
gpointer klass_data)
{
bar_parent_class = g_type_class_peek_parent (klass);
G_OBJECT_CLASS (klass)->finalize = bar_finalize;
klass->public_base_class_field = 42;
}
static void
bar_instance_init (Bar * self,
gpointer klass)
{
self->public_base_field = 23;
}
static void
bar_finalize (GObject * obj)
{
Bar * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAR, Bar);
G_OBJECT_CLASS (bar_parent_class)->finalize (obj);
}
static GType
bar_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (BarClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bar_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Bar), 0, (GInstanceInitFunc) bar_instance_init, NULL };
GType bar_type_id;
bar_type_id = g_type_register_static (G_TYPE_OBJECT, "Bar", &g_define_type_info, 0);
return bar_type_id;
}
GType
bar_get_type (void)
{
static volatile gsize bar_type_id__once = 0;
if (g_once_init_enter (&bar_type_id__once)) {
GType bar_type_id;
bar_type_id = bar_get_type_once ();
g_once_init_leave (&bar_type_id__once, bar_type_id);
}
return bar_type_id__once;
}
static inline gpointer
baz_get_instance_private (Baz* self)
{
return G_STRUCT_MEMBER_P (self, Baz_private_offset);
}
void
baz_action (Baz* self)
{
g_return_if_fail (IS_BAZ (self));
_vala_assert (self->public_field == 23, "public_field == 23");
self->public_field = 32;
_vala_assert (self->public_field == 32, "public_field == 32");
_vala_assert (self->priv->private_field == 23, "private_field == 23");
self->priv->private_field = 32;
_vala_assert (self->priv->private_field == 32, "private_field == 32");
_vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->public_base_field == 23, "public_base_field == 23");
G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->public_base_field = 32;
_vala_assert (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_BAR, Bar)->public_base_field == 32, "public_base_field == 32");
}
void
baz_action_class (Baz* self)
{
g_return_if_fail (IS_BAZ (self));
_vala_assert (BAZ_GET_CLASS (self)->public_class_field == 24, "public_class_field == 24");
BAZ_GET_CLASS (self)->public_class_field = 42;
_vala_assert (BAZ_GET_CLASS (self)->public_class_field == 42, "public_class_field == 42");
_vala_assert (BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field == 24, "private_class_field == 24");
BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field = 42;
_vala_assert (BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field == 42, "private_class_field == 42");
_vala_assert (BAR_GET_CLASS (self)->public_base_class_field == 42, "public_base_class_field == 42");
BAR_GET_CLASS (self)->public_base_class_field = 24;
_vala_assert (BAR_GET_CLASS (self)->public_base_class_field == 24, "public_base_class_field == 24");
}
void
baz_lock_action (Baz* self)
{
GError* _inner_error0_ = NULL;
g_return_if_fail (IS_BAZ (self));
{
g_rec_mutex_lock (&__lock_baz_baz_private_static_field);
{
baz_private_static_field = 1147;
_vala_assert (baz_private_static_field == 1147, "private_static_field == 1147");
}
__finally0:
{
g_rec_mutex_unlock (&__lock_baz_baz_private_static_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
{
g_rec_mutex_lock (&__lock_baz_baz_public_static_field);
{
baz_public_static_field = 1147;
_vala_assert (baz_public_static_field == 1147, "public_static_field == 1147");
}
__finally1:
{
g_rec_mutex_unlock (&__lock_baz_baz_public_static_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
{
g_rec_mutex_lock (&self->priv->__lock_private_field);
{
self->priv->private_field = 1147;
_vala_assert (self->priv->private_field == 1147, "private_field == 1147");
}
__finally2:
{
g_rec_mutex_unlock (&self->priv->__lock_private_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
{
g_rec_mutex_lock (&self->priv->__lock_public_field);
{
self->public_field = 1147;
_vala_assert (self->public_field == 1147, "public_field == 1147");
}
__finally3:
{
g_rec_mutex_unlock (&self->priv->__lock_public_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
}
void
baz_lock_action_class (Baz* self)
{
GError* _inner_error0_ = NULL;
g_return_if_fail (IS_BAZ (self));
{
g_rec_mutex_lock (&BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->__lock_private_class_field);
{
BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field = 1147;
_vala_assert (BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->private_class_field == 1147, "private_class_field == 1147");
}
__finally0:
{
g_rec_mutex_unlock (&BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->__lock_private_class_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
{
g_rec_mutex_lock (&BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->__lock_public_class_field);
{
BAZ_GET_CLASS (self)->public_class_field = 1147;
_vala_assert (BAZ_GET_CLASS (self)->public_class_field == 1147, "public_class_field == 1147");
}
__finally1:
{
g_rec_mutex_unlock (&BAZ_GET_CLASS_PRIVATE (BAZ_GET_CLASS (self))->__lock_public_class_field);
}
if (G_UNLIKELY (_inner_error0_ != NULL)) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
g_clear_error (&_inner_error0_);
return;
}
}
}
Baz*
baz_construct (GType object_type)
{
Baz * self = NULL;
self = (Baz*) bar_construct (object_type);
return self;
}
Baz*
baz_new (void)
{
return baz_construct (TYPE_BAZ);
}
static void
baz_base_init (BazClass * klass)
{
g_print ("%i\n", klass->public_class_field);
klass->public_class_field = 42;
_vala_assert (klass->public_class_field == 42, "public_class_field == 42");
klass->public_class_field = 24;
_vala_assert (klass->public_class_field == 24, "public_class_field == 24");
g_print ("%i\n", BAZ_GET_CLASS_PRIVATE (klass)->private_class_field);
BAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 42;
_vala_assert (BAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 42, "private_class_field == 42");
BAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 24;
_vala_assert (BAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 24, "private_class_field == 24");
_vala_assert (BAR_CLASS (klass)->public_base_class_field == 42, "public_base_class_field == 42");
BAR_CLASS (klass)->public_base_class_field = 24;
_vala_assert (BAR_CLASS (klass)->public_base_class_field == 24, "public_base_class_field == 24");
BAR_CLASS (klass)->public_base_class_field = 42;
}
static void
baz_class_init (BazClass * klass,
gpointer klass_data)
{
baz_parent_class = g_type_class_peek_parent (klass);
g_type_class_adjust_private_offset (klass, &Baz_private_offset);
G_OBJECT_CLASS (klass)->finalize = baz_finalize;
g_rec_mutex_init (&BAZ_GET_CLASS_PRIVATE (klass)->__lock_public_class_field);
klass->public_class_field = 42;
g_rec_mutex_init (&BAZ_GET_CLASS_PRIVATE (klass)->__lock_private_class_field);
BAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 42;
g_rec_mutex_init (&__lock_baz_baz_public_static_field);
g_rec_mutex_init (&__lock_baz_baz_private_static_field);
_vala_assert (klass->public_class_field == 42, "public_class_field == 42");
klass->public_class_field = 24;
_vala_assert (klass->public_class_field == 24, "public_class_field == 24");
_vala_assert (BAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 42, "private_class_field == 42");
BAZ_GET_CLASS_PRIVATE (klass)->private_class_field = 24;
_vala_assert (BAZ_GET_CLASS_PRIVATE (klass)->private_class_field == 24, "private_class_field == 24");
_vala_assert (BAR_CLASS (klass)->public_base_class_field == 42, "public_base_class_field == 42");
BAR_CLASS (klass)->public_base_class_field = 24;
_vala_assert (BAR_CLASS (klass)->public_base_class_field == 24, "public_base_class_field == 24");
BAR_CLASS (klass)->public_base_class_field = 42;
}
static void
baz_instance_init (Baz * self,
gpointer klass)
{
self->priv = baz_get_instance_private (self);
g_rec_mutex_init (&self->priv->__lock_public_field);
self->public_field = 23;
g_rec_mutex_init (&self->priv->__lock_private_field);
self->priv->private_field = 23;
}
static void
baz_finalize (GObject * obj)
{
Baz * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BAZ, Baz);
g_rec_mutex_clear (&self->priv->__lock_public_field);
g_rec_mutex_clear (&self->priv->__lock_private_field);
G_OBJECT_CLASS (baz_parent_class)->finalize (obj);
}
static GType
baz_get_type_once (void)
{
static const GTypeInfo g_define_type_info = { sizeof (BazClass), (GBaseInitFunc) baz_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) baz_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Baz), 0, (GInstanceInitFunc) baz_instance_init, NULL };
GType baz_type_id;
baz_type_id = g_type_register_static (TYPE_BAR, "Baz", &g_define_type_info, 0);
g_type_add_class_private (baz_type_id, sizeof (BazClassPrivate));
Baz_private_offset = g_type_add_instance_private (baz_type_id, sizeof (BazPrivate));
return baz_type_id;
}
GType
baz_get_type (void)
{
static volatile gsize baz_type_id__once = 0;
if (g_once_init_enter (&baz_type_id__once)) {
GType baz_type_id;
baz_type_id = baz_get_type_once ();
g_once_init_leave (&baz_type_id__once, baz_type_id);
}
return baz_type_id__once;
}
static inline gpointer
manam_get_instance_private (Manam* self)
{
return G_STRUCT_MEMBER_P (self, Manam_private_offset);
}
Manam*
manam_construct (GType object_type,
GType t_type,
GBoxedCopyFunc t_dup_func,
GDestroyNotify t_destroy_func)
{
Manam* self = NULL;
self = (Manam*) g_type_create_instance (object_type);
self->priv->t_type = t_type;
self->priv->t_dup_func = t_dup_func;
self->priv->t_destroy_func = t_destroy_func;
return self;
}
Manam*
manam_new (GType t_type,
GBoxedCopyFunc t_dup_func,
GDestroyNotify t_destroy_func)
{
return manam_construct (TYPE_MANAM, t_type, t_dup_func, t_destroy_func);
}
static void
value_manam_init (GValue* value)
{
value->data[0].v_pointer = NULL;
}
static void
value_manam_free_value (GValue* value)
{
if (value->data[0].v_pointer) {
manam_unref (value->data[0].v_pointer);
}
}
static void
value_manam_copy_value (const GValue* src_value,
GValue* dest_value)
{
if (src_value->data[0].v_pointer) {
dest_value->data[0].v_pointer = manam_ref (src_value->data[0].v_pointer);
} else {
dest_value->data[0].v_pointer = NULL;
}
}
static gpointer
value_manam_peek_pointer (const GValue* value)
{
return value->data[0].v_pointer;
}
static gchar*
value_manam_collect_value (GValue* value,
guint n_collect_values,
GTypeCValue* collect_values,
guint collect_flags)
{
if (collect_values[0].v_pointer) {
Manam * object;
object = collect_values[0].v_pointer;
if (object->parent_instance.g_class == NULL) {
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
}
value->data[0].v_pointer = manam_ref (object);
} else {
value->data[0].v_pointer = NULL;
}
return NULL;
}
static gchar*
value_manam_lcopy_value (const GValue* value,
guint n_collect_values,
GTypeCValue* collect_values,
guint collect_flags)
{
Manam ** object_p;
object_p = collect_values[0].v_pointer;
if (!object_p) {
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
}
if (!value->data[0].v_pointer) {
*object_p = NULL;
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
*object_p = value->data[0].v_pointer;
} else {
*object_p = manam_ref (value->data[0].v_pointer);
}
return NULL;
}
GParamSpec*
param_spec_manam (const gchar* name,
const gchar* nick,
const gchar* blurb,
GType object_type,
GParamFlags flags)
{
ParamSpecManam* spec;
g_return_val_if_fail (g_type_is_a (object_type, TYPE_MANAM), NULL);
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
G_PARAM_SPEC (spec)->value_type = object_type;
return G_PARAM_SPEC (spec);
}
gpointer
value_get_manam (const GValue* value)
{
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM), NULL);
return value->data[0].v_pointer;
}
void
value_set_manam (GValue* value,
gpointer v_object)
{
Manam * old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
manam_ref (value->data[0].v_pointer);
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
manam_unref (old);
}
}
void
value_take_manam (GValue* value,
gpointer v_object)
{
Manam * old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MANAM));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MANAM));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
manam_unref (old);
}
}
static void
manam_class_init (ManamClass * klass,
gpointer klass_data)
{
manam_parent_class = g_type_class_peek_parent (klass);
((ManamClass *) klass)->finalize = manam_finalize;
g_type_class_adjust_private_offset (klass, &Manam_private_offset);
}
static void
manam_instance_init (Manam * self,
gpointer klass)
{
self->priv = manam_get_instance_private (self);
self->ref_count = 1;
}
static void
manam_finalize (Manam * obj)
{
Manam * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MANAM, Manam);
g_signal_handlers_destroy (self);
((self->foo == NULL) || (self->priv->t_destroy_func == NULL)) ? NULL : (self->foo = (self->priv->t_destroy_func (self->foo), NULL));
}
static GType
manam_get_type_once (void)
{
static const GTypeValueTable g_define_type_value_table = { value_manam_init, value_manam_free_value, value_manam_copy_value, value_manam_peek_pointer, "p", value_manam_collect_value, "p", value_manam_lcopy_value };
static const GTypeInfo g_define_type_info = { sizeof (ManamClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) manam_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Manam), 0, (GInstanceInitFunc) manam_instance_init, &g_define_type_value_table };
static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
GType manam_type_id;
manam_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Manam", &g_define_type_info, &g_define_type_fundamental_info, 0);
Manam_private_offset = g_type_add_instance_private (manam_type_id, sizeof (ManamPrivate));
return manam_type_id;
}
GType
manam_get_type (void)
{
static volatile gsize manam_type_id__once = 0;
if (g_once_init_enter (&manam_type_id__once)) {
GType manam_type_id;
manam_type_id = manam_get_type_once ();
g_once_init_leave (&manam_type_id__once, manam_type_id);
}
return manam_type_id__once;
}
gpointer
manam_ref (gpointer instance)
{
Manam * self;
self = instance;
g_atomic_int_inc (&self->ref_count);
return instance;
}
void
manam_unref (gpointer instance)
{
Manam * self;
self = instance;
if (g_atomic_int_dec_and_test (&self->ref_count)) {
MANAM_GET_CLASS (self)->finalize (self);
g_type_free_instance ((GTypeInstance *) self);
}
}
static void
_vala_main (void)
{
{
Foo* foo = NULL;
Foo* _tmp0_;
_tmp0_ = foo_new ();
foo = _tmp0_;
foo->public_base_field = 132;
_vala_assert (foo->public_base_field == 132, "foo.public_base_field == 132");
FOO_GET_CLASS (foo)->public_base_class_field = 264;
_vala_assert (FOO_GET_CLASS (foo)->public_base_class_field == 264, "foo.public_base_class_field == 264");
FOO_GET_CLASS (foo)->public_base_class_field = 42;
_foo_unref0 (foo);
}
{
Faz* faz = NULL;
Faz* _tmp1_;
_tmp1_ = faz_new ();
faz = _tmp1_;
faz_action (faz);
faz_action_class (faz);
faz_lock_action (faz);
faz_lock_action_class (faz);
faz->public_field = 66;
_vala_assert (faz->public_field == 66, "faz.public_field == 66");
FAZ_GET_CLASS (faz)->public_class_field = 132;
_vala_assert (FAZ_GET_CLASS (faz)->public_class_field == 132, "faz.public_class_field == 132");
FOO_GET_CLASS (faz)->public_base_class_field = 264;
_vala_assert (FOO_GET_CLASS (faz)->public_base_class_field == 264, "faz.public_base_class_field == 264");
_foo_unref0 (faz);
}
{
Bar* bar = NULL;
Bar* _tmp2_;
_tmp2_ = bar_new ();
bar = _tmp2_;
bar->public_base_field = 132;
_vala_assert (bar->public_base_field == 132, "bar.public_base_field == 132");
BAR_GET_CLASS (bar)->public_base_class_field = 264;
_vala_assert (BAR_GET_CLASS (bar)->public_base_class_field == 264, "bar.public_base_class_field == 264");
BAR_GET_CLASS (bar)->public_base_class_field = 42;
_g_object_unref0 (bar);
}
{
Baz* baz = NULL;
Baz* _tmp3_;
_tmp3_ = baz_new ();
baz = _tmp3_;
baz_action (baz);
baz_action_class (baz);
baz_lock_action (baz);
baz_lock_action_class (baz);
baz->public_field = 66;
_vala_assert (baz->public_field == 66, "baz.public_field == 66");
BAZ_GET_CLASS (baz)->public_class_field = 132;
_vala_assert (BAZ_GET_CLASS (baz)->public_class_field == 132, "baz.public_class_field == 132");
BAR_GET_CLASS (baz)->public_base_class_field = 264;
_vala_assert (BAR_GET_CLASS (baz)->public_base_class_field == 264, "baz.public_base_class_field == 264");
_g_object_unref0 (baz);
}
{
CompactFoo* foo = NULL;
CompactFoo* _tmp4_;
_tmp4_ = compact_foo_new ();
foo = _tmp4_;
_vala_assert (foo->initialized_field == 23, "foo.initialized_field == 23");
_vala_assert (compact_foo_public_static_field == 4711, "foo.public_static_field == 4711");
_compact_foo_free0 (foo);
}
{
Manam* manam = NULL;
Manam* _tmp5_;
_tmp5_ = manam_new (TYPE_BAR, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
manam = _tmp5_;
_g_object_unref0 (manam->foo);
manam->foo = NULL;
_manam_unref0 (manam);
}
}
int
main (int argc,
char ** argv)
{
_vala_main ();
return 0;
}
|