mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
pdb: properly handle enum types with acronyms and sort case-insensitively.
This will be used in particular for adding GimpTRCType to libgimp. Otherwise it generates some broken gimp_TRCtype_get_type() function name. For this use case, we need to look-ahead a bit in the regular expression.
This commit is contained in:
parent
7189010f1e
commit
50e9f360f3
2 changed files with 9 additions and 9 deletions
|
@ -45,11 +45,11 @@ static const GimpGetTypeFunc get_type_funcs[] =
|
||||||
gimp_message_handler_type_get_type,
|
gimp_message_handler_type_get_type,
|
||||||
gimp_offset_type_get_type,
|
gimp_offset_type_get_type,
|
||||||
gimp_orientation_type_get_type,
|
gimp_orientation_type_get_type,
|
||||||
|
gimp_paint_application_mode_get_type,
|
||||||
|
gimp_path_stroke_type_get_type,
|
||||||
gimp_pdb_error_handler_get_type,
|
gimp_pdb_error_handler_get_type,
|
||||||
gimp_pdb_proc_type_get_type,
|
gimp_pdb_proc_type_get_type,
|
||||||
gimp_pdb_status_type_get_type,
|
gimp_pdb_status_type_get_type,
|
||||||
gimp_paint_application_mode_get_type,
|
|
||||||
gimp_path_stroke_type_get_type,
|
|
||||||
gimp_precision_get_type,
|
gimp_precision_get_type,
|
||||||
gimp_progress_command_get_type,
|
gimp_progress_command_get_type,
|
||||||
gimp_repeat_mode_get_type,
|
gimp_repeat_mode_get_type,
|
||||||
|
@ -111,11 +111,11 @@ static const gchar * const type_names[] =
|
||||||
"GimpMessageHandlerType",
|
"GimpMessageHandlerType",
|
||||||
"GimpOffsetType",
|
"GimpOffsetType",
|
||||||
"GimpOrientationType",
|
"GimpOrientationType",
|
||||||
|
"GimpPaintApplicationMode",
|
||||||
|
"GimpPathStrokeType",
|
||||||
"GimpPDBErrorHandler",
|
"GimpPDBErrorHandler",
|
||||||
"GimpPDBProcType",
|
"GimpPDBProcType",
|
||||||
"GimpPDBStatusType",
|
"GimpPDBStatusType",
|
||||||
"GimpPaintApplicationMode",
|
|
||||||
"GimpPathStrokeType",
|
|
||||||
"GimpPrecision",
|
"GimpPrecision",
|
||||||
"GimpProgressCommand",
|
"GimpProgressCommand",
|
||||||
"GimpRepeatMode",
|
"GimpRepeatMode",
|
||||||
|
|
|
@ -72,8 +72,8 @@ foreach (sort keys %enums) {
|
||||||
! $enums{$_}->{external}) {
|
! $enums{$_}->{external}) {
|
||||||
my $gtype = $func = $_;
|
my $gtype = $func = $_;
|
||||||
|
|
||||||
for ($gtype) { s/Gimp//; s/([A-Z][^A-Z]+)/\U$1\E_/g; s/_$// }
|
for ($gtype) { s/Gimp//; s/([A-Z][^A-Z]+|[A-Z]+(?=[A-Z]))/\U$1\E_/g; s/_$// }
|
||||||
for ($func) { s/Gimp//; s/([A-Z][^A-Z]+)/\L$1\E_/g; s/_$// }
|
for ($func) { s/Gimp//; s/([A-Z][^A-Z]+|[A-Z]+(?=[A-Z]))/\L$1\E_/g; s/_$// }
|
||||||
|
|
||||||
print ENUMFILE "\n#define GIMP_TYPE_$gtype (gimp_$func\_get_type ())\n\n";
|
print ENUMFILE "\n#define GIMP_TYPE_$gtype (gimp_$func\_get_type ())\n\n";
|
||||||
print ENUMFILE "GType gimp_$func\_get_type (void) G_GNUC_CONST;\n\n";
|
print ENUMFILE "GType gimp_$func\_get_type (void) G_GNUC_CONST;\n\n";
|
||||||
|
@ -136,14 +136,14 @@ static const GimpGetTypeFunc get_type_funcs[] =
|
||||||
CODE
|
CODE
|
||||||
|
|
||||||
my $first = 1;
|
my $first = 1;
|
||||||
foreach (sort keys %enums) {
|
foreach (sort {uc($a) cmp uc($b)} keys %enums) {
|
||||||
if (! ($_ =~ /GimpUnit/)) {
|
if (! ($_ =~ /GimpUnit/)) {
|
||||||
my $enum = $enums{$_};
|
my $enum = $enums{$_};
|
||||||
my $func = $_;
|
my $func = $_;
|
||||||
my $gegl_enum = ($func =~ /Gegl/);
|
my $gegl_enum = ($func =~ /Gegl/);
|
||||||
|
|
||||||
for ($func) { s/Gimp//; s/Gegl//; s/PDB/Pdb/;
|
for ($func) { s/Gimp//; s/Gegl//; s/PDB/Pdb/;
|
||||||
s/([A-Z][^A-Z]+)/\L$1\E_/g; s/_$// }
|
s/([A-Z][^A-Z]+|[A-Z]+(?=[A-Z]))/\L$1\E_/g; s/_$// }
|
||||||
|
|
||||||
print ENUMFILE ",\n" unless $first;
|
print ENUMFILE ",\n" unless $first;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ static const gchar * const type_names[] =
|
||||||
CODE
|
CODE
|
||||||
|
|
||||||
$first = 1;
|
$first = 1;
|
||||||
foreach (sort keys %enums) {
|
foreach (sort {uc($a) cmp uc($b)} keys %enums) {
|
||||||
if (! ($_ =~ /GimpUnit/)) {
|
if (! ($_ =~ /GimpUnit/)) {
|
||||||
my $enum = $enums{$_};
|
my $enum = $enums{$_};
|
||||||
my $gtype = $_;
|
my $gtype = $_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue