]> git.draconx.ca Git - gob-dx.git/blob - src/tree.c
Release 0.0.1
[gob-dx.git] / src / tree.c
1 /* GOB C Preprocessor
2  * Copyright (C) 1999 the Free Software Foundation.
3  *
4  * Author: George Lebl
5  *
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.
10  *
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.
15  *
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,
19  * USA.
20  */
21
22 #include <glib.h>
23 #include "tree.h"
24
25 Node *
26 new_ccode(int header, GString *cbuf)
27 {
28         CCode *node = (CCode *)g_new(Node,1);
29         node->type = CCODE_NODE;
30         node->header = header;
31         node->cbuf = cbuf;
32         return (Node *)node;
33 }
34
35 Node *
36 new_class(char *otype, char *ptype, GList *nodes)
37 {
38         Class *node = (Class *)g_new(Node,1);
39         node->type = CLASS_NODE;
40         node->otype = otype;
41         node->ptype = ptype;
42         node->nodes = nodes;
43         return (Node *)node;
44 }
45
46 Node *
47 new_type(int stars, char *name)
48 {
49         Type *node = (Type *)g_new(Node,1);
50         node->type = TYPE_NODE;
51         node->stars = stars;
52         node->name = name;
53         return (Node *)node;
54 }
55
56 Node *
57 new_check(int chtype, char *number)
58 {
59         Check *node = (Check *)g_new(Node,1);
60         node->type = CHECK_NODE;
61         node->chtype = chtype;
62         node->number = number;
63         return (Node *)node;
64 }
65
66 Node *
67 new_funcarg(Type *atype, char *name, GList *checks)
68 {
69         FuncArg *node = (FuncArg *)g_new(Node,1);
70         node->type = FUNCARG_NODE;
71         node->atype = atype;
72         node->name = name;
73         node->checks = checks;
74         return (Node *)node;
75 }
76
77 Node *
78 new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf, int line_no)
79 {
80         Method *node = (Method *)g_new(Node,1);
81         node->type = METHOD_NODE;
82         node->scope = scope;
83         node->mtype = mtype;
84         node->otype = otype;
85         node->gtktypes = gtktypes;
86         node->id = id;
87         node->args = args;
88         node->onerror = onerror;
89         node->cbuf = cbuf;
90         node->line_no = line_no;
91         return (Node *)node;
92 }
93
94 Node *
95 new_argument(char *gtktype, GList *flags, char *name, GString *get, GString *set)
96 {
97         Argument *node = (Argument *)g_new(Node,1);
98         node->type = ARGUMENT_NODE;
99         node->gtktype = gtktype;
100         node->flags = flags;
101         node->name = name;
102         node->get = get;
103         node->set = set;
104         return (Node *)node;
105 }
106
107 Node *
108 new_variable(int scope, Type *vtype, char *id)
109 {
110         Variable *node = (Variable *)g_new(Node,1);
111         node->type = VARIABLE_NODE;
112         node->scope = scope;
113         node->vtype = vtype;
114         node->id = id;
115         return (Node *)node;
116 }