ScriptFu: add Scheme language function script-fu-register-regular

Building on prior commits, with a few small fixes to them.

First demonstrable changes towards #12605.

Font map plugin is ported as a test case.

Old-style plugins using script-fu-register still work.
This commit is contained in:
lloyd konneker 2024-09-21 12:03:42 -04:00 committed by Lloyd Konneker
parent d361256977
commit d0a6c4c758
12 changed files with 262 additions and 38 deletions

View file

@ -197,6 +197,8 @@ script_fu_add_script (scheme *sc,
script->proc_class = GIMP_TYPE_PROCEDURE;
script_fu_script_set_is_old_style (script);
script_fu_try_map_menu (script);
script_fu_append_script_to_tree (script);
return sc->NIL;
@ -249,6 +251,45 @@ script_fu_add_script_filter (scheme *sc,
return sc->NIL;
}
/* For a script's call to script-fu-register-regular.
* Traverse Scheme argument list creating a new SFScript
* whose drawable_arity is SF_NO_DRAWABLE
*
* Return NIL or a foreign_error
*/
pointer
script_fu_add_script_regular (scheme *sc,
pointer a)
{
SFScript *script;
pointer args_error; /* a foreign_error or NIL. */
/* Check metadata args args are present.
* Has two less arg than script-fu-register.
* Last metadata arg is "copyright date"
*/
if (sc->vptr->list_length (sc, a) < 5)
return foreign_error (sc, "script-fu-register-filter: Not enough arguments", 0);
/* pass handle i.e. "&a" ("a" of type "pointer" is on the stack) */
script = script_fu_script_new_from_metadata_regular (sc, &a);
script_fu_script_set_drawable_arity_none (script);
/* Parse the args to this function that are formal declarations of
* the args to the PDB procedure being defined.
*/
args_error = script_fu_script_create_formal_args (sc, &a, script);
if (args_error != sc->NIL)
return args_error;
script->proc_class = GIMP_TYPE_PROCEDURE;
script_fu_try_map_menu (script);
script_fu_append_script_to_tree (script);
return sc->NIL;
}
pointer
script_fu_add_menu (scheme *sc,
pointer a)