gdk-3.0: Atom is an IntegerType
[vala-gnome.git] / gobject-introspection / scanner.h
blobb21407590a54d8f7a4db60a75ca388f830b31f5d
1 /* GObject introspection: gen-introspect
3 * Copyright (C) 2007 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author:
21 * Jürg Billeter <j@bitron.ch>
24 #ifndef __GEN_INTROSPECT_H__
25 #define __GEN_INTROSPECT_H__
27 #include <glib.h>
28 #include "gidlmodule.h"
30 G_BEGIN_DECLS typedef struct _GIGenerator GIGenerator;
31 typedef struct _CSymbol CSymbol;
32 typedef struct _CType CType;
33 typedef struct _CDirective CDirective;
35 struct _GIGenerator
37 /* parameters */
38 char *namespace;
39 char *shared_library;
40 char *lower_case_namespace;
41 gboolean verbose;
43 /* specified files to be parsed */
44 GList *filenames;
45 /* source reference of current lexer position */
46 char *current_filename;
47 GList *symbol_list;
48 GHashTable *typedef_table;
49 GHashTable *struct_or_union_or_enum_table;
51 GIdlModule *module;
52 GList *get_type_symbols;
53 GHashTable *type_map;
54 GHashTable *type_by_lower_case_prefix;
56 GHashTable *symbols; /* typename -> module.name */
58 /* scanner variables */
59 gboolean macro_scan;
60 GSList *directives; /* list of CDirective for the current symbol */
63 typedef enum
65 CSYMBOL_TYPE_INVALID,
66 CSYMBOL_TYPE_CONST,
67 CSYMBOL_TYPE_OBJECT,
68 CSYMBOL_TYPE_FUNCTION,
69 CSYMBOL_TYPE_STRUCT,
70 CSYMBOL_TYPE_UNION,
71 CSYMBOL_TYPE_ENUM,
72 CSYMBOL_TYPE_TYPEDEF
73 } CSymbolType;
75 struct _CSymbol
77 CSymbolType type;
78 int id;
79 char *ident;
80 CType *base_type;
81 gboolean const_int_set;
82 int const_int;
83 char *const_string;
84 GSList *directives; /* list of CDirective */
87 typedef enum
89 CTYPE_INVALID,
90 CTYPE_VOID,
91 CTYPE_BASIC_TYPE,
92 CTYPE_TYPEDEF,
93 CTYPE_STRUCT,
94 CTYPE_UNION,
95 CTYPE_ENUM,
96 CTYPE_POINTER,
97 CTYPE_ARRAY,
98 CTYPE_FUNCTION
99 } CTypeType;
101 typedef enum
103 STORAGE_CLASS_NONE = 0,
104 STORAGE_CLASS_TYPEDEF = 1 << 1,
105 STORAGE_CLASS_EXTERN = 1 << 2,
106 STORAGE_CLASS_STATIC = 1 << 3,
107 STORAGE_CLASS_AUTO = 1 << 4,
108 STORAGE_CLASS_REGISTER = 1 << 5
109 } StorageClassSpecifier;
111 typedef enum
113 TYPE_QUALIFIER_NONE = 0,
114 TYPE_QUALIFIER_CONST = 1 << 1,
115 TYPE_QUALIFIER_RESTRICT = 1 << 2,
116 TYPE_QUALIFIER_VOLATILE = 1 << 3
117 } TypeQualifier;
119 typedef enum
121 FUNCTION_NONE = 0,
122 FUNCTION_INLINE = 1 << 1
123 } FunctionSpecifier;
125 typedef enum
127 UNARY_ADDRESS_OF,
128 UNARY_POINTER_INDIRECTION,
129 UNARY_PLUS,
130 UNARY_MINUS,
131 UNARY_BITWISE_COMPLEMENT,
132 UNARY_LOGICAL_NEGATION
133 } UnaryOperator;
135 struct _CType
137 CTypeType type;
138 StorageClassSpecifier storage_class_specifier;
139 TypeQualifier type_qualifier;
140 FunctionSpecifier function_specifier;
141 char *name;
142 CType *base_type;
143 GList *child_list;
146 struct _CDirective {
147 char *name;
148 char *value;
151 CSymbol * csymbol_new (CSymbolType type);
152 gboolean csymbol_get_const_boolean (CSymbol *symbol);
153 void csymbol_free (CSymbol *symbol);
154 CDirective * cdirective_new (const gchar *name,
155 const gchar *value);
156 void cdirective_free (CDirective *directive);
158 gboolean g_igenerator_parse_file (GIGenerator *igenerator,
159 FILE *file);
160 void g_igenerator_set_verbose (GIGenerator *igenerator,
161 gboolean verbose);
162 void g_igenerator_add_symbol (GIGenerator *igenerator,
163 CSymbol *symbol);
164 gboolean g_igenerator_is_typedef (GIGenerator *igenerator,
165 const char *name);
166 G_END_DECLS
167 #endif