#!/usr/bin/perl # Convert a Script-Fu script from the 1.2 API interface to the new 2.x API. # Created January 28, 2004 by Kevin Cozens # # This script changes references to deprecated functions and constants # so they conform to the new 2.x API. If this script is applied to a script # which already confirms to the 2.x API, only deprecated constants will # be updated. No changes will be made to functions which already conform # to the 2.x API. # # ------------------------------------------------------------------------- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # ------------------------------------------------------------------------- # # Changed on January 29, 2004 by Kevin Cozens # Modified to change deprecated constants to conform to the 2.0 API. # Modified to remove 'img' argument from two deprecated function calls. # Modified to add missing arguments to deprecated gimp-blend function call. # Modified to add missing argument to plug-in-edge call. # # Changed on January 30, 2004 by Kevin Cozens # Prevented change to plug-in-edge call that already conforms to the 2.0 API. # # Changed on February 2, 2004 by Kevin Cozens # Now handles conversion of constants whether they use _ or -. # # Changed on February 7, 2006 by Kevin Cozens # Added list of function name changes needed for GIMP 2.2. # # Changed on June 16, 2006 by Kevin Cozens # Updated list of function name changes needed as of GIMP 2.2.11. # Added list of function name changes needed for GIMP 2.3/2.4. # # Changed on July 21, 2006 by Kevin Cozens # Read the entire script to be modified in to one variable and # operate on that variable. This means items which need to be # updated but are spread over multiple lines will be updated. # Also added check for white space after function name to prevent # incorrect partial matches. # # Changed on October 31, 2006 by Kevin Cozens # Updated the list of functions that have been deprecated in the 2.0, # 2.2, and 2.4 versions of GIMP. Added missing deprecated constants. # Check a command line parameter to determine the target version of # GIMP when updating a script. The default target version is set so # that all updates will be done. Usage information will be displayed # if the command line argument is not recognized. # # Changed on March 17, 2007 by Kevin Cozens # Calls to 'verbose' will be removed when updating for GIMP 2.4. # # Changed on March 19, 2007 by Kevin Cozens # Added missing checks for whitespace in loops which updated function # calls. # # Changed on October 4, 2007 by Kevin Cozens # Updated list of deprecated functions in GIMP 2.4. #Release dates for various versions of GIMP: #GIMP 1.0 Tue Jun 2 16:40:33 PDT 1998 #GIMP 1.2 Sun Dec 24 23:18:32 PST 2000 #GIMP 2.0 2004-03-23 #GIMP 2.2 2004-12-19 #The following affects GIMP 1.2 #First part of this change: Fri Nov 13 16:48:10 CET 1998 for # * app/airbrush.c, app/blend.c, app/brightness_contrast.c, # app/bucket_fill.c by_color_select.c, app/channel_ops.c, app/clone.c, # app/color_balance.c color_picker.c, app/convolve.c, app/curves.c, # app/desaturate.c, app/edit_cmds.c equalize.c, app/eraser.c, # app/flip_tool.c, app/fuzzy_select.c, gimage_mask_cmds.c # app/histogram_tool.c, app/hue_saturation.c, app/invert.c, levels.c, # app/pencil.c app/paintbrush.c, app/perspective_tool.c, # app/posterize.c, rotate_tool.c app/scale_tool.c, app/shear_tool.c, # app/text_tool.c, app/threshold.c: #Sat Nov 14 23:16:55 GMT 1998 Austin Donnelly # app/gimpimage.c app/gimage_cmds.c: gimp_image_{get,set}_resolution() # calls now get and set both X and Y resolutions. #Revision 2317 - (view) (download) (as text) - [select for diffs] #Modified Thu Aug 19 19:53:30 1999 UTC (7 years, 6 months ago) by mitch #1999-08-19 Michael Natterer # * app/layer.[ch] # * app/undo.c: renamed layer_mask() to layer_get_mask(). Prototyped # some function headers. #The following affects GIMP 2.2 #2004-10-26 Sven Neumann (version 1.1) # * New transform API was added to the PDB. # *app/core/gimpdrawable-transform.[ch]: added missing parameters # to gimp_drawable_transform_flip() #2004-11-02 Michael Natterer (version 1.5) # * tools/pdbgen/pdb/drawable_transform.pdb (flip): renamed # parameter "center" to "auto_center" and removed # "transform_direction". Renamed rotate() to rotate_free() and # added a "gboolean auto_center" parameter. Added new function # rotate() which takes enum GimpRotationType instead of an # arbiatrary angle so the flip and rotate APIs are symmetric. #2004-11-02 Michael Natterer (version 1.6) # * tools/pdbgen/pdb/drawable_transform.pdb: renamed flip() and # rotate() to flip_simple() and rotate_simple(). Renamed flip_free() # and rotate_free() to flip() and rotate() (the special cases should # have a special suffix, not the general ones). #The information in the following array came from: # libgimp/gimpcompat.h # plug-ins/script-fu/siod/siod-wrapper.c %constants = ( "NORMAL", "NORMAL-MODE", "DISSOLVE", "DISSOLVE-MODE", "BEHIND", "BEHIND-MODE", "MULTIPLY", "MULTIPLY-MODE", "SCREEN", "SCREEN-MODE", "OVERLAY", "OVERLAY-MODE", "DIFFERENCE", "DIFFERENCE-MODE", "ADDITION", "ADDITION-MODE", "SUBTRACT", "SUBTRACT-MODE", "DARKEN[-_]ONLY", "DARKEN-ONLY-MODE", "LIGHTEN[-_]ONLY", "LIGHTEN-ONLY-MODE", "HUE", "HUE-MODE", "SATURATION", "SATURATION-MODE", "COLOR", "COLOR-MODE", "VALUE", "VALUE-MODE", "DIVIDE", "DIVIDE-MODE", "BLUR", "BLUR-CONVOLVE", "SHARPEN", "SHARPEN-CONVOLVE", "RGB_IMAGE", "RGB-IMAGE", "RGBA_IMAGE", "RGBA-IMAGE", "GRAY_IMAGE", "GRAY-IMAGE", "GRAYA_IMAGE", "GRAYA-IMAGE", "INDEXED_IMAGE", "INDEXED-IMAGE", "INDEXEDA_IMAGE", "INDEXEDA-IMAGE", "WHITE[-_]MASK", "ADD-WHITE-MASK", "BLACK[-_]MASK", "ADD-BLACK-MASK", "ALPHA[-_]MASK", "ADD-ALPHA-MASK", "SELECTION[-_]MASK", "ADD-SELECTION-MASK", "COPY[-_]MASK", "ADD-COPY-MASK", "ADD", "CHANNEL-OP-ADD", "SUB", "CHANNEL-OP-SUBTRACT", "REPLACE", "CHANNEL-OP-REPLACE", "INTERSECT", "CHANNEL-OP-INTERSECT", "FG[-_]BG[-_]RGB", "FG-BG-RGB-MODE", "FG[-_]BG[-_]HSV", "FG-BG-HSV-MODE", "FG[-_]TRANS", "FG-TRANSPARENT-MODE", "CUSTOM", "CUSTOM-MODE", "FG[-_]IMAGE[-_]FILL", "FOREGROUND-FILL", "BG[-_]IMAGE[-_]FILL", "BACKGROUND-FILL", "WHITE[-_]IMAGE[-_]FILL", "WHITE-FILL", "TRANS[-_]IMAGE[-_]FILL", "TRANSPARENT-FILL", "APPLY", "MASK-APPLY", "DISCARD", "MASK-DISCARD", "HARD", "BRUSH-HARD", "SOFT", "BRUSH-SOFT", "CONTINUOUS", "PAINT-CONSTANT", "INCREMENTAL", "PAINT-INCREMENTAL", "HORIZONTAL", "ORIENTATION-HORIZONTAL", "VERTICAL", "ORIENTATION-VERTICAL", "UNKNOWN", "ORIENTATION-UNKNOWN", "LINEAR", "GRADIENT-LINEAR", "BILINEAR", "GRADIENT-BILINEAR", "RADIAL", "GRADIENT-RADIAL", "SQUARE", "GRADIENT-SQUARE", "CONICAL[-_]SYMMETRIC", "GRADIENT-CONICAL-SYMMETRIC", "CONICAL[-_]ASYMMETRIC", "GRADIENT-CONICAL-ASYMMETRIC", "SHAPEBURST[-_]ANGULAR", "GRADIENT-SHAPEBURST-ANGULAR", "SHAPEBURST[-_]SPHERICAL", "GRADIENT-SHAPEBURST-SPHERICAL", "SHAPEBURST[-_]DIMPLED", "GRADIENT-SHAPEBURST-DIMPLED", "SPIRAL[-_]CLOCKWISE", "GRADIENT-SPIRAL-CLOCKWISE", "SPIRAL[-_]ANTICLOCKWISE", "GRADIENT-SPIRAL-ANTICLOCKWISE", "VALUE[-_]LUT", "HISTOGRAM-VALUE", "RED[-_]LUT", "HISTOGRAM-RED", "GREEN[-_]LUT", "HISTOGRAM-GREEN", "BLUE[-_]LUT", "HISTOGRAM-BLUE", "ALPHA[-_]LUT", "HISTOGRAM-ALPHA" ); #List of GIMP 1.2 functions which need the img parameter to be removed. %functions_drop_img = ( "gimp-airbrush", "gimp-blend", "gimp-brightness-contrast", "gimp-bucket-fill", "gimp-by-color-select", "gimp-channel-ops-offset", "gimp-clone", "gimp-color-balance", "gimp-color-picker", "gimp-convolve", "gimp-curves-explicit", "gimp-curves-spline", "gimp-desaturate", "gimp-edit-clear", "gimp-edit-copy", "gimp-edit-cut", "gimp-edit-fill", "gimp-edit-paste", "gimp-edit-stroke", "gimp-equalize", "gimp-eraser", "gimp-eraser-extended", "gimp-flip", "gimp-fuzzy-select", "gimp-histogram", "gimp-hue-saturation", "gimp-image-add-layer-mask", "gimp-image-remove-layer-mask", "gimp-invert", "gimp-levels", "gimp-paintbrush", "gimp-paintbrush-extended", "gimp-pencil", "gimp-perspective", "gimp-posterize", "gimp-rotate", "gimp-scale", "gimp-selection-float", "gimp-selection-layer-alpha", "gimp-selection-load", "gimp-shear", "gimp-threshold" ); #Additional changes needed for some version of GIMP 1 %functions_1_X = ( "gimp-image-disable-undo", "gimp-undo-push-group-start", "gimp-image-enable-undo", "gimp-undo-push-group-end", "gimp-image-undo-disable", "gimp-undo-push-group-start", "gimp-image-undo-enable", "gimp-undo-push-group-end", "gimp-layer-mask", "gimp-layer-get-mask", #Aug 19, 1999 #FIXME: What version of GIMP required the following two changes? "gimp-image-add-layer-mask", "gimp-layer-add-mask", "gimp-image-remove-layer-mask", "gimp-layer-remove-mask" ); #The information in the following array comes from: # libgimp/gimpcompat.h # app/pdb/procedural_db.c %functions_2_0 = ( "gimp-brush-select-widget-close-popup", "gimp-brush-select-widget-close", "gimp-brush-select-widget", "gimp-brush-select-widget-new", "gimp-brush-select-widget-set-popup", "gimp-brush-select-widget-set", "gimp-brushes-list", "gimp-brushes-get-list", "gimp-bucket-fill", "gimp-edit-bucket-fill", "gimp-channel-delete", "gimp-drawable-delete", "gimp-channel-get-image-id", "gimp-drawable-get-image", "gimp-channel-get-name", "gimp-drawable-get-name", "gimp-channel-get-tattoo", "gimp-drawable-get-tattoo", "gimp-channel-get-visible", "gimp-drawable-get-visible", "gimp-channel-ops-duplicate", "gimp-image-duplicate", "gimp-channel-ops-duplicate", "gimp-image-duplictate", "gimp-channel-ops-offset", "gimp-drawable-offset", "gimp-channel-set-name", "gimp-drawable-set-name", "gimp-channel-set-tattoo", "gimp-drawable-set-tattoo", "gimp-channel-set-visible", "gimp-drawable-set-visible", "gimp-color-picker", "gimp-image-pick-color", "gimp-convert-grayscale", "gimp-image-convert-grayscale", "gimp-convert-indexed", "gimp-image-convert-indexed", "gimp-convert-rgb", "gimp-image-convert-rgb", "gimp-crop", "gimp-image-crop", "gimp-drawable-bytes", "gimp-drawable-bpp", "gimp-drawable-image", "gimp-drawable-get-image", "gimp-drawable-image-id", "gimp-drawable-get-image", "gimp-drawable-name", "gimp-drawable-get-name", "gimp-drawable-visible", "gimp-drawable-get-visible", "gimp-font-select-widget-close-popup", "gimp-font-select-widget-close", "gimp-font-select-widget", "gimp-font-select-widget-new", "gimp-font-select-widget-set-popup", "gimp-font-select-widget-set", "gimp-gradient-select-widget-close-popup", "gimp-gradient-select-widget-close", "gimp-gradient-select-widget", "gimp-gradient-select-widget-new", "gimp-gradient-select-widget-set-popup", "gimp-gradient-select-widget-set", "gimp-gradients-get-active", "gimp-gradients-get-gradient", "gimp-gradients-set-active", "gimp-gradients-set-gradient", "gimp-image-active-drawable", "gimp-image-get-active-drawable", "gimp-image-floating-selection", "gimp-image-get-floating-sel", "gimp-interactive-selection-brush", "gimp-brush-select-new", "gimp-interactive-selection-font", "gimp-font-select-new", "gimp-interactive-selection-gradient", "gimp-gradient-select-new", "gimp-interactive-selection-pattern", "gimp-pattern-select-new", "gimp-layer-delete", "gimp-drawable-delete", "gimp-layer-get-image-id", "gimp-drawable-get-image", "gimp-layer-get-linked", "gimp-drawable-get-linked", "gimp-layer-get-mask-id", "gimp-layer-get-mask", "gimp-layer-get-name", "gimp-drawable-get-name", "gimp-layer-get-preserve-transparency", "gimp-layer-get-preserve-trans", "gimp-layer-get-tattoo", "gimp-drawable-get-tattoo", "gimp-layer-get-visible", "gimp-drawable-get-visible", "gimp-layer-is-floating-selection", "gimp-layer-is-floating-sel", "gimp-layer-mask", "gimp-layer-get-mask", "gimp-layer-set-linked", "gimp-drawable-set-linked", "gimp-layer-set-name", "gimp-drawable-set-name", "gimp-layer-set-preserve-transparency", "gimp-layer-set-preserve-trans", "gimp-layer-set-tattoo", "gimp-drawable-set-tattoo", "gimp-layer-set-visible", "gimp-drawable-set-visible", "gimp-palette-refresh", "gimp-palettes-refresh", "gimp-pattern-select-widget-close-popup", "gimp-pattern-select-widget-close", "gimp-pattern-select-widget", "gimp-pattern-select-widget-new", "gimp-pattern-select-widget-set-popup", "gimp-pattern-select-widget-set", "gimp-patterns-list", "gimp-patterns-get-list", "gimp-temp-PDB-name", "gimp-procedural-db-temp-name", "gimp-undo-push-group-end", "gimp-image-undo-group-end", "gimp-undo-push-group-start", "gimp-image-undo-group-start", ); #Additional changes needed for GIMP 2.2 %functions_2_2 = ( #/* This function is obsolete and has no direct replacement # "gimp-drawable-set-image", "", # "gimp-brushes-get-opacity", "gimp-context-get-opacity", "gimp-brushes-get-paint-mode", "gimp-context-get-paint-mode", "gimp-brushes-get-brush", "gimp-context-get-brush", "gimp-brushes-get-brush-data", "gimp-brush-get-pixels", "gimp-brushes-get-spacing", "gimp-brush-get-spacing", "gimp-brushes-set-brush", "gimp-context-set-brush", "gimp-brushes-set-opacity", "gimp-context-set-opacity", "gimp-brushes-set-paint-mode", "gimp-context-set-paint-mode", "gimp-brushes-set-spacing", "gimp-brush-set-spacing", "gimp-flip", "gimp-drawable-transform-flip-simple", "gimp-gradients-get-gradient", "gimp-context-get-gradient", "gimp-gradients-get-gradient-data", "gimp-gradient-get-uniform-samples", "gimp-gradients-sample-custom", "gimp-gradient-get-custom-samples", "gimp-gradients-sample-uniform", "gimp-gradient-get-uniform-samples", "gimp-gradients-set-gradient", "gimp-context-set-gradient", "gimp-image-get-cmap", "gimp-image-get-colormap", "gimp-image-set-cmap", "gimp-image-set-colormap", "gimp-levels-auto", "gimp-levels-stretch", "gimp-palette-get-background", "gimp-context-get-background", "gimp-palette-get-foreground", "gimp-context-get-foreground", "gimp-palette-set-background", "gimp-context-set-background", "gimp-palette-set-default-colors", "gimp-context-set-default-colors", "gimp-palette-set-foreground", "gimp-context-set-foreground", "gimp-palette-swap-colors", "gimp-context-swap-colors", "gimp-palettes-get-palette", "gimp-context-get-palette", "gimp-palettes-get-palette-entry", "gimp-palette-entry-get-color", "gimp-palettes-set-palette", "gimp-context-set-palette", "gimp-patterns-set-pattern", "gimp-context-set-pattern", "gimp-patterns-get-pattern", "gimp-context-get-pattern", "gimp-patterns-get-pattern-data", "gimp-pattern-get-pixels", "gimp-perspective", "gimp-drawable-transform-perspective-default", "gimp-rotate", "gimp-drawable-transform-rotate-default", "gimp-scale", "gimp-drawable-transform-scale-default", "gimp-selection-clear", "gimp-selection-none", "gimp-shear", "gimp-drawable-transform-shear-default", "gimp-text", "gimp-text-fontname", "gimp-text-get-extents", "gimp-text-get-extents-fontname", "gimp-transform-2d", "gimp-drawable-transform-2d-default", "plug-in-blur-randomize-pick", "plug-in-randomize-pick", "script-fu-copy-visible", "gimp-edit-copy-visible" ); #Additional changes needed for GIMP 2.4 %functions_2_4 = ( "gimp-blend", "gimp-edit-blend", "gimp-get-path-by-tattoo", "gimp-image-get-vectors-by-tattoo", "gimp-gradients-get-active", "gimp-context-get-gradient", "gimp-gradients-set-active", "gimp-context-set-gradient", "gimp-layer-get-preserve-trans", "gimp-layer-get-lock-alpha", "gimp-layer-set-preserve-trans", "gimp-layer-set-lock-alpha", "gimp-path-delete", "gimp-image-remove-vectors", "gimp-path-get-current", "gimp-image-get-active-vectors", "gimp-path-get-locked", "gimp-vectors-get-linked", "gimp-path-get-point-at-dist", "gimp-vectors-stroke-get-point-at-dist", "gimp-path-get-points", "gimp-vectors-stroke-get-points", "gimp-path-get-tattoo", "gimp-vectors-get-tattoo", "gimp-path-import", "vectors-import-from-file", "gimp-path-list", "gimp-image-get-vectors", "gimp-path-set-current", "gimp-image-set-active-vectors", "gimp-path-set-locked", "gimp-vectors-set-linked", "gimp-path-set-points", "vectors-stroke-new-from-points", "gimp-path-set-tattoo", "gimp-vectors-set-tattoo", "gimp-path-stroke-current", "gimp-edit-stroke-vectors", "gimp-path-to-selection", "gimp-vectors-to-selection" ); # Default to updating scripts to the most recent (ie. 3.0) version of GIMP $old_script = 0; $gimp_version = 30; while (@ARGV > 0) { if ($ARGV[0] eq "-old") { $old_script = 1; } else { $gimp_version = abs($ARGV[0]); if ($gimp_version != 20 && $gimp_version != 22 && $gimp_version != 24) { $arg = "-h"; } } if ($arg eq "-h" || $arg eq "--help") { print "Usage: $0 [-h|--help|-old|-20|-22|-24]\n"; print " -old Use this when updating a GIMP 1.x script\n"; print "\n"; print " -20 Update script for use with GIMP version 2.0\n"; print " -22 Update script for use with GIMP version 2.2\n"; print " -24 Update script for use with GIMP version 2.4\n"; print "\n"; print " The script to be updated is read from stdin.\n"; print " The updated script is written to stdout.\n"; print "\n"; exit; } shift(ARGV); } #Read the script in as one big string. This allows the pattern matching #statements (further down in this program) to recognize functions which #are split across multiple lines. @lines = <>; $script = join("", @lines); #Replace deprecated constants with the name of a current constant foreach $old_constant (keys(%constants)) { #To avoid an incorrect match, check for white space or a bracket #before and after the constant to ensure we don't falsely match #a portion of some other constant. $script =~ s/([(\s])$old_constant([)\s])/$1$constants{$old_constant}$2/g; } if ($old_script) { #Change lines containing a quoted string inside quotes to SF-STRING. $script =~ s/(SF-VALUE|SF-STRING)(\s+".*"\s+)\"\\\"(.*)\\\"\"/SF-STRING$2\"$3\"/g; #Change lines that appear to contain a font specification to SF-FONT. $script =~ s/(SF-VALUE|SF-STRING)(\s+".*[Ff]ont"\s+".*")/SF-FONT$2/g; #Change lines that appear to contain a pattern reference to SF-PATTERN. $script =~ s/(SF-VALUE|SF-STRING)(\s+".*[Pp]attern"\s+".*")/SF-PATTERN$2/g; #Remove the img parameter from a number of old GIMP 1.X functions. foreach $old_function (%functions_drop_img) { $script =~ s/([(\s]$old_function)\s+\S+/$1/g; } #Replace deprecated 1.X functions with the name of a current function foreach $old_function (keys(%functions_1_X)) { #Include white space after function name to avoid an incorrect match. $script =~ s/([(\s])$old_function([)\s])/\1$functions_1_X{$old_function}$2/g; } #GIMP 1.0: randomize.c, version 1.11, Thu Jul 2 18:06:30 1998 UTC $script =~ s/([(\s])plug-in-randomize(\s+\S+\s+\S+\s+\S+)(\s+1)(\s+\S+\s+\S+)(\s*)\)/$1plug-in-randomize-hurl$2$4$5 FALSE 0$6)/g; $script =~ s/([(\s])plug-in-randomize(\s+\S+\s+\S+\s+\S+)(\s+2)(\s+\S+\s+\S+)(\s*)\)/$1plug-in-randomize-pick$2$4$5 FALSE 0$6)/g; $script =~ s/([(\s])plug-in-randomize(\s+\S+\s+\S+\s+\S+)(\s+3)(\s+\S+\s+\S+)(\s*)\)/$1plug-in-randomize-slur$2$4$5 FALSE 0$6)/g; } if ($gimp_version >= 20) { #Add two extra arguments (reverse, and dither) $script =~ s/([(\s])gimp-blend(\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+)(\s+\S+\s+\S+\s+\S+)/$1gimp-edit-blend$2 FALSE$3 FALSE/g; #Add extra argument (edgemode) $script =~ s/([(\s]plug-in-edge\s+\S+\s+\S+\s+\S+\s+\S+\s+[-\w]+)(\s*\))/$1 0$2/g; #Replace deprecated 2.0 functions with the name of a current function foreach $old_function (keys(%functions_2_0)) { #Include white space after function name to avoid an incorrect match. $script =~ s/([(\s])$old_function([)\s])/\1$functions_2_0{$old_function}$2/g; } } if ($gimp_version >= 22) { #(plug-in-blur-randomize 1 img fire-layer 2 80 rndamt) #GIMP 2.1.0: blur.c, version 1.62, Wed Jun 16 15:40:56 2004 UTC #plug-in-blur-randomize is renamed to plug-in-blur #and removed randomize and repeat options. $script =~ s/([(\s])plug-in-blur-randomize(\s+\S+\s+\S+\s+\S+)(\s+\S+\s+\S+\s+\S+\s+\S+)/$1plug-in-blur$2/g; #Replace deprecated 2.2 functions with the name of a current function foreach $old_function (keys(%functions_2_2)) { #Include white space after function name to avoid an incorrect match. $script =~ s/([(\s])$old_function([)\s])/\1$functions_2_2{$old_function}$2/g; } } if ($gimp_version >= 24) { #Remove calls to verbose as that function no longer exists. $script =~ s/\([\s]*verbose[\s]*[\S]*[\s]*\)//g; #Replace deprecated 2.4 functions with the name of a current function foreach $old_function (keys(%functions_2_4)) { #Include white space after function name to avoid an incorrect match. $script =~ s/([(\s])$old_function([)\s])/\1$functions_2_4{$old_function}$2/g; } } printf "$script";