On Wed, 06 Feb 2002, Dave Neary wrote:
> Parasite naming is non-standard. Anyone can create a parasite with any
> name they want. [...]
> Where *is* the list of parasites? There are only (as you point out)
> about 10 persistent parasites, and the list isn't maintained anywhere.
> One possible approach to the metadata thing (I won't call it a problem
> yet) is to maintain a list of all the parasites which are used along
> with a description, and any time someone adds a parasite, they add it
> (with a description) to the list. devel-docs/parasites.txt is
> something approaching that. But that makes maintenance pretty
> difficult, compared to having the code document itself (one metadata
> structure with typed fields, and a couple of parsing routines).
OK, so now the problem is clear: we need a way to enforce some
consistency for the names of the parasites in the standard namespace
("gimp-*"). The plug-ins should be allowed to do anything they want
with the parasites in their own namespace (e.g., "jpeg-save-options"
or "tiff-save-options") and nobody has to worry about these. The only
thing that should be checked is the usage of the "gimp-*" names, which
should have a pre-defined name and type. Maybe we could also define
the "exif-*" namespace as common, although it could also be
"gimp-exif-*". Any plug-in that attempts to set or get a "gimp-*"
parasite that has not been defined in some central place should cause
the core to generate some kind of warning.
So, what about this solution: I convert the existing list of common
parasites (only the "gimp-*" parasites in devel-docs/parasites.txt) to
a list of strings that can be put in a *.c or *.h file. I also add
the EXIF data to this list. Then if the GIMP is compiled in debug
mode, I would add some code in the PDB functions for accessing the
parasites. This code would trigger a g_warning if the name of a
"gimp-*" parasite cannot be found in the pre-compiled list.
The code could also check the type of the parasite automatically, but
this would imply an API change for all PDB functions dealing with
parasites and that would also require an upgrade of the XCF format.
So this would break a lot of things, but maybe it is better to do it
as early as possible. Any opinions on this?
Note that the *.c or *.h file containing the list of common parasites
in the "gimp-*" namespace could be generated at build time from an XML
file. That file could also hold the human-readable documentation of
these parasites and it could be used to generate a text file or HTML
file documenting the common parasites.
> I don't see the parasite handler as one place. As a scenario - say
> that the TIFF plug-in wants to set some metadata information (but not
> all of it) for a certain image, and later we are saving as PNG, and we
> want to set some more metadata with the image, wouldn't you consider
> the two plug-ins as two places? If I add a parasite to the metadata in
> the TIFF plug-in, the PNG developer knows nothing about it - if I as a
> lazy developer didn't add it to the list of supported metadata he
> wouldn't know it existed. And let's say I as the PNG developer want to
> use the same data, but I call it a slightly different name - now we
> have two parasites which do the same thing. Those kind of problems are
> eliminated by definition if all the metadata's defined in one place.
The usage of non-standard parasites has not been a problem so far.
All authors of plug-ins have correctly followed the guidelines
described in devel-docs/parasites.txt. From that point of view, I do
not think that it is really important to add a mechanism that checks
if the "gimp-*" namespace is used correctly. But I think that it
could be a nice addition, so I will see what I can do about it until
Gimp-developer mailing list