[SYMBOL_LINES] Support for line numbers on Symbols
[gnome.gobject-introspection] / giscanner / sourcescanner.h
index 496a226..581b6b1 100644 (file)
@@ -6,7 +6,7 @@
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * version 2 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -31,18 +31,19 @@ G_BEGIN_DECLS
 typedef struct _GISourceScanner GISourceScanner;
 typedef struct _GISourceSymbol GISourceSymbol;
 typedef struct _GISourceType GISourceType;
-typedef struct _GISourceDirective GISourceDirective;
 
 typedef enum
 {
   CSYMBOL_TYPE_INVALID,
+  CSYMBOL_TYPE_ELLIPSIS,
   CSYMBOL_TYPE_CONST,
   CSYMBOL_TYPE_OBJECT,
   CSYMBOL_TYPE_FUNCTION,
   CSYMBOL_TYPE_STRUCT,
   CSYMBOL_TYPE_UNION,
   CSYMBOL_TYPE_ENUM,
-  CSYMBOL_TYPE_TYPEDEF
+  CSYMBOL_TYPE_TYPEDEF,
+  CSYMBOL_TYPE_MEMBER
 } GISourceSymbolType;
 
 typedef enum
@@ -74,7 +75,8 @@ typedef enum
   TYPE_QUALIFIER_NONE = 0,
   TYPE_QUALIFIER_CONST = 1 << 1,
   TYPE_QUALIFIER_RESTRICT = 1 << 2,
-  TYPE_QUALIFIER_VOLATILE = 1 << 3
+  TYPE_QUALIFIER_VOLATILE = 1 << 3,
+  TYPE_QUALIFIER_EXTENSION = 1 << 4
 } TypeQualifier;
 
 typedef enum
@@ -99,7 +101,7 @@ struct _GISourceScanner
   gboolean macro_scan;
   GSList *symbols;
   GList *filenames;
-  GHashTable *directives_map;
+  GSList *comments;
   GHashTable *typedef_table;
   GHashTable *struct_or_union_or_enum_table;
 };
@@ -114,7 +116,10 @@ struct _GISourceSymbol
   gboolean const_int_set;
   int const_int;
   char *const_string;
-  GSList *directives; /* list of GISourceDirective */
+  gboolean const_double_set;
+  double const_double;
+  char *source_filename;
+  int line;
 };
 
 struct _GISourceType
@@ -126,13 +131,7 @@ struct _GISourceType
   char *name;
   GISourceType *base_type;
   GList *child_list; /* list of GISourceSymbol */
-};
-
-struct _GISourceDirective
-{
-  char *name;
-  char *value;
-  GSList *options; /* list of options (key=value) */
+  gboolean is_bitfield;
 };
 
 GISourceScanner *   gi_source_scanner_new              (void);
@@ -140,23 +139,20 @@ gboolean            gi_source_scanner_lex_filename     (GISourceScanner  *igener
                                                        const gchar      *filename);
 gboolean            gi_source_scanner_parse_file       (GISourceScanner  *igenerator,
                                                        FILE             *file);
+void                gi_source_scanner_parse_macros     (GISourceScanner  *scanner,
+                                                       GList            *filenames);
 void                gi_source_scanner_set_macro_scan   (GISourceScanner  *scanner,
                                                        gboolean          macro_scan);
 GSList *            gi_source_scanner_get_symbols      (GISourceScanner  *scanner);
+GSList *            gi_source_scanner_get_comments     (GISourceScanner  *scanner);
 void                gi_source_scanner_free             (GISourceScanner  *scanner);
 
-GISourceSymbol *    gi_source_symbol_new               (GISourceSymbolType  type);
+GISourceSymbol *    gi_source_symbol_new               (GISourceSymbolType  type, int line);
 gboolean            gi_source_symbol_get_const_boolean (GISourceSymbol     *symbol);
 GISourceSymbol *    gi_source_symbol_ref               (GISourceSymbol     *symbol);
 void                gi_source_symbol_unref             (GISourceSymbol     *symbol);
 
-GISourceDirective * gi_source_directive_new            (const gchar       *name,
-                                                       const gchar        *value,
-                                                       GSList             *options);
-void                gi_source_directive_free           (GISourceDirective  *directive);
-
 /* Private */
-GISourceType *      gi_source_array_new                (void);
 void                gi_source_scanner_add_symbol       (GISourceScanner  *scanner,
                                                        GISourceSymbol   *symbol);
 gboolean            gi_source_scanner_is_typedef       (GISourceScanner  *scanner,
@@ -171,9 +167,11 @@ GISourceType *         gi_source_struct_new               (const char       *name);
 GISourceType *             gi_source_union_new                (const char       *name);
 GISourceType *             gi_source_enum_new                 (const char       *name);
 GISourceType *             gi_source_pointer_new              (GISourceType     *base_type);
-GISourceType *             gi_source_array_new                (void);
+GISourceType *             gi_source_array_new                (GISourceSymbol   *size);
 GISourceType *             gi_source_function_new             (void);
 
+void ctype_free (GISourceType * type);
+
 G_END_DECLS
 
 #endif /* __SOURCE_SCANNER_H__ */