tools/pdbgen/pdbgen.pl some simplistic code to add a $deprecated flag to

2004-06-15  Manish Singh  <yosh@gimp.org>

        * tools/pdbgen/pdbgen.pl
        * tools/pdbgen/lib.pl: some simplistic code to add a $deprecated
        flag to pdb definitions, which translates into GIMP_DISABLE_DEPRECATED
        guards in lib headers.
This commit is contained in:
Manish Singh
2004-06-15 21:08:14 +00:00
committed by Manish Singh
parent 8ab1ae98a3
commit 58dc763b63
3 changed files with 64 additions and 27 deletions

View File

@ -1,3 +1,10 @@
2004-06-15 Manish Singh <yosh@gimp.org>
* tools/pdbgen/pdbgen.pl
* tools/pdbgen/lib.pl: some simplistic code to add a $deprecated
flag to pdb definitions, which translates into GIMP_DISABLE_DEPRECATED
guards in lib headers.
2004-06-15 Michael Natterer <mitch@gimp.org> 2004-06-15 Michael Natterer <mitch@gimp.org>
* app/actions/Makefile.am * app/actions/Makefile.am

View File

@ -432,7 +432,13 @@ CODE
my $proto = "$hrettype $wrapped$funcname ($arglist);\n"; my $proto = "$hrettype $wrapped$funcname ($arglist);\n";
$proto =~ s/ +/ /g; $proto =~ s/ +/ /g;
if ($proc->{deprecated}) {
push @{$out->{protos}}, "#ifndef GIMP_DISABLE_DEPRECATED\n";
}
push @{$out->{protos}}, $proto; push @{$out->{protos}}, $proto;
if ($proc->{deprecated}) {
push @{$out->{protos}}, "#endif /* GIMP_DISABLE_DEPRECATED */\n";
}
my $clist = $arglist; my $clist = $arglist;
my $padlen = length($wrapped) + length($funcname) + 2; my $padlen = length($wrapped) + length($funcname) + 2;
@ -535,19 +541,28 @@ LGPL
my @longest = (0, 0, 0); my @arglist = (); my $seen = 0; my @longest = (0, 0, 0); my @arglist = (); my $seen = 0;
foreach (@{$out->{protos}}) { foreach (@{$out->{protos}}) {
my $len; my $arglist = [ split(' ', $_, 3) ]; my $arglist;
for (0..1) { if (!/^#/) {
$len = length($arglist->[$_]); my $len;
$longest[$_] = $len if $longest[$_] < $len;
$arglist = [ split(' ', $_, 3) ];
for (0..1) {
$len = length($arglist->[$_]);
$longest[$_] = $len if $longest[$_] < $len;
}
foreach (split(/,/, $arglist->[2])) {
next unless /(const \w+) \S+/ || /(\w+) \S+/;
$len = length($1) + 1;
my $num = scalar @{[ /\*/g ]};
$seen = $num if $seen < $num;
$longest[2] = $len if $longest[2] < $len;
}
} }
else {
foreach (split(/,/, $arglist->[2])) { $arglist = $_;
next unless /(const \w+) \S+/ || /(\w+) \S+/;
$len = length($1) + 1;
my $num = scalar @{[ /\*/g ]};
$seen = $num if $seen < $num;
$longest[2] = $len if $longest[2] < $len;
} }
push @arglist, $arglist; push @arglist, $arglist;
@ -557,23 +572,38 @@ LGPL
@{$out->{protos}} = (); @{$out->{protos}} = ();
foreach (@arglist) { foreach (@arglist) {
my ($type, $func, $arglist) = @$_; my $arg;
my @args = split(/,/, $arglist); $arglist = ""; if (ref) {
foreach (@args) { my ($type, $func, $arglist) = @$_;
$space = rindex($_, ' ');
my $len = $longest[2] - $space + 1; my @args = split(/,/, $arglist); $arglist = "";
$len -= scalar @{[ /\*/g ]};
$len++ if /\t/; foreach (@args) {
substr($_, $space, 1) = ' ' x $len if $space != -1 && $len > 1; $space = rindex($_, ' ');
$arglist .= $_; my $len = $longest[2] - $space + 1;
$arglist .= "," if !/;\n$/;
$len -= scalar @{[ /\*/g ]};
$len++ if /\t/;
if ($space != -1 && $len > 1) {
substr($_, $space, 1) = ' ' x $len;
}
$arglist .= $_;
$arglist .= "," if !/;\n$/;
}
$arg = $type;
$arg .= ' ' x ($longest[0] - length($type) + 1) . $func;
$arg .= ' ' x ($longest[1] - length($func) + 1) . $arglist;
$arg =~ s/\t/' ' x ($longest[0] + $longest[1] + 3)/eg;
while ($arg =~ /^\t* {8}/m) { $arg =~ s/^(\t*) {8}/$1\t/mg }
}
else {
$arg = $_;
} }
my $arg = $type;
$arg .= ' ' x ($longest[0] - length($type) + 1) . $func;
$arg .= ' ' x ($longest[1] - length($func) + 1) . $arglist;
$arg =~ s/\t/' ' x ($longest[0] + $longest[1] + 3)/eg;
while ($arg =~ /^\t* {8}/m) { $arg =~ s/^(\t*) {8}/$1\t/mg }
push @{$out->{protos}}, $arg; push @{$out->{protos}}, $arg;
} }

View File

@ -67,7 +67,7 @@ $evalcode = <<'CODE';
# Variables to evaluate and insert into the PDB structure # Variables to evaluate and insert into the PDB structure
my @procvars = qw($name $group $blurb $help $author $copyright $date $since my @procvars = qw($name $group $blurb $help $author $copyright $date $since
@inargs @outargs %invoke); $deprecated @inargs @outargs %invoke);
# These are attached to the group structure # These are attached to the group structure
my @groupvars = qw($desc @headers %extra); my @groupvars = qw($desc @headers %extra);