synced with glib-mkenums (execept for the newly added template feature).

2004-07-28  Sven Neumann  <sven@gimp.org>

	* tools/gimp-mkenums: synced with glib-mkenums (execept for the
	newly added template feature).
This commit is contained in:
Sven Neumann 2004-07-28 02:10:49 +00:00 committed by Sven Neumann
parent 80a40f0b96
commit 2adc9be23f
1 changed files with 12 additions and 3 deletions

View File

@ -89,7 +89,9 @@ sub parse_entries {
if (m@^\s*
(\w+)\s* # name
(?:=( # value
(?:[^,/]|/(?!\*))*
\s*\w+\s*\(.*\)\s* # macro with multiple args
| # OR
(?:[^,/]|/(?!\*))* # anything but a comma or comment
))?,?\s*
(?:/\*< # options
(([^*]|\*(?!/))*)
@ -195,7 +197,7 @@ while ($_ = $ARGV[0], /^-/) {
if (length($fhead)) {
my $prod = $fhead;
$prod =~ s/\@filename\@/$ARGV/g;
$prod =~ s/\@filename\@/$ARGV[0]/g;
$prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
$prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
@ -230,9 +232,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) {
@ -313,6 +317,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;
@ -366,7 +375,7 @@ while (<>) {
$prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
for (@entries) {
my ($name,$nick,$desc) = @{$_};
my $tmp_prod = $vprod;
my $tmp_prod = $prod;
$tmp_prod =~ s/\@VALUENAME\@/$name/g;
$tmp_prod =~ s/\@valuenick\@/$nick/g;