113
123
typedef struct _ValaAttributeClass ValaAttributeClass;
114
124
typedef struct _ValaSymbolPrivate ValaSymbolPrivate;
126
#define VALA_TYPE_LOCKABLE (vala_lockable_get_type ())
127
#define VALA_LOCKABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_LOCKABLE, ValaLockable))
128
#define VALA_IS_LOCKABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_LOCKABLE))
129
#define VALA_LOCKABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), VALA_TYPE_LOCKABLE, ValaLockableIface))
131
typedef struct _ValaLockable ValaLockable;
132
typedef struct _ValaLockableIface ValaLockableIface;
134
#define VALA_TYPE_CONSTANT (vala_constant_get_type ())
135
#define VALA_CONSTANT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_CONSTANT, ValaConstant))
136
#define VALA_CONSTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_CONSTANT, ValaConstantClass))
137
#define VALA_IS_CONSTANT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_CONSTANT))
138
#define VALA_IS_CONSTANT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_CONSTANT))
139
#define VALA_CONSTANT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_CONSTANT, ValaConstantClass))
141
typedef struct _ValaConstant ValaConstant;
142
typedef struct _ValaConstantClass ValaConstantClass;
143
typedef struct _ValaConstantPrivate ValaConstantPrivate;
116
145
#define VALA_TYPE_ENUM_VALUE (vala_enum_value_get_type ())
117
146
#define VALA_ENUM_VALUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_ENUM_VALUE, ValaEnumValue))
118
147
#define VALA_ENUM_VALUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_ENUM_VALUE, ValaEnumValueClass))
134
173
typedef struct _ValaComment ValaComment;
135
174
typedef struct _ValaCommentClass ValaCommentClass;
136
#define _vala_code_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_code_node_unref (var), NULL)))
137
#define _vala_comment_unref0(var) ((var == NULL) ? NULL : (var = (vala_comment_unref (var), NULL)))
138
175
#define _g_free0(var) (var = (g_free (var), NULL))
140
#define VALA_TYPE_SOURCE_REFERENCE (vala_source_reference_get_type ())
141
#define VALA_SOURCE_REFERENCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VALA_TYPE_SOURCE_REFERENCE, ValaSourceReference))
142
#define VALA_SOURCE_REFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VALA_TYPE_SOURCE_REFERENCE, ValaSourceReferenceClass))
143
#define VALA_IS_SOURCE_REFERENCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VALA_TYPE_SOURCE_REFERENCE))
144
#define VALA_IS_SOURCE_REFERENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VALA_TYPE_SOURCE_REFERENCE))
145
#define VALA_SOURCE_REFERENCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VALA_TYPE_SOURCE_REFERENCE, ValaSourceReferenceClass))
147
typedef struct _ValaSourceReference ValaSourceReference;
148
typedef struct _ValaSourceReferenceClass ValaSourceReferenceClass;
149
176
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
151
178
#define VALA_TYPE_TYPESYMBOL (vala_typesymbol_get_type ())
261
294
void vala_value_take_source_reference (GValue* value, gpointer v_object);
262
295
gpointer vala_value_get_source_reference (const GValue* value);
263
296
GType vala_source_reference_get_type (void) G_GNUC_CONST;
264
ValaSymbol* vala_symbol_construct (GType object_type, const char* name, ValaSourceReference* source_reference);
265
void vala_enum_value_set_comment (ValaEnumValue* self, ValaComment* value);
266
ValaEnumValue* vala_enum_value_new (const char* name, ValaSourceReference* source_reference, ValaComment* comment);
267
ValaEnumValue* vala_enum_value_construct (GType object_type, const char* name, ValaSourceReference* source_reference, ValaComment* comment);
268
void vala_enum_value_set_value (ValaEnumValue* self, ValaExpression* value);
269
ValaEnumValue* vala_enum_value_new_with_value (const char* name, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment);
270
ValaEnumValue* vala_enum_value_construct_with_value (GType object_type, const char* name, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment);
297
gpointer vala_comment_ref (gpointer instance);
298
void vala_comment_unref (gpointer instance);
299
GParamSpec* vala_param_spec_comment (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
300
void vala_value_set_comment (GValue* value, gpointer v_object);
301
void vala_value_take_comment (GValue* value, gpointer v_object);
302
gpointer vala_value_get_comment (const GValue* value);
303
GType vala_comment_get_type (void) G_GNUC_CONST;
304
ValaConstant* vala_constant_new (const char* name, ValaDataType* type_reference, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment);
305
ValaConstant* vala_constant_construct (GType object_type, const char* name, ValaDataType* type_reference, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment);
306
ValaEnumValue* vala_enum_value_new (const char* name, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment);
307
ValaEnumValue* vala_enum_value_construct (GType object_type, const char* name, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment);
271
308
const char* vala_symbol_get_name (ValaSymbol* self);
272
309
ValaCCodeConstant* vala_enum_value_get_canonical_cconstant (ValaEnumValue* self);
273
310
void vala_code_visitor_visit_enum_value (ValaCodeVisitor* self, ValaEnumValue* ev);
274
311
static void vala_enum_value_real_accept (ValaCodeNode* base, ValaCodeVisitor* visitor);
275
ValaExpression* vala_enum_value_get_value (ValaEnumValue* self);
312
ValaExpression* vala_constant_get_value (ValaConstant* self);
276
313
void vala_code_node_accept (ValaCodeNode* self, ValaCodeVisitor* visitor);
277
314
static void vala_enum_value_real_accept_children (ValaCodeNode* base, ValaCodeVisitor* visitor);
278
const char* vala_attribute_get_name (ValaAttribute* self);
279
gboolean vala_attribute_has_argument (ValaAttribute* self, const char* name);
280
char* vala_attribute_get_string (ValaAttribute* self, const char* name);
281
void vala_symbol_process_deprecated_attribute (ValaSymbol* self, ValaAttribute* attr);
282
void vala_enum_value_process_attributes (ValaEnumValue* self);
283
char* vala_enum_value_get_default_cname (ValaEnumValue* self);
284
char* vala_enum_value_get_cname (ValaEnumValue* self);
285
315
ValaSymbol* vala_symbol_get_parent_symbol (ValaSymbol* self);
286
316
GType vala_typesymbol_get_type (void) G_GNUC_CONST;
287
317
GType vala_enum_get_type (void) G_GNUC_CONST;
288
318
char* vala_symbol_get_cprefix (ValaSymbol* self);
289
void vala_enum_value_set_cname (ValaEnumValue* self, const char* cname);
319
static char* vala_enum_value_real_get_default_cname (ValaConstant* base);
290
320
gboolean vala_code_node_get_checked (ValaCodeNode* self);
291
321
gboolean vala_code_node_get_error (ValaCodeNode* self);
292
322
void vala_code_node_set_checked (ValaCodeNode* self, gboolean value);
323
void vala_constant_process_attributes (ValaConstant* self);
293
324
gboolean vala_code_node_check (ValaCodeNode* self, ValaSemanticAnalyzer* analyzer);
294
325
static gboolean vala_enum_value_real_check (ValaCodeNode* base, ValaSemanticAnalyzer* analyzer);
295
ValaComment* vala_enum_value_get_comment (ValaEnumValue* self);
296
static void vala_enum_value_finalize (ValaCodeNode* obj);
297
static int _vala_strcmp0 (const char * str1, const char * str2);
301
ValaEnumValue* vala_enum_value_construct (GType object_type, const char* name, ValaSourceReference* source_reference, ValaComment* comment) {
303
g_return_val_if_fail (name != NULL, NULL);
304
self = (ValaEnumValue*) vala_symbol_construct (object_type, name, source_reference);
305
vala_enum_value_set_comment (self, comment);
310
ValaEnumValue* vala_enum_value_new (const char* name, ValaSourceReference* source_reference, ValaComment* comment) {
311
return vala_enum_value_construct (VALA_TYPE_ENUM_VALUE, name, source_reference, comment);
315
ValaEnumValue* vala_enum_value_construct_with_value (GType object_type, const char* name, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment) {
317
g_return_val_if_fail (name != NULL, NULL);
318
g_return_val_if_fail (value != NULL, NULL);
319
self = (ValaEnumValue*) vala_enum_value_construct (object_type, name, source_reference, comment);
320
vala_enum_value_set_value (self, value);
325
ValaEnumValue* vala_enum_value_new_with_value (const char* name, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment) {
326
return vala_enum_value_construct_with_value (VALA_TYPE_ENUM_VALUE, name, value, source_reference, comment);
330
* Creates a new enum value with the specified numerical representation.
332
* @param name enum value name
333
* @param value numerical representation
334
* @return newly created enum value
336
ValaEnumValue* vala_enum_value_construct (GType object_type, const char* name, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment) {
338
g_return_val_if_fail (name != NULL, NULL);
339
self = (ValaEnumValue*) vala_constant_construct (object_type, name, NULL, value, source_reference, comment);
344
ValaEnumValue* vala_enum_value_new (const char* name, ValaExpression* value, ValaSourceReference* source_reference, ValaComment* comment) {
345
return vala_enum_value_construct (VALA_TYPE_ENUM_VALUE, name, value, source_reference, comment);
350
* Returns the string literal of this signal to be used in C code.
351
* (FIXME: from vlaasignal.vala)
353
* @return string literal to be used in C code
330
355
ValaCCodeConstant* vala_enum_value_get_canonical_cconstant (ValaEnumValue* self) {
331
356
ValaCCodeConstant* result = NULL;
382
void vala_enum_value_process_attributes (ValaEnumValue* self) {
383
g_return_if_fail (self != NULL);
387
a_collection = ((ValaCodeNode*) self)->attributes;
388
for (a_it = a_collection; a_it != NULL; a_it = a_it->next) {
390
a = _vala_code_node_ref0 ((ValaAttribute*) a_it->data);
392
gboolean _tmp0_ = FALSE;
393
if (_vala_strcmp0 (vala_attribute_get_name (a), "CCode") == 0) {
394
_tmp0_ = vala_attribute_has_argument (a, "cname");
400
self->priv->cname = (_tmp1_ = vala_attribute_get_string (a, "cname"), _g_free0 (self->priv->cname), _tmp1_);
402
if (_vala_strcmp0 (vala_attribute_get_name (a), "Deprecated") == 0) {
403
vala_symbol_process_deprecated_attribute ((ValaSymbol*) self, a);
406
_vala_code_node_unref0 (a);
413
char* vala_enum_value_get_cname (ValaEnumValue* self) {
415
g_return_val_if_fail (self != NULL, NULL);
416
if (self->priv->cname == NULL) {
418
self->priv->cname = (_tmp0_ = vala_enum_value_get_default_cname (self), _g_free0 (self->priv->cname), _tmp0_);
420
result = g_strdup (self->priv->cname);
425
char* vala_enum_value_get_default_cname (ValaEnumValue* self) {
407
static char* vala_enum_value_real_get_default_cname (ValaConstant* base) {
408
ValaEnumValue * self;
426
409
char* result = NULL;
430
g_return_val_if_fail (self != NULL, NULL);
413
self = (ValaEnumValue*) base;
431
414
en = _vala_code_node_ref0 (VALA_ENUM (vala_symbol_get_parent_symbol ((ValaSymbol*) self)));
432
415
result = (_tmp1_ = g_strdup_printf ("%s%s", _tmp0_ = vala_symbol_get_cprefix ((ValaSymbol*) en), vala_symbol_get_name ((ValaSymbol*) self)), _g_free0 (_tmp0_), _tmp1_);
433
416
_vala_code_node_unref0 (en);
456
431
vala_code_node_set_checked ((ValaCodeNode*) self, TRUE);
457
vala_enum_value_process_attributes (self);
458
if (self->priv->_value != NULL) {
459
vala_code_node_check ((ValaCodeNode*) self->priv->_value, analyzer);
432
vala_constant_process_attributes ((ValaConstant*) self);
433
if (vala_constant_get_value ((ValaConstant*) self) != NULL) {
434
vala_code_node_check ((ValaCodeNode*) vala_constant_get_value ((ValaConstant*) self), analyzer);
461
436
result = !vala_code_node_get_error ((ValaCodeNode*) self);
466
ValaExpression* vala_enum_value_get_value (ValaEnumValue* self) {
467
ValaExpression* result;
468
g_return_val_if_fail (self != NULL, NULL);
469
result = self->priv->_value;
474
void vala_enum_value_set_value (ValaEnumValue* self, ValaExpression* value) {
475
ValaExpression* _tmp0_;
476
g_return_if_fail (self != NULL);
477
self->priv->_value = (_tmp0_ = _vala_code_node_ref0 (value), _vala_code_node_unref0 (self->priv->_value), _tmp0_);
481
ValaComment* vala_enum_value_get_comment (ValaEnumValue* self) {
483
g_return_val_if_fail (self != NULL, NULL);
484
result = self->priv->_comment;
489
static gpointer _vala_comment_ref0 (gpointer self) {
490
return self ? vala_comment_ref (self) : NULL;
494
void vala_enum_value_set_comment (ValaEnumValue* self, ValaComment* value) {
496
g_return_if_fail (self != NULL);
497
self->priv->_comment = (_tmp0_ = _vala_comment_ref0 (value), _vala_comment_unref0 (self->priv->_comment), _tmp0_);
501
441
static void vala_enum_value_class_init (ValaEnumValueClass * klass) {
502
442
vala_enum_value_parent_class = g_type_class_peek_parent (klass);
503
VALA_CODE_NODE_CLASS (klass)->finalize = vala_enum_value_finalize;
504
g_type_class_add_private (klass, sizeof (ValaEnumValuePrivate));
505
443
VALA_CODE_NODE_CLASS (klass)->accept = vala_enum_value_real_accept;
506
444
VALA_CODE_NODE_CLASS (klass)->accept_children = vala_enum_value_real_accept_children;
445
VALA_CONSTANT_CLASS (klass)->get_default_cname = vala_enum_value_real_get_default_cname;
507
446
VALA_CODE_NODE_CLASS (klass)->check = vala_enum_value_real_check;
511
450
static void vala_enum_value_instance_init (ValaEnumValue * self) {
512
self->priv = VALA_ENUM_VALUE_GET_PRIVATE (self);
516
static void vala_enum_value_finalize (ValaCodeNode* obj) {
517
ValaEnumValue * self;
518
self = VALA_ENUM_VALUE (obj);
519
_vala_code_node_unref0 (self->priv->_value);
520
_vala_comment_unref0 (self->priv->_comment);
521
_g_free0 (self->priv->cname);
522
VALA_CODE_NODE_CLASS (vala_enum_value_parent_class)->finalize (obj);
455
* Represents an enum member in the source code.
526
457
GType vala_enum_value_get_type (void) {
527
458
static volatile gsize vala_enum_value_type_id__volatile = 0;
528
459
if (g_once_init_enter (&vala_enum_value_type_id__volatile)) {
529
460
static const GTypeInfo g_define_type_info = { sizeof (ValaEnumValueClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_enum_value_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaEnumValue), 0, (GInstanceInitFunc) vala_enum_value_instance_init, NULL };
530
461
GType vala_enum_value_type_id;
531
vala_enum_value_type_id = g_type_register_static (VALA_TYPE_SYMBOL, "ValaEnumValue", &g_define_type_info, 0);
462
vala_enum_value_type_id = g_type_register_static (VALA_TYPE_CONSTANT, "ValaEnumValue", &g_define_type_info, 0);
532
463
g_once_init_leave (&vala_enum_value_type_id__volatile, vala_enum_value_type_id);
534
465
return vala_enum_value_type_id__volatile;
538
static int _vala_strcmp0 (const char * str1, const char * str2) {
540
return -(str1 != str2);
545
return strcmp (str1, str2);