]> git.draconx.ca Git - gob-dx.git/blobdiff - src/parse.y
Release 2.0.9
[gob-dx.git] / src / parse.y
index 7588b9d252131bfe1eb4b0f8bc464de469cc4f6a..ded33fd4bc9e361e8f64f77845aa5b97da5d32a3 100644 (file)
@@ -1,6 +1,7 @@
 /* GOB C Preprocessor
  * Copyright (C) 1999-2000 the Free Software Foundation.
- * Copyright (C) 2001 George Lebl
+ * Copyright (C) 2000 Eazel, Inc.
+ * Copyright (C) 2001-2004 George (Jiri) Lebl
  *
  * Author: George Lebl
  *
@@ -77,6 +78,7 @@ int yylex(void);
 
 extern int ccode_line;
 extern int line_no;
+extern gboolean for_cpp;
 
 extern char *yytext;
 
@@ -517,6 +519,8 @@ property_link_and_export (Node *node)
                                               root, prop->name);
                        g_free (cast);
                } else if (strcmp (prop->gtktype, "BOXED") == 0) {
+                       char *type = make_me_type (prop->extra_gtktype,
+                                                  "G_TYPE_BOXED");
                        if (prop->extra_gtktype == NULL) {
                                error_print (GOB_ERROR, prop->line_no,
                                             _("Property linking requested for BOXED, but "
@@ -531,12 +535,13 @@ property_link_and_export (Node *node)
                                              "} "
                                              "}",
                                              root, prop->name,
-                                             prop->extra_gtktype,
+                                             type,
                                              root, prop->name,
-                                             prop->extra_gtktype,
+                                             type,
                                              root, prop->name);
                        get = g_strdup_printf("g_value_set_boxed (VAL, %s->%s);",
                                              root, prop->name);
+                       g_free (type);
                } else {
                        char *set_func;
                        char *get_func;
@@ -548,14 +553,16 @@ property_link_and_export (Node *node)
                        get_func = g_strdup_printf ("g_value_get_%s", prop->gtktype);
                        g_strdown (get_func);
 
-                       if (strcmp (prop->gtktype, "FLAGS") == 0) {
-                               setcast = "(guint) ";
-                               getcast = to_free =
-                                       get_prop_enum_flag_cast (prop);
-                       } else if (strcmp (prop->gtktype, "ENUM") == 0) {
-                               setcast = "(gint) ";
-                               getcast = to_free =
-                                       get_prop_enum_flag_cast (prop);
+                       if (for_cpp) {
+                               if (strcmp (prop->gtktype, "FLAGS") == 0) {
+                                       setcast = "(guint) ";
+                                       getcast = to_free =
+                                               get_prop_enum_flag_cast (prop);
+                               } else if (strcmp (prop->gtktype, "ENUM") == 0) {
+                                       setcast = "(gint) ";
+                                       getcast = to_free =
+                                               get_prop_enum_flag_cast (prop);
+                               }
                        }
 
                        set = g_strdup_printf("%s->%s = %s%s (VAL);",