gimp/tools/pdbgen
Sven Neumann 929fef0d57 added some sanity checks to temp_buf conversion routines.
2003-05-15  Sven Neumann  <sven@gimp.org>

	* app/base/temp-buf.c: added some sanity checks to temp_buf
	conversion routines.

	* tools/pdbgen/pdb/fileops.pdb (file_load_thumbnail_invoker): use
	GimpImagefile to load a thumbnail. Only works for RGB images yet.
	This adresses bug #113033.

	* app/pdb/fileops_cmds.c: regenerated.

	* app/file/file-utils.[ch]: removed file_utils_readXVThumb(). It
	is not needed any longer since GimpImagefile also handles the
	old-style .xvpics.

	* plug-ins/script-fu/scripts/copy-visible.scm: fixed typo.
2003-05-15 13:33:30 +00:00
..
app for testing 2002-04-04 07:53:39 +00:00
libgimp PDB autogen stuff. Unfinished and undocumented 1998-10-24 05:19:30 +00:00
pdb added some sanity checks to temp_buf conversion routines. 2003-05-15 13:33:30 +00:00
.cvsignore use True and False if available. Ditch GIMP_ prefixes since we have real 2003-02-08 19:47:48 +00:00
Makefile.am Removed support for pluggable tools: 2003-04-15 14:20:19 +00:00
README add the new args to gimp-paintbrush PDB calls. 1999-04-20 23:03:31 +00:00
app.pl include locale.h for setlocale(). 2003-03-25 17:39:01 +00:00
enumcode-py.pl use True and False if available. Ditch GIMP_ prefixes since we have real 2003-02-08 19:47:48 +00:00
enumcode.pl use True and False if available. Ditch GIMP_ prefixes since we have real 2003-02-08 19:47:48 +00:00
enumgen.pl tools/pdbgen/app.pl tools/pdbgen/enumcode-py.pl tools/pdbgen/enumcode.pl 2002-03-17 22:54:26 +00:00
enums.pl register GimpPaintApplicationMode with the type system. 2003-03-24 17:58:28 +00:00
groups.pl app/gui/Makefile.am added font selection GUI to be used through the PDB. 2003-03-28 14:13:54 +00:00
lib.pl try to complete the aborted commit 2003-02-06 18:51:44 +00:00
pdb.pl added check_funcs (GIMP_IS_LAYER, GIMP_IS_IMAGE etc.) to all data types 2002-08-29 17:21:21 +00:00
pdbgen.pl added 2000 to the copyrights 2000-02-17 11:44:27 +00:00
stddefs.pdb changed GimpOrientationType from GIMP_HORIZONTAL to 2003-02-09 21:03:36 +00:00
util.pl added 2000 to the copyrights 2000-02-17 11:44:27 +00:00

README

Some mostly unfinished docs are here.

-Yosh

PDBGEN
------------------

What is this?
It's a tool to automate much of the drudge work of making PDB interfaces
to GIMP internals. Right now, it generates PDB description records,
argument marshallers (with sanity checking) for the app side, as well
as libgimp wrappers for C plugins. It's written so that extending it
to provide support for CORBA and other languages suited to static
autogeneration.

How to invoke pdbgen from the command line:
Change into the ./tools/pdbgen directory
  $ ./pdbgen.pl DIRNAME
where DIRNAME is either "lib" or "app", depending on which set of
files you want to generate.  The files are written to ./app or ./lib
in the ./tools/pdbgen directory.  Up to you to diff the file you
changed and when you're happy copy it into the actual ./app/ or ./lib/
directory where it gets built.

Anatomy of a PDB descriptor:
PDB descriptors are Perl code. You define a subroutine, which corresponds
to the PDB function you want to create. You then fill certain special
variables to fully describe all the information pdbgen needs to generate
code. Since it's perl, you can do practically whatever perl lets you
do to help you do this. However, at the simplest level, you don't need
to know perl at all to make PDB descriptors.

Annotated description:
For example, we will look at gimp_display_new, specified in gdisplay.pdb.

sub display_new { 

We start with the name of our PDB function (not including the "gimp_" prefix).

    $blurb = 'Create a new display for the specified image.';

This directly corresponds to the "blurb" field in the ProcRecord.

    $help = <<'HELP';
Creates a new display for the specified image. If the image already has a
display, another is added. Multiple displays are handled transparently by the
GIMP. The newly created display is returned and can be subsequently destroyed
with a call to 'gimp-display-delete'. This procedure only makes sense for use
with the GIMP UI.
HELP

This is the help field. Notice because it is a long string, we used HERE
document syntax to split it over multiple lines. Any extra whitespace
in $blurb or $help, including newlines, is automatically stripped, so you
don't have to worry about that.

    &std_pdb_misc;

This is the "author", "copyright", and "date" fields. Since S&P are quite
common, they get a special shortcut which fills these in for you. Stuff
like this is defined in stddefs.pdb.

    @inargs = ( &std_image_arg );

You specify arguments in a list. Again, your basic image is very common,
so it gets a shortcut.

    @outargs = (
        { name => 'display', type => 'display',
          desc => 'The new display', alias => 'gdisp', init => 1 }
    );

This is a real argument. It has a name, type, description at a minumum.
"alias" lets you use the alias name in your invoker code, but the real
name is still shown in the ProcRecord. This is useful not only as a
shorthand, but for grabbing variables defined somewhere else (or constants),
in conjunction with the "no_declare" flag. "init" simply says initialize
this variable to a dummy value (in this case to placate gcc warnings)

    %invoke = (
        headers => [ qw("gdisplay.h") ],

These are the headers needed for the functions you call.

        vars => [ 'guint scale = 0x101' ],

Extra variables can be put here for your invoker.

        code => <<'CODE'
{
  if (gimage->layers == NULL)
    success = FALSE;
  else
    success = ((gdisp = gdisplay_new (gimage, scale)) != NULL);
}
CODE

The actual invoker code. Since it's a multiline block, we put curly braces
in the beginning.