At 09:44 28.09.03 -0700, Jeff Trefftzs wrote:
>Hi all,
>As we are about to move to the next stage of gimpery, I have begun
>looking closely at my large collection of plug-ins, many of which I
>remember compiling with GIMP_ENABLE_COMPAT_CRUFT, and wondering how to
>make them usable again under the new regime.  Can anybody point me to a
>porting guide that identifies the changes needed to go from the old
>(well, present) api to that used in gimp-1.3.20 and up?
>I have already written a quckie decrufter perl script to obviate the
>need to use GIMP_ENABLE_COMPAT_CRUFT, and I have found a few changes
>between present stable usage and the 1.3.20 version, but I'm still
>wondering what else I'm missing.  
Attached you'll find my small porting helper (a little bit like a
working documentation; sorry if it's in the wrong scripting language :-)

Beside that there were some smaller changes required as

GimpRGB instead of guchar r,g,b;

deleting :
  color_cube = gimp_color_cube ();
  gtk_preview_set_color_cube (color_cube[0], color_cube[1],
                              color_cube[2], color_cube[3]);

Have Fun,
ApiPrefixChanges = (
        # old prefix, new prefix, identifiers rest
        ("G", "Gimp",
        ("PARAM_", "GIMP_PDB_",
        ("PROC_", "GIMP_",
                #not "PLUG_IN",
        ("RUN_", "GIMP_RUN_",
        ("STATUS_", "GIMP_PDB_",
        ("", "GIMP_",
                # GimpImageType
                # GimpLayerModeEffects
                # ...

OtherChanges = (
        ("GDrawableType", "GimpImageType"),
        ("GRunModeType", "GimpRunMode"),
        ("GStatusType", "GimpPDBStatusType"),
        ("PROC_PLUG_IN", "GIMP_PLUGIN"),
        ("gimp_drawable_color", "gimp_drawable_is_rgb"),
        ("gimp_drawable_gray", "gimp_drawable_is_gray"),
        ("gimp_drawable_indexed", "gimp_drawable_is_indexed"),

import os, re, sys

# create a dictionary with all the changes to apply
changes = []
sBefore = r"(^|[ \t(=])"
sAfter = r"([ \t,;:()=])"
for t1 in ApiPrefixChanges :
        s1PreOld = t1[0]
        s1PreNew = t1[1]
        for t2 in t1[2] :
                r1 = re.compile(sBefore + s1PreOld + t2 + sAfter, re.DOTALL | 
                r2 = r"\1" + s1PreNew + t2 + r"\2"
                changes.append((r1, r2))
for t1 in OtherChanges :
        r1 = re.compile(sBefore + t1[0] + sAfter, re.DOTALL | re.MULTILINE)
        r2 = r"\1" + t1[1] + r"\2"
        changes.append((r1, r2))

sFile = sys.argv[1]
sFileBac = sFile + ".pre13"
os.rename(sFile, sFileBac)
f = open(sFileBac)
sAll =

for t in changes :
        print t[1][2:-2]
        sAll = t[0].sub(t[1], sAll)

f = open(sFile, "w")
-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to 
get along without it.                -- Dilbert
Gimp-developer mailing list

Reply via email to