/* GOB C Preprocessor * Copyright (C) 1999 the Free Software Foundation. * * Author: George Lebl * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include "config.h" #include #include "tree.h" Node * new_ccode(int header, GString *cbuf, int line_no) { CCode *node = (CCode *)g_new(Node,1); node->type = CCODE_NODE; node->header = header; node->cbuf = cbuf; node->line_no = line_no; return (Node *)node; } Node * new_class(char *otype, char *ptype, GList *nodes) { Class *node = (Class *)g_new(Node,1); node->type = CLASS_NODE; node->otype = otype; node->ptype = ptype; node->nodes = nodes; return (Node *)node; } Node * new_type(int stars, char *name) { Type *node = (Type *)g_new(Node,1); node->type = TYPE_NODE; node->stars = stars; node->name = name; return (Node *)node; } Node * new_check(int chtype, char *number) { Check *node = (Check *)g_new(Node,1); node->type = CHECK_NODE; node->chtype = chtype; node->number = number; return (Node *)node; } Node * new_funcarg(Type *atype, char *name, GList *checks) { FuncArg *node = (FuncArg *)g_new(Node,1); node->type = FUNCARG_NODE; node->atype = atype; node->name = name; node->checks = checks; return (Node *)node; } Node * new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf, int line_no,int ccode_line) { Method *node = (Method *)g_new(Node,1); node->type = METHOD_NODE; node->scope = scope; node->mtype = mtype; node->otype = otype; node->gtktypes = gtktypes; node->id = id; node->args = args; node->onerror = onerror; node->cbuf = cbuf; node->line_no = line_no; node->ccode_line = ccode_line; return (Node *)node; } Node * new_argument(char *gtktype, GList *flags, char *name, GString *get, int get_line, GString *set, int set_line, int line_no) { Argument *node = (Argument *)g_new(Node,1); node->type = ARGUMENT_NODE; node->gtktype = gtktype; node->flags = flags; node->name = name; node->get = get; node->get_line = get_line; node->set = set; node->set_line = set_line; node->line_no = line_no; return (Node *)node; } Node * new_variable(int scope, Type *vtype, char *id, int line_no) { Variable *node = (Variable *)g_new(Node,1); node->type = VARIABLE_NODE; node->scope = scope; node->vtype = vtype; node->id = id; node->line_no = line_no; return (Node *)node; }