Add G_OPTION_FLAG_REVERSE, to reverse the sense of a G_OPTION_ARG_NONE

2004-11-04  Tor Lillqvist  <tml@iki.fi>

	* glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
	to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.

	* glib/goption.c (parse_arg): Obey the above flag.
This commit is contained in:
Tor Lillqvist 2004-11-04 00:40:06 +00:00 committed by Tor Lillqvist
parent 912ba0d43c
commit 5ddd4874a6
7 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,10 @@
2004-11-04 Tor Lillqvist <tml@iki.fi> 2004-11-04 Tor Lillqvist <tml@iki.fi>
* glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
* glib/goption.c (parse_arg): Obey the above flag.
* glib/gconvert.c (g_filename_display_name): Document that the * glib/gconvert.c (g_filename_display_name): Document that the
result is guaranteed to be non-NULL. result is guaranteed to be non-NULL.

View File

@ -1,5 +1,10 @@
2004-11-04 Tor Lillqvist <tml@iki.fi> 2004-11-04 Tor Lillqvist <tml@iki.fi>
* glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
* glib/goption.c (parse_arg): Obey the above flag.
* glib/gconvert.c (g_filename_display_name): Document that the * glib/gconvert.c (g_filename_display_name): Document that the
result is guaranteed to be non-NULL. result is guaranteed to be non-NULL.

View File

@ -1,5 +1,10 @@
2004-11-04 Tor Lillqvist <tml@iki.fi> 2004-11-04 Tor Lillqvist <tml@iki.fi>
* glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
* glib/goption.c (parse_arg): Obey the above flag.
* glib/gconvert.c (g_filename_display_name): Document that the * glib/gconvert.c (g_filename_display_name): Document that the
result is guaranteed to be non-NULL. result is guaranteed to be non-NULL.

View File

@ -1,5 +1,10 @@
2004-11-04 Tor Lillqvist <tml@iki.fi> 2004-11-04 Tor Lillqvist <tml@iki.fi>
* glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
* glib/goption.c (parse_arg): Obey the above flag.
* glib/gconvert.c (g_filename_display_name): Document that the * glib/gconvert.c (g_filename_display_name): Document that the
result is guaranteed to be non-NULL. result is guaranteed to be non-NULL.

View File

@ -1,5 +1,10 @@
2004-11-04 Tor Lillqvist <tml@iki.fi> 2004-11-04 Tor Lillqvist <tml@iki.fi>
* glib/goption.h (enum GOptionFlags): Add G_OPTION_FLAG_REVERSE,
to reverse the sense of a G_OPTION_ARG_NONE (boolean) option.
* glib/goption.c (parse_arg): Obey the above flag.
* glib/gconvert.c (g_filename_display_name): Document that the * glib/gconvert.c (g_filename_display_name): Document that the
result is guaranteed to be non-NULL. result is guaranteed to be non-NULL.

View File

@ -654,7 +654,7 @@ parse_arg (GOptionContext *context,
change = get_change (context, G_OPTION_ARG_NONE, change = get_change (context, G_OPTION_ARG_NONE,
entry->arg_data); entry->arg_data);
*(gboolean *)entry->arg_data = TRUE; *(gboolean *)entry->arg_data = !(entry->flags & G_OPTION_FLAG_REVERSE);
break; break;
} }
case G_OPTION_ARG_STRING: case G_OPTION_ARG_STRING:

View File

@ -33,7 +33,8 @@ typedef struct _GOptionEntry GOptionEntry;
typedef enum typedef enum
{ {
G_OPTION_FLAG_HIDDEN = 1 << 0, G_OPTION_FLAG_HIDDEN = 1 << 0,
G_OPTION_FLAG_IN_MAIN = 1 << 1 G_OPTION_FLAG_IN_MAIN = 1 << 1,
G_OPTION_FLAG_REVERSE = 1 << 2
} GOptionFlags; } GOptionFlags;
typedef enum typedef enum