diff --git a/gobject/glib-mkenums.1 b/gobject/glib-mkenums.1 index 0837d082c..cacddfff6 100644 --- a/gobject/glib-mkenums.1 +++ b/gobject/glib-mkenums.1 @@ -118,6 +118,9 @@ The same as \fI@type@\fP with all letters uppercased (e.g. FLAGS). .TP 12 \fI@filename@ The name of the input file currently being processed (e.g. foo.h). +.TP 12 +\fI@basename@ +The base name of the input file currently being processed (e.g. foo.h). (Since: 2.22) .SS Trigraph extensions Some C comments are treated specially in the parsed enum definitions, such comments diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in index 9bb5aa90c..1e4062267 100755 --- a/gobject/glib-mkenums.in +++ b/gobject/glib-mkenums.in @@ -1,5 +1,7 @@ #!@PERL_PATH@ -w +use File::Basename; + # glib-mkenums.pl # Information about the current enumeration my $flags; # Is enumeration a bitmask? @@ -160,6 +162,7 @@ sub usage { print " \@Type\@ either Enum or Flags\n"; print " \@TYPE\@ either ENUM or FLAGS\n"; print " \@filename\@ name of current input file\n"; + print " \@basename\@ base name of the current input file (Since: 2.22)\n"; exit 0; } @@ -247,8 +250,10 @@ while ($_=$ARGV[0],/^-/) { if (length($fhead)) { my $prod = $fhead; + my $base = basename ($ARGV[0]); $prod =~ s/\@filename\@/$ARGV[0]/g; + $prod =~ s/\@basename\@/$base/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; chomp ($prod); @@ -397,8 +402,10 @@ while (<>) { if (length($fprod)) { my $prod = $fprod; + my $base = basename ($ARGV); $prod =~ s/\@filename\@/$ARGV/g; + $prod =~ s/\@basename\@/$base/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; chomp ($prod); @@ -485,8 +492,10 @@ while (<>) { if (length($ftail)) { my $prod = $ftail; + my $base = basename ($ARGV); $prod =~ s/\@filename\@/$ARGV/g; + $prod =~ s/\@basename\@/$base/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; chomp ($prod);