+++ /dev/null
-/* 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 <glib.h>
-#include "tree.h"
-
-Node *
-new_ccode(int cctype, char *cbuf, int line_no)
-{
- CCode *node = (CCode *)g_new(Node,1);
- node->type = CCODE_NODE;
- node->cctype = cctype;
- 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, char *postfix)
-{
- Type *node = (Type *)g_new(Node,1);
- node->type = TYPE_NODE;
- node->stars = stars;
- node->name = name;
- node->postfix = postfix;
- 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, int method, Type *mtype, char *otype,
- GList *gtktypes, GList *flags, char *id, GList *args,
- char *onerror, char *cbuf, int line_no, int ccode_line,
- gboolean vararg)
-{
- Method *node = (Method *)g_new(Node,1);
- node->type = METHOD_NODE;
- node->scope = scope;
- node->method = method;
- node->mtype = mtype;
- node->otype = otype;
- node->gtktypes = gtktypes;
- node->flags = flags;
- node->id = id;
- node->args = args;
- node->onerror = onerror;
- node->cbuf = cbuf;
- node->line_no = line_no;
- node->ccode_line = ccode_line;
- node->vararg = vararg;
- return (Node *)node;
-}
-
-Node *
-new_argument(char *gtktype, Type *atype, GList *flags, char *name, char *get, int get_line, char *set, int set_line, int line_no)
-{
- Argument *node = (Argument *)g_new(Node,1);
- node->type = ARGUMENT_NODE;
- node->gtktype = gtktype;
- node->atype = atype;
- 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,
- char *destructor, int destructor_line,
- gboolean destructor_simple,
- char *initializer, int initializer_line)
-{
- 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;
- node->destructor = destructor;
- node->destructor_line = destructor_line;
- node->destructor_simple = destructor_simple;
- node->initializer = initializer;
- node->initializer_line = initializer_line;
- return (Node *)node;
-}
-
-Type *
-copy_type(Type *type)
-{
- Node *node;
-
- if(!type) return NULL;
-
- node = new_type(type->stars,
- g_strdup(type->name),
- g_strdup(type->postfix));
-
- return (Type *)node;
-}