From 582a675584bcf38b758fcf324e47beb723f2b058 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 12 Nov 2008 17:16:42 +0000 Subject: [PATCH] Add a GirParser object to hold the state of a compilation Add a toplevel GirParser object to hold state that is global across a compilation. Currently just holds the include path, but will eventually also keep a cached list of parsed modules. svn path=/trunk/; revision=901 --- girepository/tools/compiler.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/girepository/tools/compiler.c b/girepository/tools/compiler.c index 50ba37e34..69b49bd80 100644 --- a/girepository/tools/compiler.c +++ b/girepository/tools/compiler.c @@ -169,6 +169,7 @@ main (int argc, char ** argv) { GOptionContext *context; GError *error = NULL; + GIrParser *parser; GList *m, *modules; gint i; g_typelib_check_sanity (); @@ -203,11 +204,15 @@ main (int argc, char ** argv) for (i = 0; includedirs[i]; i++) g_irepository_prepend_search_path (includedirs[i]); + parser = g_ir_parser_new (); + + g_ir_parser_set_includes (parser, (const char*const*) includedirs); + modules = NULL; for (i = 0; input[i]; i++) { GList *mods; - mods = g_ir_parse_file (input[i], (const char*const*) includedirs, &error); + mods = g_ir_parser_parse_file (parser, input[i], &error); if (mods == NULL) { @@ -272,5 +277,10 @@ main (int argc, char ** argv) g_debug ("[building] done"); +#if 0 + /* No point */ + g_ir_parser_free (parser); +#endif + return 0; }