Skip to content

Issue #5402 Scriptfu handle GFile and GimpObjectArray types

Lloyd Konneker requested to merge bootchk/gimp:5402scriptfu_unknown_types into master

About the files in the MR:

I put most new code in a new file scheme-marshal.c. Because the file scheme-wrapper.c is already huge and mixes concerns. Ideally scheme-wrapper.c would be split into several files along concerns:

  • the interpreter
  • and marshalling

Extent

The MR adds these cases apropos to #5402 (closed), re ScriptFu script pass/receive to/from a PDB procedure:

  • pass GimpObjectArray
  • pass GFile (where formerly a string was passed)
  • receive GimpObjectArray
  • receive GFile

Extra changes

The MR also makes an incidental change (not required to fix #5402 (closed)) : the preflight of arg counts is changed. Formerly, an error was returned for all mismatch between count of supplied args and formal param specs. Now, a warning is given to the log, and parsing/marshalling continues. The new behavior is that:

  • scripts supplying too many args still call the PDB procedure, which might succeed (formerly, the behavior was to proceed only when the PDB procedure took exactly zero args.)
  • scripts with too few args will say the type of the expected missing arg and still call the PDB procedure, which for now is expected to fail

This is better because:

  • the code is smaller
  • Scriptfu as a language interpreter is more forgiving for author's, letting them more quickly spot their errors
  • it looks to the future, when a called PDB procedures might provide defaults for missing args (like python trailing keyword).
  • it looks to the future, when ScriptFu might be more like other bindings, where the binding takes one supplied arg and converts it to two actual args (like GI converts a Python list to a integer, array) See a forthcoming MR that implements this.

Testing

I tested rather thoroughly most paths of this part of scriptfu using my plugin testScriptFuBinding. See that to know exactly what was tested.

Merge request reports