From ae824dcab59f1286d5071ff2d6f4edb6bbb9fec4 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 11 Aug 2019 22:31:15 +0200 Subject: [PATCH] pdb, libgimp: remove the now unused gimp_pdb_proc_arg() and _proc_val() Bye bye legacy. --- app/pdb/internal-procs.c | 2 +- app/pdb/pdb-cmds.c | 238 +-------------------------------------- libgimp/gimp.def | 2 - libgimp/gimplegacy.c | 55 --------- libgimp/gimplegacy.h | 10 -- libgimp/gimppdb_pdb.c | 125 +------------------- libgimp/gimppdb_pdb.h | 10 -- pdb/groups/pdb.pdb | 144 +---------------------- 8 files changed, 5 insertions(+), 581 deletions(-) diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c index 9a1782134e..99d5a369d0 100644 --- a/app/pdb/internal-procs.c +++ b/app/pdb/internal-procs.c @@ -28,7 +28,7 @@ #include "internal-procs.h" -/* 745 procedures registered total */ +/* 743 procedures registered total */ void internal_procs_init (GimpPDB *pdb) diff --git a/app/pdb/pdb-cmds.c b/app/pdb/pdb-cmds.c index e7e699818f..9f9b76d082 100644 --- a/app/pdb/pdb-cmds.c +++ b/app/pdb/pdb-cmds.c @@ -240,136 +240,6 @@ pdb_proc_info_invoker (GimpProcedure *procedure, return return_vals; } -static GimpValueArray * -pdb_proc_arg_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GimpValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GimpValueArray *return_vals; - const gchar *procedure_name; - gint32 arg_num; - gint32 arg_type = 0; - gchar *arg_name = NULL; - gchar *arg_desc = NULL; - - procedure_name = g_value_get_string (gimp_value_array_index (args, 0)); - arg_num = g_value_get_int (gimp_value_array_index (args, 1)); - - if (success) - { - GimpProcedure *proc; - gchar *canonical; - - canonical = gimp_canonicalize_identifier (procedure_name); - - proc = gimp_pdb_lookup_procedure (gimp->pdb, canonical); - - if (! proc) - { - const gchar *compat_name; - - compat_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical); - - if (compat_name) - proc = gimp_pdb_lookup_procedure (gimp->pdb, compat_name); - } - - g_free (canonical); - - if (proc && (arg_num >= 0 && arg_num < proc->num_args)) - { - GParamSpec *pspec = proc->args[arg_num]; - - arg_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec)); - arg_name = g_strdup (g_param_spec_get_name (pspec)); - arg_desc = gimp_param_spec_get_desc (pspec); - } - else - success = FALSE; - } - - return_vals = gimp_procedure_get_return_values (procedure, success, - error ? *error : NULL); - - if (success) - { - g_value_set_enum (gimp_value_array_index (return_vals, 1), arg_type); - g_value_take_string (gimp_value_array_index (return_vals, 2), arg_name); - g_value_take_string (gimp_value_array_index (return_vals, 3), arg_desc); - } - - return return_vals; -} - -static GimpValueArray * -pdb_proc_val_invoker (GimpProcedure *procedure, - Gimp *gimp, - GimpContext *context, - GimpProgress *progress, - const GimpValueArray *args, - GError **error) -{ - gboolean success = TRUE; - GimpValueArray *return_vals; - const gchar *procedure_name; - gint32 val_num; - gint32 val_type = 0; - gchar *val_name = NULL; - gchar *val_desc = NULL; - - procedure_name = g_value_get_string (gimp_value_array_index (args, 0)); - val_num = g_value_get_int (gimp_value_array_index (args, 1)); - - if (success) - { - GimpProcedure *proc; - gchar *canonical; - - canonical = gimp_canonicalize_identifier (procedure_name); - - proc = gimp_pdb_lookup_procedure (gimp->pdb, canonical); - - if (! proc) - { - const gchar *compat_name; - - compat_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical); - - if (compat_name) - proc = gimp_pdb_lookup_procedure (gimp->pdb, compat_name); - } - - g_free (canonical); - - if (proc && (val_num >= 0 && val_num < proc->num_values)) - { - GParamSpec *pspec = proc->values[val_num]; - - val_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec)); - val_name = g_strdup (g_param_spec_get_name (pspec)); - val_desc = gimp_param_spec_get_desc (pspec); - } - else - success = FALSE; - } - - return_vals = gimp_procedure_get_return_values (procedure, success, - error ? *error : NULL); - - if (success) - { - g_value_set_enum (gimp_value_array_index (return_vals, 1), val_type); - g_value_take_string (gimp_value_array_index (return_vals, 2), val_name); - g_value_take_string (gimp_value_array_index (return_vals, 3), val_desc); - } - - return return_vals; -} - static GimpValueArray * pdb_proc_argument_invoker (GimpProcedure *procedure, Gimp *gimp, @@ -759,7 +629,7 @@ register_pdb_procs (GimpPDB *pdb) gimp_procedure_set_static_strings (procedure, "gimp-pdb-proc-info", "Queries the procedural database for information on the specified procedure.", - "This procedure returns information on the specified procedure. A short blurb, detailed help, authors, copyright information, procedure type, number of input, and number of return values are returned. For specific information on each input argument and return value, use the 'gimp-procedural-db-proc-arg' and 'gimp-procedural-db-proc-val' procedures.", + "This procedure returns information on the specified procedure. A short blurb, detailed help, authors, copyright information, procedure type, number of input, and number of return values are returned. For specific information on each input argument and return value, use the 'gimp-pdb-db-proc-argument' and 'gimp-pdb-db-proc-return-value' procedures.", "Spencer Kimball & Peter Mattis", "Spencer Kimball & Peter Mattis", "1997", @@ -828,112 +698,6 @@ register_pdb_procs (GimpPDB *pdb) gimp_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); - /* - * gimp-pdb-proc-arg - */ - procedure = gimp_procedure_new (pdb_proc_arg_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-pdb-proc-arg"); - gimp_procedure_set_static_strings (procedure, - "gimp-pdb-proc-arg", - "Queries the procedural database for information on the specified procedure's argument.", - "This procedure returns information on the specified procedure's argument. The argument type, name, and a description are retrieved.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1997", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_string ("procedure-name", - "procedure name", - "The procedure name", - FALSE, FALSE, TRUE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - gimp_param_spec_int32 ("arg-num", - "arg num", - "The argument number", - G_MININT32, G_MAXINT32, 0, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_enum ("arg-type", - "arg type", - "The type of argument", - GIMP_TYPE_PDB_ARG_TYPE, - GIMP_PDB_INT32, - GIMP_PARAM_READWRITE)); - gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]), - GIMP_PDB_END); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_string ("arg-name", - "arg name", - "The name of the argument", - FALSE, FALSE, FALSE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_string ("arg-desc", - "arg desc", - "A description of the argument", - FALSE, FALSE, FALSE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - - /* - * gimp-pdb-proc-val - */ - procedure = gimp_procedure_new (pdb_proc_val_invoker); - gimp_object_set_static_name (GIMP_OBJECT (procedure), - "gimp-pdb-proc-val"); - gimp_procedure_set_static_strings (procedure, - "gimp-pdb-proc-val", - "Queries the procedural database for information on the specified procedure's return value.", - "This procedure returns information on the specified procedure's return value. The return value type, name, and a description are retrieved.", - "Spencer Kimball & Peter Mattis", - "Spencer Kimball & Peter Mattis", - "1997", - NULL); - gimp_procedure_add_argument (procedure, - gimp_param_spec_string ("procedure-name", - "procedure name", - "The procedure name", - FALSE, FALSE, TRUE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_argument (procedure, - gimp_param_spec_int32 ("val-num", - "val num", - "The return value number", - G_MININT32, G_MAXINT32, 0, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_enum ("val-type", - "val type", - "The type of return value", - GIMP_TYPE_PDB_ARG_TYPE, - GIMP_PDB_INT32, - GIMP_PARAM_READWRITE)); - gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]), - GIMP_PDB_END); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_string ("val-name", - "val name", - "The name of the return value", - FALSE, FALSE, FALSE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_procedure_add_return_value (procedure, - gimp_param_spec_string ("val-desc", - "val desc", - "A description of the return value", - FALSE, FALSE, FALSE, - NULL, - GIMP_PARAM_READWRITE)); - gimp_pdb_register_procedure (pdb, procedure); - g_object_unref (procedure); - /* * gimp-pdb-proc-argument */ diff --git a/libgimp/gimp.def b/libgimp/gimp.def index ee97894867..239e3db8a6 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -639,12 +639,10 @@ EXPORTS gimp_pdb_get_last_status gimp_pdb_get_type gimp_pdb_lookup_procedure - gimp_pdb_proc_arg gimp_pdb_proc_argument gimp_pdb_proc_exists gimp_pdb_proc_info gimp_pdb_proc_return_value - gimp_pdb_proc_val gimp_pdb_procedure_exists gimp_pdb_query gimp_pdb_query_procedures diff --git a/libgimp/gimplegacy.c b/libgimp/gimplegacy.c index 966914b721..4596cf9986 100644 --- a/libgimp/gimplegacy.c +++ b/libgimp/gimplegacy.c @@ -1705,61 +1705,6 @@ gimp_pdb_proc_info (const gchar *procedure_name, return success; } -/** - * gimp_pdb_proc_arg: - * @procedure_name: The procedure name. - * @arg_num: The argument number. - * @arg_type: (out): The type of argument. - * @arg_name: (out) (transfer full): The name of the argument. - * @arg_desc: (out) (transfer full): A description of the argument. - * - * Queries the procedural database for information on the specified - * procedure's argument. - * - * This procedure returns information on the specified procedure's - * argument. The argument type, name, and a description are retrieved. - * - * Returns: TRUE on success. - **/ -gboolean -gimp_pdb_proc_arg (const gchar *procedure_name, - gint arg_num, - GimpPDBArgType *arg_type, - gchar **arg_name, - gchar **arg_desc) -{ - return _gimp_pdb_proc_arg (procedure_name, arg_num, - arg_type, arg_name, arg_desc); -} - -/** - * gimp_pdb_proc_val: - * @procedure_name: The procedure name. - * @val_num: The return value number. - * @val_type: (out): The type of return value. - * @val_name: (out) (transfer full): The name of the return value. - * @val_desc: (out) (transfer full): A description of the return value. - * - * Queries the procedural database for information on the specified - * procedure's return value. - * - * This procedure returns information on the specified procedure's - * return value. The return value type, name, and a description are - * retrieved. - * - * Returns: TRUE on success. - **/ -gboolean -gimp_pdb_proc_val (const gchar *procedure_name, - gint val_num, - GimpPDBArgType *val_type, - gchar **val_name, - gchar **val_desc) -{ - return _gimp_pdb_proc_val (procedure_name, val_num, - val_type, val_name, val_desc); -} - /* private functions */ diff --git a/libgimp/gimplegacy.h b/libgimp/gimplegacy.h index 950caa0941..738ff41949 100644 --- a/libgimp/gimplegacy.h +++ b/libgimp/gimplegacy.h @@ -400,16 +400,6 @@ gboolean gimp_pdb_proc_info (const gchar *procedure_name, gint *num_values, GimpParamDef **args, GimpParamDef **return_vals); -gboolean gimp_pdb_proc_arg (const gchar *procedure_name, - gint arg_num, - GimpPDBArgType *arg_type, - gchar **arg_name, - gchar **arg_desc); -gboolean gimp_pdb_proc_val (const gchar *procedure_name, - gint val_num, - GimpPDBArgType *val_type, - gchar **val_name, - gchar **val_desc); #endif /* GIMP_DISABLE_COMPAT_CRUFT */ diff --git a/libgimp/gimppdb_pdb.c b/libgimp/gimppdb_pdb.c index ab1301a2a9..80fbdbcbea 100644 --- a/libgimp/gimppdb_pdb.c +++ b/libgimp/gimppdb_pdb.c @@ -246,8 +246,8 @@ _gimp_pdb_proc_exists (const gchar *procedure_name) * short blurb, detailed help, authors, copyright information, * procedure type, number of input, and number of return values are * returned. For specific information on each input argument and return - * value, use the gimp_procedural_db_proc_arg() and - * gimp_procedural_db_proc_val() procedures. + * value, use the gimp_pdb_db_proc_argument() and + * gimp_pdb_db_proc_return_value() procedures. * * Returns: TRUE on success. **/ @@ -308,127 +308,6 @@ _gimp_pdb_proc_info (const gchar *procedure_name, return success; } -/** - * _gimp_pdb_proc_arg: - * @procedure_name: The procedure name. - * @arg_num: The argument number. - * @arg_type: (out): The type of argument. - * @arg_name: (out) (transfer full): The name of the argument. - * @arg_desc: (out) (transfer full): A description of the argument. - * - * Queries the procedural database for information on the specified - * procedure's argument. - * - * This procedure returns information on the specified procedure's - * argument. The argument type, name, and a description are retrieved. - * - * Returns: TRUE on success. - **/ -gboolean -_gimp_pdb_proc_arg (const gchar *procedure_name, - gint arg_num, - GimpPDBArgType *arg_type, - gchar **arg_name, - gchar **arg_desc) -{ - GimpPDB *pdb = gimp_get_pdb (); - GimpValueArray *args; - GimpValueArray *return_vals; - gboolean success = TRUE; - - args = gimp_value_array_new_from_types (NULL, - G_TYPE_STRING, procedure_name, - GIMP_TYPE_INT32, arg_num, - G_TYPE_NONE); - - if (pdb) - return_vals = gimp_pdb_run_procedure_array (pdb, - "gimp-pdb-proc-arg", - args); - else - return_vals = gimp_run_procedure_array ("gimp-pdb-proc-arg", - args); - gimp_value_array_unref (args); - - *arg_type = 0; - *arg_name = NULL; - *arg_desc = NULL; - - success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS; - - if (success) - { - *arg_type = g_value_get_enum (gimp_value_array_index (return_vals, 1)); - *arg_name = g_value_dup_string (gimp_value_array_index (return_vals, 2)); - *arg_desc = g_value_dup_string (gimp_value_array_index (return_vals, 3)); - } - - gimp_value_array_unref (return_vals); - - return success; -} - -/** - * _gimp_pdb_proc_val: - * @procedure_name: The procedure name. - * @val_num: The return value number. - * @val_type: (out): The type of return value. - * @val_name: (out) (transfer full): The name of the return value. - * @val_desc: (out) (transfer full): A description of the return value. - * - * Queries the procedural database for information on the specified - * procedure's return value. - * - * This procedure returns information on the specified procedure's - * return value. The return value type, name, and a description are - * retrieved. - * - * Returns: TRUE on success. - **/ -gboolean -_gimp_pdb_proc_val (const gchar *procedure_name, - gint val_num, - GimpPDBArgType *val_type, - gchar **val_name, - gchar **val_desc) -{ - GimpPDB *pdb = gimp_get_pdb (); - GimpValueArray *args; - GimpValueArray *return_vals; - gboolean success = TRUE; - - args = gimp_value_array_new_from_types (NULL, - G_TYPE_STRING, procedure_name, - GIMP_TYPE_INT32, val_num, - G_TYPE_NONE); - - if (pdb) - return_vals = gimp_pdb_run_procedure_array (pdb, - "gimp-pdb-proc-val", - args); - else - return_vals = gimp_run_procedure_array ("gimp-pdb-proc-val", - args); - gimp_value_array_unref (args); - - *val_type = 0; - *val_name = NULL; - *val_desc = NULL; - - success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS; - - if (success) - { - *val_type = g_value_get_enum (gimp_value_array_index (return_vals, 1)); - *val_name = g_value_dup_string (gimp_value_array_index (return_vals, 2)); - *val_desc = g_value_dup_string (gimp_value_array_index (return_vals, 3)); - } - - gimp_value_array_unref (return_vals); - - return success; -} - /** * _gimp_pdb_proc_argument: * @procedure_name: The procedure name. diff --git a/libgimp/gimppdb_pdb.h b/libgimp/gimppdb_pdb.h index 14e479fd7e..78e1b8cf20 100644 --- a/libgimp/gimppdb_pdb.h +++ b/libgimp/gimppdb_pdb.h @@ -53,16 +53,6 @@ G_GNUC_INTERNAL gboolean _gimp_pdb_proc_info (const gchar *proc GimpPDBProcType *proc_type, gint *num_args, gint *num_values); -G_GNUC_INTERNAL gboolean _gimp_pdb_proc_arg (const gchar *procedure_name, - gint arg_num, - GimpPDBArgType *arg_type, - gchar **arg_name, - gchar **arg_desc); -G_GNUC_INTERNAL gboolean _gimp_pdb_proc_val (const gchar *procedure_name, - gint val_num, - GimpPDBArgType *val_type, - gchar **val_name, - gchar **val_desc); G_GNUC_INTERNAL GParamSpec* _gimp_pdb_proc_argument (const gchar *procedure_name, gint arg_num); G_GNUC_INTERNAL GParamSpec* _gimp_pdb_proc_return_value (const gchar *procedure_name, diff --git a/pdb/groups/pdb.pdb b/pdb/groups/pdb.pdb index 23ece8e2be..cdda1a1e24 100644 --- a/pdb/groups/pdb.pdb +++ b/pdb/groups/pdb.pdb @@ -200,7 +200,7 @@ This procedure returns information on the specified procedure. A short blurb, detailed help, authors, copyright information, procedure type, number of input, and number of return values are returned. For specific information on each input argument and return value, use the -gimp_procedural_db_proc_arg() and gimp_procedural_db_proc_val() +gimp_pdb_db_proc_argument() and gimp_pdb_db_proc_return_value() procedures. HELP @@ -376,146 +376,6 @@ CODE ); } -sub pdb_proc_arg { - $blurb = < 'procedure_name', type => 'string', non_empty => 1, - desc => 'The procedure name' }, - { name => 'arg_num', type => 'int32', - desc => 'The argument number' } - ); - - @outargs = ( - { name => 'arg_type', type => 'enum GimpPDBArgType (no GIMP_PDB_END)', - void_ret => 1, - desc => "The type of argument" }, - { name => 'arg_name', type => 'string', - desc => 'The name of the argument' }, - { name => 'arg_desc', type => 'string', - desc => 'A description of the argument' } - ); - - %invoke = ( - code => <pdb, canonical); - - if (! proc) - { - const gchar *compat_name; - - compat_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical); - - if (compat_name) - proc = gimp_pdb_lookup_procedure (gimp->pdb, compat_name); - } - - g_free (canonical); - - if (proc && (arg_num >= 0 && arg_num < proc->num_args)) - { - GParamSpec *pspec = proc->args[arg_num]; - - arg_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec)); - arg_name = g_strdup (g_param_spec_get_name (pspec)); - arg_desc = gimp_param_spec_get_desc (pspec); - } - else - success = FALSE; -} -CODE - ); -} - -sub pdb_proc_val { - $blurb = < 'procedure_name', type => 'string', non_empty => 1, - desc => 'The procedure name' }, - { name => 'val_num', type => 'int32', - desc => 'The return value number' } - ); - - @outargs = ( - { name => 'val_type', type => 'enum GimpPDBArgType (no GIMP_PDB_END)', - void_ret => 1, - desc => "The type of return value" }, - { name => 'val_name', type => 'string', - desc => 'The name of the return value' }, - { name => 'val_desc', type => 'string', - desc => 'A description of the return value' } - ); - - %invoke = ( - code => <pdb, canonical); - - if (! proc) - { - const gchar *compat_name; - - compat_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical); - - if (compat_name) - proc = gimp_pdb_lookup_procedure (gimp->pdb, compat_name); - } - - g_free (canonical); - - if (proc && (val_num >= 0 && val_num < proc->num_values)) - { - GParamSpec *pspec = proc->values[val_num]; - - val_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec)); - val_name = g_strdup (g_param_spec_get_name (pspec)); - val_desc = gimp_param_spec_get_desc (pspec); - } - else - success = FALSE; -} -CODE - ); -} - sub pdb_get_data { $blurb = 'Returns data associated with the specified identifier.'; @@ -649,8 +509,6 @@ CODE pdb_query pdb_proc_exists pdb_proc_info - pdb_proc_arg - pdb_proc_val pdb_proc_argument pdb_proc_return_value pdb_get_data