From 10bacd60587c883b794c94d323338bb07405d5ec Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Tue, 30 Dec 2003 10:42:57 +0000 Subject: [PATCH] Added a lowercase_name option, to be used next to the enum declaration, 2003-12-30 Murray Cumming * gobject/glib-mkenums.in: Added a lowercase_name option, to be used next to the enum declaration, where the flag option is already used, when it is not possible to guess where to put the underscores in the _get_type() function name, for instance for GNOMEVFSURIHide. --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-12 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ docs/reference/gobject/glib-mkenums.xml | 6 +++++- gobject/glib-mkenums.in | 9 +++++++++ 8 files changed, 56 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c48c0859..3829493c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-12-30 Murray Cumming + + * gobject/glib-mkenums.in: Added a lowercase_name option, to be used + next to the enum declaration, where the flag option is already used, + when it is not possible to guess where to put the underscores in the + _get_type() function name, for instance for GNOMEVFSURIHide. + Fri Dec 26 02:03:58 2003 Matthias Clasen * glib/garray.[hc] (g_ptr_array_foreach): New function to diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c48c0859..3829493c 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2003-12-30 Murray Cumming + + * gobject/glib-mkenums.in: Added a lowercase_name option, to be used + next to the enum declaration, where the flag option is already used, + when it is not possible to guess where to put the underscores in the + _get_type() function name, for instance for GNOMEVFSURIHide. + Fri Dec 26 02:03:58 2003 Matthias Clasen * glib/garray.[hc] (g_ptr_array_foreach): New function to diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index c48c0859..3829493c 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,10 @@ +2003-12-30 Murray Cumming + + * gobject/glib-mkenums.in: Added a lowercase_name option, to be used + next to the enum declaration, where the flag option is already used, + when it is not possible to guess where to put the underscores in the + _get_type() function name, for instance for GNOMEVFSURIHide. + Fri Dec 26 02:03:58 2003 Matthias Clasen * glib/garray.[hc] (g_ptr_array_foreach): New function to diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index c48c0859..3829493c 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +2003-12-30 Murray Cumming + + * gobject/glib-mkenums.in: Added a lowercase_name option, to be used + next to the enum declaration, where the flag option is already used, + when it is not possible to guess where to put the underscores in the + _get_type() function name, for instance for GNOMEVFSURIHide. + Fri Dec 26 02:03:58 2003 Matthias Clasen * glib/garray.[hc] (g_ptr_array_foreach): New function to diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c48c0859..3829493c 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2003-12-30 Murray Cumming + + * gobject/glib-mkenums.in: Added a lowercase_name option, to be used + next to the enum declaration, where the flag option is already used, + when it is not possible to guess where to put the underscores in the + _get_type() function name, for instance for GNOMEVFSURIHide. + Fri Dec 26 02:03:58 2003 Matthias Clasen * glib/garray.[hc] (g_ptr_array_foreach): New function to diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c48c0859..3829493c 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2003-12-30 Murray Cumming + + * gobject/glib-mkenums.in: Added a lowercase_name option, to be used + next to the enum declaration, where the flag option is already used, + when it is not possible to guess where to put the underscores in the + _get_type() function name, for instance for GNOMEVFSURIHide. + Fri Dec 26 02:03:58 2003 Matthias Clasen * glib/garray.[hc] (g_ptr_array_foreach): New function to diff --git a/docs/reference/gobject/glib-mkenums.xml b/docs/reference/gobject/glib-mkenums.xml index b8e4032f..92668e8b 100644 --- a/docs/reference/gobject/glib-mkenums.xml +++ b/docs/reference/gobject/glib-mkenums.xml @@ -240,7 +240,11 @@ and end with the trigraph sequence >*/. Per enum definition, the options "skip" and "flags" can be specified, to indicate this enum definition to be skipped, or for it to be treated as a flags definition, or to specify the common prefix to be stripped from -all values to generate value nicknames, respectively. +all values to generate value nicknames, respectively. The "lowercase_name" +option can be used to specify the word separation used in the *_get_type() +function. For instance, /*< lowercase_name=gnome_vfs_uri_hide_options >*/. + + Per value definition, the options "skip" and "nick" are supported. The former causes the value to be skipped, and the latter can be used to specify the otherwise auto-generated nickname. diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in index ec2575fd..1643fd62 100755 --- a/gobject/glib-mkenums.in +++ b/gobject/glib-mkenums.in @@ -3,6 +3,8 @@ # glib-mkenums.pl # Information about the current enumeration my $flags; # Is enumeration a bitmask? +my $option_lowercase_name; # A lower case name to use as part of the *_get_type() function, instead of the one that we guess. + # For instance, when an enum uses abnormal capitalization and we can not guess where to put the underscores. my $seenbitshift; # Have we seen bitshift operators? my $enum_prefix; # Prefix for this enumeration my $enumname; # Name for this enumeration @@ -268,9 +270,11 @@ while (<>) { next if defined $options{skip}; $enum_prefix = $options{prefix}; $flags = $options{flags}; + $option_lowercase_name = $options{lowercase_name}; } else { $enum_prefix = undef; $flags = undef; + $option_lowercase_name = undef; } # Didn't have trailing '{' look on next lines if (!defined $1) { @@ -346,6 +350,11 @@ while (<>) { $enumlong = uc($enspace) . "_" . $enumshort; $enumsym = lc($enspace) . "_" . lc($enumshort); + #The options might override the lower case name if it could not be generated correctly: + if (defined($option_lowercase_name)) { + $enumsym = $option_lowercase_name; + } + if ($firstenum) { $firstenum = 0; -- 2.34.1