2 * Copyright (C) 1999 the Free Software Foundation.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
27 new_ccode(int cctype, char *cbuf, int line_no)
29 CCode *node = (CCode *)g_new(Node,1);
30 node->type = CCODE_NODE;
31 node->cctype = cctype;
33 node->line_no = line_no;
38 new_class(char *otype, char *ptype, GList *nodes)
40 Class *node = (Class *)g_new(Node,1);
41 node->type = CLASS_NODE;
49 new_type(int stars, char *name, char *postfix)
51 Type *node = (Type *)g_new(Node,1);
52 node->type = TYPE_NODE;
55 node->postfix = postfix;
60 new_check(int chtype, char *number)
62 Check *node = (Check *)g_new(Node,1);
63 node->type = CHECK_NODE;
64 node->chtype = chtype;
65 node->number = number;
70 new_funcarg(Type *atype, char *name, GList *checks)
72 FuncArg *node = (FuncArg *)g_new(Node,1);
73 node->type = FUNCARG_NODE;
76 node->checks = checks;
81 new_method(int scope, int method, Type *mtype, char *otype,
82 GList *gtktypes, GList *flags, char *id, GList *args,
83 char *onerror, char *cbuf, int line_no, int ccode_line,
86 Method *node = (Method *)g_new(Node,1);
87 node->type = METHOD_NODE;
89 node->method = method;
92 node->gtktypes = gtktypes;
96 node->onerror = onerror;
98 node->line_no = line_no;
99 node->ccode_line = ccode_line;
100 node->vararg = vararg;
105 new_argument(char *gtktype, Type *atype, GList *flags, char *name, char *get, int get_line, char *set, int set_line, int line_no)
107 Argument *node = (Argument *)g_new(Node,1);
108 node->type = ARGUMENT_NODE;
109 node->gtktype = gtktype;
114 node->get_line = get_line;
116 node->set_line = set_line;
117 node->line_no = line_no;
122 new_variable(int scope, Type *vtype, char *id, int line_no,
123 char *destructor, int destructor_line,
124 gboolean destructor_simple,
125 char *initializer, int initializer_line)
127 Variable *node = (Variable *)g_new(Node,1);
128 node->type = VARIABLE_NODE;
132 node->line_no = line_no;
133 node->destructor = destructor;
134 node->destructor_line = destructor_line;
135 node->destructor_simple = destructor_simple;
136 node->initializer = initializer;
137 node->initializer_line = initializer_line;
142 copy_type(Type *type)
146 if(!type) return NULL;
148 node = new_type(type->stars,
149 g_strdup(type->name),
150 g_strdup(type->postfix));