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