+ | ARGUMENT flags argtype TOKEN TOKEN {
+ Node *node;
+ char *get, *set = NULL;
+ Variable *var;
+ Type *type;
+ char *root;
+
+ if(strcmp($<id>5,"link")!=0 &&
+ strcmp($<id>5,"stringlink")!=0 &&
+ strcmp($<id>5,"objectlink")!=0) {
+ g_free($<id>5); g_free($<id>3);
+ g_free($<id>4);
+ g_list_foreach($<list>2,(GFunc)g_free,NULL);
+ yyerror(_("parse error"));
+ YYERROR;
+ }
+
+ type = pop_type();
+
+ var = find_var_or_die($<id>4, $<line>1);
+ if(var->scope == PRIVATE_SCOPE)
+ root = "self->_priv";
+ else
+ root = "self";
+
+ if(strcmp($<id>5,"link")==0) {
+ set = g_strdup_printf("%s->%s = ARG;",
+ root, $<id>4);
+ } else if(strcmp($<id>5,"stringlink")==0) {
+ set = g_strdup_printf("g_free(%s->%s); "
+ "%s->%s = g_strdup(ARG);",
+ root, $<id>4,
+ root, $<id>4);
+ } else if(strcmp($<id>5,"objectlink")==0) {
+ set = g_strdup_printf(
+ "if(%s->%s) "
+ "gtk_object_unref(GTK_OBJECT(%s->%s)); "
+ "%s->%s = ARG; "
+ "if(%s->%s) "
+ "gtk_object_ref(GTK_OBJECT(%s->%s)); ",
+ root, $<id>4,
+ root, $<id>4,
+ root, $<id>4,
+ root, $<id>4,
+ root, $<id>4);
+ } else {
+ g_assert_not_reached();
+ }
+
+ /* get is the same for everything */
+ get = g_strdup_printf("ARG = %s->%s;", root, $<id>4);
+
+ g_free($<id>5);
+
+
+ if(!type)
+ type = copy_type(var->vtype);
+
+ node = new_argument($<id>3, type, $<list>2,
+ $<id>4, get, $<line>1,
+ set, $<line>1, $<line>1);
+ class_nodes = g_list_append(class_nodes,node);
+ }
+ ;
+
+argtype: TOKEN '(' TOKEN type ')' {
+ if(strcmp($<id>3,"type")!=0) {
+ g_free($<id>1);
+ g_free($<id>3);
+ yyerror(_("parse error"));
+ YYERROR;
+ }
+ $<id>$ = $<id>1;
+ }
+ | TOKEN {
+ $<id>$ = $<id>1;
+ typestack = g_list_prepend(typestack,NULL);
+ }