diff --git a/tools/gimp-mkenums b/tools/gimp-mkenums index 54b5aa83e7..7892ff2ff1 100755 --- a/tools/gimp-mkenums +++ b/tools/gimp-mkenums @@ -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;