On Fri, 2004-01-30 at 13:06, [EMAIL PROTECTED] wrote:
> On Fri, Jan 30, 2004 at 11:57:32AM -0500, Kevin Cozens <[EMAIL PROTECTED]> wrote:
> > > A third set? I was afraid that might be the case.
> Well, a set extremely similar and in-sync (at least loosely) to the C
> contants, so while technically different constant names, there is a very
> easy rule to convert from C to Perl: drop the GIMP_. The gimpdoc program
> already converts between C and Perl method syntax, so it could just be
> extended to drop DIMP_ for Contants, too.
> > I will take a look at the way gimp-perl does things.
> Constants are hardcoded in Gimp.pm, and there is a program named insenums
> which will replace these in-place.
For Script-Fu, the leading GIMP- part was being dropped. I will leave
the gimp-perl stuff alone for now but for consistancy, it should be
updated to accept the "new" versions of the enums as well as the
existing (backwards compatible) ones.
> I am not sure wether I understand your concept of "sameness". To me,
> GIMP_RGB_IMAGE, RGB-IMAGE and RGB_IMAGE is exactly the same constant, just
> as gimp-drawable-add-layer is the same as gimp_drawable_add_layer and
It is a case of "a rose by any other name" or in this case "a constant
by any other name" to paraphrase Shakespeare. Yes, GIMP_RGB_IMAGE,
RGB-IMAGE, and RGB_IMAGE are numerically the same. If you use numerical
values for function call arguments, then you use the same numbers
regardless of plug-in language. On the other hand, if you want to create
a new image using an indexed palette its easier to remember to use
GIMP_INDEXED_IMAGE rather than 4 or was that INDEXED_IMAGE, or
INDEXED-IMAGE? What type of plug-in am I writing again? :-) You get the
> > For other languages you would need a one liner explaining whether they
> > are the same as for C or whether you need to change _ to - and you are
> > done.
> This is the situation with perl right now, although that line is probably
> hard to find, but people don't read this type of documentation anyway,
> they just look at other scripts, and then consistency really pays off.
Thats right. People often don't RTFM apart from the difficulty one often
has finding relevant documentation. If you go to http://www.gimp.org/,
click on documentation, scroll down to the PDB section, then click on
the "Procedural Data-Base" link you get a page called pdb.html. Under
"Browsing the PDB", it states the following:
Because the PDB includes info about plugins, scripts, and extensions, it
is very dynamic. The easiest way to search and browse the PDB is to use
the DB Browser extension included with the gimp. This is located under
the Xtns menu on the main toolbar and allows you to browse and search
through the PDB. Very handy.
Followed a bit further down with:
A typical use of the PDB is to write scripts or plugins.
Very handy indeed, and no reference to differences in the named
constants based on whether you are writing a script or a (C-based)
plug-in. Another reason to keep things close to what is listed under the
DB Browser. People are told to use the DB Browser information and yet,
it provides misleading information that could frustrate the budding new
script writer out there.
And finally, on line 263 of plug-ins/script-fu/siod-wrapper.c is a
comment which reads:
These are for backwards compatibility; they should be removed sometime
Following that comment are statements which allow the parser to
understand the older constants (ie. the ones not starting with GIMP-). I
ran a CVS annotate on this file and that comment and the start of the
code below to which allows the accepting of the older forms of constants
was in the file since the 1.1 version entered by user mathieu and dated
July 17, 2001.
It appears in the end that I have merely finished something that was
started a long time ago. My patch to accept both old and new forms of
the constants is attached to the bug report. I also have the patch and
my script to convert from the 1.2 API to the 2.0 API on my web page at:
If you want to include the conversion script as part of the GIMP source
(as a replacement for plug-ins/script-fu/convert-script) feel free to do
I have made my case for making the change and provided a patch (sorry I
forgot to include a ChangeLog entry), and script to update things to the
2.0 API. I now leave it in the hands of the judges...er...core GIMP
developers to decide what they want to do with this. At least I will
have a patch I can apply to my own copy of the GIMP should the patch not
become part of the official GIMP source.
Owner of Elecraft K2 #2172 |"What are we going to do today, Borg?"
E-mail:kcozens at interlog dot com|"Same thing we always do, Pinkutus:
Packet:[EMAIL PROTECTED]| Try to assimilate the world!"
#include <disclaimer/favourite> | -Pinkutus & the Borg
Gimp-developer mailing list