Commit aba2eea1 authored by Michael Natterer's avatar Michael Natterer 😴

libgimp: remove gimp_run_procedure() and gimp_destroy_params()

parent 966c49d0
Pipeline #104402 passed with stages
in 18 minutes and 13 seconds
......@@ -173,7 +173,6 @@ EXPORTS
gimp_debug_timer_end
gimp_debug_timer_start
gimp_default_display
gimp_destroy_params
gimp_detach_parasite
gimp_display_delete
gimp_display_get_window_handle
......@@ -715,7 +714,6 @@ EXPORTS
gimp_register_magic_load_handler
gimp_register_save_handler
gimp_register_thumbnail_loader
gimp_run_procedure
gimp_run_procedure_array
gimp_save_procedure_get_type
gimp_save_procedure_new
......
......@@ -446,221 +446,6 @@ _gimp_legacy_read_expect_msg (GimpWireMessage *msg,
}
}
/**
* gimp_run_procedure: (skip)
* @name: the name of the procedure to run
* @n_return_vals: return location for the number of return values
* @...: list of procedure parameters
*
* This function calls a GIMP procedure and returns its return values.
*
* The procedure's parameters are given by a va_list in the format
* (type, value, type, value) and must be terminated by %GIMP_PDB_END.
*
* This function converts the va_list of parameters into an array and
* passes them to gimp_run_procedure2(). Please look there for further
* information.
*
* Returns: the procedure's return values unless there was an error,
* in which case the zero-th return value will be the error status, and
* the first return value will be a string detailing the error.
**/
GimpParam *
gimp_run_procedure (const gchar *name,
gint *n_return_vals,
...)
{
GimpValueArray *arguments;
GimpValueArray *return_values;
GimpPDBArgType param_type;
GimpParam *return_vals;
GimpParam *params = NULL;
gint n_params = 0;
va_list args;
gint i;
g_return_val_if_fail (name != NULL, NULL);
g_return_val_if_fail (n_return_vals != NULL, NULL);
ASSERT_NO_PLUG_IN_EXISTS (G_STRFUNC);
va_start (args, n_return_vals);
param_type = va_arg (args, GimpPDBArgType);
while (param_type != GIMP_PDB_END)
{
switch (param_type)
{
case GIMP_PDB_INT32:
case GIMP_PDB_DISPLAY:
case GIMP_PDB_IMAGE:
case GIMP_PDB_ITEM:
case GIMP_PDB_LAYER:
case GIMP_PDB_CHANNEL:
case GIMP_PDB_DRAWABLE:
case GIMP_PDB_SELECTION:
case GIMP_PDB_VECTORS:
case GIMP_PDB_STATUS:
(void) va_arg (args, gint);
break;
case GIMP_PDB_INT16:
(void) va_arg (args, gint);
break;
case GIMP_PDB_INT8:
(void) va_arg (args, gint);
break;
case GIMP_PDB_FLOAT:
(void) va_arg (args, gdouble);
break;
case GIMP_PDB_STRING:
(void) va_arg (args, gchar *);
break;
case GIMP_PDB_INT32ARRAY:
(void) va_arg (args, gint32 *);
break;
case GIMP_PDB_INT16ARRAY:
(void) va_arg (args, gint16 *);
break;
case GIMP_PDB_INT8ARRAY:
(void) va_arg (args, gint8 *);
break;
case GIMP_PDB_FLOATARRAY:
(void) va_arg (args, gdouble *);
break;
case GIMP_PDB_STRINGARRAY:
(void) va_arg (args, gchar **);
break;
case GIMP_PDB_COLOR:
case GIMP_PDB_COLORARRAY:
(void) va_arg (args, GimpRGB *);
break;
case GIMP_PDB_PARASITE:
(void) va_arg (args, GimpParasite *);
break;
case GIMP_PDB_END:
break;
}
n_params++;
param_type = va_arg (args, GimpPDBArgType);
}
va_end (args);
params = g_new0 (GimpParam, n_params);
va_start (args, n_return_vals);
for (i = 0; i < n_params; i++)
{
params[i].type = va_arg (args, GimpPDBArgType);
switch (params[i].type)
{
case GIMP_PDB_INT32:
params[i].data.d_int32 = (gint32) va_arg (args, gint);
break;
case GIMP_PDB_INT16:
params[i].data.d_int16 = (gint16) va_arg (args, gint);
break;
case GIMP_PDB_INT8:
params[i].data.d_int8 = (guint8) va_arg (args, gint);
break;
case GIMP_PDB_FLOAT:
params[i].data.d_float = (gdouble) va_arg (args, gdouble);
break;
case GIMP_PDB_STRING:
params[i].data.d_string = va_arg (args, gchar *);
break;
case GIMP_PDB_INT32ARRAY:
params[i].data.d_int32array = va_arg (args, gint32 *);
break;
case GIMP_PDB_INT16ARRAY:
params[i].data.d_int16array = va_arg (args, gint16 *);
break;
case GIMP_PDB_INT8ARRAY:
params[i].data.d_int8array = va_arg (args, guint8 *);
break;
case GIMP_PDB_FLOATARRAY:
params[i].data.d_floatarray = va_arg (args, gdouble *);
break;
case GIMP_PDB_STRINGARRAY:
params[i].data.d_stringarray = va_arg (args, gchar **);
break;
case GIMP_PDB_COLOR:
params[i].data.d_color = *va_arg (args, GimpRGB *);
break;
case GIMP_PDB_ITEM:
params[i].data.d_item = va_arg (args, gint32);
break;
case GIMP_PDB_DISPLAY:
params[i].data.d_display = va_arg (args, gint32);
break;
case GIMP_PDB_IMAGE:
params[i].data.d_image = va_arg (args, gint32);
break;
case GIMP_PDB_LAYER:
params[i].data.d_layer = va_arg (args, gint32);
break;
case GIMP_PDB_CHANNEL:
params[i].data.d_channel = va_arg (args, gint32);
break;
case GIMP_PDB_DRAWABLE:
params[i].data.d_drawable = va_arg (args, gint32);
break;
case GIMP_PDB_SELECTION:
params[i].data.d_selection = va_arg (args, gint32);
break;
case GIMP_PDB_COLORARRAY:
params[i].data.d_colorarray = va_arg (args, GimpRGB *);
break;
case GIMP_PDB_VECTORS:
params[i].data.d_vectors = va_arg (args, gint32);
break;
case GIMP_PDB_PARASITE:
{
GimpParasite *parasite = va_arg (args, GimpParasite *);
if (parasite == NULL)
{
params[i].data.d_parasite.name = NULL;
params[i].data.d_parasite.data = NULL;
}
else
{
params[i].data.d_parasite.name = parasite->name;
params[i].data.d_parasite.flags = parasite->flags;
params[i].data.d_parasite.size = parasite->size;
params[i].data.d_parasite.data = parasite->data;
}
}
break;
case GIMP_PDB_STATUS:
params[i].data.d_status = va_arg (args, gint32);
break;
case GIMP_PDB_END:
break;
}
}
va_end (args);
arguments = _gimp_params_to_value_array (params, n_params, FALSE);
return_values = gimp_run_procedure_array (name, arguments);
gimp_value_array_unref (arguments);
g_free (params);
*n_return_vals = gimp_value_array_length (return_values);
return_vals = _gimp_value_array_to_params (return_values, TRUE);
gimp_value_array_unref (return_values);
return return_vals;
}
GimpValueArray *
gimp_run_procedure_array (const gchar *name,
const GimpValueArray *arguments)
......@@ -699,94 +484,6 @@ gimp_run_procedure_array (const gchar *name,
return return_values;
}
/**
* gimp_destroy_params:
* @params: the #GimpParam array to destroy
* @n_params: the number of elements in the array
*
* Destroys a #GimpParam array as returned by gimp_run_procedure() or
* gimp_run_procedure2().
**/
void
gimp_destroy_params (GimpParam *params,
gint n_params)
{
gint i;
ASSERT_NO_PLUG_IN_EXISTS (G_STRFUNC);
for (i = 0; i < n_params; i++)
{
switch (params[i].type)
{
case GIMP_PDB_INT32:
case GIMP_PDB_INT16:
case GIMP_PDB_INT8:
case GIMP_PDB_FLOAT:
case GIMP_PDB_COLOR:
case GIMP_PDB_ITEM:
case GIMP_PDB_DISPLAY:
case GIMP_PDB_IMAGE:
case GIMP_PDB_LAYER:
case GIMP_PDB_CHANNEL:
case GIMP_PDB_DRAWABLE:
case GIMP_PDB_SELECTION:
case GIMP_PDB_VECTORS:
case GIMP_PDB_STATUS:
break;
case GIMP_PDB_STRING:
g_free (params[i].data.d_string);
break;
case GIMP_PDB_INT32ARRAY:
g_free (params[i].data.d_int32array);
break;
case GIMP_PDB_INT16ARRAY:
g_free (params[i].data.d_int16array);
break;
case GIMP_PDB_INT8ARRAY:
g_free (params[i].data.d_int8array);
break;
case GIMP_PDB_FLOATARRAY:
g_free (params[i].data.d_floatarray);
break;
case GIMP_PDB_STRINGARRAY:
if ((i > 0) && (params[i-1].type == GIMP_PDB_INT32))
{
gint count = params[i-1].data.d_int32;
gint j;
for (j = 0; j < count; j++)
g_free (params[i].data.d_stringarray[j]);
g_free (params[i].data.d_stringarray);
}
break;
case GIMP_PDB_COLORARRAY:
g_free (params[i].data.d_colorarray);
break;
case GIMP_PDB_PARASITE:
if (params[i].data.d_parasite.name)
g_free (params[i].data.d_parasite.name);
if (params[i].data.d_parasite.data)
g_free (params[i].data.d_parasite.data);
break;
case GIMP_PDB_END:
break;
}
}
g_free (params);
}
/**
* gimp_get_pdb_error:
*
......
......@@ -278,27 +278,12 @@ void gimp_uninstall_temp_proc (const gchar *name);
*/
void gimp_extension_enable (void);
/* Run a procedure in the procedure database. The parameters are
* specified via the variable length argument list. The return
* values are returned in the 'GimpParam*' array.
*/
GimpParam * gimp_run_procedure (const gchar *name,
gint *n_return_vals,
...);
/* Run a procedure in the procedure database. The parameters are
* specified as a GimpValueArray, so are the return values.
*/
GimpValueArray * gimp_run_procedure_array (const gchar *name,
const GimpValueArray *arguments);
/* Destroy the an array of parameters. This is useful for
* destroying the return values returned by a call to
* 'gimp_run_procedure'.
*/
void gimp_destroy_params (GimpParam *params,
gint n_params);
/* Retrieve the error message and return status for the last procedure
* call.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment