From 059a6990e9a2e371a59e53ea6e43e2733cfbc709 Mon Sep 17 00:00:00 2001 From: lloyd konneker Date: Sun, 8 Dec 2024 14:20:14 -0500 Subject: [PATCH 1/2] ScriptFu: cleanup some debug statements Condense a few, eliminate a few. Turn off the debugging of args in a Config. --- plug-ins/script-fu/libscriptfu/scheme-wrapper.c | 11 +++++------ plug-ins/script-fu/libscriptfu/script-fu-dialog.c | 3 +-- plug-ins/script-fu/libscriptfu/script-fu-errors.c | 5 +++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/plug-ins/script-fu/libscriptfu/scheme-wrapper.c b/plug-ins/script-fu/libscriptfu/scheme-wrapper.c index 20bda9c170c..28e05e56822 100644 --- a/plug-ins/script-fu/libscriptfu/scheme-wrapper.c +++ b/plug-ins/script-fu/libscriptfu/scheme-wrapper.c @@ -715,8 +715,6 @@ script_fu_marshal_procedure_call (scheme *sc, gint i; pointer return_val = sc->NIL; - g_debug ("In %s()", G_STRFUNC); - if (a == sc->NIL) /* Some ScriptFu function is calling this incorrectly. */ return implementation_error (sc, @@ -731,8 +729,10 @@ script_fu_marshal_procedure_call (scheme *sc, else proc_name = g_strdup (sc->vptr->string_value (a)); - g_debug ("proc name: %s", proc_name); - g_debug ("parms rcvd: %d", sc->vptr->list_length (sc, a)-1); + g_debug ("%s, proc name: %s, args rcvd: %d", + G_STRFUNC, + proc_name, + sc->vptr->list_length (sc, a)-1); if (deprecated ) g_warning ("PDB procedure name %s is deprecated, please use %s.", @@ -1429,9 +1429,8 @@ script_fu_marshal_procedure_call (scheme *sc, if (strcmp (proc_name, "script-fu-refresh") == 0) return script_error (sc, "A script cannot refresh scripts", 0); - g_debug ("calling %s", proc_name); + g_debug ("%s, calling:%s", G_STRFUNC, proc_name); values = gimp_procedure_run_config (procedure, config); - g_debug ("done."); g_clear_object (&config); /* Check the return status */ diff --git a/plug-ins/script-fu/libscriptfu/script-fu-dialog.c b/plug-ins/script-fu/libscriptfu/script-fu-dialog.c index f8faea36c81..6b5e4cfc1d2 100644 --- a/plug-ins/script-fu/libscriptfu/script-fu-dialog.c +++ b/plug-ins/script-fu/libscriptfu/script-fu-dialog.c @@ -60,8 +60,7 @@ * corresponding to SFType the author declared in script-fu-register call. */ -/* FUTURE: delete this after v3 is stable. */ -#define DEBUG_CONFIG_PROPERTIES TRUE +#define DEBUG_CONFIG_PROPERTIES FALSE #if DEBUG_CONFIG_PROPERTIES static void diff --git a/plug-ins/script-fu/libscriptfu/script-fu-errors.c b/plug-ins/script-fu/libscriptfu/script-fu-errors.c index 8482e2afd56..a623297be15 100644 --- a/plug-ins/script-fu/libscriptfu/script-fu-errors.c +++ b/plug-ins/script-fu/libscriptfu/script-fu-errors.c @@ -272,8 +272,9 @@ debug_in_arg (scheme *sc, const guint arg_index, const gchar *type_name ) { - g_debug ("param %d - expecting type %s", arg_index + 1, type_name ); - g_debug ("actual arg is type %s (%d)", + g_debug ("param:%d, formal C type:%s, actual scheme type:%s (%d)", + arg_index + 1, + type_name, ts_types[ type(sc->vptr->pair_car (a)) ], type(sc->vptr->pair_car (a))); } -- GitLab From 500ef62cc4b93a03a71a792b0d4bdfbddc0e3f4f Mon Sep 17 00:00:00 2001 From: lloyd konneker Date: Sun, 8 Dec 2024 14:30:46 -0500 Subject: [PATCH 2/2] ScriptFu: change warning to info for lenient wrong arg count to PDB It is like a compiler warning, and should not be a full g_warning, which should mean something will probably fail. Passing fewer args is a feature since 3.0: the PDB will use defaults. --- plug-ins/script-fu/libscriptfu/scheme-wrapper.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/plug-ins/script-fu/libscriptfu/scheme-wrapper.c b/plug-ins/script-fu/libscriptfu/scheme-wrapper.c index 28e05e56822..b057df74ff6 100644 --- a/plug-ins/script-fu/libscriptfu/scheme-wrapper.c +++ b/plug-ins/script-fu/libscriptfu/scheme-wrapper.c @@ -735,7 +735,7 @@ script_fu_marshal_procedure_call (scheme *sc, sc->vptr->list_length (sc, a)-1); if (deprecated ) - g_warning ("PDB procedure name %s is deprecated, please use %s.", + g_info ("PDB procedure name %s is deprecated, please use %s.", deprecated_name_for (proc_name), proc_name); @@ -756,7 +756,7 @@ script_fu_marshal_procedure_call (scheme *sc, actual_arg_count = sc->vptr->list_length (sc, a) - 1; /* Check the supplied number of arguments. - * This only gives warnings to the console. + * This only gives messages to the console. * It does not ensure that the count of supplied args equals the count of formal args. * Subsequent code must not assume that. * @@ -769,16 +769,13 @@ script_fu_marshal_procedure_call (scheme *sc, { if (actual_arg_count > n_arg_specs) { - /* Warn, but permit extra args. Will discard args from script.*/ - g_warning ("in script, permitting too many args to %s", proc_name); + /* Permit extra args. Will discard args from script, to next right paren.*/ + g_info ("in script, permitting too many args to %s", proc_name); } else if (actual_arg_count < n_arg_specs) { - /* Warn, but permit too few args. - * Scriptfu or downstream might provide missing args. - * It is author friendly to continue to parse the script for type errors. - */ - g_warning ("in script, permitting too few args to %s", proc_name); + /* Permit too few args. The config carries a sane default for most types. */ + g_info ("in script, permitting too few args to %s", proc_name); } /* else equal counts of args. */ } -- GitLab