1 /* GObject introspection: public scanner api
3 * Copyright (C) 2007 Jürg Billeter
4 * Copyright (C) 2008 Johan Dahlin
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library 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 GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 #ifndef __SOURCE_SCANNER_H__
24 #define __SOURCE_SCANNER_H__
31 typedef struct _GISourceScanner GISourceScanner;
32 typedef struct _GISourceSymbol GISourceSymbol;
33 typedef struct _GISourceType GISourceType;
38 CSYMBOL_TYPE_ELLIPSIS,
41 CSYMBOL_TYPE_FUNCTION,
65 STORAGE_CLASS_NONE = 0,
66 STORAGE_CLASS_TYPEDEF = 1 << 1,
67 STORAGE_CLASS_EXTERN = 1 << 2,
68 STORAGE_CLASS_STATIC = 1 << 3,
69 STORAGE_CLASS_AUTO = 1 << 4,
70 STORAGE_CLASS_REGISTER = 1 << 5
71 } StorageClassSpecifier;
75 TYPE_QUALIFIER_NONE = 0,
76 TYPE_QUALIFIER_CONST = 1 << 1,
77 TYPE_QUALIFIER_RESTRICT = 1 << 2,
78 TYPE_QUALIFIER_VOLATILE = 1 << 3,
79 TYPE_QUALIFIER_EXTENSION = 1 << 4
85 FUNCTION_INLINE = 1 << 1
91 UNARY_POINTER_INDIRECTION,
94 UNARY_BITWISE_COMPLEMENT,
95 UNARY_LOGICAL_NEGATION
98 struct _GISourceScanner
100 char *current_filename;
105 GHashTable *typedef_table;
106 GHashTable *struct_or_union_or_enum_table;
109 struct _GISourceSymbol
112 GISourceSymbolType type;
115 GISourceType *base_type;
116 gboolean const_int_set;
123 GISourceTypeType type;
124 StorageClassSpecifier storage_class_specifier;
125 TypeQualifier type_qualifier;
126 FunctionSpecifier function_specifier;
128 GISourceType *base_type;
129 GList *child_list; /* list of GISourceSymbol */
132 GISourceScanner * gi_source_scanner_new (void);
133 gboolean gi_source_scanner_lex_filename (GISourceScanner *igenerator,
134 const gchar *filename);
135 gboolean gi_source_scanner_parse_file (GISourceScanner *igenerator,
137 void gi_source_scanner_parse_macros (GISourceScanner *scanner,
139 void gi_source_scanner_set_macro_scan (GISourceScanner *scanner,
140 gboolean macro_scan);
141 GSList * gi_source_scanner_get_symbols (GISourceScanner *scanner);
142 GSList * gi_source_scanner_get_comments (GISourceScanner *scanner);
143 void gi_source_scanner_free (GISourceScanner *scanner);
145 GISourceSymbol * gi_source_symbol_new (GISourceSymbolType type);
146 gboolean gi_source_symbol_get_const_boolean (GISourceSymbol *symbol);
147 GISourceSymbol * gi_source_symbol_ref (GISourceSymbol *symbol);
148 void gi_source_symbol_unref (GISourceSymbol *symbol);
151 void gi_source_scanner_add_symbol (GISourceScanner *scanner,
152 GISourceSymbol *symbol);
153 gboolean gi_source_scanner_is_typedef (GISourceScanner *scanner,
155 void gi_source_symbol_merge_type (GISourceSymbol *symbol,
157 GISourceType * gi_source_type_new (GISourceTypeType type);
158 GISourceType * gi_source_type_copy (GISourceType *type);
159 GISourceType * gi_source_basic_type_new (const char *name);
160 GISourceType * gi_source_typedef_new (const char *name);
161 GISourceType * gi_source_struct_new (const char *name);
162 GISourceType * gi_source_union_new (const char *name);
163 GISourceType * gi_source_enum_new (const char *name);
164 GISourceType * gi_source_pointer_new (GISourceType *base_type);
165 GISourceType * gi_source_array_new (GISourceSymbol *size);
166 GISourceType * gi_source_function_new (void);
170 #endif /* __SOURCE_SCANNER_H__ */