gobject-introspection r153 - in trunk: . tools
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: gobject-introspection r153 - in trunk: . tools
- Date: Tue, 11 Mar 2008 14:25:09 +0000 (GMT)
Author: johan
Date: Tue Mar 11 14:25:08 2008
New Revision: 153
URL: http://svn.gnome.org/viewvc/gobject-introspection?rev=153&view=rev
Log:
2008-03-11 Johan Dahlin <johan gnome org>
* tools/compiler.c:
* tools/generate.c:
Remove most global variables
Modified:
trunk/ChangeLog
trunk/tools/compiler.c
trunk/tools/generate.c
Modified: trunk/tools/compiler.c
==============================================================================
--- trunk/tools/compiler.c (original)
+++ trunk/tools/compiler.c Tue Mar 11 14:25:08 2008
@@ -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 @@
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);
Modified: trunk/tools/generate.c
==============================================================================
--- trunk/tools/generate.c (original)
+++ trunk/tools/generate.c Tue Mar 11 14:25:08 2008
@@ -30,9 +30,8 @@
#include "girepository.h"
#include "gmetadata.h"
-gboolean raw = FALSE;
-gchar **input = NULL;
-gchar *output = NULL;
+/* FIXME: Avoid global */
+static gchar *output = NULL;
static void
write_type_name (const gchar *namespace,
@@ -1104,14 +1103,6 @@
g_strfreev (namespaces);
}
-static GOptionEntry options[] =
-{
- { "raw", 0, 0, G_OPTION_ARG_NONE, &raw, "handle raw metadata", NULL },
- { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
- { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
- { NULL, }
-};
-
static const guchar *
load_metadata (const gchar *filename,
GModule **dlhandle,
@@ -1152,11 +1143,20 @@
int
main (int argc, char *argv[])
{
+ gboolean raw = FALSE;
+ gchar **input = NULL;
GOptionContext *context;
GError *error = NULL;
gboolean needs_prefix;
gint i;
GMetadata *data;
+ GOptionEntry options[] =
+ {
+ { "raw", 0, 0, G_OPTION_ARG_NONE, &raw, "handle raw metadata", NULL },
+ { "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
+ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &input, NULL, NULL },
+ { NULL, }
+ };
g_type_init ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]