2000-06-02 01:34:56 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpproceduraldb.c
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gimp.h"
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_procedural_db_proc_info (gchar *procedure,
|
|
|
|
gchar **blurb,
|
|
|
|
gchar **help,
|
|
|
|
gchar **author,
|
|
|
|
gchar **copyright,
|
|
|
|
gchar **date,
|
|
|
|
GimpPDBProcType *proc_type,
|
|
|
|
gint *num_args,
|
|
|
|
gint *num_values,
|
|
|
|
GimpParamDef **args,
|
|
|
|
GimpParamDef **return_vals)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2000-08-23 09:44:59 +08:00
|
|
|
success = _gimp_procedural_db_proc_info (procedure,
|
|
|
|
blurb,
|
|
|
|
help,
|
|
|
|
author,
|
|
|
|
copyright,
|
|
|
|
date,
|
|
|
|
proc_type,
|
|
|
|
num_args,
|
|
|
|
num_values);
|
2000-06-02 01:34:56 +08:00
|
|
|
|
|
|
|
if (success)
|
|
|
|
{
|
|
|
|
*args = g_new (GimpParamDef, *num_args);
|
|
|
|
*return_vals = g_new (GimpParamDef, *num_values);
|
|
|
|
|
|
|
|
for (i = 0; i < *num_args; i++)
|
|
|
|
{
|
|
|
|
if (! gimp_procedural_db_proc_arg (procedure,
|
|
|
|
i,
|
|
|
|
&(*args)[i].type,
|
|
|
|
&(*args)[i].name,
|
|
|
|
&(*args)[i].description))
|
|
|
|
{
|
|
|
|
g_free (*args);
|
|
|
|
g_free (*return_vals);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < *num_values; i++)
|
|
|
|
{
|
|
|
|
if (! gimp_procedural_db_proc_val (procedure,
|
|
|
|
i,
|
|
|
|
&(*return_vals)[i].type,
|
|
|
|
&(*return_vals)[i].name,
|
|
|
|
&(*return_vals)[i].description))
|
|
|
|
{
|
|
|
|
g_free (*args);
|
|
|
|
g_free (*return_vals);
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2000-08-23 19:22:08 +08:00
|
|
|
gboolean
|
2000-06-02 01:34:56 +08:00
|
|
|
gimp_procedural_db_get_data (gchar *identifier,
|
|
|
|
gpointer data)
|
|
|
|
{
|
2000-08-23 19:22:08 +08:00
|
|
|
gint size;
|
|
|
|
guint8 *hack;
|
|
|
|
gboolean success;
|
2000-06-03 10:04:33 +08:00
|
|
|
|
2000-08-23 19:22:08 +08:00
|
|
|
success = _gimp_procedural_db_get_data (identifier,
|
|
|
|
&size,
|
|
|
|
&hack);
|
2000-06-03 10:04:33 +08:00
|
|
|
if (hack)
|
|
|
|
{
|
2000-08-10 01:04:16 +08:00
|
|
|
memcpy (data, (gpointer) hack, size * sizeof (guint8));
|
2000-06-03 10:04:33 +08:00
|
|
|
g_free (hack);
|
|
|
|
}
|
2000-08-23 19:22:08 +08:00
|
|
|
|
|
|
|
return success;
|
2000-06-02 01:34:56 +08:00
|
|
|
}
|
|
|
|
|
2000-08-23 19:22:08 +08:00
|
|
|
gboolean
|
2000-06-02 01:34:56 +08:00
|
|
|
gimp_procedural_db_set_data (gchar *identifier,
|
|
|
|
gpointer data,
|
|
|
|
guint32 bytes)
|
|
|
|
{
|
2000-08-23 19:22:08 +08:00
|
|
|
return _gimp_procedural_db_set_data (identifier,
|
|
|
|
bytes,
|
|
|
|
data);
|
2000-06-02 01:34:56 +08:00
|
|
|
}
|