initial pass of getting all the libgimp wrappers autogenned.

-Yosh
This commit is contained in:
Manish Singh 2000-06-22 03:21:20 +00:00
parent 17d593592b
commit fef490a10e
16 changed files with 77 additions and 57 deletions

View file

@ -1,3 +1,22 @@
Wed Jun 21 20:18:16 PDT 2000 Manish Singh <yosh@gimp.org>
* tools/pdbgen/lib.pl
* tools/pdbgen/pdb/brushes.pdb
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/color.pdb
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/gimprc.pdb
* tools/pdbgen/pdb/gradient_select.pdb
* tools/pdbgen/pdb/image.pdb
* tools/pdbgen/pdb/layer.pdb
* tools/pdbgen/pdb/parasite.pdb
* tools/pdbgen/pdb/plug_in.pdb
* tools/pdbgen/pdb/procedural_db.pdb
* tools/pdbgen/pdb/selection.pdb
* tools/pdbgen/pdb/text_tool.pdb
* tools/pdbgen/pdb/unit.pdb: initial pass of getting all the libgimp
wrappers autogenned.
2000-06-19 Simon Budig <simon@gimp.org>
* app/layers_dialog.c: Layers can be renamed by pressing

View file

@ -58,7 +58,7 @@ sub generate {
my @inargs = @{$proc->{inargs}} if exists $proc->{inargs};
my @outargs = @{$proc->{outargs}} if exists $proc->{outargs};
my $funcname = "gimp_$name";
my $funcname = "gimp_$name"; my $wrapped = "";
# The 'color' argument is special cased to accept and return the
# individual color components. This is to maintain backwards
@ -107,6 +107,8 @@ sub generate {
my $arg = $arg_types{$type};
my $id = exists $arg->{id_func} || $_->{type} =~ /guide/;
$wrapped = "_" if exists $_->{wrap};
if (exists $_->{implicit_fill}) {
$privatevars++;
}
@ -153,7 +155,7 @@ CODE
if ($rettype ne 'void' || $retcol || $retvoid) {
my $once = 0;
my $firstvar;
my @arraynums;
my @initnums;
foreach (@outargs) {
my ($type) = &arg_parse($_->{type});
@ -163,10 +165,12 @@ CODE
$return_marshal = "" unless $once++;
$wrapped = "_" if exists $_->{wrap};
if (exists $_->{num}) {
if (!exists $_->{no_lib}) {
$arglist .= "gint \*$_->{name}, ";
push @arraynums, $_;
push @initnums, $_;
}
}
elsif (exists $_->{retval} && $type ne 'color') {
@ -193,7 +197,7 @@ CODE
$return_args .= " = NULL";
}
elsif ($arg->{type} =~ /boolean/) {
$return_args .= " = TRUE";
$return_args .= " = FALSE";
}
else {
# Default to 0
@ -206,10 +210,25 @@ CODE
$return_args .= "\n" . ' ' x 2 . "gint num_$var;";
}
}
elsif ($retvoid) {
push @initnums, $_;
}
}
foreach (@arraynums) { $return_marshal .= "\*$_->{name} = 0;\n " }
$return_marshal =~ s/\n $/\n\n /s if scalar(@arraynums);
if (scalar(@initnums)) {
foreach (@initnums) {
$return_marshal .= "\*$_->{name} = ";
my ($type) = &arg_parse($_->{type});
for ($arg_types{$type}->{type}) {
/\*$/ && do { $return_marshal .= "NULL"; last };
/boolean/ && do { $return_marshal .= "FALSE"; last };
/double/ && do { $return_marshal .= "0.0"; last };
$return_marshal .= "0";
}
$return_marshal .= ";\n ";
}
$return_marshal =~ s/\n $/\n\n /s;
}
$return_marshal .= <<CODE;
if (return_vals[0].data.d_status == STATUS_SUCCESS)
@ -353,12 +372,12 @@ CODE
# Our function prototype for the headers
(my $hrettype = $rettype) =~ s/ //g;
my $proto = "$hrettype $funcname ($arglist);\n";
my $proto = "$hrettype $wrapped$funcname ($arglist);\n";
$proto =~ s/ +/ /g;
push @{$out->{protos}}, $proto;
my $clist = $arglist;
my $padlen = length($funcname) + 2;
my $padlen = length($wrapped) + length($funcname) + 2;
my $padtab = $padlen / 8; my $padspace = $padlen % 8;
my $padding = "\t" x $padtab . ' ' x $padspace;
$clist =~ s/\t/$padding/eg;
@ -366,7 +385,7 @@ CODE
$out->{code} .= <<CODE;
$rettype
$funcname ($clist)
$wrapped$funcname ($clist)
{
GParam *return_vals;
gint nreturn_vals;$return_args$color

View file

@ -314,7 +314,7 @@ HELP
push @outargs, { name => 'mask_data', type => 'int8array', init => 1,
desc => 'The brush mask data',
array => { name => 'length', init => 1, no_lib => 1,
array => { name => 'length', init => 1,
desc => 'Length of brush mask data' } };
%invoke = (

View file

@ -137,7 +137,7 @@ HELP
$inargs[0]->{desc} .= ' to which to add the channel';
@outargs = (
{ name => 'channel', type => 'channel',
{ name => 'channel', type => 'channel', wrap => 1,
desc => 'The newly created channel', init => 1 }
);

View file

@ -568,7 +568,7 @@ HELP
}
@outargs = (
{ name => 'mean',
{ name => 'mean', void_ret => 1,
desc => 'Mean itensity value' },
{ name => 'std_dev',
desc => 'Standard deviation of intensity values' },

View file

@ -456,11 +456,12 @@ HELP
@outargs = (
&dim_args,
{ name => 'thumbnail_data', type => 'int8array',
desc => 'The thumbnail data', init => 1, retval => 1,
desc => 'The thumbnail data', init => 1, wrap => 1,
array => { name => 'thumbnail_data_count',
desc => 'The number of pixels in thumbnail data',
alias => 'num_pixels', init => 1 } }
);
$outargs[0]->{void_ret} = 1;
%invoke = (
headers => [ qw(<string.h> "channel.h" "layer.h") ],

View file

@ -107,7 +107,7 @@ HELP
@inargs = ( );
@outargs = (
{ name => 'xres', type => 'float',
{ name => 'xres', type => 'float', void_ret => 1,
desc => 'X resolution', alias => 'xres' },
{ name => 'yres', type => 'float',
desc => 'Y resolution', alias => 'yres' },

View file

@ -177,7 +177,7 @@ HELP
desc => 'The gradient name',
alias => 'g_strdup (gradient->name)', no_declare => 1 },
{ name => 'grad_data', type => 'floatarray', alias => 'values',
desc => 'The gradient sample data', init => 1,
desc => 'The gradient sample data', init => 1, wrap => 1,
array => { name => 'width',
desc => 'The gradient sample width (r,g,b,a)',
alias => 'sample_size * 4', no_declare => 1 } }

View file

@ -760,7 +760,7 @@ HELP
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'cmap', type => 'int8array', init => 1,
{ name => 'cmap', type => 'int8array', init => 1, wrap => 1,
desc => "The image's colormap",
array => { name => 'num_bytes', init => 1,
desc => 'Number of bytes in the colormap array:
@ -792,7 +792,7 @@ HELP
@inargs = (
&std_image_arg,
{ name => 'cmap', type => 'int8array',
{ name => 'cmap', type => 'int8array', wrap => 1,
desc => "The new colormap values",
array => { name => 'num_bytes', type => '0 <= int32 <= 768',
desc => 'Number of bytes in the colormap array:
@ -1182,6 +1182,7 @@ HELP
$date = '1998';
push @outargs, { %{$outargs[0]} };
$outargs[0]->{void_ret} = 1;
my $count = 0;
foreach $coord (qw(x y)) {
@ -1318,12 +1319,13 @@ HELP
@outargs = (
&preview_dim_args,
{ name => 'thumbnail_data', type => 'int8array',
{ name => 'thumbnail_data', type => 'int8array', wrap => 1,
desc => 'The thumbnail data', init => 1,
array => { name => 'thumbnail_data_count',
desc => 'The number of bytes in thumbnail data',
alias => 'num_bytes', init => 1 } }
);
$outargs[0]->{void_ret} = 1;
%invoke = (
headers => [ qw(<string.h>) ],

View file

@ -229,7 +229,7 @@ HELP
$inargs[0]->{desc} .= ' to which to add the layer';
@outargs = (
{ name => 'layer', type => 'layer',
{ name => 'layer', type => 'layer', wrap => 1,
desc => 'The newly created layer', init => 1 }
);
@ -266,7 +266,7 @@ HELP
$inargs[0]->{desc} .= ' to copy';
@outargs = (
{ name => 'layer_copy', type => 'layer', init => 1,
{ name => 'layer_copy', type => 'layer', init => 1, wrap => 1,
desc => 'The newly copied layer', alias => 'copy' }
);
@ -517,7 +517,7 @@ CODE2
&layer_accessors('mode', 'enum LayerModeEffects', 'combination mode', 0, 0);
&layer_accessors('linked', 'int32', 'linked state', 0, 0,
&layer_accessors('linked', 'boolean', 'linked state', 0, 0,
<<'CODE');
$author = $copyright = 'Wolfgang Hofer';
$date = '1998';

View file

@ -129,7 +129,7 @@ sub parasite_list {
$date = '1999';
@outargs = (
{ name => 'parasites', type => 'stringarray',
{ name => 'parasites', type => 'stringarray', void_ret => 1,
desc => 'The names of currently attached parasites',
array => { desc => 'The number of attached parasites' } }
);
@ -140,13 +140,6 @@ sub parasite_list {
@headers = qw("gimpparasite.h" "gimpdrawable.h"
"gimpimage.h");
$extra{lib}->{protos} = <<'CODE';
void gimp_parasite_attach_new (gchar *name,
gint flags,
gint size,
gpointer data);
CODE
$extra{lib}->{code} = <<'CODE';
void
gimp_parasite_attach_new (gchar *name,
@ -169,8 +162,6 @@ CODE
['image' , '&std_image_arg', 'gimage' ]
);
my %code;
foreach $type (@types) {
foreach (@procs[0..3]) {
my $desc = ($type->[0] =~ /^[aeiou]/ ? 'an ' : 'a ') . $type->[0];
@ -196,25 +187,8 @@ SUB
push @procs, "$type->[0]_$_";
}
foreach (qw(protos code)) {
my $code = $extra{lib}->{$_};
$code =~ s/\t/' ' x 8/eg;
$code =~ s/gimp/gimp_$type->[0]/g;
$code =~ s/^ {8}/' ' x (length($type->[0]) + 9)/meg;
while ($code =~ /^\t* {8}/m) { $code =~ s/^(\t*) {8}/$1\t/mg }
$code{$_} .= $code;
}
}
foreach (qw(protos code)) {
$extra{lib}->{$_} .= $code{$_};
}
chop $extra{lib}->{code};
%exports = (app => [@procs], lib => [@procs]);
$desc = 'Parasite procedures';

View file

@ -50,7 +50,7 @@ HELP
{ name => 'gdisplay', type => 'int32',
desc => 'GDisplay to update progressbar in, or -1 for a seperate
window',
implicit_fill => '_gdisp_ID', no_id_lookup => 1 }
implicit_fill => 'gimp_default_display ()', no_id_lookup => 1 }
);
%invoke = (

View file

@ -69,7 +69,7 @@ HELP
@outargs = (
{ name => "${type}_type", type => 'enum PDBArgType (no PDB_END)',
desc => "The type of $long_type { %%desc%% }",
desc => "The type of $long_type { %%desc%% }", wrap => 1,
alias => "${type}->arg_type", no_declare => 1 },
{ name => "${type}_name", type => 'string',
desc => "The name of the $long_type",
@ -170,7 +170,7 @@ HELP
'GIMP Extension' }>;
@outargs = (
{ name => 'procedure_names', type => 'stringarray',
{ name => 'procedure_names', type => 'stringarray', void_ret => 1,
desc => 'The list of procedure names',
alias => 'pdb_query.list_of_procs', no_declare => 1,
array => { name => 'num_matches',
@ -216,7 +216,7 @@ HELP
@inargs = ( &proc_name_arg );
@outargs = (
{ name => 'blurb', type => 'string', void_ret => 1,
{ name => 'blurb', type => 'string', void_ret => 1, wrap => 1,
desc => 'A short blurb' },
{ name => 'help', type => 'string',
desc => 'Detailed procedure help' },
@ -275,6 +275,7 @@ HELP
@outargs = ( &data_arg );
$outargs[0]->{alias} = 'data_copy';
$outargs[0]->{init} = 1;
$outargs[0]->{wrap} = 1;
%invoke = (
vars => [ 'PDBData *data = NULL', 'GList *list' ],
@ -356,6 +357,7 @@ HELP
@inargs = ( &data_ident_arg, &data_arg );
$inargs[1]->{alias} = 'data_src';
$inargs[1]->{wrap} = 1;
delete @{$inargs[1]->{array}}{qw(alias no_declare)};
%invoke = (

View file

@ -69,7 +69,7 @@ HELP
@inargs = ( &std_image_arg );
@outargs = (
{ name => 'non_empty', type => 'boolean',
{ name => 'non_empty', type => 'boolean', void_ret => 1,
desc => 'True if there is a selection', init => 1 }
);
@ -165,7 +165,7 @@ HELP
&coord_args('off$_', '$_ offset for translation', \@inargs);
@outargs = (
{ name => 'layer', type => 'layer',
{ name => 'layer', type => 'layer', wrap => 1,
desc => 'The floated layer', init => 1 }
);

View file

@ -167,6 +167,7 @@ HELP
);
&extents_outargs;
$outargs[0]->{void_ret} = 1;
%invoke = (
vars => [ 'gchar *real_fontname' ],
@ -243,6 +244,7 @@ HELP
);
&extents_outargs;
$outargs[0]->{void_ret} = 1;
%invoke = (
pass_through => 'text_get_extents_fontname',

View file

@ -26,7 +26,8 @@ sub unit_arg () {{
name => 'unit_id',
type => 'unit',
desc => "The unit's integer ID",
alias => 'unit'
alias => 'unit',
wrap => 1
}}
sub unit_prop_proc {
@ -60,7 +61,7 @@ sub unit_get_number_of_units {
@outargs = (
{ name => 'num_units', type => 'int32', libdef => 'GIMP_UNIT_END',
desc => 'The number of units',
desc => 'The number of units', wrap => 1,
alias => 'gimp_unit_get_number_of_units ()', no_declare => 1 }
);
}
@ -77,7 +78,7 @@ HELP
&pdb_misc;
@inargs = (
{ name => 'identifier', type => 'string',
{ name => 'identifier', type => 'string', wrap => 1,
desc => "The new unit's identifier" },
{ name => 'factor', type => 'float',
desc => "The new unit's factor" },