Re: [Gimp-developer] Re: Bug 132698 - Script-Fu constants vs DB Browser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 30, 2004 at 11:57:32AM -0500, Kevin Cozens <kcozens@xxxxxxxxxxxx> wrote:
> >i.e.., strip the GIMP_-prefix, so the contants are the names with "_"
> >(easier to type in perl than "-"), but withouth the prefixes. Looks like
> >a third set to me.
> 
> 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.

The pdb documentation is "almost" parseable nowadays (or at leats when I
last looked).

> 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.

> The script should be invoked during a build process as it is for the
> core part of GIMP.

Not so quickly ;) Changes in these enums will immediately break existing
scripts, which is a very bad thing. Also, some wild renaming during
the 1.3 era resulted in duplicated constants that had to be resolved
differently, so this usually involves some manual work, which is why the
script has to be run manually, too.

> Another way to look at this is from he point of view of help/documentation. 
> Someone has to create information somewhere that documents the constants 
> used for plug-ins (whether they be C-based, Script-Fu, or Perl). If we have 
> one set of constants for use in all plug-in languages the constants only 
> need be documented once for C.

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
$drawable->add_layer.

> 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.

-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       pcg@xxxxxxxx      |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux