File: | _build/../libbean/cparamspecs.c |
Warning: | line 805, column 7 Value stored to 'string' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* GObject - GLib Type, Object, Parameter and Signal Library |
2 | * Copyright (C) 1997-1999, 2000-2001 Tim Janik and Red Hat, Inc. |
3 | * Copyright (C) 2010 Christian Persch |
4 | * |
5 | * SPDX-License-Identifier: LGPL-2.1-or-later |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Lesser General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2.1 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Lesser General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Lesser General |
18 | * Public License along with this library; if not, see <http://www.gnu.org/licenses/>. |
19 | */ |
20 | |
21 | /* |
22 | * MT safe |
23 | */ |
24 | |
25 | #include "config.h" |
26 | |
27 | #include <string.h> |
28 | |
29 | #include "cparamspecs.h" |
30 | |
31 | |
32 | #define G_FLOAT_EPSILON(1e-30f) (1e-30f) |
33 | #define G_DOUBLE_EPSILON(1e-90) (1e-90) |
34 | |
35 | |
36 | /* --- param spec functions --- */ |
37 | static void |
38 | param_char_init (CParamSpec *pspec) |
39 | { |
40 | CParamSpecChar *cspec = C_PARAM_SPEC_CHAR (pspec)((((CParamSpecChar*) (void *) ((pspec))))); |
41 | |
42 | cspec->minimum = 0x7f; |
43 | cspec->maximum = 0x80; |
44 | cspec->default_value = 0; |
45 | } |
46 | |
47 | static void |
48 | param_char_set_default (CParamSpec *pspec, |
49 | GValue *value) |
50 | { |
51 | value->data[0].v_int = C_PARAM_SPEC_CHAR (pspec)((((CParamSpecChar*) (void *) ((pspec)))))->default_value; |
52 | } |
53 | |
54 | static gboolean |
55 | param_char_is_valid (CParamSpec *pspec, |
56 | const GValue *value) |
57 | { |
58 | CParamSpecChar *cspec = C_PARAM_SPEC_CHAR (pspec)((((CParamSpecChar*) (void *) ((pspec))))); |
59 | gint oval = value->data[0].v_int; |
60 | |
61 | return cspec->minimum <= oval && oval <= cspec->maximum; |
62 | } |
63 | |
64 | static gboolean |
65 | param_char_validate (CParamSpec *pspec, |
66 | GValue *value) |
67 | { |
68 | CParamSpecChar *cspec = C_PARAM_SPEC_CHAR (pspec)((((CParamSpecChar*) (void *) ((pspec))))); |
69 | gint oval = value->data[0].v_int; |
70 | |
71 | value->data[0].v_int = CLAMP (value->data[0].v_int, cspec->minimum, cspec->maximum)(((value->data[0].v_int) > (cspec->maximum)) ? (cspec ->maximum) : (((value->data[0].v_int) < (cspec->minimum )) ? (cspec->minimum) : (value->data[0].v_int))); |
72 | |
73 | return value->data[0].v_int != oval; |
74 | } |
75 | |
76 | static void |
77 | param_uchar_init (CParamSpec *pspec) |
78 | { |
79 | CParamSpecUChar *uspec = C_PARAM_SPEC_UCHAR (pspec)((((CParamSpecUChar*) (void *) ((pspec))))); |
80 | |
81 | uspec->minimum = 0; |
82 | uspec->maximum = 0xff; |
83 | uspec->default_value = 0; |
84 | } |
85 | |
86 | static void |
87 | param_uchar_set_default (CParamSpec *pspec, |
88 | GValue *value) |
89 | { |
90 | value->data[0].v_uint = C_PARAM_SPEC_UCHAR (pspec)((((CParamSpecUChar*) (void *) ((pspec)))))->default_value; |
91 | } |
92 | |
93 | static gboolean |
94 | param_uchar_is_valid (CParamSpec *pspec, |
95 | const GValue *value) |
96 | { |
97 | CParamSpecUChar *uspec = C_PARAM_SPEC_UCHAR (pspec)((((CParamSpecUChar*) (void *) ((pspec))))); |
98 | guint oval = value->data[0].v_uint; |
99 | |
100 | return uspec->minimum <= oval && oval <= uspec->maximum; |
101 | } |
102 | |
103 | static gboolean |
104 | param_uchar_validate (CParamSpec *pspec, |
105 | GValue *value) |
106 | { |
107 | CParamSpecUChar *uspec = C_PARAM_SPEC_UCHAR (pspec)((((CParamSpecUChar*) (void *) ((pspec))))); |
108 | guint oval = value->data[0].v_uint; |
109 | |
110 | value->data[0].v_uint = CLAMP (value->data[0].v_uint, uspec->minimum, uspec->maximum)(((value->data[0].v_uint) > (uspec->maximum)) ? (uspec ->maximum) : (((value->data[0].v_uint) < (uspec-> minimum)) ? (uspec->minimum) : (value->data[0].v_uint)) ); |
111 | |
112 | return value->data[0].v_uint != oval; |
113 | } |
114 | |
115 | static void |
116 | param_boolean_set_default (CParamSpec *pspec, |
117 | GValue *value) |
118 | { |
119 | value->data[0].v_int = C_PARAM_SPEC_BOOLEAN (pspec)((((CParamSpecBoolean*) (void *) ((pspec)))))->default_value; |
120 | } |
121 | |
122 | static gboolean |
123 | param_boolean_is_valid (CParamSpec *pspec, |
124 | const GValue *value) |
125 | { |
126 | int oval = value->data[0].v_int; |
127 | |
128 | return oval == FALSE(0) || oval == TRUE(!(0)); |
129 | } |
130 | |
131 | static gboolean |
132 | param_boolean_validate (CParamSpec *pspec, |
133 | GValue *value) |
134 | { |
135 | gint oval = value->data[0].v_int; |
136 | |
137 | value->data[0].v_int = value->data[0].v_int != FALSE(0); |
138 | |
139 | return value->data[0].v_int != oval; |
140 | } |
141 | |
142 | static void |
143 | param_int_init (CParamSpec *pspec) |
144 | { |
145 | CParamSpecInt *ispec = C_PARAM_SPEC_INT (pspec)((((CParamSpecInt*) (void *) ((pspec))))); |
146 | |
147 | ispec->minimum = 0x7fffffff; |
148 | ispec->maximum = 0x80000000; |
149 | ispec->default_value = 0; |
150 | } |
151 | |
152 | static void |
153 | param_int_set_default (CParamSpec *pspec, |
154 | GValue *value) |
155 | { |
156 | value->data[0].v_int = C_PARAM_SPEC_INT (pspec)((((CParamSpecInt*) (void *) ((pspec)))))->default_value; |
157 | } |
158 | |
159 | static gboolean |
160 | param_int_is_valid (CParamSpec *pspec, |
161 | const GValue *value) |
162 | { |
163 | CParamSpecInt *ispec = C_PARAM_SPEC_INT (pspec)((((CParamSpecInt*) (void *) ((pspec))))); |
164 | int oval = value->data[0].v_int; |
165 | |
166 | return ispec->minimum <= oval && oval <= ispec->maximum; |
167 | } |
168 | |
169 | static gboolean |
170 | param_int_validate (CParamSpec *pspec, |
171 | GValue *value) |
172 | { |
173 | CParamSpecInt *ispec = C_PARAM_SPEC_INT (pspec)((((CParamSpecInt*) (void *) ((pspec))))); |
174 | gint oval = value->data[0].v_int; |
175 | |
176 | value->data[0].v_int = CLAMP (value->data[0].v_int, ispec->minimum, ispec->maximum)(((value->data[0].v_int) > (ispec->maximum)) ? (ispec ->maximum) : (((value->data[0].v_int) < (ispec->minimum )) ? (ispec->minimum) : (value->data[0].v_int))); |
177 | |
178 | return value->data[0].v_int != oval; |
179 | } |
180 | |
181 | static gint |
182 | param_int_values_cmp (CParamSpec *pspec, |
183 | const GValue *value1, |
184 | const GValue *value2) |
185 | { |
186 | if (value1->data[0].v_int < value2->data[0].v_int) |
187 | return -1; |
188 | else |
189 | return value1->data[0].v_int > value2->data[0].v_int; |
190 | } |
191 | |
192 | static void |
193 | param_uint_init (CParamSpec *pspec) |
194 | { |
195 | CParamSpecUInt *uspec = C_PARAM_SPEC_UINT (pspec)((((CParamSpecUInt*) (void *) ((pspec))))); |
196 | |
197 | uspec->minimum = 0; |
198 | uspec->maximum = 0xffffffff; |
199 | uspec->default_value = 0; |
200 | } |
201 | |
202 | static void |
203 | param_uint_set_default (CParamSpec *pspec, |
204 | GValue *value) |
205 | { |
206 | value->data[0].v_uint = C_PARAM_SPEC_UINT (pspec)((((CParamSpecUInt*) (void *) ((pspec)))))->default_value; |
207 | } |
208 | |
209 | static gboolean |
210 | param_uint_is_valid (CParamSpec *pspec, |
211 | const GValue *value) |
212 | { |
213 | CParamSpecUInt *uspec = C_PARAM_SPEC_UINT (pspec)((((CParamSpecUInt*) (void *) ((pspec))))); |
214 | guint oval = value->data[0].v_uint; |
215 | |
216 | return uspec->minimum <= oval && oval <= uspec->maximum; |
217 | } |
218 | |
219 | static gboolean |
220 | param_uint_validate (CParamSpec *pspec, |
221 | GValue *value) |
222 | { |
223 | CParamSpecUInt *uspec = C_PARAM_SPEC_UINT (pspec)((((CParamSpecUInt*) (void *) ((pspec))))); |
224 | guint oval = value->data[0].v_uint; |
225 | |
226 | value->data[0].v_uint = CLAMP (value->data[0].v_uint, uspec->minimum, uspec->maximum)(((value->data[0].v_uint) > (uspec->maximum)) ? (uspec ->maximum) : (((value->data[0].v_uint) < (uspec-> minimum)) ? (uspec->minimum) : (value->data[0].v_uint)) ); |
227 | |
228 | return value->data[0].v_uint != oval; |
229 | } |
230 | |
231 | static gint |
232 | param_uint_values_cmp (CParamSpec *pspec, |
233 | const GValue *value1, |
234 | const GValue *value2) |
235 | { |
236 | if (value1->data[0].v_uint < value2->data[0].v_uint) |
237 | return -1; |
238 | else |
239 | return value1->data[0].v_uint > value2->data[0].v_uint; |
240 | } |
241 | |
242 | static void |
243 | param_long_init (CParamSpec *pspec) |
244 | { |
245 | CParamSpecLong *lspec = C_PARAM_SPEC_LONG (pspec)((((CParamSpecLong*) (void *) ((pspec))))); |
246 | |
247 | #if SIZEOF_LONG == 4 |
248 | lspec->minimum = 0x7fffffff; |
249 | lspec->maximum = 0x80000000; |
250 | #else /* SIZEOF_LONG != 4 (8) */ |
251 | lspec->minimum = 0x7fffffffffffffff; |
252 | lspec->maximum = 0x8000000000000000; |
253 | #endif |
254 | lspec->default_value = 0; |
255 | } |
256 | |
257 | static void |
258 | param_long_set_default (CParamSpec *pspec, |
259 | GValue *value) |
260 | { |
261 | value->data[0].v_long = C_PARAM_SPEC_LONG (pspec)((((CParamSpecLong*) (void *) ((pspec)))))->default_value; |
262 | } |
263 | |
264 | static gboolean |
265 | param_long_is_valid (CParamSpec *pspec, |
266 | const GValue *value) |
267 | { |
268 | CParamSpecLong *lspec = C_PARAM_SPEC_LONG (pspec)((((CParamSpecLong*) (void *) ((pspec))))); |
269 | glong oval = value->data[0].v_long; |
270 | |
271 | return lspec->minimum <= oval && oval <= lspec->maximum; |
272 | } |
273 | |
274 | static gboolean |
275 | param_long_validate (CParamSpec *pspec, |
276 | GValue *value) |
277 | { |
278 | CParamSpecLong *lspec = C_PARAM_SPEC_LONG (pspec)((((CParamSpecLong*) (void *) ((pspec))))); |
279 | glong oval = value->data[0].v_long; |
280 | |
281 | value->data[0].v_long = CLAMP (value->data[0].v_long, lspec->minimum, lspec->maximum)(((value->data[0].v_long) > (lspec->maximum)) ? (lspec ->maximum) : (((value->data[0].v_long) < (lspec-> minimum)) ? (lspec->minimum) : (value->data[0].v_long)) ); |
282 | |
283 | return value->data[0].v_long != oval; |
284 | } |
285 | |
286 | static gint |
287 | param_long_values_cmp (CParamSpec *pspec, |
288 | const GValue *value1, |
289 | const GValue *value2) |
290 | { |
291 | if (value1->data[0].v_long < value2->data[0].v_long) |
292 | return -1; |
293 | else |
294 | return value1->data[0].v_long > value2->data[0].v_long; |
295 | } |
296 | |
297 | static void |
298 | param_ulong_init (CParamSpec *pspec) |
299 | { |
300 | CParamSpecULong *uspec = C_PARAM_SPEC_ULONG (pspec)((((CParamSpecULong*) (void *) ((pspec))))); |
301 | |
302 | uspec->minimum = 0; |
303 | #if SIZEOF_LONG == 4 |
304 | uspec->maximum = 0xffffffff; |
305 | #else /* SIZEOF_LONG != 4 (8) */ |
306 | uspec->maximum = 0xffffffffffffffff; |
307 | #endif |
308 | uspec->default_value = 0; |
309 | } |
310 | |
311 | static void |
312 | param_ulong_set_default (CParamSpec *pspec, |
313 | GValue *value) |
314 | { |
315 | value->data[0].v_ulong = C_PARAM_SPEC_ULONG (pspec)((((CParamSpecULong*) (void *) ((pspec)))))->default_value; |
316 | } |
317 | |
318 | static gboolean |
319 | param_ulong_is_valid (CParamSpec *pspec, |
320 | const GValue *value) |
321 | { |
322 | CParamSpecULong *uspec = C_PARAM_SPEC_ULONG (pspec)((((CParamSpecULong*) (void *) ((pspec))))); |
323 | gulong oval = value->data[0].v_ulong; |
324 | |
325 | return uspec->minimum <= oval && oval <= uspec->maximum; |
326 | } |
327 | |
328 | static gboolean |
329 | param_ulong_validate (CParamSpec *pspec, |
330 | GValue *value) |
331 | { |
332 | CParamSpecULong *uspec = C_PARAM_SPEC_ULONG (pspec)((((CParamSpecULong*) (void *) ((pspec))))); |
333 | gulong oval = value->data[0].v_ulong; |
334 | |
335 | value->data[0].v_ulong = CLAMP (value->data[0].v_ulong, uspec->minimum, uspec->maximum)(((value->data[0].v_ulong) > (uspec->maximum)) ? (uspec ->maximum) : (((value->data[0].v_ulong) < (uspec-> minimum)) ? (uspec->minimum) : (value->data[0].v_ulong) )); |
336 | |
337 | return value->data[0].v_ulong != oval; |
338 | } |
339 | |
340 | static gint |
341 | param_ulong_values_cmp (CParamSpec *pspec, |
342 | const GValue *value1, |
343 | const GValue *value2) |
344 | { |
345 | if (value1->data[0].v_ulong < value2->data[0].v_ulong) |
346 | return -1; |
347 | else |
348 | return value1->data[0].v_ulong > value2->data[0].v_ulong; |
349 | } |
350 | |
351 | static void |
352 | param_int64_init (CParamSpec *pspec) |
353 | { |
354 | CParamSpecInt64 *lspec = C_PARAM_SPEC_INT64 (pspec)((((CParamSpecInt64*) (void *) ((pspec))))); |
355 | |
356 | lspec->minimum = G_MININT64((gint64) (-(0x7fffffffffffffffL) - (1L))); |
357 | lspec->maximum = G_MAXINT64(0x7fffffffffffffffL); |
358 | lspec->default_value = 0; |
359 | } |
360 | |
361 | static void |
362 | param_int64_set_default (CParamSpec *pspec, |
363 | GValue *value) |
364 | { |
365 | value->data[0].v_int64 = C_PARAM_SPEC_INT64 (pspec)((((CParamSpecInt64*) (void *) ((pspec)))))->default_value; |
366 | } |
367 | |
368 | static gboolean |
369 | param_int64_is_valid (CParamSpec *pspec, |
370 | const GValue *value) |
371 | { |
372 | CParamSpecInt64 *lspec = C_PARAM_SPEC_INT64 (pspec)((((CParamSpecInt64*) (void *) ((pspec))))); |
373 | gint64 oval = value->data[0].v_int64; |
374 | |
375 | return lspec->minimum <= oval && oval <= lspec->maximum; |
376 | } |
377 | |
378 | static gboolean |
379 | param_int64_validate (CParamSpec *pspec, |
380 | GValue *value) |
381 | { |
382 | CParamSpecInt64 *lspec = C_PARAM_SPEC_INT64 (pspec)((((CParamSpecInt64*) (void *) ((pspec))))); |
383 | gint64 oval = value->data[0].v_int64; |
384 | |
385 | value->data[0].v_int64 = CLAMP (value->data[0].v_int64, lspec->minimum, lspec->maximum)(((value->data[0].v_int64) > (lspec->maximum)) ? (lspec ->maximum) : (((value->data[0].v_int64) < (lspec-> minimum)) ? (lspec->minimum) : (value->data[0].v_int64) )); |
386 | |
387 | return value->data[0].v_int64 != oval; |
388 | } |
389 | |
390 | static gint |
391 | param_int64_values_cmp (CParamSpec *pspec, |
392 | const GValue *value1, |
393 | const GValue *value2) |
394 | { |
395 | if (value1->data[0].v_int64 < value2->data[0].v_int64) |
396 | return -1; |
397 | else |
398 | return value1->data[0].v_int64 > value2->data[0].v_int64; |
399 | } |
400 | |
401 | static void |
402 | param_uint64_init (CParamSpec *pspec) |
403 | { |
404 | CParamSpecUInt64 *uspec = C_PARAM_SPEC_UINT64 (pspec)((((CParamSpecUInt64*) (void *) ((pspec))))); |
405 | |
406 | uspec->minimum = 0; |
407 | uspec->maximum = G_MAXUINT64(0xffffffffffffffffUL); |
408 | uspec->default_value = 0; |
409 | } |
410 | |
411 | static void |
412 | param_uint64_set_default (CParamSpec *pspec, |
413 | GValue *value) |
414 | { |
415 | value->data[0].v_uint64 = C_PARAM_SPEC_UINT64 (pspec)((((CParamSpecUInt64*) (void *) ((pspec)))))->default_value; |
416 | } |
417 | |
418 | static gboolean |
419 | param_uint64_is_valid (CParamSpec *pspec, |
420 | const GValue *value) |
421 | { |
422 | CParamSpecUInt64 *uspec = C_PARAM_SPEC_UINT64 (pspec)((((CParamSpecUInt64*) (void *) ((pspec))))); |
423 | guint64 oval = value->data[0].v_uint64; |
424 | |
425 | return uspec->minimum <= oval && oval <= uspec->maximum; |
426 | } |
427 | |
428 | static gboolean |
429 | param_uint64_validate (CParamSpec *pspec, |
430 | GValue *value) |
431 | { |
432 | CParamSpecUInt64 *uspec = C_PARAM_SPEC_UINT64 (pspec)((((CParamSpecUInt64*) (void *) ((pspec))))); |
433 | guint64 oval = value->data[0].v_uint64; |
434 | |
435 | value->data[0].v_uint64 = CLAMP (value->data[0].v_uint64, uspec->minimum, uspec->maximum)(((value->data[0].v_uint64) > (uspec->maximum)) ? (uspec ->maximum) : (((value->data[0].v_uint64) < (uspec-> minimum)) ? (uspec->minimum) : (value->data[0].v_uint64 ))); |
436 | |
437 | return value->data[0].v_uint64 != oval; |
438 | } |
439 | |
440 | static gint |
441 | param_uint64_values_cmp (CParamSpec *pspec, |
442 | const GValue *value1, |
443 | const GValue *value2) |
444 | { |
445 | if (value1->data[0].v_uint64 < value2->data[0].v_uint64) |
446 | return -1; |
447 | else |
448 | return value1->data[0].v_uint64 > value2->data[0].v_uint64; |
449 | } |
450 | |
451 | static void |
452 | param_unichar_init (CParamSpec *pspec) |
453 | { |
454 | CParamSpecUnichar *uspec = C_PARAM_SPEC_UNICHAR (pspec)((((CParamSpecUnichar*) (void *) ((pspec))))); |
455 | |
456 | uspec->default_value = 0; |
457 | } |
458 | |
459 | static void |
460 | param_unichar_set_default (CParamSpec *pspec, |
461 | GValue *value) |
462 | { |
463 | value->data[0].v_uint = C_PARAM_SPEC_UNICHAR (pspec)((((CParamSpecUnichar*) (void *) ((pspec)))))->default_value; |
464 | } |
465 | |
466 | static gboolean |
467 | param_unichar_is_valid (CParamSpec *pspec, |
468 | const GValue *value) |
469 | { |
470 | return g_unichar_validate (value->data[0].v_uint); |
471 | } |
472 | |
473 | static gboolean |
474 | param_unichar_validate (CParamSpec *pspec, |
475 | GValue *value) |
476 | { |
477 | gunichar oval = value->data[0].v_uint; |
478 | gboolean changed = FALSE(0); |
479 | |
480 | if (!g_unichar_validate (oval)) |
481 | { |
482 | value->data[0].v_uint = 0; |
483 | changed = TRUE(!(0)); |
484 | } |
485 | |
486 | return changed; |
487 | } |
488 | |
489 | static gint |
490 | param_unichar_values_cmp (CParamSpec *pspec, |
491 | const GValue *value1, |
492 | const GValue *value2) |
493 | { |
494 | if (value1->data[0].v_uint < value2->data[0].v_uint) |
495 | return -1; |
496 | else |
497 | return value1->data[0].v_uint > value2->data[0].v_uint; |
498 | } |
499 | |
500 | static void |
501 | param_enum_init (CParamSpec *pspec) |
502 | { |
503 | CParamSpecEnum *espec = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec))))); |
504 | |
505 | espec->enum_class = NULL((void*)0); |
506 | espec->default_value = 0; |
507 | } |
508 | |
509 | static void |
510 | param_enum_finalize (CParamSpec *pspec) |
511 | { |
512 | CParamSpecEnum *espec = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec))))); |
513 | CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_ENUM(c_param_spec_types[10]))); |
514 | |
515 | if (espec->enum_class) |
516 | { |
517 | g_type_class_unref (espec->enum_class); |
518 | espec->enum_class = NULL((void*)0); |
519 | } |
520 | |
521 | parent_class->finalize (pspec); |
522 | } |
523 | |
524 | static void |
525 | param_enum_set_default (CParamSpec *pspec, |
526 | GValue *value) |
527 | { |
528 | value->data[0].v_long = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec)))))->default_value; |
529 | } |
530 | |
531 | static gboolean |
532 | param_enum_is_valid (CParamSpec *pspec, |
533 | const GValue *value) |
534 | { |
535 | CParamSpecEnum *espec = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec))))); |
536 | glong oval = value->data[0].v_long; |
537 | |
538 | return g_enum_get_value (espec->enum_class, oval) != NULL((void*)0); |
539 | } |
540 | |
541 | static gboolean |
542 | param_enum_validate (CParamSpec *pspec, |
543 | GValue *value) |
544 | { |
545 | CParamSpecEnum *espec = C_PARAM_SPEC_ENUM (pspec)((((CParamSpecEnum*) (void *) ((pspec))))); |
546 | glong oval = value->data[0].v_long; |
547 | |
548 | if (!espec->enum_class || |
549 | !g_enum_get_value (espec->enum_class, value->data[0].v_long)) |
550 | value->data[0].v_long = espec->default_value; |
551 | |
552 | return value->data[0].v_long != oval; |
553 | } |
554 | |
555 | static void |
556 | param_flags_init (CParamSpec *pspec) |
557 | { |
558 | CParamSpecFlags *fspec = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec))))); |
559 | |
560 | fspec->flags_class = NULL((void*)0); |
561 | fspec->default_value = 0; |
562 | } |
563 | |
564 | static void |
565 | param_flags_finalize (CParamSpec *pspec) |
566 | { |
567 | CParamSpecFlags *fspec = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec))))); |
568 | CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_FLAGS(c_param_spec_types[11]))); |
569 | |
570 | if (fspec->flags_class) |
571 | { |
572 | g_type_class_unref (fspec->flags_class); |
573 | fspec->flags_class = NULL((void*)0); |
574 | } |
575 | |
576 | parent_class->finalize (pspec); |
577 | } |
578 | |
579 | static void |
580 | param_flags_set_default (CParamSpec *pspec, |
581 | GValue *value) |
582 | { |
583 | value->data[0].v_ulong = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec)))))->default_value; |
584 | } |
585 | |
586 | static gboolean |
587 | param_flags_is_valid (CParamSpec *pspec, |
588 | const GValue *value) |
589 | { |
590 | CParamSpecFlags *fspec = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec))))); |
591 | gulong oval = value->data[0].v_ulong; |
592 | |
593 | return (oval & ~fspec->flags_class->mask) == 0; |
594 | } |
595 | static gboolean |
596 | param_flags_validate (CParamSpec *pspec, |
597 | GValue *value) |
598 | { |
599 | CParamSpecFlags *fspec = C_PARAM_SPEC_FLAGS (pspec)((((CParamSpecFlags*) (void *) ((pspec))))); |
600 | gulong oval = value->data[0].v_ulong; |
601 | |
602 | if (fspec->flags_class) |
603 | value->data[0].v_ulong &= fspec->flags_class->mask; |
604 | else |
605 | value->data[0].v_ulong = fspec->default_value; |
606 | |
607 | return value->data[0].v_ulong != oval; |
608 | } |
609 | |
610 | static void |
611 | param_float_init (CParamSpec *pspec) |
612 | { |
613 | CParamSpecFloat *fspec = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec))))); |
614 | |
615 | fspec->minimum = -G_MAXFLOAT3.40282347e+38F; |
616 | fspec->maximum = G_MAXFLOAT3.40282347e+38F; |
617 | fspec->default_value = 0; |
618 | fspec->epsilon = G_FLOAT_EPSILON(1e-30f); |
619 | } |
620 | |
621 | static void |
622 | param_float_set_default (CParamSpec *pspec, |
623 | GValue *value) |
624 | { |
625 | value->data[0].v_float = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec)))))->default_value; |
626 | } |
627 | |
628 | static gboolean |
629 | param_float_is_valid (CParamSpec *pspec, |
630 | const GValue *value) |
631 | { |
632 | CParamSpecFloat *fspec = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec))))); |
633 | gfloat oval = value->data[0].v_float; |
634 | |
635 | return fspec->minimum <= oval && oval <= fspec->maximum; |
636 | } |
637 | |
638 | static gboolean |
639 | param_float_validate (CParamSpec *pspec, |
640 | GValue *value) |
641 | { |
642 | CParamSpecFloat *fspec = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec))))); |
643 | gfloat oval = value->data[0].v_float; |
644 | |
645 | value->data[0].v_float = CLAMP (value->data[0].v_float, fspec->minimum, fspec->maximum)(((value->data[0].v_float) > (fspec->maximum)) ? (fspec ->maximum) : (((value->data[0].v_float) < (fspec-> minimum)) ? (fspec->minimum) : (value->data[0].v_float) )); |
646 | |
647 | return value->data[0].v_float != oval; |
648 | } |
649 | |
650 | static gint |
651 | param_float_values_cmp (CParamSpec *pspec, |
652 | const GValue *value1, |
653 | const GValue *value2) |
654 | { |
655 | gfloat epsilon = C_PARAM_SPEC_FLOAT (pspec)((((CParamSpecFloat*) (void *) ((pspec)))))->epsilon; |
656 | |
657 | if (value1->data[0].v_float < value2->data[0].v_float) |
658 | return - (value2->data[0].v_float - value1->data[0].v_float > epsilon); |
659 | else |
660 | return value1->data[0].v_float - value2->data[0].v_float > epsilon; |
661 | } |
662 | |
663 | static void |
664 | param_double_init (CParamSpec *pspec) |
665 | { |
666 | CParamSpecDouble *dspec = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec))))); |
667 | |
668 | dspec->minimum = -G_MAXDOUBLE1.7976931348623157e+308; |
669 | dspec->maximum = G_MAXDOUBLE1.7976931348623157e+308; |
670 | dspec->default_value = 0; |
671 | dspec->epsilon = G_DOUBLE_EPSILON(1e-90); |
672 | } |
673 | |
674 | static void |
675 | param_double_set_default (CParamSpec *pspec, |
676 | GValue *value) |
677 | { |
678 | value->data[0].v_double = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec)))))->default_value; |
679 | } |
680 | |
681 | static gboolean |
682 | param_double_is_valid (CParamSpec *pspec, |
683 | const GValue *value) |
684 | { |
685 | CParamSpecDouble *dspec = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec))))); |
686 | gdouble oval = value->data[0].v_double; |
687 | |
688 | return dspec->minimum <= oval && oval <= dspec->maximum; |
689 | } |
690 | |
691 | static gboolean |
692 | param_double_validate (CParamSpec *pspec, |
693 | GValue *value) |
694 | { |
695 | CParamSpecDouble *dspec = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec))))); |
696 | gdouble oval = value->data[0].v_double; |
697 | |
698 | value->data[0].v_double = CLAMP (value->data[0].v_double, dspec->minimum, dspec->maximum)(((value->data[0].v_double) > (dspec->maximum)) ? (dspec ->maximum) : (((value->data[0].v_double) < (dspec-> minimum)) ? (dspec->minimum) : (value->data[0].v_double ))); |
699 | |
700 | return value->data[0].v_double != oval; |
701 | } |
702 | |
703 | static gint |
704 | param_double_values_cmp (CParamSpec *pspec, |
705 | const GValue *value1, |
706 | const GValue *value2) |
707 | { |
708 | gdouble epsilon = C_PARAM_SPEC_DOUBLE (pspec)((((CParamSpecDouble*) (void *) ((pspec)))))->epsilon; |
709 | |
710 | if (value1->data[0].v_double < value2->data[0].v_double) |
711 | return - (value2->data[0].v_double - value1->data[0].v_double > epsilon); |
712 | else |
713 | return value1->data[0].v_double - value2->data[0].v_double > epsilon; |
714 | } |
715 | |
716 | static void |
717 | param_string_init (CParamSpec *pspec) |
718 | { |
719 | CParamSpecString *sspec = C_PARAM_SPEC_STRING (pspec)((((CParamSpecString*) (void *) ((pspec))))); |
720 | |
721 | sspec->default_value = NULL((void*)0); |
722 | sspec->cset_first = NULL((void*)0); |
723 | sspec->cset_nth = NULL((void*)0); |
724 | sspec->substitutor = '_'; |
725 | sspec->null_fold_if_empty = FALSE(0); |
726 | sspec->ensure_non_null = FALSE(0); |
727 | } |
728 | |
729 | static void |
730 | param_string_finalize (CParamSpec *pspec) |
731 | { |
732 | CParamSpecString *sspec = C_PARAM_SPEC_STRING (pspec)((((CParamSpecString*) (void *) ((pspec))))); |
733 | CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_STRING(c_param_spec_types[14]))); |
734 | |
735 | g_free (sspec->default_value); |
736 | g_free (sspec->cset_first); |
737 | g_free (sspec->cset_nth); |
738 | sspec->default_value = NULL((void*)0); |
739 | sspec->cset_first = NULL((void*)0); |
740 | sspec->cset_nth = NULL((void*)0); |
741 | |
742 | parent_class->finalize (pspec); |
743 | } |
744 | |
745 | static void |
746 | param_string_set_default (CParamSpec *pspec, |
747 | GValue *value) |
748 | { |
749 | value->data[0].v_pointer = g_strdup (C_PARAM_SPEC_STRING (pspec)->default_value)g_strdup_inline (((((CParamSpecString*) (void *) ((pspec))))) ->default_value); |
750 | } |
751 | |
752 | static gboolean |
753 | param_string_validate (CParamSpec *pspec, |
754 | GValue *value) |
755 | { |
756 | CParamSpecString *sspec = C_PARAM_SPEC_STRING (pspec)((((CParamSpecString*) (void *) ((pspec))))); |
757 | gchar *string = value->data[0].v_pointer; |
758 | guint changed = 0; |
759 | |
760 | if (string && string[0]) |
761 | { |
762 | gchar *s; |
763 | |
764 | if (sspec->cset_first && !strchr (sspec->cset_first, string[0])) |
765 | { |
766 | if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS(1 << 27)) |
767 | { |
768 | value->data[0].v_pointer = g_strdup (string)g_strdup_inline (string); |
769 | string = value->data[0].v_pointer; |
770 | value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS(1 << 27); |
771 | } |
772 | string[0] = sspec->substitutor; |
773 | changed++; |
774 | } |
775 | if (sspec->cset_nth) |
776 | for (s = string + 1; *s; s++) |
777 | if (!strchr (sspec->cset_nth, *s)) |
778 | { |
779 | if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS(1 << 27)) |
780 | { |
781 | value->data[0].v_pointer = g_strdup (string)g_strdup_inline (string); |
782 | s = (gchar*) value->data[0].v_pointer + (s - string); |
783 | string = value->data[0].v_pointer; |
784 | value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS(1 << 27); |
785 | } |
786 | *s = sspec->substitutor; |
787 | changed++; |
788 | } |
789 | } |
790 | if (sspec->null_fold_if_empty && string && string[0] == 0) |
791 | { |
792 | if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS(1 << 27))) |
793 | g_free (value->data[0].v_pointer); |
794 | else |
795 | value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS(1 << 27); |
796 | value->data[0].v_pointer = NULL((void*)0); |
797 | changed++; |
798 | string = value->data[0].v_pointer; |
799 | } |
800 | if (sspec->ensure_non_null && !string) |
801 | { |
802 | value->data[1].v_uint &= ~G_VALUE_NOCOPY_CONTENTS(1 << 27); |
803 | value->data[0].v_pointer = g_strdup ("")g_strdup_inline (""); |
804 | changed++; |
805 | string = value->data[0].v_pointer; |
Value stored to 'string' is never read | |
806 | } |
807 | |
808 | return changed; |
809 | } |
810 | |
811 | static gboolean |
812 | param_string_is_valid (CParamSpec *pspec, |
813 | const GValue *value) |
814 | { |
815 | CParamSpecString *sspec = C_PARAM_SPEC_STRING (pspec)((((CParamSpecString*) (void *) ((pspec))))); |
816 | gboolean ret = TRUE(!(0)); |
817 | |
818 | if (sspec->cset_first != NULL((void*)0) || sspec->cset_nth != NULL((void*)0) || |
819 | sspec->ensure_non_null || sspec->null_fold_if_empty) |
820 | { |
821 | GValue tmp_value = G_VALUE_INIT{ 0, { { 0 } } }; |
822 | |
823 | g_value_init (&tmp_value, G_VALUE_TYPE (value)(((GValue*) (value))->g_type)); |
824 | g_value_copy (value, &tmp_value); |
825 | |
826 | ret = !param_string_validate (pspec, &tmp_value); |
827 | |
828 | g_value_unset (&tmp_value); |
829 | } |
830 | |
831 | return ret; |
832 | } |
833 | |
834 | static gint |
835 | param_string_values_cmp (CParamSpec *pspec, |
836 | const GValue *value1, |
837 | const GValue *value2) |
838 | { |
839 | if (!value1->data[0].v_pointer) |
840 | return value2->data[0].v_pointer != NULL((void*)0) ? -1 : 0; |
841 | else if (!value2->data[0].v_pointer) |
842 | return value1->data[0].v_pointer != NULL((void*)0); |
843 | else |
844 | return strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer); |
845 | } |
846 | |
847 | static void |
848 | param_param_init (CParamSpec *pspec) |
849 | { |
850 | /* CParamSpecParam *spec = C_PARAM_SPEC_PARAM (pspec); */ |
851 | } |
852 | |
853 | static void |
854 | param_param_set_default (CParamSpec *pspec, |
855 | GValue *value) |
856 | { |
857 | value->data[0].v_pointer = NULL((void*)0); |
858 | } |
859 | |
860 | static gboolean |
861 | param_param_is_valid (CParamSpec *pspec, |
862 | const GValue *value) |
863 | { |
864 | CParamSpec *param = value->data[0].v_pointer; |
865 | |
866 | if (param == NULL((void*)0)) |
867 | return FALSE(0); |
868 | |
869 | return g_value_type_compatible (C_PARAM_SPEC_TYPE (param)(((((GTypeClass*) (((GTypeInstance*) (param))->g_class))-> g_type))), C_PARAM_SPEC_VALUE_TYPE (pspec)(((((CParamSpec*) (void *) ((pspec)))))->value_type)); |
870 | } |
871 | |
872 | static gboolean |
873 | param_param_validate (CParamSpec *pspec, |
874 | GValue *value) |
875 | { |
876 | /* CParamSpecParam *spec = C_PARAM_SPEC_PARAM (pspec); */ |
877 | CParamSpec *param = value->data[0].v_pointer; |
878 | guint changed = 0; |
879 | |
880 | if (param && !g_value_type_compatible (C_PARAM_SPEC_TYPE (param)(((((GTypeClass*) (((GTypeInstance*) (param))->g_class))-> g_type))), C_PARAM_SPEC_VALUE_TYPE (pspec)(((((CParamSpec*) (void *) ((pspec)))))->value_type))) |
881 | { |
882 | c_param_spec_unref (param); |
883 | value->data[0].v_pointer = NULL((void*)0); |
884 | changed++; |
885 | } |
886 | |
887 | return changed; |
888 | } |
889 | |
890 | static void |
891 | param_boxed_init (CParamSpec *pspec) |
892 | { |
893 | /* CParamSpecBoxed *bspec = C_PARAM_SPEC_BOXED (pspec); */ |
894 | } |
895 | |
896 | static void |
897 | param_boxed_set_default (CParamSpec *pspec, |
898 | GValue *value) |
899 | { |
900 | value->data[0].v_pointer = NULL((void*)0); |
901 | } |
902 | |
903 | static gint |
904 | param_boxed_values_cmp (CParamSpec *pspec, |
905 | const GValue *value1, |
906 | const GValue *value2) |
907 | { |
908 | guint8 *p1 = value1->data[0].v_pointer; |
909 | guint8 *p2 = value2->data[0].v_pointer; |
910 | |
911 | /* not much to compare here, try to at least provide stable lesser/greater result */ |
912 | |
913 | return p1 < p2 ? -1 : p1 > p2; |
914 | } |
915 | |
916 | static void |
917 | param_pointer_init (CParamSpec *pspec) |
918 | { |
919 | /* CParamSpecPointer *spec = C_PARAM_SPEC_POINTER (pspec); */ |
920 | } |
921 | |
922 | static void |
923 | param_pointer_set_default (CParamSpec *pspec, |
924 | GValue *value) |
925 | { |
926 | value->data[0].v_pointer = NULL((void*)0); |
927 | } |
928 | |
929 | static gint |
930 | param_pointer_values_cmp (CParamSpec *pspec, |
931 | const GValue *value1, |
932 | const GValue *value2) |
933 | { |
934 | guint8 *p1 = value1->data[0].v_pointer; |
935 | guint8 *p2 = value2->data[0].v_pointer; |
936 | |
937 | /* not much to compare here, try to at least provide stable lesser/greater result */ |
938 | |
939 | return p1 < p2 ? -1 : p1 > p2; |
940 | } |
941 | |
942 | static void |
943 | param_value_array_init (CParamSpec *pspec) |
944 | { |
945 | CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol" ; |
946 | |
947 | aspec->element_spec = NULL((void*)0); |
948 | aspec->fixed_n_elements = 0; /* disable */ |
949 | } |
950 | |
951 | static inline guint |
952 | value_array_ensure_size (GValueArray *value_array, |
953 | guint fixed_n_elements) |
954 | { |
955 | guint changed = 0; |
956 | |
957 | if (fixed_n_elements) |
958 | { |
959 | while (value_array->n_values < fixed_n_elements) |
960 | { |
961 | g_value_array_append (value_array, NULL((void*)0)); |
962 | changed++; |
963 | } |
964 | while (value_array->n_values > fixed_n_elements) |
965 | { |
966 | g_value_array_remove (value_array, value_array->n_values - 1); |
967 | changed++; |
968 | } |
969 | } |
970 | return changed; |
971 | } |
972 | |
973 | static void |
974 | param_value_array_finalize (CParamSpec *pspec) |
975 | { |
976 | CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol" ; |
977 | CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_VALUE_ARRAY(c_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol" )); |
978 | |
979 | if (aspec->element_spec) |
980 | { |
981 | c_param_spec_unref (aspec->element_spec); |
982 | aspec->element_spec = NULL((void*)0); |
983 | } |
984 | |
985 | parent_class->finalize (pspec); |
986 | } |
987 | |
988 | static void |
989 | param_value_array_set_default (CParamSpec *pspec, |
990 | GValue *value) |
991 | { |
992 | CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol" ; |
993 | |
994 | if (!value->data[0].v_pointer && aspec->fixed_n_elements) |
995 | value->data[0].v_pointer = g_value_array_new (aspec->fixed_n_elements); |
996 | |
997 | if (value->data[0].v_pointer) |
998 | { |
999 | /* g_value_reset (value); already done */ |
1000 | value_array_ensure_size (value->data[0].v_pointer, aspec->fixed_n_elements); |
1001 | } |
1002 | } |
1003 | |
1004 | static gboolean |
1005 | param_value_array_validate (CParamSpec *pspec, |
1006 | GValue *value) |
1007 | { |
1008 | CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol" ; |
1009 | GValueArray *value_array = value->data[0].v_pointer; |
1010 | guint changed = 0; |
1011 | |
1012 | if (!value->data[0].v_pointer && aspec->fixed_n_elements) |
1013 | value_array = value->data[0].v_pointer = g_value_array_new (aspec->fixed_n_elements); |
1014 | |
1015 | if (value->data[0].v_pointer) |
1016 | { |
1017 | /* ensure array size validity */ |
1018 | changed += value_array_ensure_size (value_array, aspec->fixed_n_elements); |
1019 | |
1020 | /* ensure array values validity against a present element spec */ |
1021 | if (aspec->element_spec) |
1022 | { |
1023 | CParamSpec *element_spec = aspec->element_spec; |
1024 | guint i; |
1025 | |
1026 | for (i = 0; i < value_array->n_values; i++) |
1027 | { |
1028 | GValue *element = value_array->values + i; |
1029 | |
1030 | /* need to fixup value type, or ensure that the array value is initialized at all */ |
1031 | if (!g_value_type_compatible (G_VALUE_TYPE (element)(((GValue*) (element))->g_type), C_PARAM_SPEC_VALUE_TYPE (element_spec)(((((CParamSpec*) (void *) ((element_spec)))))->value_type ))) |
1032 | { |
1033 | if (G_VALUE_TYPE (element)(((GValue*) (element))->g_type) != 0) |
1034 | g_value_unset (element); |
1035 | g_value_init (element, C_PARAM_SPEC_VALUE_TYPE (element_spec)(((((CParamSpec*) (void *) ((element_spec)))))->value_type )); |
1036 | c_param_value_set_default (element_spec, element); |
1037 | changed++; |
1038 | } |
1039 | else |
1040 | { |
1041 | /* validate array value against element_spec */ |
1042 | changed += c_param_value_validate (element_spec, element); |
1043 | } |
1044 | } |
1045 | } |
1046 | } |
1047 | |
1048 | return changed; |
1049 | } |
1050 | |
1051 | static gint |
1052 | param_value_array_values_cmp (CParamSpec *pspec, |
1053 | const GValue *value1, |
1054 | const GValue *value2) |
1055 | { |
1056 | CParamSpecValueArray *aspec = C_PARAM_SPEC_VALUE_ARRAY (pspec)((((CParamSpecValueArray*) (void *) ((pspec))))) GCC warning "Deprecated pre-processor symbol" ; |
1057 | GValueArray *value_array1 = value1->data[0].v_pointer; |
1058 | GValueArray *value_array2 = value2->data[0].v_pointer; |
1059 | |
1060 | if (!value_array1 || !value_array2) |
1061 | return value_array2 ? -1 : value_array1 != value_array2; |
1062 | |
1063 | if (value_array1->n_values != value_array2->n_values) |
1064 | return value_array1->n_values < value_array2->n_values ? -1 : 1; |
1065 | else if (!aspec->element_spec) |
1066 | { |
1067 | /* we need an element specification for comparisons, so there's not much |
1068 | * to compare here, try to at least provide stable lesser/greater result |
1069 | */ |
1070 | return value_array1->n_values < value_array2->n_values ? -1 : value_array1->n_values > value_array2->n_values; |
1071 | } |
1072 | else /* value_array1->n_values == value_array2->n_values */ |
1073 | { |
1074 | guint i; |
1075 | |
1076 | for (i = 0; i < value_array1->n_values; i++) |
1077 | { |
1078 | GValue *element1 = value_array1->values + i; |
1079 | GValue *element2 = value_array2->values + i; |
1080 | gint cmp; |
1081 | |
1082 | /* need corresponding element types, provide stable result otherwise */ |
1083 | if (G_VALUE_TYPE (element1)(((GValue*) (element1))->g_type) != G_VALUE_TYPE (element2)(((GValue*) (element2))->g_type)) |
1084 | return G_VALUE_TYPE (element1)(((GValue*) (element1))->g_type) < G_VALUE_TYPE (element2)(((GValue*) (element2))->g_type) ? -1 : 1; |
1085 | cmp = c_param_values_cmp (aspec->element_spec, element1, element2); |
1086 | if (cmp) |
1087 | return cmp; |
1088 | } |
1089 | return 0; |
1090 | } |
1091 | } |
1092 | |
1093 | static void |
1094 | param_object_init (CParamSpec *pspec) |
1095 | { |
1096 | /* CParamSpecObject *ospec = C_PARAM_SPEC_OBJECT (pspec); */ |
1097 | } |
1098 | |
1099 | static void |
1100 | param_object_set_default (CParamSpec *pspec, |
1101 | GValue *value) |
1102 | { |
1103 | value->data[0].v_pointer = NULL((void*)0); |
1104 | } |
1105 | |
1106 | static gboolean |
1107 | param_object_is_valid (CParamSpec *pspec, |
1108 | const GValue *value) |
1109 | { |
1110 | CParamSpecObject *ospec = C_PARAM_SPEC_OBJECT (pspec)((((CParamSpecObject*) (void *) ((pspec))))); |
1111 | GObject *object = value->data[0].v_pointer; |
1112 | |
1113 | return object && |
1114 | g_value_type_compatible (G_OBJECT_TYPE (object)(((((GTypeClass*) (((GTypeInstance*) (object))->g_class))-> g_type))), C_PARAM_SPEC_VALUE_TYPE (ospec)(((((CParamSpec*) (void *) ((ospec)))))->value_type)); |
1115 | } |
1116 | |
1117 | static gboolean |
1118 | param_object_validate (CParamSpec *pspec, |
1119 | GValue *value) |
1120 | { |
1121 | CParamSpecObject *ospec = C_PARAM_SPEC_OBJECT (pspec)((((CParamSpecObject*) (void *) ((pspec))))); |
1122 | GObject *object = value->data[0].v_pointer; |
1123 | guint changed = 0; |
1124 | |
1125 | if (object && !g_value_type_compatible (G_OBJECT_TYPE (object)(((((GTypeClass*) (((GTypeInstance*) (object))->g_class))-> g_type))), C_PARAM_SPEC_VALUE_TYPE (ospec)(((((CParamSpec*) (void *) ((ospec)))))->value_type))) |
1126 | { |
1127 | g_object_unref (object); |
1128 | value->data[0].v_pointer = NULL((void*)0); |
1129 | changed++; |
1130 | } |
1131 | |
1132 | return changed; |
1133 | } |
1134 | |
1135 | static gint |
1136 | param_object_values_cmp (CParamSpec *pspec, |
1137 | const GValue *value1, |
1138 | const GValue *value2) |
1139 | { |
1140 | guint8 *p1 = value1->data[0].v_pointer; |
1141 | guint8 *p2 = value2->data[0].v_pointer; |
1142 | |
1143 | /* not much to compare here, try to at least provide stable lesser/greater result */ |
1144 | |
1145 | return p1 < p2 ? -1 : p1 > p2; |
1146 | } |
1147 | |
1148 | static void |
1149 | param_override_init (CParamSpec *pspec) |
1150 | { |
1151 | /* CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec); */ |
1152 | } |
1153 | |
1154 | static void |
1155 | param_override_finalize (CParamSpec *pspec) |
1156 | { |
1157 | CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec))))); |
1158 | CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_OVERRIDE(c_param_spec_types[20]))); |
1159 | |
1160 | if (ospec->overridden) |
1161 | { |
1162 | c_param_spec_unref (ospec->overridden); |
1163 | ospec->overridden = NULL((void*)0); |
1164 | } |
1165 | |
1166 | parent_class->finalize (pspec); |
1167 | } |
1168 | |
1169 | static void |
1170 | param_override_set_default (CParamSpec *pspec, |
1171 | GValue *value) |
1172 | { |
1173 | CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec))))); |
1174 | |
1175 | c_param_value_set_default (ospec->overridden, value); |
1176 | } |
1177 | |
1178 | static gboolean |
1179 | param_override_is_valid (CParamSpec *pspec, |
1180 | const GValue *value) |
1181 | { |
1182 | CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec))))); |
1183 | |
1184 | return c_param_value_is_valid (ospec->overridden, value); |
1185 | } |
1186 | |
1187 | static gboolean |
1188 | param_override_validate (CParamSpec *pspec, |
1189 | GValue *value) |
1190 | { |
1191 | CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec))))); |
1192 | |
1193 | return c_param_value_validate (ospec->overridden, value); |
1194 | } |
1195 | |
1196 | static gint |
1197 | param_override_values_cmp (CParamSpec *pspec, |
1198 | const GValue *value1, |
1199 | const GValue *value2) |
1200 | { |
1201 | CParamSpecOverride *ospec = C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec))))); |
1202 | |
1203 | return c_param_values_cmp (ospec->overridden, value1, value2); |
1204 | } |
1205 | |
1206 | static void |
1207 | param_gtype_init (CParamSpec *pspec) |
1208 | { |
1209 | } |
1210 | |
1211 | static void |
1212 | param_gtype_set_default (CParamSpec *pspec, |
1213 | GValue *value) |
1214 | { |
1215 | CParamSpecGType *tspec = C_PARAM_SPEC_GTYPE (pspec)((((CParamSpecGType*) (void *) ((pspec))))); |
1216 | |
1217 | value->data[0].v_pointer = GTYPE_TO_POINTER (tspec->is_a_type)((gpointer) (guintptr) (tspec->is_a_type)); |
1218 | } |
1219 | |
1220 | static gboolean |
1221 | param_gtype_is_valid (CParamSpec *pspec, |
1222 | const GValue *value) |
1223 | { |
1224 | CParamSpecGType *tspec = C_PARAM_SPEC_GTYPE (pspec)((((CParamSpecGType*) (void *) ((pspec))))); |
1225 | GType gtype = GPOINTER_TO_TYPE (value->data[0].v_pointer)((GType) (guintptr) (value->data[0].v_pointer)); |
1226 | |
1227 | return tspec->is_a_type == G_TYPE_NONE((GType) ((1) << (2))) || |
1228 | g_type_is_a (gtype, tspec->is_a_type)((gtype) == (tspec->is_a_type) || (g_type_is_a) ((gtype), ( tspec->is_a_type))); |
1229 | } |
1230 | |
1231 | static gboolean |
1232 | param_gtype_validate (CParamSpec *pspec, |
1233 | GValue *value) |
1234 | { |
1235 | CParamSpecGType *tspec = C_PARAM_SPEC_GTYPE (pspec)((((CParamSpecGType*) (void *) ((pspec))))); |
1236 | GType gtype = GPOINTER_TO_TYPE (value->data[0].v_pointer)((GType) (guintptr) (value->data[0].v_pointer)); |
1237 | guint changed = 0; |
1238 | |
1239 | if (tspec->is_a_type != G_TYPE_NONE((GType) ((1) << (2))) && !g_type_is_a (gtype, tspec->is_a_type)((gtype) == (tspec->is_a_type) || (g_type_is_a) ((gtype), ( tspec->is_a_type)))) |
1240 | { |
1241 | value->data[0].v_pointer = GTYPE_TO_POINTER (tspec->is_a_type)((gpointer) (guintptr) (tspec->is_a_type)); |
1242 | changed++; |
1243 | } |
1244 | |
1245 | return changed; |
1246 | } |
1247 | |
1248 | static gint |
1249 | param_gtype_values_cmp (CParamSpec *pspec, |
1250 | const GValue *value1, |
1251 | const GValue *value2) |
1252 | { |
1253 | GType p1 = GPOINTER_TO_TYPE (value1->data[0].v_pointer)((GType) (guintptr) (value1->data[0].v_pointer)); |
1254 | GType p2 = GPOINTER_TO_TYPE (value2->data[0].v_pointer)((GType) (guintptr) (value2->data[0].v_pointer)); |
1255 | |
1256 | /* not much to compare here, try to at least provide stable lesser/greater result */ |
1257 | |
1258 | return p1 < p2 ? -1 : p1 > p2; |
1259 | } |
1260 | |
1261 | static void |
1262 | param_variant_init (CParamSpec *pspec) |
1263 | { |
1264 | CParamSpecVariant *vspec = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec))))); |
1265 | |
1266 | vspec->type = NULL((void*)0); |
1267 | vspec->default_value = NULL((void*)0); |
1268 | } |
1269 | |
1270 | static void |
1271 | param_variant_finalize (CParamSpec *pspec) |
1272 | { |
1273 | CParamSpecVariant *vspec = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec))))); |
1274 | CParamSpecClass *parent_class = g_type_class_peek (g_type_parent (C_TYPE_PARAM_VARIANT(c_param_spec_types[22]))); |
1275 | |
1276 | if (vspec->default_value) |
1277 | g_variant_unref (vspec->default_value); |
1278 | g_variant_type_free (vspec->type); |
1279 | |
1280 | parent_class->finalize (pspec); |
1281 | } |
1282 | |
1283 | static void |
1284 | param_variant_set_default (CParamSpec *pspec, |
1285 | GValue *value) |
1286 | { |
1287 | value->data[0].v_pointer = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec)))))->default_value; |
1288 | value->data[1].v_uint |= G_VALUE_NOCOPY_CONTENTS(1 << 27); |
1289 | } |
1290 | |
1291 | static gboolean |
1292 | param_variant_is_valid (CParamSpec *pspec, |
1293 | const GValue *value) |
1294 | { |
1295 | CParamSpecVariant *vspec = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec))))); |
1296 | GVariant *variant = value->data[0].v_pointer; |
1297 | |
1298 | if (variant == NULL((void*)0)) |
1299 | return vspec->default_value == NULL((void*)0); |
1300 | else |
1301 | return g_variant_is_of_type (variant, vspec->type); |
1302 | } |
1303 | |
1304 | static gboolean |
1305 | param_variant_validate (CParamSpec *pspec, |
1306 | GValue *value) |
1307 | { |
1308 | CParamSpecVariant *vspec = C_PARAM_SPEC_VARIANT (pspec)((((CParamSpecVariant*) (void *) ((pspec))))); |
1309 | GVariant *variant = value->data[0].v_pointer; |
1310 | |
1311 | if ((variant == NULL((void*)0) && vspec->default_value != NULL((void*)0)) || |
1312 | (variant != NULL((void*)0) && !g_variant_is_of_type (variant, vspec->type))) |
1313 | { |
1314 | c_param_value_set_default (pspec, value); |
1315 | return TRUE(!(0)); |
1316 | } |
1317 | |
1318 | return FALSE(0); |
1319 | } |
1320 | |
1321 | /* g_variant_compare() can only be used with scalar types. */ |
1322 | static gboolean |
1323 | variant_is_incomparable (GVariant *v) |
1324 | { |
1325 | GVariantClass v_class = g_variant_classify (v); |
1326 | |
1327 | return (v_class == G_VARIANT_CLASS_HANDLE || |
1328 | v_class == G_VARIANT_CLASS_VARIANT || |
1329 | v_class == G_VARIANT_CLASS_MAYBE|| |
1330 | v_class == G_VARIANT_CLASS_ARRAY || |
1331 | v_class == G_VARIANT_CLASS_TUPLE || |
1332 | v_class == G_VARIANT_CLASS_DICT_ENTRY); |
1333 | } |
1334 | |
1335 | static gint |
1336 | param_variant_values_cmp (CParamSpec *pspec, |
1337 | const GValue *value1, |
1338 | const GValue *value2) |
1339 | { |
1340 | GVariant *v1 = value1->data[0].v_pointer; |
1341 | GVariant *v2 = value2->data[0].v_pointer; |
1342 | |
1343 | if (v1 == NULL((void*)0) && v2 == NULL((void*)0)) |
1344 | return 0; |
1345 | else if (v1 == NULL((void*)0) && v2 != NULL((void*)0)) |
1346 | return -1; |
1347 | else if (v1 != NULL((void*)0) && v2 == NULL((void*)0)) |
1348 | return 1; |
1349 | |
1350 | if (!g_variant_type_equal (g_variant_get_type (v1), g_variant_get_type (v2)) || |
1351 | variant_is_incomparable (v1) || |
1352 | variant_is_incomparable (v2)) |
1353 | return g_variant_equal (v1, v2) ? 0 : (v1 < v2 ? -1 : 1); |
1354 | |
1355 | return g_variant_compare (v1, v2); |
1356 | } |
1357 | |
1358 | /* --- type initialization --- */ |
1359 | |
1360 | #define set_is_valid_vfunc(type,func){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = func; g_type_class_unref (class); } { \ |
1361 | CParamSpecClass *class = g_type_class_ref (type); \ |
1362 | class->value_is_valid = func; \ |
1363 | g_type_class_unref (class); \ |
1364 | } |
1365 | |
1366 | GType *c_param_spec_types = NULL((void*)0); |
1367 | |
1368 | void |
1369 | _c_param_spec_types_init (void) |
1370 | { |
1371 | const guint n_types = 23; |
1372 | GType type, *spec_types; |
1373 | #ifndef G_DISABLE_ASSERT |
1374 | GType *spec_types_bound; |
1375 | #endif |
1376 | |
1377 | c_param_spec_types = g_new0 (GType, n_types)(GType *) (__extension__ ({ gsize __n = (gsize) (n_types); gsize __s = sizeof (GType); gpointer __p; if (__s == 1) __p = g_malloc0 (__n); else if (__builtin_constant_p (__n) && (__s == 0 || __n <= (9223372036854775807L *2UL+1UL) / __s)) __p = g_malloc0 (__n * __s); else __p = g_malloc0_n (__n, __s); __p ; })); |
1378 | spec_types = c_param_spec_types; |
1379 | #ifndef G_DISABLE_ASSERT |
1380 | spec_types_bound = c_param_spec_types + n_types; |
1381 | #endif |
1382 | |
1383 | /* C_TYPE_PARAM_CHAR |
1384 | */ |
1385 | { |
1386 | const CParamSpecTypeInfo pspec_info = { |
1387 | sizeof (CParamSpecChar), /* instance_size */ |
1388 | 16, /* n_preallocs */ |
1389 | param_char_init, /* instance_init */ |
1390 | G_TYPE_CHAR((GType) ((3) << (2))), /* value_type */ |
1391 | NULL((void*)0), /* finalize */ |
1392 | param_char_set_default, /* value_set_default */ |
1393 | param_char_validate, /* value_validate */ |
1394 | param_int_values_cmp, /* values_cmp */ |
1395 | }; |
1396 | type = c_param_type_register_static (g_intern_static_string ("CParamChar"), &pspec_info); |
1397 | set_is_valid_vfunc (type, param_char_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_char_is_valid; g_type_class_unref (class ); }; |
1398 | *spec_types++ = type; |
1399 | g_assert (type == C_TYPE_PARAM_CHAR)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_58 = 0; if (type == (c_param_spec_types[0])) _g_boolean_var_58 = 1; _g_boolean_var_58; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1399, ((const char*) (__func__)), "type == C_TYPE_PARAM_CHAR"); } while (0); |
1400 | } |
1401 | |
1402 | /* C_TYPE_PARAM_UCHAR |
1403 | */ |
1404 | { |
1405 | const CParamSpecTypeInfo pspec_info = { |
1406 | sizeof (CParamSpecUChar), /* instance_size */ |
1407 | 16, /* n_preallocs */ |
1408 | param_uchar_init, /* instance_init */ |
1409 | G_TYPE_UCHAR((GType) ((4) << (2))), /* value_type */ |
1410 | NULL((void*)0), /* finalize */ |
1411 | param_uchar_set_default, /* value_set_default */ |
1412 | param_uchar_validate, /* value_validate */ |
1413 | param_uint_values_cmp, /* values_cmp */ |
1414 | }; |
1415 | type = c_param_type_register_static (g_intern_static_string ("CParamUChar"), &pspec_info); |
1416 | set_is_valid_vfunc (type, param_uchar_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_uchar_is_valid; g_type_class_unref (class ); }; |
1417 | *spec_types++ = type; |
1418 | g_assert (type == C_TYPE_PARAM_UCHAR)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_59 = 0; if (type == (c_param_spec_types[1])) _g_boolean_var_59 = 1; _g_boolean_var_59; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1418, ((const char*) (__func__)), "type == C_TYPE_PARAM_UCHAR"); } while (0); |
1419 | } |
1420 | |
1421 | /* C_TYPE_PARAM_BOOLEAN |
1422 | */ |
1423 | { |
1424 | const CParamSpecTypeInfo pspec_info = { |
1425 | sizeof (CParamSpecBoolean), /* instance_size */ |
1426 | 16, /* n_preallocs */ |
1427 | NULL((void*)0), /* instance_init */ |
1428 | G_TYPE_BOOLEAN((GType) ((5) << (2))), /* value_type */ |
1429 | NULL((void*)0), /* finalize */ |
1430 | param_boolean_set_default, /* value_set_default */ |
1431 | param_boolean_validate, /* value_validate */ |
1432 | param_int_values_cmp, /* values_cmp */ |
1433 | }; |
1434 | type = c_param_type_register_static (g_intern_static_string ("CParamBoolean"), &pspec_info); |
1435 | set_is_valid_vfunc (type, param_boolean_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_boolean_is_valid; g_type_class_unref ( class); }; |
1436 | *spec_types++ = type; |
1437 | g_assert (type == C_TYPE_PARAM_BOOLEAN)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_60 = 0; if (type == (c_param_spec_types[2])) _g_boolean_var_60 = 1; _g_boolean_var_60; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1437, ((const char*) (__func__)), "type == C_TYPE_PARAM_BOOLEAN"); } while (0); |
1438 | } |
1439 | |
1440 | /* C_TYPE_PARAM_INT |
1441 | */ |
1442 | { |
1443 | const CParamSpecTypeInfo pspec_info = { |
1444 | sizeof (CParamSpecInt), /* instance_size */ |
1445 | 16, /* n_preallocs */ |
1446 | param_int_init, /* instance_init */ |
1447 | G_TYPE_INT((GType) ((6) << (2))), /* value_type */ |
1448 | NULL((void*)0), /* finalize */ |
1449 | param_int_set_default, /* value_set_default */ |
1450 | param_int_validate, /* value_validate */ |
1451 | param_int_values_cmp, /* values_cmp */ |
1452 | }; |
1453 | type = c_param_type_register_static (g_intern_static_string ("CParamInt"), &pspec_info); |
1454 | set_is_valid_vfunc (type, param_int_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_int_is_valid; g_type_class_unref (class ); }; |
1455 | *spec_types++ = type; |
1456 | g_assert (type == C_TYPE_PARAM_INT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_61 = 0; if (type == (c_param_spec_types[3])) _g_boolean_var_61 = 1; _g_boolean_var_61; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1456, ((const char*) (__func__)), "type == C_TYPE_PARAM_INT"); } while (0); |
1457 | } |
1458 | |
1459 | /* C_TYPE_PARAM_UINT |
1460 | */ |
1461 | { |
1462 | const CParamSpecTypeInfo pspec_info = { |
1463 | sizeof (CParamSpecUInt), /* instance_size */ |
1464 | 16, /* n_preallocs */ |
1465 | param_uint_init, /* instance_init */ |
1466 | G_TYPE_UINT((GType) ((7) << (2))), /* value_type */ |
1467 | NULL((void*)0), /* finalize */ |
1468 | param_uint_set_default, /* value_set_default */ |
1469 | param_uint_validate, /* value_validate */ |
1470 | param_uint_values_cmp, /* values_cmp */ |
1471 | }; |
1472 | type = c_param_type_register_static (g_intern_static_string ("CParamUInt"), &pspec_info); |
1473 | set_is_valid_vfunc (type, param_uint_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_uint_is_valid; g_type_class_unref (class ); }; |
1474 | *spec_types++ = type; |
1475 | g_assert (type == C_TYPE_PARAM_UINT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_62 = 0; if (type == (c_param_spec_types[4])) _g_boolean_var_62 = 1; _g_boolean_var_62; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1475, ((const char*) (__func__)), "type == C_TYPE_PARAM_UINT"); } while (0); |
1476 | } |
1477 | |
1478 | /* C_TYPE_PARAM_LONG |
1479 | */ |
1480 | { |
1481 | const CParamSpecTypeInfo pspec_info = { |
1482 | sizeof (CParamSpecLong), /* instance_size */ |
1483 | 16, /* n_preallocs */ |
1484 | param_long_init, /* instance_init */ |
1485 | G_TYPE_LONG((GType) ((8) << (2))), /* value_type */ |
1486 | NULL((void*)0), /* finalize */ |
1487 | param_long_set_default, /* value_set_default */ |
1488 | param_long_validate, /* value_validate */ |
1489 | param_long_values_cmp, /* values_cmp */ |
1490 | }; |
1491 | type = c_param_type_register_static (g_intern_static_string ("CParamLong"), &pspec_info); |
1492 | set_is_valid_vfunc (type, param_long_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_long_is_valid; g_type_class_unref (class ); }; |
1493 | *spec_types++ = type; |
1494 | g_assert (type == C_TYPE_PARAM_LONG)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_63 = 0; if (type == (c_param_spec_types[5])) _g_boolean_var_63 = 1; _g_boolean_var_63; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1494, ((const char*) (__func__)), "type == C_TYPE_PARAM_LONG"); } while (0); |
1495 | } |
1496 | |
1497 | /* C_TYPE_PARAM_ULONG |
1498 | */ |
1499 | { |
1500 | const CParamSpecTypeInfo pspec_info = { |
1501 | sizeof (CParamSpecULong), /* instance_size */ |
1502 | 16, /* n_preallocs */ |
1503 | param_ulong_init, /* instance_init */ |
1504 | G_TYPE_ULONG((GType) ((9) << (2))), /* value_type */ |
1505 | NULL((void*)0), /* finalize */ |
1506 | param_ulong_set_default, /* value_set_default */ |
1507 | param_ulong_validate, /* value_validate */ |
1508 | param_ulong_values_cmp, /* values_cmp */ |
1509 | }; |
1510 | type = c_param_type_register_static (g_intern_static_string ("CParamULong"), &pspec_info); |
1511 | set_is_valid_vfunc (type, param_ulong_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_ulong_is_valid; g_type_class_unref (class ); }; |
1512 | *spec_types++ = type; |
1513 | g_assert (type == C_TYPE_PARAM_ULONG)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_64 = 0; if (type == (c_param_spec_types[6])) _g_boolean_var_64 = 1; _g_boolean_var_64; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1513, ((const char*) (__func__)), "type == C_TYPE_PARAM_ULONG"); } while (0); |
1514 | } |
1515 | |
1516 | /* C_TYPE_PARAM_INT64 |
1517 | */ |
1518 | { |
1519 | const CParamSpecTypeInfo pspec_info = { |
1520 | sizeof (CParamSpecInt64), /* instance_size */ |
1521 | 16, /* n_preallocs */ |
1522 | param_int64_init, /* instance_init */ |
1523 | G_TYPE_INT64((GType) ((10) << (2))), /* value_type */ |
1524 | NULL((void*)0), /* finalize */ |
1525 | param_int64_set_default, /* value_set_default */ |
1526 | param_int64_validate, /* value_validate */ |
1527 | param_int64_values_cmp, /* values_cmp */ |
1528 | }; |
1529 | type = c_param_type_register_static (g_intern_static_string ("CParamInt64"), &pspec_info); |
1530 | set_is_valid_vfunc (type, param_int64_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_int64_is_valid; g_type_class_unref (class ); }; |
1531 | *spec_types++ = type; |
1532 | g_assert (type == C_TYPE_PARAM_INT64)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_65 = 0; if (type == (c_param_spec_types[7])) _g_boolean_var_65 = 1; _g_boolean_var_65; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1532, ((const char*) (__func__)), "type == C_TYPE_PARAM_INT64"); } while (0); |
1533 | } |
1534 | |
1535 | /* C_TYPE_PARAM_UINT64 |
1536 | */ |
1537 | { |
1538 | const CParamSpecTypeInfo pspec_info = { |
1539 | sizeof (CParamSpecUInt64), /* instance_size */ |
1540 | 16, /* n_preallocs */ |
1541 | param_uint64_init, /* instance_init */ |
1542 | G_TYPE_UINT64((GType) ((11) << (2))), /* value_type */ |
1543 | NULL((void*)0), /* finalize */ |
1544 | param_uint64_set_default, /* value_set_default */ |
1545 | param_uint64_validate, /* value_validate */ |
1546 | param_uint64_values_cmp, /* values_cmp */ |
1547 | }; |
1548 | type = c_param_type_register_static (g_intern_static_string ("CParamUInt64"), &pspec_info); |
1549 | set_is_valid_vfunc (type, param_uint64_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_uint64_is_valid; g_type_class_unref (class ); }; |
1550 | *spec_types++ = type; |
1551 | g_assert (type == C_TYPE_PARAM_UINT64)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_66 = 0; if (type == (c_param_spec_types[8])) _g_boolean_var_66 = 1; _g_boolean_var_66; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1551, ((const char*) (__func__)), "type == C_TYPE_PARAM_UINT64"); } while (0); |
1552 | } |
1553 | |
1554 | /* C_TYPE_PARAM_UNICHAR |
1555 | */ |
1556 | { |
1557 | const CParamSpecTypeInfo pspec_info = { |
1558 | sizeof (CParamSpecUnichar), /* instance_size */ |
1559 | 16, /* n_preallocs */ |
1560 | param_unichar_init, /* instance_init */ |
1561 | G_TYPE_UINT((GType) ((7) << (2))), /* value_type */ |
1562 | NULL((void*)0), /* finalize */ |
1563 | param_unichar_set_default, /* value_set_default */ |
1564 | param_unichar_validate, /* value_validate */ |
1565 | param_unichar_values_cmp, /* values_cmp */ |
1566 | }; |
1567 | type = c_param_type_register_static (g_intern_static_string ("CParamUnichar"), &pspec_info); |
1568 | set_is_valid_vfunc (type, param_unichar_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_unichar_is_valid; g_type_class_unref ( class); }; |
1569 | *spec_types++ = type; |
1570 | g_assert (type == C_TYPE_PARAM_UNICHAR)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_67 = 0; if (type == (c_param_spec_types[9])) _g_boolean_var_67 = 1; _g_boolean_var_67; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1570, ((const char*) (__func__)), "type == C_TYPE_PARAM_UNICHAR"); } while (0); |
1571 | } |
1572 | |
1573 | /* C_TYPE_PARAM_ENUM |
1574 | */ |
1575 | { |
1576 | const CParamSpecTypeInfo pspec_info = { |
1577 | sizeof (CParamSpecEnum), /* instance_size */ |
1578 | 16, /* n_preallocs */ |
1579 | param_enum_init, /* instance_init */ |
1580 | G_TYPE_ENUM((GType) ((12) << (2))), /* value_type */ |
1581 | param_enum_finalize, /* finalize */ |
1582 | param_enum_set_default, /* value_set_default */ |
1583 | param_enum_validate, /* value_validate */ |
1584 | param_long_values_cmp, /* values_cmp */ |
1585 | }; |
1586 | type = c_param_type_register_static (g_intern_static_string ("CParamEnum"), &pspec_info); |
1587 | set_is_valid_vfunc (type, param_enum_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_enum_is_valid; g_type_class_unref (class ); }; |
1588 | *spec_types++ = type; |
1589 | g_assert (type == C_TYPE_PARAM_ENUM)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_68 = 0; if (type == (c_param_spec_types[10])) _g_boolean_var_68 = 1; _g_boolean_var_68; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1589, ((const char*) (__func__)), "type == C_TYPE_PARAM_ENUM"); } while (0); |
1590 | } |
1591 | |
1592 | /* C_TYPE_PARAM_FLAGS |
1593 | */ |
1594 | { |
1595 | const CParamSpecTypeInfo pspec_info = { |
1596 | sizeof (CParamSpecFlags), /* instance_size */ |
1597 | 16, /* n_preallocs */ |
1598 | param_flags_init, /* instance_init */ |
1599 | G_TYPE_FLAGS((GType) ((13) << (2))), /* value_type */ |
1600 | param_flags_finalize, /* finalize */ |
1601 | param_flags_set_default, /* value_set_default */ |
1602 | param_flags_validate, /* value_validate */ |
1603 | param_ulong_values_cmp, /* values_cmp */ |
1604 | }; |
1605 | type = c_param_type_register_static (g_intern_static_string ("CParamFlags"), &pspec_info); |
1606 | set_is_valid_vfunc (type, param_flags_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_flags_is_valid; g_type_class_unref (class ); }; |
1607 | *spec_types++ = type; |
1608 | g_assert (type == C_TYPE_PARAM_FLAGS)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_69 = 0; if (type == (c_param_spec_types[11])) _g_boolean_var_69 = 1; _g_boolean_var_69; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1608, ((const char*) (__func__)), "type == C_TYPE_PARAM_FLAGS"); } while (0); |
1609 | } |
1610 | |
1611 | /* C_TYPE_PARAM_FLOAT |
1612 | */ |
1613 | { |
1614 | const CParamSpecTypeInfo pspec_info = { |
1615 | sizeof (CParamSpecFloat), /* instance_size */ |
1616 | 16, /* n_preallocs */ |
1617 | param_float_init, /* instance_init */ |
1618 | G_TYPE_FLOAT((GType) ((14) << (2))), /* value_type */ |
1619 | NULL((void*)0), /* finalize */ |
1620 | param_float_set_default, /* value_set_default */ |
1621 | param_float_validate, /* value_validate */ |
1622 | param_float_values_cmp, /* values_cmp */ |
1623 | }; |
1624 | type = c_param_type_register_static (g_intern_static_string ("CParamFloat"), &pspec_info); |
1625 | set_is_valid_vfunc (type, param_float_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_float_is_valid; g_type_class_unref (class ); }; |
1626 | *spec_types++ = type; |
1627 | g_assert (type == C_TYPE_PARAM_FLOAT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_70 = 0; if (type == (c_param_spec_types[12])) _g_boolean_var_70 = 1; _g_boolean_var_70; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1627, ((const char*) (__func__)), "type == C_TYPE_PARAM_FLOAT"); } while (0); |
1628 | } |
1629 | |
1630 | /* C_TYPE_PARAM_DOUBLE |
1631 | */ |
1632 | { |
1633 | const CParamSpecTypeInfo pspec_info = { |
1634 | sizeof (CParamSpecDouble), /* instance_size */ |
1635 | 16, /* n_preallocs */ |
1636 | param_double_init, /* instance_init */ |
1637 | G_TYPE_DOUBLE((GType) ((15) << (2))), /* value_type */ |
1638 | NULL((void*)0), /* finalize */ |
1639 | param_double_set_default, /* value_set_default */ |
1640 | param_double_validate, /* value_validate */ |
1641 | param_double_values_cmp, /* values_cmp */ |
1642 | }; |
1643 | type = c_param_type_register_static (g_intern_static_string ("CParamDouble"), &pspec_info); |
1644 | set_is_valid_vfunc (type, param_double_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_double_is_valid; g_type_class_unref (class ); }; |
1645 | *spec_types++ = type; |
1646 | g_assert (type == C_TYPE_PARAM_DOUBLE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_71 = 0; if (type == (c_param_spec_types[13])) _g_boolean_var_71 = 1; _g_boolean_var_71; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1646, ((const char*) (__func__)), "type == C_TYPE_PARAM_DOUBLE"); } while (0); |
1647 | } |
1648 | |
1649 | /* C_TYPE_PARAM_STRING |
1650 | */ |
1651 | { |
1652 | const CParamSpecTypeInfo pspec_info = { |
1653 | sizeof (CParamSpecString), /* instance_size */ |
1654 | 16, /* n_preallocs */ |
1655 | param_string_init, /* instance_init */ |
1656 | G_TYPE_STRING((GType) ((16) << (2))), /* value_type */ |
1657 | param_string_finalize, /* finalize */ |
1658 | param_string_set_default, /* value_set_default */ |
1659 | param_string_validate, /* value_validate */ |
1660 | param_string_values_cmp, /* values_cmp */ |
1661 | }; |
1662 | type = c_param_type_register_static (g_intern_static_string ("CParamString"), &pspec_info); |
1663 | set_is_valid_vfunc (type, param_string_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_string_is_valid; g_type_class_unref (class ); }; |
1664 | *spec_types++ = type; |
1665 | g_assert (type == C_TYPE_PARAM_STRING)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_72 = 0; if (type == (c_param_spec_types[14])) _g_boolean_var_72 = 1; _g_boolean_var_72; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1665, ((const char*) (__func__)), "type == C_TYPE_PARAM_STRING"); } while (0); |
1666 | } |
1667 | |
1668 | /* C_TYPE_PARAM_PARAM |
1669 | */ |
1670 | { |
1671 | const CParamSpecTypeInfo pspec_info = { |
1672 | sizeof (CParamSpecParam), /* instance_size */ |
1673 | 16, /* n_preallocs */ |
1674 | param_param_init, /* instance_init */ |
1675 | C_TYPE_PARAM((GType) ((19) << (2))), /* value_type */ |
1676 | NULL((void*)0), /* finalize */ |
1677 | param_param_set_default, /* value_set_default */ |
1678 | param_param_validate, /* value_validate */ |
1679 | param_pointer_values_cmp, /* values_cmp */ |
1680 | }; |
1681 | type = c_param_type_register_static (g_intern_static_string ("CParamParam"), &pspec_info); |
1682 | set_is_valid_vfunc (type, param_param_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_param_is_valid; g_type_class_unref (class ); }; |
1683 | *spec_types++ = type; |
1684 | g_assert (type == C_TYPE_PARAM_PARAM)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_73 = 0; if (type == (c_param_spec_types[15])) _g_boolean_var_73 = 1; _g_boolean_var_73; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1684, ((const char*) (__func__)), "type == C_TYPE_PARAM_PARAM"); } while (0); |
1685 | } |
1686 | |
1687 | /* C_TYPE_PARAM_BOXED |
1688 | */ |
1689 | { |
1690 | const CParamSpecTypeInfo pspec_info = { |
1691 | sizeof (CParamSpecBoxed), /* instance_size */ |
1692 | 4, /* n_preallocs */ |
1693 | param_boxed_init, /* instance_init */ |
1694 | G_TYPE_BOXED((GType) ((18) << (2))), /* value_type */ |
1695 | NULL((void*)0), /* finalize */ |
1696 | param_boxed_set_default, /* value_set_default */ |
1697 | NULL((void*)0), /* value_validate */ |
1698 | param_boxed_values_cmp, /* values_cmp */ |
1699 | }; |
1700 | type = c_param_type_register_static (g_intern_static_string ("CParamBoxed"), &pspec_info); |
1701 | *spec_types++ = type; |
1702 | g_assert (type == C_TYPE_PARAM_BOXED)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_74 = 0; if (type == (c_param_spec_types[16])) _g_boolean_var_74 = 1; _g_boolean_var_74; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1702, ((const char*) (__func__)), "type == C_TYPE_PARAM_BOXED"); } while (0); |
1703 | } |
1704 | |
1705 | /* C_TYPE_PARAM_POINTER |
1706 | */ |
1707 | { |
1708 | const CParamSpecTypeInfo pspec_info = { |
1709 | sizeof (CParamSpecPointer), /* instance_size */ |
1710 | 0, /* n_preallocs */ |
1711 | param_pointer_init, /* instance_init */ |
1712 | G_TYPE_POINTER((GType) ((17) << (2))), /* value_type */ |
1713 | NULL((void*)0), /* finalize */ |
1714 | param_pointer_set_default, /* value_set_default */ |
1715 | NULL((void*)0), |
1716 | param_pointer_values_cmp, /* values_cmp */ |
1717 | }; |
1718 | type = c_param_type_register_static (g_intern_static_string ("CParamPointer"), &pspec_info); |
1719 | *spec_types++ = type; |
1720 | g_assert (type == C_TYPE_PARAM_POINTER)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_75 = 0; if (type == (c_param_spec_types[17])) _g_boolean_var_75 = 1; _g_boolean_var_75; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1720, ((const char*) (__func__)), "type == C_TYPE_PARAM_POINTER"); } while (0); |
1721 | } |
1722 | |
1723 | /* C_TYPE_PARAM_VALUE_ARRAY |
1724 | */ |
1725 | { |
1726 | /* const */ CParamSpecTypeInfo pspec_info = { |
1727 | sizeof (CParamSpecValueArray), /* instance_size */ |
1728 | 0, /* n_preallocs */ |
1729 | param_value_array_init, /* instance_init */ |
1730 | 0xdeadbeef, /* value_type, assigned further down */ |
1731 | param_value_array_finalize, /* finalize */ |
1732 | param_value_array_set_default, /* value_set_default */ |
1733 | param_value_array_validate, /* value_validate */ |
1734 | param_value_array_values_cmp, /* values_cmp */ |
1735 | }; |
1736 | pspec_info.value_type = G_TYPE_VALUE_ARRAY(g_value_array_get_type ()) GCC warning "Deprecated pre-processor symbol: replace with \"(g_array_get_type ())\"" ; |
1737 | type = c_param_type_register_static (g_intern_static_string ("CParamValueArray"), &pspec_info); |
1738 | *spec_types++ = type; |
1739 | g_assert (type == C_TYPE_PARAM_VALUE_ARRAY)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_76 = 0; if (type == (c_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol" ) _g_boolean_var_76 = 1; _g_boolean_var_76; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1739, ((const char*) (__func__)), "type == C_TYPE_PARAM_VALUE_ARRAY"); } while (0 ); |
1740 | } |
1741 | |
1742 | /* C_TYPE_PARAM_OBJECT |
1743 | */ |
1744 | { |
1745 | const CParamSpecTypeInfo pspec_info = { |
1746 | sizeof (CParamSpecObject), /* instance_size */ |
1747 | 16, /* n_preallocs */ |
1748 | param_object_init, /* instance_init */ |
1749 | G_TYPE_OBJECT((GType) ((20) << (2))), /* value_type */ |
1750 | NULL((void*)0), /* finalize */ |
1751 | param_object_set_default, /* value_set_default */ |
1752 | param_object_validate, /* value_validate */ |
1753 | param_object_values_cmp, /* values_cmp */ |
1754 | }; |
1755 | type = c_param_type_register_static (g_intern_static_string ("CParamObject"), &pspec_info); |
1756 | set_is_valid_vfunc (type, param_object_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_object_is_valid; g_type_class_unref (class ); }; |
1757 | *spec_types++ = type; |
1758 | g_assert (type == C_TYPE_PARAM_OBJECT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_77 = 0; if (type == (c_param_spec_types[19])) _g_boolean_var_77 = 1; _g_boolean_var_77; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1758, ((const char*) (__func__)), "type == C_TYPE_PARAM_OBJECT"); } while (0); |
1759 | } |
1760 | |
1761 | /* C_TYPE_PARAM_OVERRIDE |
1762 | */ |
1763 | { |
1764 | const CParamSpecTypeInfo pspec_info = { |
1765 | sizeof (CParamSpecOverride), /* instance_size */ |
1766 | 16, /* n_preallocs */ |
1767 | param_override_init, /* instance_init */ |
1768 | G_TYPE_NONE((GType) ((1) << (2))), /* value_type */ |
1769 | param_override_finalize, /* finalize */ |
1770 | param_override_set_default, /* value_set_default */ |
1771 | param_override_validate, /* value_validate */ |
1772 | param_override_values_cmp, /* values_cmp */ |
1773 | }; |
1774 | type = c_param_type_register_static (g_intern_static_string ("CParamOverride"), &pspec_info); |
1775 | set_is_valid_vfunc (type, param_override_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_override_is_valid; g_type_class_unref ( class); }; |
1776 | *spec_types++ = type; |
1777 | g_assert (type == C_TYPE_PARAM_OVERRIDE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_78 = 0; if (type == (c_param_spec_types[20])) _g_boolean_var_78 = 1; _g_boolean_var_78; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1777, ((const char*) (__func__)), "type == C_TYPE_PARAM_OVERRIDE"); } while (0); |
1778 | } |
1779 | |
1780 | /* C_TYPE_PARAM_GTYPE |
1781 | */ |
1782 | { |
1783 | CParamSpecTypeInfo pspec_info = { |
1784 | sizeof (CParamSpecGType), /* instance_size */ |
1785 | 0, /* n_preallocs */ |
1786 | param_gtype_init, /* instance_init */ |
1787 | 0xdeadbeef, /* value_type, assigned further down */ |
1788 | NULL((void*)0), /* finalize */ |
1789 | param_gtype_set_default, /* value_set_default */ |
1790 | param_gtype_validate, /* value_validate */ |
1791 | param_gtype_values_cmp, /* values_cmp */ |
1792 | }; |
1793 | pspec_info.value_type = G_TYPE_GTYPE(g_gtype_get_type()); |
1794 | type = c_param_type_register_static (g_intern_static_string ("CParamGType"), &pspec_info); |
1795 | set_is_valid_vfunc (type, param_gtype_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_gtype_is_valid; g_type_class_unref (class ); }; |
1796 | *spec_types++ = type; |
1797 | g_assert (type == C_TYPE_PARAM_GTYPE)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_79 = 0; if (type == (c_param_spec_types[21])) _g_boolean_var_79 = 1; _g_boolean_var_79; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1797, ((const char*) (__func__)), "type == C_TYPE_PARAM_GTYPE"); } while (0); |
1798 | } |
1799 | |
1800 | /* C_TYPE_PARAM_VARIANT |
1801 | */ |
1802 | { |
1803 | const CParamSpecTypeInfo pspec_info = { |
1804 | sizeof (CParamSpecVariant), /* instance_size */ |
1805 | 0, /* n_preallocs */ |
1806 | param_variant_init, /* instance_init */ |
1807 | G_TYPE_VARIANT((GType) ((21) << (2))), /* value_type */ |
1808 | param_variant_finalize, /* finalize */ |
1809 | param_variant_set_default, /* value_set_default */ |
1810 | param_variant_validate, /* value_validate */ |
1811 | param_variant_values_cmp, /* values_cmp */ |
1812 | }; |
1813 | type = c_param_type_register_static (g_intern_static_string ("CParamVariant"), &pspec_info); |
1814 | set_is_valid_vfunc (type, param_variant_is_valid){ CParamSpecClass *class = g_type_class_ref (type); class-> value_is_valid = param_variant_is_valid; g_type_class_unref ( class); }; |
1815 | *spec_types++ = type; |
1816 | g_assert (type == C_TYPE_PARAM_VARIANT)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_80 = 0; if (type == (c_param_spec_types[22])) _g_boolean_var_80 = 1; _g_boolean_var_80; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1816, ((const char*) (__func__)), "type == C_TYPE_PARAM_VARIANT"); } while (0); |
1817 | } |
1818 | |
1819 | g_assert (spec_types == spec_types_bound)do { if (__builtin_expect (__extension__ ({ int _g_boolean_var_81 = 0; if (spec_types == spec_types_bound) _g_boolean_var_81 = 1; _g_boolean_var_81; }), 1)) ; else g_assertion_message_expr ("libbean", "../libbean/cparamspecs.c", 1819, ((const char*) (__func__)), "spec_types == spec_types_bound"); } while (0); |
1820 | } |
1821 | |
1822 | /* --- CParamSpec initialization --- */ |
1823 | |
1824 | /** |
1825 | * c_param_spec_char: |
1826 | * @name: canonical name of the property specified |
1827 | * @nick: (nullable): nick name for the property specified |
1828 | * @blurb: (nullable): description of the property specified |
1829 | * @minimum: minimum value for the property specified |
1830 | * @maximum: maximum value for the property specified |
1831 | * @default_value: default value for the property specified |
1832 | * @flags: flags for the property specified |
1833 | * |
1834 | * Creates a new #CParamSpecChar instance specifying a %G_TYPE_CHAR property. |
1835 | * |
1836 | * Returns: (transfer full): a newly created parameter specification |
1837 | */ |
1838 | CParamSpec* |
1839 | c_param_spec_char (const gchar *name, |
1840 | const gchar *nick, |
1841 | const gchar *blurb, |
1842 | gint8 minimum, |
1843 | gint8 maximum, |
1844 | gint8 default_value, |
1845 | CParamFlags flags) |
1846 | { |
1847 | CParamSpecChar *cspec; |
1848 | |
1849 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_82 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_82 = 1; _g_boolean_var_82; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
1850 | |
1851 | cspec = c_param_spec_internal (C_TYPE_PARAM_CHAR(c_param_spec_types[0]), |
1852 | name, |
1853 | nick, |
1854 | blurb, |
1855 | flags); |
1856 | |
1857 | cspec->minimum = minimum; |
1858 | cspec->maximum = maximum; |
1859 | cspec->default_value = default_value; |
1860 | |
1861 | return C_PARAM_SPEC (cspec)((((CParamSpec*) (void *) ((cspec))))); |
1862 | } |
1863 | |
1864 | /** |
1865 | * c_param_spec_uchar: |
1866 | * @name: canonical name of the property specified |
1867 | * @nick: (nullable): nick name for the property specified |
1868 | * @blurb: (nullable): description of the property specified |
1869 | * @minimum: minimum value for the property specified |
1870 | * @maximum: maximum value for the property specified |
1871 | * @default_value: default value for the property specified |
1872 | * @flags: flags for the property specified |
1873 | * |
1874 | * Creates a new #CParamSpecUChar instance specifying a %G_TYPE_UCHAR property. |
1875 | * |
1876 | * Returns: (transfer full): a newly created parameter specification |
1877 | */ |
1878 | CParamSpec* |
1879 | c_param_spec_uchar (const gchar *name, |
1880 | const gchar *nick, |
1881 | const gchar *blurb, |
1882 | guint8 minimum, |
1883 | guint8 maximum, |
1884 | guint8 default_value, |
1885 | CParamFlags flags) |
1886 | { |
1887 | CParamSpecUChar *uspec; |
1888 | |
1889 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_83 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_83 = 1; _g_boolean_var_83; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
1890 | |
1891 | uspec = c_param_spec_internal (C_TYPE_PARAM_UCHAR(c_param_spec_types[1]), |
1892 | name, |
1893 | nick, |
1894 | blurb, |
1895 | flags); |
1896 | |
1897 | uspec->minimum = minimum; |
1898 | uspec->maximum = maximum; |
1899 | uspec->default_value = default_value; |
1900 | |
1901 | return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec))))); |
1902 | } |
1903 | |
1904 | /** |
1905 | * c_param_spec_boolean: |
1906 | * @name: canonical name of the property specified |
1907 | * @nick: (nullable): nick name for the property specified |
1908 | * @blurb: (nullable): description of the property specified |
1909 | * @default_value: default value for the property specified |
1910 | * @flags: flags for the property specified |
1911 | * |
1912 | * Creates a new #CParamSpecBoolean instance specifying a %G_TYPE_BOOLEAN |
1913 | * property. In many cases, it may be more appropriate to use an enum with |
1914 | * c_param_spec_enum(), both to improve code clarity by using explicitly named |
1915 | * values, and to allow for more values to be added in future without breaking |
1916 | * API. |
1917 | * |
1918 | * See c_param_spec_internal() for details on property names. |
1919 | * |
1920 | * Returns: (transfer full): a newly created parameter specification |
1921 | */ |
1922 | CParamSpec* |
1923 | c_param_spec_boolean (const gchar *name, |
1924 | const gchar *nick, |
1925 | const gchar *blurb, |
1926 | gboolean default_value, |
1927 | CParamFlags flags) |
1928 | { |
1929 | CParamSpecBoolean *bspec; |
1930 | |
1931 | g_return_val_if_fail (default_value == TRUE || default_value == FALSE, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_84 = 0; if (default_value == (!(0)) || default_value == (0)) _g_boolean_var_84 = 1; _g_boolean_var_84; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value == TRUE || default_value == FALSE" ); return (((void*)0)); } } while (0); |
1932 | |
1933 | bspec = c_param_spec_internal (C_TYPE_PARAM_BOOLEAN(c_param_spec_types[2]), |
1934 | name, |
1935 | nick, |
1936 | blurb, |
1937 | flags); |
1938 | |
1939 | bspec->default_value = default_value; |
1940 | |
1941 | return C_PARAM_SPEC (bspec)((((CParamSpec*) (void *) ((bspec))))); |
1942 | } |
1943 | |
1944 | /** |
1945 | * c_param_spec_int: |
1946 | * @name: canonical name of the property specified |
1947 | * @nick: (nullable): nick name for the property specified |
1948 | * @blurb: (nullable): description of the property specified |
1949 | * @minimum: minimum value for the property specified |
1950 | * @maximum: maximum value for the property specified |
1951 | * @default_value: default value for the property specified |
1952 | * @flags: flags for the property specified |
1953 | * |
1954 | * Creates a new #CParamSpecInt instance specifying a %G_TYPE_INT property. |
1955 | * |
1956 | * See c_param_spec_internal() for details on property names. |
1957 | * |
1958 | * Returns: (transfer full): a newly created parameter specification |
1959 | */ |
1960 | CParamSpec* |
1961 | c_param_spec_int (const gchar *name, |
1962 | const gchar *nick, |
1963 | const gchar *blurb, |
1964 | gint minimum, |
1965 | gint maximum, |
1966 | gint default_value, |
1967 | CParamFlags flags) |
1968 | { |
1969 | CParamSpecInt *ispec; |
1970 | |
1971 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_85 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_85 = 1; _g_boolean_var_85; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
1972 | |
1973 | ispec = c_param_spec_internal (C_TYPE_PARAM_INT(c_param_spec_types[3]), |
1974 | name, |
1975 | nick, |
1976 | blurb, |
1977 | flags); |
1978 | |
1979 | ispec->minimum = minimum; |
1980 | ispec->maximum = maximum; |
1981 | ispec->default_value = default_value; |
1982 | |
1983 | return C_PARAM_SPEC (ispec)((((CParamSpec*) (void *) ((ispec))))); |
1984 | } |
1985 | |
1986 | /** |
1987 | * c_param_spec_uint: |
1988 | * @name: canonical name of the property specified |
1989 | * @nick: (nullable): nick name for the property specified |
1990 | * @blurb: (nullable): description of the property specified |
1991 | * @minimum: minimum value for the property specified |
1992 | * @maximum: maximum value for the property specified |
1993 | * @default_value: default value for the property specified |
1994 | * @flags: flags for the property specified |
1995 | * |
1996 | * Creates a new #CParamSpecUInt instance specifying a %G_TYPE_UINT property. |
1997 | * |
1998 | * See c_param_spec_internal() for details on property names. |
1999 | * |
2000 | * Returns: (transfer full): a newly created parameter specification |
2001 | */ |
2002 | CParamSpec* |
2003 | c_param_spec_uint (const gchar *name, |
2004 | const gchar *nick, |
2005 | const gchar *blurb, |
2006 | guint minimum, |
2007 | guint maximum, |
2008 | guint default_value, |
2009 | CParamFlags flags) |
2010 | { |
2011 | CParamSpecUInt *uspec; |
2012 | |
2013 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_86 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_86 = 1; _g_boolean_var_86; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
2014 | |
2015 | uspec = c_param_spec_internal (C_TYPE_PARAM_UINT(c_param_spec_types[4]), |
2016 | name, |
2017 | nick, |
2018 | blurb, |
2019 | flags); |
2020 | |
2021 | uspec->minimum = minimum; |
2022 | uspec->maximum = maximum; |
2023 | uspec->default_value = default_value; |
2024 | |
2025 | return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec))))); |
2026 | } |
2027 | |
2028 | /** |
2029 | * c_param_spec_long: |
2030 | * @name: canonical name of the property specified |
2031 | * @nick: (nullable): nick name for the property specified |
2032 | * @blurb: (nullable): description of the property specified |
2033 | * @minimum: minimum value for the property specified |
2034 | * @maximum: maximum value for the property specified |
2035 | * @default_value: default value for the property specified |
2036 | * @flags: flags for the property specified |
2037 | * |
2038 | * Creates a new #CParamSpecLong instance specifying a %G_TYPE_LONG property. |
2039 | * |
2040 | * See c_param_spec_internal() for details on property names. |
2041 | * |
2042 | * Returns: (transfer full): a newly created parameter specification |
2043 | */ |
2044 | CParamSpec* |
2045 | c_param_spec_long (const gchar *name, |
2046 | const gchar *nick, |
2047 | const gchar *blurb, |
2048 | glong minimum, |
2049 | glong maximum, |
2050 | glong default_value, |
2051 | CParamFlags flags) |
2052 | { |
2053 | CParamSpecLong *lspec; |
2054 | |
2055 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_87 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_87 = 1; _g_boolean_var_87; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
2056 | |
2057 | lspec = c_param_spec_internal (C_TYPE_PARAM_LONG(c_param_spec_types[5]), |
2058 | name, |
2059 | nick, |
2060 | blurb, |
2061 | flags); |
2062 | |
2063 | lspec->minimum = minimum; |
2064 | lspec->maximum = maximum; |
2065 | lspec->default_value = default_value; |
2066 | |
2067 | return C_PARAM_SPEC (lspec)((((CParamSpec*) (void *) ((lspec))))); |
2068 | } |
2069 | |
2070 | /** |
2071 | * c_param_spec_ulong: |
2072 | * @name: canonical name of the property specified |
2073 | * @nick: (nullable): nick name for the property specified |
2074 | * @blurb: (nullable): description of the property specified |
2075 | * @minimum: minimum value for the property specified |
2076 | * @maximum: maximum value for the property specified |
2077 | * @default_value: default value for the property specified |
2078 | * @flags: flags for the property specified |
2079 | * |
2080 | * Creates a new #CParamSpecULong instance specifying a %G_TYPE_ULONG |
2081 | * property. |
2082 | * |
2083 | * See c_param_spec_internal() for details on property names. |
2084 | * |
2085 | * Returns: (transfer full): a newly created parameter specification |
2086 | */ |
2087 | CParamSpec* |
2088 | c_param_spec_ulong (const gchar *name, |
2089 | const gchar *nick, |
2090 | const gchar *blurb, |
2091 | gulong minimum, |
2092 | gulong maximum, |
2093 | gulong default_value, |
2094 | CParamFlags flags) |
2095 | { |
2096 | CParamSpecULong *uspec; |
2097 | |
2098 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_88 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_88 = 1; _g_boolean_var_88; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
2099 | |
2100 | uspec = c_param_spec_internal (C_TYPE_PARAM_ULONG(c_param_spec_types[6]), |
2101 | name, |
2102 | nick, |
2103 | blurb, |
2104 | flags); |
2105 | |
2106 | uspec->minimum = minimum; |
2107 | uspec->maximum = maximum; |
2108 | uspec->default_value = default_value; |
2109 | |
2110 | return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec))))); |
2111 | } |
2112 | |
2113 | /** |
2114 | * c_param_spec_int64: |
2115 | * @name: canonical name of the property specified |
2116 | * @nick: (nullable): nick name for the property specified |
2117 | * @blurb: (nullable): description of the property specified |
2118 | * @minimum: minimum value for the property specified |
2119 | * @maximum: maximum value for the property specified |
2120 | * @default_value: default value for the property specified |
2121 | * @flags: flags for the property specified |
2122 | * |
2123 | * Creates a new #CParamSpecInt64 instance specifying a %G_TYPE_INT64 property. |
2124 | * |
2125 | * See c_param_spec_internal() for details on property names. |
2126 | * |
2127 | * Returns: (transfer full): a newly created parameter specification |
2128 | */ |
2129 | CParamSpec* |
2130 | c_param_spec_int64 (const gchar *name, |
2131 | const gchar *nick, |
2132 | const gchar *blurb, |
2133 | gint64 minimum, |
2134 | gint64 maximum, |
2135 | gint64 default_value, |
2136 | CParamFlags flags) |
2137 | { |
2138 | CParamSpecInt64 *lspec; |
2139 | |
2140 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_89 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_89 = 1; _g_boolean_var_89; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
2141 | |
2142 | lspec = c_param_spec_internal (C_TYPE_PARAM_INT64(c_param_spec_types[7]), |
2143 | name, |
2144 | nick, |
2145 | blurb, |
2146 | flags); |
2147 | |
2148 | lspec->minimum = minimum; |
2149 | lspec->maximum = maximum; |
2150 | lspec->default_value = default_value; |
2151 | |
2152 | return C_PARAM_SPEC (lspec)((((CParamSpec*) (void *) ((lspec))))); |
2153 | } |
2154 | |
2155 | /** |
2156 | * c_param_spec_uint64: |
2157 | * @name: canonical name of the property specified |
2158 | * @nick: (nullable): nick name for the property specified |
2159 | * @blurb: (nullable): description of the property specified |
2160 | * @minimum: minimum value for the property specified |
2161 | * @maximum: maximum value for the property specified |
2162 | * @default_value: default value for the property specified |
2163 | * @flags: flags for the property specified |
2164 | * |
2165 | * Creates a new #CParamSpecUInt64 instance specifying a %G_TYPE_UINT64 |
2166 | * property. |
2167 | * |
2168 | * See c_param_spec_internal() for details on property names. |
2169 | * |
2170 | * Returns: (transfer full): a newly created parameter specification |
2171 | */ |
2172 | CParamSpec* |
2173 | c_param_spec_uint64 (const gchar *name, |
2174 | const gchar *nick, |
2175 | const gchar *blurb, |
2176 | guint64 minimum, |
2177 | guint64 maximum, |
2178 | guint64 default_value, |
2179 | CParamFlags flags) |
2180 | { |
2181 | CParamSpecUInt64 *uspec; |
2182 | |
2183 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_90 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_90 = 1; _g_boolean_var_90; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
2184 | |
2185 | uspec = c_param_spec_internal (C_TYPE_PARAM_UINT64(c_param_spec_types[8]), |
2186 | name, |
2187 | nick, |
2188 | blurb, |
2189 | flags); |
2190 | |
2191 | uspec->minimum = minimum; |
2192 | uspec->maximum = maximum; |
2193 | uspec->default_value = default_value; |
2194 | |
2195 | return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec))))); |
2196 | } |
2197 | |
2198 | /** |
2199 | * c_param_spec_unichar: |
2200 | * @name: canonical name of the property specified |
2201 | * @nick: (nullable): nick name for the property specified |
2202 | * @blurb: (nullable): description of the property specified |
2203 | * @default_value: default value for the property specified |
2204 | * @flags: flags for the property specified |
2205 | * |
2206 | * Creates a new #CParamSpecUnichar instance specifying a %G_TYPE_UINT |
2207 | * property. #GValue structures for this property can be accessed with |
2208 | * g_value_set_uint() and g_value_get_uint(). |
2209 | * |
2210 | * See c_param_spec_internal() for details on property names. |
2211 | * |
2212 | * Returns: (transfer full): a newly created parameter specification |
2213 | */ |
2214 | CParamSpec* |
2215 | c_param_spec_unichar (const gchar *name, |
2216 | const gchar *nick, |
2217 | const gchar *blurb, |
2218 | gunichar default_value, |
2219 | CParamFlags flags) |
2220 | { |
2221 | CParamSpecUnichar *uspec; |
2222 | |
2223 | uspec = c_param_spec_internal (C_TYPE_PARAM_UNICHAR(c_param_spec_types[9]), |
2224 | name, |
2225 | nick, |
2226 | blurb, |
2227 | flags); |
2228 | |
2229 | uspec->default_value = default_value; |
2230 | |
2231 | return C_PARAM_SPEC (uspec)((((CParamSpec*) (void *) ((uspec))))); |
2232 | } |
2233 | |
2234 | /** |
2235 | * c_param_spec_enum: |
2236 | * @name: canonical name of the property specified |
2237 | * @nick: (nullable): nick name for the property specified |
2238 | * @blurb: (nullable): description of the property specified |
2239 | * @enum_type: a #GType derived from %G_TYPE_ENUM |
2240 | * @default_value: default value for the property specified |
2241 | * @flags: flags for the property specified |
2242 | * |
2243 | * Creates a new #CParamSpecEnum instance specifying a %G_TYPE_ENUM |
2244 | * property. |
2245 | * |
2246 | * See c_param_spec_internal() for details on property names. |
2247 | * |
2248 | * Returns: (transfer full): a newly created parameter specification |
2249 | */ |
2250 | CParamSpec* |
2251 | c_param_spec_enum (const gchar *name, |
2252 | const gchar *nick, |
2253 | const gchar *blurb, |
2254 | GType enum_type, |
2255 | gint default_value, |
2256 | CParamFlags flags) |
2257 | { |
2258 | CParamSpecEnum *espec; |
2259 | GEnumClass *enum_class; |
2260 | |
2261 | g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_91 = 0; if (((g_type_fundamental (enum_type)) == ((GType) ((12) << (2))))) _g_boolean_var_91 = 1; _g_boolean_var_91; } ), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "G_TYPE_IS_ENUM (enum_type)"); return (( (void*)0)); } } while (0); |
2262 | |
2263 | enum_class = g_type_class_ref (enum_type); |
2264 | |
2265 | g_return_val_if_fail (g_enum_get_value (enum_class, default_value) != NULL, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_92 = 0; if (g_enum_get_value (enum_class, default_value) != ((void *)0)) _g_boolean_var_92 = 1; _g_boolean_var_92; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__ )), "g_enum_get_value (enum_class, default_value) != NULL"); return (((void*)0)); } } while (0); |
2266 | |
2267 | espec = c_param_spec_internal (C_TYPE_PARAM_ENUM(c_param_spec_types[10]), |
2268 | name, |
2269 | nick, |
2270 | blurb, |
2271 | flags); |
2272 | |
2273 | espec->enum_class = enum_class; |
2274 | espec->default_value = default_value; |
2275 | C_PARAM_SPEC (espec)((((CParamSpec*) (void *) ((espec)))))->value_type = enum_type; |
2276 | |
2277 | return C_PARAM_SPEC (espec)((((CParamSpec*) (void *) ((espec))))); |
2278 | } |
2279 | |
2280 | /** |
2281 | * c_param_spec_flags: |
2282 | * @name: canonical name of the property specified |
2283 | * @nick: (nullable): nick name for the property specified |
2284 | * @blurb: (nullable): description of the property specified |
2285 | * @flags_type: a #GType derived from %G_TYPE_FLAGS |
2286 | * @default_value: default value for the property specified |
2287 | * @flags: flags for the property specified |
2288 | * |
2289 | * Creates a new #CParamSpecFlags instance specifying a %G_TYPE_FLAGS |
2290 | * property. |
2291 | * |
2292 | * See c_param_spec_internal() for details on property names. |
2293 | * |
2294 | * Returns: (transfer full): a newly created parameter specification |
2295 | */ |
2296 | CParamSpec* |
2297 | c_param_spec_flags (const gchar *name, |
2298 | const gchar *nick, |
2299 | const gchar *blurb, |
2300 | GType flags_type, |
2301 | guint default_value, |
2302 | CParamFlags flags) |
2303 | { |
2304 | CParamSpecFlags *fspec; |
2305 | GFlagsClass *flags_class; |
2306 | |
2307 | g_return_val_if_fail (G_TYPE_IS_FLAGS (flags_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_93 = 0; if (((g_type_fundamental (flags_type)) == ((GType) ((13 ) << (2))))) _g_boolean_var_93 = 1; _g_boolean_var_93; } ), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "G_TYPE_IS_FLAGS (flags_type)"); return ( ((void*)0)); } } while (0); |
2308 | |
2309 | flags_class = g_type_class_ref (flags_type); |
2310 | |
2311 | g_return_val_if_fail ((default_value & flags_class->mask) == default_value, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_94 = 0; if ((default_value & flags_class->mask) == default_value ) _g_boolean_var_94 = 1; _g_boolean_var_94; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__ )), "(default_value & flags_class->mask) == default_value" ); return (((void*)0)); } } while (0); |
2312 | |
2313 | fspec = c_param_spec_internal (C_TYPE_PARAM_FLAGS(c_param_spec_types[11]), |
2314 | name, |
2315 | nick, |
2316 | blurb, |
2317 | flags); |
2318 | |
2319 | fspec->flags_class = flags_class; |
2320 | fspec->default_value = default_value; |
2321 | C_PARAM_SPEC (fspec)((((CParamSpec*) (void *) ((fspec)))))->value_type = flags_type; |
2322 | |
2323 | return C_PARAM_SPEC (fspec)((((CParamSpec*) (void *) ((fspec))))); |
2324 | } |
2325 | |
2326 | /** |
2327 | * c_param_spec_float: |
2328 | * @name: canonical name of the property specified |
2329 | * @nick: (nullable): nick name for the property specified |
2330 | * @blurb: (nullable): description of the property specified |
2331 | * @minimum: minimum value for the property specified |
2332 | * @maximum: maximum value for the property specified |
2333 | * @default_value: default value for the property specified |
2334 | * @flags: flags for the property specified |
2335 | * |
2336 | * Creates a new #CParamSpecFloat instance specifying a %G_TYPE_FLOAT property. |
2337 | * |
2338 | * See c_param_spec_internal() for details on property names. |
2339 | * |
2340 | * Returns: (transfer full): a newly created parameter specification |
2341 | */ |
2342 | CParamSpec* |
2343 | c_param_spec_float (const gchar *name, |
2344 | const gchar *nick, |
2345 | const gchar *blurb, |
2346 | gfloat minimum, |
2347 | gfloat maximum, |
2348 | gfloat default_value, |
2349 | CParamFlags flags) |
2350 | { |
2351 | CParamSpecFloat *fspec; |
2352 | |
2353 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_95 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_95 = 1; _g_boolean_var_95; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
2354 | |
2355 | fspec = c_param_spec_internal (C_TYPE_PARAM_FLOAT(c_param_spec_types[12]), |
2356 | name, |
2357 | nick, |
2358 | blurb, |
2359 | flags); |
2360 | |
2361 | fspec->minimum = minimum; |
2362 | fspec->maximum = maximum; |
2363 | fspec->default_value = default_value; |
2364 | |
2365 | return C_PARAM_SPEC (fspec)((((CParamSpec*) (void *) ((fspec))))); |
2366 | } |
2367 | |
2368 | /** |
2369 | * c_param_spec_double: |
2370 | * @name: canonical name of the property specified |
2371 | * @nick: (nullable): nick name for the property specified |
2372 | * @blurb: (nullable): description of the property specified |
2373 | * @minimum: minimum value for the property specified |
2374 | * @maximum: maximum value for the property specified |
2375 | * @default_value: default value for the property specified |
2376 | * @flags: flags for the property specified |
2377 | * |
2378 | * Creates a new #CParamSpecDouble instance specifying a %G_TYPE_DOUBLE |
2379 | * property. |
2380 | * |
2381 | * See c_param_spec_internal() for details on property names. |
2382 | * |
2383 | * Returns: (transfer full): a newly created parameter specification |
2384 | */ |
2385 | CParamSpec* |
2386 | c_param_spec_double (const gchar *name, |
2387 | const gchar *nick, |
2388 | const gchar *blurb, |
2389 | gdouble minimum, |
2390 | gdouble maximum, |
2391 | gdouble default_value, |
2392 | CParamFlags flags) |
2393 | { |
2394 | CParamSpecDouble *dspec; |
2395 | |
2396 | g_return_val_if_fail (default_value >= minimum && default_value <= maximum, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_96 = 0; if (default_value >= minimum && default_value <= maximum) _g_boolean_var_96 = 1; _g_boolean_var_96; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "default_value >= minimum && default_value <= maximum" ); return (((void*)0)); } } while (0); |
2397 | |
2398 | dspec = c_param_spec_internal (C_TYPE_PARAM_DOUBLE(c_param_spec_types[13]), |
2399 | name, |
2400 | nick, |
2401 | blurb, |
2402 | flags); |
2403 | |
2404 | dspec->minimum = minimum; |
2405 | dspec->maximum = maximum; |
2406 | dspec->default_value = default_value; |
2407 | |
2408 | return C_PARAM_SPEC (dspec)((((CParamSpec*) (void *) ((dspec))))); |
2409 | } |
2410 | |
2411 | /** |
2412 | * c_param_spec_string: |
2413 | * @name: canonical name of the property specified |
2414 | * @nick: (nullable): nick name for the property specified |
2415 | * @blurb: (nullable): description of the property specified |
2416 | * @default_value: (nullable): default value for the property specified |
2417 | * @flags: flags for the property specified |
2418 | * |
2419 | * Creates a new #CParamSpecString instance. |
2420 | * |
2421 | * See c_param_spec_internal() for details on property names. |
2422 | * |
2423 | * Returns: (transfer full): a newly created parameter specification |
2424 | */ |
2425 | CParamSpec* |
2426 | c_param_spec_string (const gchar *name, |
2427 | const gchar *nick, |
2428 | const gchar *blurb, |
2429 | const gchar *default_value, |
2430 | CParamFlags flags) |
2431 | { |
2432 | CParamSpecString *sspec = c_param_spec_internal (C_TYPE_PARAM_STRING(c_param_spec_types[14]), |
2433 | name, |
2434 | nick, |
2435 | blurb, |
2436 | flags); |
2437 | |
2438 | g_free (sspec->default_value); |
2439 | sspec->default_value = g_strdup (default_value)g_strdup_inline (default_value); |
2440 | |
2441 | return C_PARAM_SPEC (sspec)((((CParamSpec*) (void *) ((sspec))))); |
2442 | } |
2443 | |
2444 | /** |
2445 | * c_param_spec_param: |
2446 | * @name: canonical name of the property specified |
2447 | * @nick: (nullable): nick name for the property specified |
2448 | * @blurb: (nullable): description of the property specified |
2449 | * @param_type: a #GType derived from %C_TYPE_PARAM |
2450 | * @flags: flags for the property specified |
2451 | * |
2452 | * Creates a new #CParamSpecParam instance specifying a %C_TYPE_PARAM |
2453 | * property. |
2454 | * |
2455 | * See c_param_spec_internal() for details on property names. |
2456 | * |
2457 | * Returns: (transfer full): a newly created parameter specification |
2458 | */ |
2459 | CParamSpec* |
2460 | c_param_spec_param (const gchar *name, |
2461 | const gchar *nick, |
2462 | const gchar *blurb, |
2463 | GType param_type, |
2464 | CParamFlags flags) |
2465 | { |
2466 | CParamSpecParam *pspec; |
2467 | |
2468 | g_return_val_if_fail (C_TYPE_IS_PARAM (param_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_97 = 0; if (((g_type_fundamental (param_type)) == ((GType) ((19 ) << (2))))) _g_boolean_var_97 = 1; _g_boolean_var_97; } ), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "C_TYPE_IS_PARAM (param_type)"); return ( ((void*)0)); } } while (0); |
2469 | |
2470 | pspec = c_param_spec_internal (C_TYPE_PARAM_PARAM(c_param_spec_types[15]), |
2471 | name, |
2472 | nick, |
2473 | blurb, |
2474 | flags); |
2475 | |
2476 | C_PARAM_SPEC (pspec)((((CParamSpec*) (void *) ((pspec)))))->value_type = param_type; |
2477 | |
2478 | return C_PARAM_SPEC (pspec)((((CParamSpec*) (void *) ((pspec))))); |
2479 | } |
2480 | |
2481 | /** |
2482 | * c_param_spec_boxed: |
2483 | * @name: canonical name of the property specified |
2484 | * @nick: (nullable): nick name for the property specified |
2485 | * @blurb: (nullable): description of the property specified |
2486 | * @boxed_type: %G_TYPE_BOXED derived type of this property |
2487 | * @flags: flags for the property specified |
2488 | * |
2489 | * Creates a new #CParamSpecBoxed instance specifying a %G_TYPE_BOXED |
2490 | * derived property. |
2491 | * |
2492 | * See c_param_spec_internal() for details on property names. |
2493 | * |
2494 | * Returns: (transfer full): a newly created parameter specification |
2495 | */ |
2496 | CParamSpec* |
2497 | c_param_spec_boxed (const gchar *name, |
2498 | const gchar *nick, |
2499 | const gchar *blurb, |
2500 | GType boxed_type, |
2501 | CParamFlags flags) |
2502 | { |
2503 | CParamSpecBoxed *bspec; |
2504 | |
2505 | g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_98 = 0; if (((g_type_fundamental (boxed_type)) == ((GType) ((18 ) << (2))))) _g_boolean_var_98 = 1; _g_boolean_var_98; } ), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "G_TYPE_IS_BOXED (boxed_type)"); return ( ((void*)0)); } } while (0); |
2506 | g_return_val_if_fail (G_TYPE_IS_VALUE_TYPE (boxed_type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_99 = 0; if ((g_type_check_is_value_type (boxed_type))) _g_boolean_var_99 = 1; _g_boolean_var_99; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "G_TYPE_IS_VALUE_TYPE (boxed_type)" ); return (((void*)0)); } } while (0); |
2507 | |
2508 | bspec = c_param_spec_internal (C_TYPE_PARAM_BOXED(c_param_spec_types[16]), |
2509 | name, |
2510 | nick, |
2511 | blurb, |
2512 | flags); |
2513 | |
2514 | C_PARAM_SPEC (bspec)((((CParamSpec*) (void *) ((bspec)))))->value_type = boxed_type; |
2515 | |
2516 | return C_PARAM_SPEC (bspec)((((CParamSpec*) (void *) ((bspec))))); |
2517 | } |
2518 | |
2519 | /** |
2520 | * c_param_spec_pointer: |
2521 | * @name: canonical name of the property specified |
2522 | * @nick: (nullable): nick name for the property specified |
2523 | * @blurb: (nullable): description of the property specified |
2524 | * @flags: flags for the property specified |
2525 | * |
2526 | * Creates a new #CParamSpecPointer instance specifying a pointer property. |
2527 | * Where possible, it is better to use c_param_spec_object() or |
2528 | * c_param_spec_boxed() to expose memory management information. |
2529 | * |
2530 | * See c_param_spec_internal() for details on property names. |
2531 | * |
2532 | * Returns: (transfer full): a newly created parameter specification |
2533 | */ |
2534 | CParamSpec* |
2535 | c_param_spec_pointer (const gchar *name, |
2536 | const gchar *nick, |
2537 | const gchar *blurb, |
2538 | CParamFlags flags) |
2539 | { |
2540 | CParamSpecPointer *pspec; |
2541 | |
2542 | pspec = c_param_spec_internal (C_TYPE_PARAM_POINTER(c_param_spec_types[17]), |
2543 | name, |
2544 | nick, |
2545 | blurb, |
2546 | flags); |
2547 | |
2548 | return C_PARAM_SPEC (pspec)((((CParamSpec*) (void *) ((pspec))))); |
2549 | } |
2550 | |
2551 | /** |
2552 | * c_param_spec_gtype: |
2553 | * @name: canonical name of the property specified |
2554 | * @nick: (nullable): nick name for the property specified |
2555 | * @blurb: (nullable): description of the property specified |
2556 | * @is_a_type: a #GType whose subtypes are allowed as values |
2557 | * of the property (use %G_TYPE_NONE for any type) |
2558 | * @flags: flags for the property specified |
2559 | * |
2560 | * Creates a new #CParamSpecGType instance specifying a |
2561 | * %G_TYPE_GTYPE property. |
2562 | * |
2563 | * See c_param_spec_internal() for details on property names. |
2564 | * |
2565 | * Since: 2.10 |
2566 | * |
2567 | * Returns: (transfer full): a newly created parameter specification |
2568 | */ |
2569 | CParamSpec* |
2570 | c_param_spec_gtype (const gchar *name, |
2571 | const gchar *nick, |
2572 | const gchar *blurb, |
2573 | GType is_a_type, |
2574 | CParamFlags flags) |
2575 | { |
2576 | CParamSpecGType *tspec; |
2577 | |
2578 | tspec = c_param_spec_internal (C_TYPE_PARAM_GTYPE(c_param_spec_types[21]), |
2579 | name, |
2580 | nick, |
2581 | blurb, |
2582 | flags); |
2583 | |
2584 | tspec->is_a_type = is_a_type; |
2585 | |
2586 | return C_PARAM_SPEC (tspec)((((CParamSpec*) (void *) ((tspec))))); |
2587 | } |
2588 | |
2589 | /** |
2590 | * c_param_spec_value_array: (skip) |
2591 | * @name: canonical name of the property specified |
2592 | * @nick: (nullable): nick name for the property specified |
2593 | * @blurb: (nullable): description of the property specified |
2594 | * @element_spec: a #CParamSpec describing the elements contained in |
2595 | * arrays of this property, may be %NULL |
2596 | * @flags: flags for the property specified |
2597 | * |
2598 | * Creates a new #CParamSpecValueArray instance specifying a |
2599 | * %G_TYPE_VALUE_ARRAY property. %G_TYPE_VALUE_ARRAY is a |
2600 | * %G_TYPE_BOXED type, as such, #GValue structures for this property |
2601 | * can be accessed with g_value_set_boxed() and g_value_get_boxed(). |
2602 | * |
2603 | * See c_param_spec_internal() for details on property names. |
2604 | * |
2605 | * Returns: a newly created parameter specification |
2606 | */ |
2607 | CParamSpec* |
2608 | c_param_spec_value_array (const gchar *name, |
2609 | const gchar *nick, |
2610 | const gchar *blurb, |
2611 | CParamSpec *element_spec, |
2612 | CParamFlags flags) |
2613 | { |
2614 | CParamSpecValueArray *aspec; |
2615 | |
2616 | g_return_val_if_fail (element_spec == NULL || C_IS_PARAM_SPEC (element_spec), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_100 = 0; if (element_spec == ((void*)0) || (((g_type_check_instance_is_fundamentally_a ((GTypeInstance*) ((element_spec)), (((GType) ((19) << (2))))))))) _g_boolean_var_100 = 1; _g_boolean_var_100; }), 1 ))) { } else { g_return_if_fail_warning ("libbean", ((const char *) (__func__)), "element_spec == NULL || C_IS_PARAM_SPEC (element_spec)" ); return (((void*)0)); } } while (0); |
2617 | |
2618 | aspec = c_param_spec_internal (C_TYPE_PARAM_VALUE_ARRAY(c_param_spec_types[18]) GCC warning "Deprecated pre-processor symbol" , |
2619 | name, |
2620 | nick, |
2621 | blurb, |
2622 | flags); |
2623 | |
2624 | if (element_spec) |
2625 | { |
2626 | aspec->element_spec = c_param_spec_ref (element_spec); |
2627 | c_param_spec_sink (element_spec); |
2628 | } |
2629 | |
2630 | return C_PARAM_SPEC (aspec)((((CParamSpec*) (void *) ((aspec))))); |
2631 | } |
2632 | |
2633 | /** |
2634 | * c_param_spec_object: |
2635 | * @name: canonical name of the property specified |
2636 | * @nick: (nullable): nick name for the property specified |
2637 | * @blurb: (nullable): description of the property specified |
2638 | * @object_type: %G_TYPE_OBJECT derived type of this property |
2639 | * @flags: flags for the property specified |
2640 | * |
2641 | * Creates a new #CParamSpecBoxed instance specifying a %G_TYPE_OBJECT |
2642 | * derived property. |
2643 | * |
2644 | * See c_param_spec_internal() for details on property names. |
2645 | * |
2646 | * Returns: (transfer full): a newly created parameter specification |
2647 | */ |
2648 | CParamSpec* |
2649 | c_param_spec_object (const gchar *name, |
2650 | const gchar *nick, |
2651 | const gchar *blurb, |
2652 | GType object_type, |
2653 | CParamFlags flags) |
2654 | { |
2655 | CParamSpecObject *ospec; |
2656 | |
2657 | g_return_val_if_fail (g_type_is_a (object_type, G_TYPE_OBJECT), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_101 = 0; if (((object_type) == (((GType) ((20) << (2)))) || (g_type_is_a) ((object_type), (((GType) ((20) << (2))) )))) _g_boolean_var_101 = 1; _g_boolean_var_101; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) ( __func__)), "g_type_is_a (object_type, G_TYPE_OBJECT)"); return (((void*)0)); } } while (0); |
2658 | |
2659 | ospec = c_param_spec_internal (C_TYPE_PARAM_OBJECT(c_param_spec_types[19]), |
2660 | name, |
2661 | nick, |
2662 | blurb, |
2663 | flags); |
2664 | |
2665 | C_PARAM_SPEC (ospec)((((CParamSpec*) (void *) ((ospec)))))->value_type = object_type; |
2666 | |
2667 | return C_PARAM_SPEC (ospec)((((CParamSpec*) (void *) ((ospec))))); |
2668 | } |
2669 | |
2670 | /** |
2671 | * c_param_spec_override: (skip) |
2672 | * @name: the name of the property. |
2673 | * @overridden: The property that is being overridden |
2674 | * |
2675 | * Creates a new property of type #CParamSpecOverride. This is used |
2676 | * to direct operations to another paramspec, and will not be directly |
2677 | * useful unless you are implementing a new base type similar to GObject. |
2678 | * |
2679 | * Since: 2.4 |
2680 | * |
2681 | * Returns: the newly created #CParamSpec |
2682 | */ |
2683 | CParamSpec* |
2684 | c_param_spec_override (const gchar *name, |
2685 | CParamSpec *overridden) |
2686 | { |
2687 | CParamSpec *pspec; |
2688 | |
2689 | g_return_val_if_fail (name != NULL, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_102 = 0; if (name != ((void*)0)) _g_boolean_var_102 = 1; _g_boolean_var_102 ; }), 1))) { } else { g_return_if_fail_warning ("libbean", (( const char*) (__func__)), "name != NULL"); return (((void*)0) ); } } while (0); |
2690 | g_return_val_if_fail (C_IS_PARAM_SPEC (overridden), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_103 = 0; if ((((g_type_check_instance_is_fundamentally_a ((GTypeInstance *) ((overridden)), (((GType) ((19) << (2))))))))) _g_boolean_var_103 = 1; _g_boolean_var_103; }), 1))) { } else { g_return_if_fail_warning ("libbean", ((const char*) (__func__)), "C_IS_PARAM_SPEC (overridden)" ); return (((void*)0)); } } while (0); |
2691 | |
2692 | /* Dereference further redirections for property that was passed in |
2693 | */ |
2694 | while (TRUE(!(0))) |
2695 | { |
2696 | CParamSpec *indirect = c_param_spec_get_redirect_target (overridden); |
2697 | if (indirect) |
2698 | overridden = indirect; |
2699 | else |
2700 | break; |
2701 | } |
2702 | |
2703 | pspec = c_param_spec_internal (C_TYPE_PARAM_OVERRIDE(c_param_spec_types[20]), |
2704 | name, NULL((void*)0), NULL((void*)0), |
2705 | overridden->flags); |
2706 | |
2707 | pspec->value_type = C_PARAM_SPEC_VALUE_TYPE (overridden)(((((CParamSpec*) (void *) ((overridden)))))->value_type); |
2708 | C_PARAM_SPEC_OVERRIDE (pspec)((((CParamSpecOverride*) (void *) ((pspec)))))->overridden = c_param_spec_ref (overridden); |
2709 | |
2710 | return pspec; |
2711 | } |
2712 | |
2713 | /** |
2714 | * c_param_spec_variant: |
2715 | * @name: canonical name of the property specified |
2716 | * @nick: (nullable): nick name for the property specified |
2717 | * @blurb: (nullable): description of the property specified |
2718 | * @type: a #GVariantType |
2719 | * @default_value: (nullable) (transfer full): a #GVariant of type @type to |
2720 | * use as the default value, or %NULL |
2721 | * @flags: flags for the property specified |
2722 | * |
2723 | * Creates a new #CParamSpecVariant instance specifying a #GVariant |
2724 | * property. |
2725 | * |
2726 | * If @default_value is floating, it is consumed. |
2727 | * |
2728 | * See c_param_spec_internal() for details on property names. |
2729 | * |
2730 | * Returns: (transfer full): the newly created #CParamSpec |
2731 | * |
2732 | * Since: 2.26 |
2733 | */ |
2734 | CParamSpec* |
2735 | c_param_spec_variant (const gchar *name, |
2736 | const gchar *nick, |
2737 | const gchar *blurb, |
2738 | const GVariantType *type, |
2739 | GVariant *default_value, |
2740 | CParamFlags flags) |
2741 | { |
2742 | CParamSpecVariant *vspec; |
2743 | |
2744 | g_return_val_if_fail (type != NULL, NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_104 = 0; if (type != ((void*)0)) _g_boolean_var_104 = 1; _g_boolean_var_104 ; }), 1))) { } else { g_return_if_fail_warning ("libbean", (( const char*) (__func__)), "type != NULL"); return (((void*)0) ); } } while (0); |
2745 | g_return_val_if_fail (default_value == NULL ||do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_105 = 0; if (default_value == ((void*)0) || g_variant_is_of_type (default_value, type)) _g_boolean_var_105 = 1; _g_boolean_var_105 ; }), 1))) { } else { g_return_if_fail_warning ("libbean", (( const char*) (__func__)), "default_value == NULL || g_variant_is_of_type (default_value, type)" ); return (((void*)0)); } } while (0) |
2746 | g_variant_is_of_type (default_value, type), NULL)do { if ((__builtin_expect (__extension__ ({ int _g_boolean_var_105 = 0; if (default_value == ((void*)0) || g_variant_is_of_type (default_value, type)) _g_boolean_var_105 = 1; _g_boolean_var_105 ; }), 1))) { } else { g_return_if_fail_warning ("libbean", (( const char*) (__func__)), "default_value == NULL || g_variant_is_of_type (default_value, type)" ); return (((void*)0)); } } while (0); |
2747 | |
2748 | vspec = c_param_spec_internal (C_TYPE_PARAM_VARIANT(c_param_spec_types[22]), |
2749 | name, |
2750 | nick, |
2751 | blurb, |
2752 | flags); |
2753 | |
2754 | vspec->type = g_variant_type_copy (type); |
2755 | if (default_value) |
2756 | vspec->default_value = g_variant_ref_sink (default_value); |
2757 | |
2758 | return C_PARAM_SPEC (vspec)((((CParamSpec*) (void *) ((vspec))))); |
2759 | } |