mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 18:26:19 +01:00
applied patch from David Necas which introduces an underscore_name option
Tue Oct 10 12:06:08 2006 Tim Janik <timj@gtk.org> * glib-mkenums.in: * glib-mkenums.1: applied patch from David Necas which introduces an underscore_name option and fixes #358734.
This commit is contained in:
parent
4766e33d9b
commit
49eacae2a3
@ -1,3 +1,9 @@
|
|||||||
|
Tue Oct 10 12:06:08 2006 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
|
* glib-mkenums.in:
|
||||||
|
* glib-mkenums.1: applied patch from David Necas which introduces
|
||||||
|
an underscore_name option and fixes #358734.
|
||||||
|
|
||||||
Mon Oct 2 15:50:16 2006 Tim Janik <timj@gtk.org>
|
Mon Oct 2 15:50:16 2006 Tim Janik <timj@gtk.org>
|
||||||
|
|
||||||
* gvalue.c (g_value_peek_pointer): reverted a change to have an
|
* gvalue.c (g_value_peek_pointer): reverted a change to have an
|
||||||
|
@ -126,8 +126,9 @@ start out with the trigraph sequence "/*<" and end with the trigraph sequence ">
|
|||||||
Per enum definition, the options "skip" and "flags" can be specified, to indicate
|
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
|
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,
|
to specify the common prefix to be stripped from all values to generate value nicknames,
|
||||||
respectively. The "lowercase_name" option can be used to specify the word separation used
|
respectively. The "underscore_name" option can be used to specify the underscorized name
|
||||||
in the *_get_type() function. For instance, /*< lowercase_name=gnome_vfs_uri_hide_options >*/.
|
variant used in the *_get_type() function and *_TYPE_* macro. For instance,
|
||||||
|
/*< underscore_name=gnome_vfs_uri_hide_options >*/.
|
||||||
.PP
|
.PP
|
||||||
Per value definition, the options "skip" and "nick" are supported. The former causes the
|
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
|
value to be skipped, and the latter can be used to specify the otherwise auto-generated
|
||||||
|
@ -3,8 +3,14 @@
|
|||||||
# glib-mkenums.pl
|
# glib-mkenums.pl
|
||||||
# Information about the current enumeration
|
# Information about the current enumeration
|
||||||
my $flags; # Is enumeration a bitmask?
|
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.
|
my $option_underscore_name; # Overriden underscore variant of the enum name
|
||||||
# For instance, when an enum uses abnormal capitalization and we can not guess where to put the underscores.
|
# for example to fix the cases we don't get the
|
||||||
|
# mixed-case -> underscorized transform right.
|
||||||
|
my $option_lowercase_name; # DEPRECATED. 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 $seenbitshift; # Have we seen bitshift operators?
|
||||||
my $enum_prefix; # Prefix for this enumeration
|
my $enum_prefix; # Prefix for this enumeration
|
||||||
my $enumname; # Name for this enumeration
|
my $enumname; # Name for this enumeration
|
||||||
@ -184,8 +190,7 @@ sub read_template_file {
|
|||||||
elsif (($in eq $2) && ($1 eq 'END') && (exists($tmpl{$2}))) {
|
elsif (($in eq $2) && ($1 eq 'END') && (exists($tmpl{$2}))) {
|
||||||
$in = 'junk';
|
$in = 'junk';
|
||||||
next;
|
next;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
die "Malformed template file $file\n";
|
die "Malformed template file $file\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,10 +280,20 @@ while (<>) {
|
|||||||
$enum_prefix = $options{prefix};
|
$enum_prefix = $options{prefix};
|
||||||
$flags = $options{flags};
|
$flags = $options{flags};
|
||||||
$option_lowercase_name = $options{lowercase_name};
|
$option_lowercase_name = $options{lowercase_name};
|
||||||
|
$option_underscore_name = $options{underscore_name};
|
||||||
} else {
|
} else {
|
||||||
$enum_prefix = undef;
|
$enum_prefix = undef;
|
||||||
$flags = undef;
|
$flags = undef;
|
||||||
$option_lowercase_name = undef;
|
$option_lowercase_name = undef;
|
||||||
|
$option_underscore_name = undef;
|
||||||
|
}
|
||||||
|
if (defined $option_lowercase_name) {
|
||||||
|
if (defined $option_underscore_name) {
|
||||||
|
print STDERR "$0: $ARGV:$.: lowercase_name overriden with underscore_name\n";
|
||||||
|
$option_lowercase_name = undef;
|
||||||
|
} else {
|
||||||
|
print STDERR "$0: $ARGV:$.: lowercase_name is deprecated, use underscore_name\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# Didn't have trailing '{' look on next lines
|
# Didn't have trailing '{' look on next lines
|
||||||
if (!defined $1 && !defined $4) {
|
if (!defined $1 && !defined $4) {
|
||||||
@ -340,7 +355,12 @@ while (<>) {
|
|||||||
|
|
||||||
|
|
||||||
# Spit out the output
|
# Spit out the output
|
||||||
|
if (defined $option_underscore_name) {
|
||||||
|
$enumlong = uc $option_underscore_name;
|
||||||
|
$enumsym = lc $option_underscore_name;
|
||||||
|
$enumshort = $enumlong;
|
||||||
|
$enumshort =~ s/^[A-Z][A-Z0-9]*_//;
|
||||||
|
} else {
|
||||||
# enumname is e.g. GMatchType
|
# enumname is e.g. GMatchType
|
||||||
$enspace = $enumname;
|
$enspace = $enumname;
|
||||||
$enspace =~ s/^([A-Z][a-z]*).*$/$1/;
|
$enspace =~ s/^([A-Z][a-z]*).*$/$1/;
|
||||||
@ -354,10 +374,10 @@ while (<>) {
|
|||||||
$enumlong = uc($enspace) . "_" . $enumshort;
|
$enumlong = uc($enspace) . "_" . $enumshort;
|
||||||
$enumsym = lc($enspace) . "_" . lc($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)) {
|
if (defined($option_lowercase_name)) {
|
||||||
$enumsym = $option_lowercase_name;
|
$enumsym = $option_lowercase_name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($firstenum) {
|
if ($firstenum) {
|
||||||
$firstenum = 0;
|
$firstenum = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user