/* 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. */ #ifndef _TREE_H_ #define _TREE_H_ #include enum { CCODE_NODE, CLASS_NODE, TYPE_NODE, CHECK_NODE, FUNCARG_NODE, METHOD_NODE, ARGUMENT_NODE, VARIABLE_NODE }; typedef union _Node Node; typedef struct _CCode CCode; struct _CCode { int type; int header; GString *cbuf; }; typedef struct _Class Class; struct _Class { int type; char *otype; /*this object class type*/ char *ptype; /*parent class type*/ GList *nodes; }; typedef struct _Type Type; struct _Type { int type; int stars; char *name; }; enum { NULL_CHECK, TYPE_CHECK, LT_CHECK, GT_CHECK, LE_CHECK, GE_CHECK, EQ_CHECK, NE_CHECK }; typedef struct _Check Check; struct _Check { int type; int chtype; char *number; }; typedef struct _FuncArg FuncArg; struct _FuncArg { int type; Type *atype; char *name; GList *checks; }; typedef struct _Argument Argument; struct _Argument { int type; char *gtktype; GList *flags; char *name; GString *get; GString *set; }; /*scope type*/ enum { PUBLIC_SCOPE, PRIVATE_SCOPE, INIT_METHOD, CLASS_INIT_METHOD, VIRTUAL_METHOD, SIGNAL_LAST_METHOD, SIGNAL_FIRST_METHOD, OVERRIDE_METHOD }; typedef struct _Method Method; struct _Method { int type; int scope; Type *mtype; char *otype; /*for override methods*/ GList *gtktypes; /*GTK types for a signal*/ char *id; GList *args; char *onerror; GString *cbuf; int line_no; }; typedef struct _Variable Variable; struct _Variable { int type; int scope; Type *vtype; char *id; }; union _Node { int type; CCode ccode; Class class; Type _type; Check check; Argument argument; Method method; Variable variable; }; Node *new_ccode(int header, GString *cbuf); Node *new_class(char *otype, char *ptype, GList *nodes); Node *new_type(int stars, char *name); Node *new_check(int chtype, char *number); Node *new_funcarg(Type *atype, char *name, GList *checks); Node *new_method(int scope, Type *mtype, char *otype, GList *gtktypes, char *id, GList *args, char *onerror, GString *cbuf,int line_no); Node *new_argument(char *gtktype, GList *flags, char *name, GString *get, GString *set); Node *new_variable(int scope, Type *vtype, char *id); #endif