mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Merge branch 'wip/smcv/gi-unused-options' into 'main'
gi- tools: Remove unused options, improve --debug/--verbose See merge request GNOME/glib!3926
This commit is contained in:
commit
fe2c18a835
@ -40,15 +40,13 @@
|
|||||||
#include "girnode-private.h"
|
#include "girnode-private.h"
|
||||||
#include "girparser-private.h"
|
#include "girparser-private.h"
|
||||||
|
|
||||||
gchar **includedirs = NULL;
|
static gchar **includedirs = NULL;
|
||||||
gchar **input = NULL;
|
static gchar **input = NULL;
|
||||||
gchar *output = NULL;
|
static gchar *output = NULL;
|
||||||
gchar *mname = NULL;
|
static gchar **shlibs = NULL;
|
||||||
gchar **shlibs = NULL;
|
static gboolean debug = FALSE;
|
||||||
gboolean include_cwd = FALSE;
|
static gboolean verbose = FALSE;
|
||||||
gboolean debug = FALSE;
|
static gboolean show_version = FALSE;
|
||||||
gboolean verbose = FALSE;
|
|
||||||
gboolean show_version = FALSE;
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
write_out_typelib (gchar *prefix,
|
write_out_typelib (gchar *prefix,
|
||||||
@ -126,7 +124,7 @@ out:
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLogLevelFlags logged_levels;
|
static GLogLevelFlags logged_levels;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
log_handler (const gchar *log_domain,
|
log_handler (const gchar *log_domain,
|
||||||
@ -141,7 +139,6 @@ log_handler (const gchar *log_domain,
|
|||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = {
|
||||||
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
|
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
|
||||||
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
|
{ "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_ARRAY, &shlibs, "shared library", "FILE" },
|
{ "shared-library", 'l', 0, G_OPTION_ARG_FILENAME_ARRAY, &shlibs, "shared library", "FILE" },
|
||||||
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, "show debug messages", NULL },
|
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, "show debug messages", NULL },
|
||||||
{ "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "show verbose messages", NULL },
|
{ "verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "show verbose messages", NULL },
|
||||||
@ -207,6 +204,7 @@ main (int argc, char **argv)
|
|||||||
includedirs ? g_strv_length (includedirs) : 0);
|
includedirs ? g_strv_length (includedirs) : 0);
|
||||||
|
|
||||||
parser = gi_ir_parser_new ();
|
parser = gi_ir_parser_new ();
|
||||||
|
gi_ir_parser_set_debug (parser, logged_levels);
|
||||||
|
|
||||||
gi_ir_parser_set_includes (parser, (const char *const *) includedirs);
|
gi_ir_parser_set_includes (parser, (const char *const *) includedirs);
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ int
|
|||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GIRepository *repository = NULL;
|
GIRepository *repository = NULL;
|
||||||
gboolean shlib = FALSE;
|
|
||||||
gchar *output = NULL;
|
gchar *output = NULL;
|
||||||
gchar **includedirs = NULL;
|
gchar **includedirs = NULL;
|
||||||
gboolean show_all = FALSE;
|
gboolean show_all = FALSE;
|
||||||
@ -48,7 +47,6 @@ main (int argc, char *argv[])
|
|||||||
gint i;
|
gint i;
|
||||||
GOptionEntry options[] =
|
GOptionEntry options[] =
|
||||||
{
|
{
|
||||||
{ "shlib", 0, 0, G_OPTION_ARG_NONE, &shlib, "handle typelib embedded in shlib", NULL },
|
|
||||||
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
|
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output, "output file", "FILE" },
|
||||||
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
|
{ "includedir", 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &includedirs, "include directories in GIR search path", NULL },
|
||||||
{ "all", 0, 0, G_OPTION_ARG_NONE, &show_all, "show all available information", NULL, },
|
{ "all", 0, 0, G_OPTION_ARG_NONE, &show_all, "show all available information", NULL, },
|
||||||
|
@ -33,6 +33,8 @@ typedef struct _GIIrParser GIIrParser;
|
|||||||
|
|
||||||
GIIrParser *gi_ir_parser_new (void);
|
GIIrParser *gi_ir_parser_new (void);
|
||||||
void gi_ir_parser_free (GIIrParser *parser);
|
void gi_ir_parser_free (GIIrParser *parser);
|
||||||
|
void gi_ir_parser_set_debug (GIIrParser *parser,
|
||||||
|
GLogLevelFlags logged_levels);
|
||||||
void gi_ir_parser_set_includes (GIIrParser *parser,
|
void gi_ir_parser_set_includes (GIIrParser *parser,
|
||||||
const char *const *includes);
|
const char *const *includes);
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ struct _GIIrParser
|
|||||||
char **includes;
|
char **includes;
|
||||||
char **gi_gir_path;
|
char **gi_gir_path;
|
||||||
GList *parsed_modules; /* All previously parsed modules */
|
GList *parsed_modules; /* All previously parsed modules */
|
||||||
|
GLogLevelFlags logged_levels;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@ -191,9 +192,17 @@ gi_ir_parser_new (void)
|
|||||||
if (gi_gir_path != NULL)
|
if (gi_gir_path != NULL)
|
||||||
parser->gi_gir_path = g_strsplit (gi_gir_path, G_SEARCHPATH_SEPARATOR_S, 0);
|
parser->gi_gir_path = g_strsplit (gi_gir_path, G_SEARCHPATH_SEPARATOR_S, 0);
|
||||||
|
|
||||||
|
parser->logged_levels = G_LOG_LEVEL_MASK & ~(G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_DEBUG);
|
||||||
return parser;
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gi_ir_parser_set_debug (GIIrParser *parser,
|
||||||
|
GLogLevelFlags logged_levels)
|
||||||
|
{
|
||||||
|
parser->logged_levels = logged_levels;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gi_ir_parser_free (GIIrParser *parser)
|
gi_ir_parser_free (GIIrParser *parser)
|
||||||
{
|
{
|
||||||
@ -2915,8 +2924,6 @@ parse_include (GMarkupParseContext *context,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern GLogLevelFlags logged_levels;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
start_element_handler (GMarkupParseContext *context,
|
start_element_handler (GMarkupParseContext *context,
|
||||||
const char *element_name,
|
const char *element_name,
|
||||||
@ -2927,7 +2934,7 @@ start_element_handler (GMarkupParseContext *context,
|
|||||||
{
|
{
|
||||||
ParseContext *ctx = user_data;
|
ParseContext *ctx = user_data;
|
||||||
|
|
||||||
if (logged_levels & G_LOG_LEVEL_DEBUG)
|
if (ctx->parser->logged_levels & G_LOG_LEVEL_DEBUG)
|
||||||
{
|
{
|
||||||
GString *tags = g_string_new ("");
|
GString *tags = g_string_new ("");
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
Reference in New Issue
Block a user