stas 2003/03/23 20:29:45
Modified: lib/ModPerl WrapXS.pm
Log:
make the autogenerated typemap more-readable (sorted and aligned)
Revision Changes Path
1.53 +12 -4 modperl-2.0/lib/ModPerl/WrapXS.pm
Index: WrapXS.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/WrapXS.pm,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- WrapXS.pm 24 Mar 2003 03:02:10 -0000 1.52
+++ WrapXS.pm 24 Mar 2003 04:29:45 -0000 1.53
@@ -535,18 +535,26 @@
my $fh = $self->open_class_file('ModPerl::WrapXS', 'typemap');
print $fh $self->ModPerl::Code::noedit_warning_hash(), "\n";
+ my %entries = ();
+ my $max_key_len = 0;
while (my($type, $class) = each %$map) {
$class ||= $type;
+ my $val;
next if $seen{$type}++ || $typemap->special($class);
if ($class =~ /::/) {
- my $typemap = $typemap{$class} || 'T_PTROBJ';
- print $fh "$class\t$typemap\n";
+ $val = $typemap{$class} || 'T_PTROBJ';
}
else {
- my $typemap = $typemap{$type} || "T_$class";
- print $fh "$type\t$typemap\n";
+ $val = $typemap{$type} || "T_$class";
}
+
+ $entries{$type} = $val;
+ $max_key_len = length $type if length $type > $max_key_len;
+ }
+
+ for (sort keys %entries) {
+ printf $fh "%-${max_key_len}s %s\n", $_, $entries{$_};
}
close $fh;