Commit 17be1d18 authored by Manish Singh's avatar Manish Singh
Browse files

Another checkpoint

-Yosh
parent cef394a9
......@@ -51,8 +51,10 @@ sub declare_args {
}
unless (exists $_->{no_declare}) {
$result .= ' ' x 2;
$result .= $arg->{type} . &arg_vname($_) . ";\n";
my $type = $arg->{type};
$result .= ' ' x 2 . $type . &arg_vname($_);
$result .= ' = NULL' if exists $_->{init} && $type =~ /\*$/;
$result .= ";\n";
if (exists $arg->{id_headers}) {
foreach (@{$arg->{id_headers}}) {
......@@ -61,9 +63,10 @@ sub declare_args {
}
if (exists $_->{get}) {
$result .= ' ' x 2;
$result .= $arg_types{$_->{get}->{type}}->{type};
$result .= &arg_vname($_->{get}) . ";\n";
my $type = $arg_types{$_->{get}->{type}}->{type};
$result .= ' ' x 2 . $type . &arg_vname($_->{get});
$result .= ' = NULL' if $type =~ /\*$/;
$result .= ";\n";
}
}
}
......@@ -87,12 +90,15 @@ sub make_args {
foreach my $arg (@{$proc->{$_}}) {
my ($type) = &arg_parse($arg->{type});
local ($desc) = "";
$desc = 'TRUE or FALSE' if $type eq 'boolean';
$result .= <<CODE;
{
PDB_$arg_types{$type}->{name},
"$arg->{name}",
"$arg->{desc}"
"@{[ eval qq/"$arg->{desc}"/ ]}"
},
CODE
}
......@@ -121,27 +127,16 @@ sub marshal_inargs {
my $var = &arg_vname($_);
if (exists $arg->{id_func}) {
my $code = "";
$code .= <<CODE;
$result .= <<CODE;
if (($var = $arg->{id_func} (args[$argc].value.pdb_$type)) == NULL)
success = FALSE;
CODE
$code .= <<CODE if exists $_->{get};
$result .= <<CODE if exists $_->{get};
else
@{[ &arg_vname($_->{get}) ]} = @{[ eval qq/"$arg->{$_->{get}->{type}}"/ ]};
CODE
if ($success) {
$code =~ s/^/' ' x 4/meg;
$code =~ s/^ {8}/\t/mg;
$result .= "{\n" . $code . ' ' x 4 . "}\n";
}
else {
$result .= $code;
}
$success = 1;
}
else {
......@@ -337,7 +332,7 @@ CODE
my $gpl = <<'GPL';
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 1995-1999 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -354,6 +349,8 @@ CODE
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl. */
GPL
my $internal = "$destdir/internal_procs.h$FILE_EXT";
......
......@@ -280,7 +280,7 @@ CODE
my $lgpl = <<'LGPL';
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* Copyright (C) 1995-1999 Peter Mattis and Spencer Kimball
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -298,6 +298,8 @@ CODE
* Boston, MA 02111-1307, USA.
*/
/* NOTE: This file is autogenerated by pdbgen.pl */
LGPL
# We generate two files, a .h file with prototypes for all the functions
......
......@@ -36,7 +36,7 @@ HELP
@outargs = (
{ name => 'display', type => 'display',
desc => 'The new display', alias => 'gdisp' }
desc => 'The new display', alias => 'gdisp', init => 1 }
);
%invoke = (
......
......@@ -97,7 +97,7 @@ HELP
@outargs = (
{ name => 'floating_sel', type => 'layer',
desc => 'The new floating selection', alias => 'layer' }
desc => 'The new floating selection', alias => 'layer', init => 1 }
);
&invoke('layer != NULL');
......
......@@ -31,7 +31,7 @@ sub invoke {
headers => [ qw("layer.h" "floating_sel.h") ],
code => <<CODE
{
if (! layer_is_floating_sel (floating_sel))
if (!layer_is_floating_sel (floating_sel))
success = FALSE;
else
$cmd (floating_sel);
......@@ -89,7 +89,64 @@ HELP
&invoke;
}
@procs = qw(floating_sel_remove floating_sel_anchor floating_sel_to_layer);
sub floating_sel_attach {
$blurb = <<'BLURB';
Attach the specified layer as floating to the specified drawable.
BLURB
$help = <<'HELP';
This procedure attaches the layer as floating selection to the drawable.
HELP
&std_pdb_misc;
@inargs = (
{ name => 'layer', type => 'layer',
desc => 'The layer (is attached as floating selection)' },
{ name => 'drawable', type => 'drawable',
desc => 'The drawable (where to attach the floating selection)' }
);
%invoke = (
headers => [ qw("floating_sel.h") ],
code => 'floating_sel_attach (layer, drawable);'
);
}
sub floating_sel_rigor {
$blurb = 'Rigor the floating selection.';
$help = <<'HELP';
This procedure rigors the floating selection.
HELP
&std_pdb_misc;
&inargs;
push @inargs, { name => 'undo', type => 'boolean', desc => '$desc' };
&invoke;
$invoke{code} =~ s/\(floating_sel\);/(floating_sel, undo);/;
}
sub floating_sel_relax {
$blurb = 'Relax the floating selection.';
$help = <<'HELP';
This procedure relaxes the floating selection.
HELP
&std_pdb_misc;
&inargs;
push @inargs, { name => 'undo', type => 'boolean', desc => '$desc' };
&invoke;
$invoke{code} =~ s/\(floating_sel\);/(floating_sel, undo);/;
}
@procs = qw(floating_sel_remove floating_sel_anchor floating_sel_to_layer
floating_sel_attach floating_sel_rigor floating_sel_relax);
%exports = (app => [@procs]);
$desc = 'Floating selections';
......
......@@ -36,7 +36,7 @@ HELP
@outargs = (
{ name => 'display', type => 'display',
desc => 'The new display', alias => 'gdisp' }
desc => 'The new display', alias => 'gdisp', init => 1 }
);
%invoke = (
......
......@@ -175,11 +175,13 @@ while ((undef, $entry) = each %pdb) {
&nicetext(\$entry->{copyright});
&nicetext(\$entry->{date});
&arrayexpand(\$entry->{inargs}) if exists $entry->{inargs};
&arrayexpand(\$entry->{outargs}) if exists $entry->{outargs};
&niceargs($entry->{inargs}) if exists $entry->{inargs};
&niceargs($entry->{outargs}) if exists $entry->{outargs};
foreach (qw(in out)) {
my $args = $_ . 'args';
if (exists $entry->{$args}) {
&arrayexpand(\$entry->{$args});
&niceargs($entry->{$args});
}
}
&nicelist($entry->{invoke}{headers}) if exists $entry->{invoke}{headers};
&nicelist($entry->{globals}) if exists $entry->{globals};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment