Skip to content

ScriptFu: refactor marshalling of PDB return values

Lloyd Konneker requested to merge bootchk/gimp:sfRefactorPDBReturn into master

What

Simple refactoring. No functional changes intended. I followed known refactoring process for extracting functions.

Extracts 1000 lines from one huge function, script_fu_marshal_procedure_call, into four smaller functions.

Only extracts the marshalling of GValues from PDB calls. Marshalling to PDB is still worthy of refactoring.

Why

To enable simple implementation of #9608 and #8404. Only a few dozen lines need change now, in the one new file. As marked by FUTURE comments in this refactoring.

Also to enable simpler fixes for GimpResource.

Impact

Again, should be zero impact from the refactoring.

But the planned #9608 and #8404 will impact many Gimp scripts and third party plugins. Simple, rote changes will be needed. Breaks API, but so have other changes to the PDB in v3.

Such planned changes will get rid of much un-scheme-like folly:

Needless unwrapping of single results that don't need to be wrapped in a list:

(car (gimp-...

And un-scheme-like returning of 0,1 for boolean instead of #f,#t

(if (= (car (gimp-...) 1)...
where
(if (gimp-...) would do.

Status

Complete. Passes the pdb.scm test suite. Except I have yet to test actual plugins.

When and if I do the intended enhancements, they should be in two chunks, close together. Not piecemeal, i.e. change ScriptFu and all the scripts and test cases in a chunk.

Merge request reports