summaryrefslogtreecommitdiff
path: root/tools/compiler.c
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-03-11 14:25:08 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-03-11 14:25:08 +0000
commit369e7a8d79196113b7cefd6f1f9d85e96e27b1ba (patch)
tree84fc20d7d794da99227fac58be9fdef6f1ca0776 /tools/compiler.c
parentcd4a4df89a137fdc4177059bd7dcf84b1bf45ec1 (diff)
downloadgobject-introspection-369e7a8d79196113b7cefd6f1f9d85e96e27b1ba.tar.gz
Remove most global variables
2008-03-11 Johan Dahlin <johan@gnome.org> * tools/compiler.c: * tools/generate.c: Remove most global variables svn path=/trunk/; revision=153
Diffstat (limited to 'tools/compiler.c')
-rw-r--r--tools/compiler.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/tools/compiler.c b/tools/compiler.c
index 9da0c7b2..a73a8516 100644
--- a/tools/compiler.c
+++ b/tools/compiler.c
@@ -30,15 +30,7 @@
#include "gmetadata.h"
#include "gidlcompilercontext.h"
-gboolean no_init = FALSE;
-gchar **input = NULL;
-gchar *output = NULL;
-gchar *mname = NULL;
-gchar *shlib = NULL;
-gboolean debug = FALSE;
-gboolean verbose = FALSE;
-
-GLogLevelFlags logged_levels;
+static GLogLevelFlags logged_levels;
static void log_handler (const gchar *log_domain,
GLogLevelFlags log_level,
@@ -50,30 +42,43 @@ static void log_handler (const gchar *log_domain,
g_log_default_handler (log_domain, log_level, message, user_data);
}
-static GOptionEntry options[] =
-{
- { "no-init", 0, 0, G_OPTION_ARG_NONE, &no_init, "do not create _init() function", NULL },
- { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
- { "module", 'm', 0, G_OPTION_ARG_STRING, &mname, "module to compile", "NAME" },
- { "shared-library", 'l', 0, G_OPTION_ARG_FILENAME, &shlib, "shared library", "FILE" },
- { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, "show debug messages", NULL },
- { "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "show verbose messages", NULL },
- { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
- { NULL, }
-};
-
int
main (int argc, char ** argv)
{
+ gboolean no_init = FALSE;
+ gchar **input = NULL;
+ gchar *output = NULL;
+ gchar *mname = NULL;
+ gchar *shlib = NULL;
+ gboolean debug = FALSE;
+ gboolean verbose = FALSE;
+
GOptionContext *context;
GError *error = NULL;
GList *m, *modules;
gint i;
GList *c;
gint entry_id;
-
FILE *file;
GIdlCompilerContext *ctx;
+ GOptionEntry options[] =
+ {
+ { "no-init", 0, 0, G_OPTION_ARG_NONE, &no_init,
+ "do not create _init() function", NULL },
+ { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output,
+ "output file", "FILE" },
+ { "module", 'm', 0, G_OPTION_ARG_STRING, &mname,
+ "module to compile", "NAME" },
+ { "shared-library", 'l', 0, G_OPTION_ARG_FILENAME, &shlib,
+ "shared library", "FILE" },
+ { "debug", 0, 0, G_OPTION_ARG_NONE, &debug,
+ "show debug messages", NULL },
+ { "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose,
+ "show verbose messages", NULL },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input,
+ NULL, NULL },
+ { NULL, }
+ };
context = g_option_context_new ("");
g_option_context_add_main_entries (context, options, NULL);