16
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
/* NOTE: This file is autogenerated by pdbgen.pl. */
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
21
21
#include "config.h"
27
24
#include <glib-object.h>
26
#include "libgimpbase/gimpbase.h"
29
28
#include "pdb-types.h"
30
#include "procedural_db.h"
30
#include "gimpprocedure.h"
31
#include "core/gimpparamspecs.h"
32
33
#include "core/gimp.h"
33
#include "gimp-intl.h"
35
#ifdef HAVE_GLIBC_REGEX
38
#include "regexrepl/regex.h"
41
#define COMPAT_BLURB "This procedure is deprecated! Use '%s' instead."
45
typedef struct _PDBQuery PDBQuery;
55
regex_t copyright_regex;
57
regex_t proc_type_regex;
59
gchar **list_of_procs;
61
gboolean querying_compat;
65
typedef struct _PDBStrings PDBStrings;
78
static gchar *proc_type_str[] =
80
N_("Internal GIMP procedure"),
83
N_("Temporary Procedure")
86
static const gchar * const type_str[] =
93
"GIMP_PDB_INT32ARRAY",
94
"GIMP_PDB_INT16ARRAY",
96
"GIMP_PDB_FLOATARRAY",
97
"GIMP_PDB_STRINGARRAY",
105
"GIMP_PDB_SELECTION",
113
static ProcRecord procedural_db_temp_name_proc;
114
static ProcRecord procedural_db_dump_proc;
115
static ProcRecord procedural_db_query_proc;
116
static ProcRecord procedural_db_proc_info_proc;
117
static ProcRecord procedural_db_proc_arg_proc;
118
static ProcRecord procedural_db_proc_val_proc;
119
static ProcRecord procedural_db_get_data_proc;
120
static ProcRecord procedural_db_get_data_size_proc;
121
static ProcRecord procedural_db_set_data_proc;
124
register_procedural_db_procs (Gimp *gimp)
126
procedural_db_register (gimp, &procedural_db_temp_name_proc);
127
procedural_db_register (gimp, &procedural_db_dump_proc);
128
procedural_db_register (gimp, &procedural_db_query_proc);
129
procedural_db_register (gimp, &procedural_db_proc_info_proc);
130
procedural_db_register (gimp, &procedural_db_proc_arg_proc);
131
procedural_db_register (gimp, &procedural_db_proc_val_proc);
132
procedural_db_register (gimp, &procedural_db_get_data_proc);
133
procedural_db_register (gimp, &procedural_db_get_data_size_proc);
134
procedural_db_register (gimp, &procedural_db_set_data_proc);
138
match_strings (regex_t *preg,
144
return regexec (preg, a, 0, NULL, 0);
148
get_pdb_strings (PDBStrings *strings,
152
strings->compat = compat;
156
strings->blurb = g_strdup_printf (COMPAT_BLURB, proc->name);
157
strings->help = g_strdup (strings->blurb);
158
strings->author = NULL;
159
strings->copyright = NULL;
160
strings->date = NULL;
164
strings->blurb = proc->blurb;
165
strings->help = proc->help;
166
strings->author = proc->author;
167
strings->copyright = proc->copyright;
168
strings->date = proc->date;
173
procedural_db_query_entry (gpointer key,
177
PDBQuery *pdb_query = user_data;
180
const gchar *proc_name;
185
if (pdb_query->querying_compat)
186
list = g_hash_table_lookup (pdb_query->gimp->procedural_ht, value);
193
proc = (ProcRecord *) list->data;
195
get_pdb_strings (&strings, proc, pdb_query->querying_compat);
197
if (! match_strings (&pdb_query->name_regex, proc_name) &&
198
! match_strings (&pdb_query->blurb_regex, strings.blurb) &&
199
! match_strings (&pdb_query->help_regex, strings.help) &&
200
! match_strings (&pdb_query->author_regex, strings.author) &&
201
! match_strings (&pdb_query->copyright_regex, strings.copyright) &&
202
! match_strings (&pdb_query->date_regex, strings.date) &&
203
! match_strings (&pdb_query->proc_type_regex,
204
proc_type_str[(gint) proc->proc_type]))
206
pdb_query->num_procs++;
207
pdb_query->list_of_procs = g_renew (gchar *, pdb_query->list_of_procs,
208
pdb_query->num_procs);
209
pdb_query->list_of_procs[pdb_query->num_procs - 1] = g_strdup (proc_name);
214
g_free (strings.blurb);
215
g_free (strings.help);
220
output_string (FILE *file,
223
if (fprintf (file, "\"") < 0)
231
case '\\' : if (fprintf (file, "\\\\") < 0) return FALSE; break;
232
case '\"' : if (fprintf (file, "\\\"") < 0) return FALSE; break;
233
case '{' : if (fprintf (file, "@{") < 0) return FALSE; break;
234
case '@' : if (fprintf (file, "@@") < 0) return FALSE; break;
235
case '}' : if (fprintf (file, "@}") < 0) return FALSE; break;
238
if (fprintf (file, "%c", *string) < 0)
244
if (fprintf (file, "\"\n") < 0)
251
procedural_db_print_entry (gpointer key,
255
ProcRecord *procedure;
262
list = (GList *) value;
263
file = (FILE *) user_data;
265
buf = g_string_new ("");
270
procedure = (ProcRecord*) list->data;
273
fprintf (file, "\n(register-procedure ");
275
if (list || num != 1)
277
g_string_printf (buf, "%s <%d>", procedure->name, num);
278
output_string (file, buf->str);
281
output_string (file, procedure->name);
283
output_string (file, procedure->blurb);
284
output_string (file, procedure->help);
285
output_string (file, procedure->author);
286
output_string (file, procedure->copyright);
287
output_string (file, procedure->date);
288
output_string (file, proc_type_str[(int) procedure->proc_type]);
290
fprintf (file, "( ");
291
for (i = 0; i < procedure->num_args; i++)
293
fprintf (file, "( ");
295
output_string (file, procedure->args[i].name );
296
output_string (file, type_str[procedure->args[i].arg_type]);
297
output_string (file, procedure->args[i].description);
299
fprintf (file, " ) ");
301
fprintf (file, " ) ");
303
fprintf (file, "( ");
304
for (i = 0; i < procedure->num_values; i++)
306
fprintf (file, "( ");
307
output_string (file, procedure->values[i].name );
308
output_string (file, type_str[procedure->values[i].arg_type]);
309
output_string (file, procedure->values[i].description);
311
fprintf (file, " ) ");
313
fprintf (file, " ) ");
314
fprintf (file, " ) ");
317
g_string_free (buf, TRUE);
320
/* This really doesn't belong here, but it depends on our generated type_str
324
pdb_type_name (gint type)
326
if (type >= 0 && type <= GIMP_PDB_END)
327
return type_str[type];
329
return g_strdup_printf ("(PDB type %d unknown)", type);
330
/* Yeah, we leak the memory. But then you shouldn't try and
331
* get the name of a PDB type that doesn't exist, should you.
336
procedural_db_temp_name_invoker (Gimp *gimp,
337
GimpContext *context,
338
GimpProgress *progress,
341
Argument *return_args;
34
#include "core/gimpparamspecs-desc.h"
35
#include "gimp-pdb-compat.h"
36
#include "gimppdb-query.h"
37
#include "plug-in/gimppluginmanager-data.h"
39
#include "internal_procs.h"
43
procedural_db_temp_name_invoker (GimpProcedure *procedure,
46
GimpProgress *progress,
47
const GValueArray *args)
49
GValueArray *return_vals;
50
gchar *temp_name = NULL;
343
52
static gint proc_number = 0;
345
temp_name = g_strdup_printf ("temp_procedure_number_%d", proc_number++);
347
return_args = procedural_db_return_args (&procedural_db_temp_name_proc, TRUE);
348
return_args[1].value.pdb_pointer = temp_name;
353
static ProcArg procedural_db_temp_name_outargs[] =
358
"A unique temporary name for a temporary PDB entry"
362
static ProcRecord procedural_db_temp_name_proc =
364
"gimp_procedural_db_temp_name",
365
"Generates a unique temporary PDB name.",
366
"This procedure generates a temporary PDB entry name that is guaranteed to be unique. It is many used by the interactive popup dialogs to generate a PDB entry name.",
375
procedural_db_temp_name_outargs,
376
{ { procedural_db_temp_name_invoker } }
380
procedural_db_dump_invoker (Gimp *gimp,
381
GimpContext *context,
382
GimpProgress *progress,
385
gboolean success = TRUE;
389
filename = (gchar *) args[0].value.pdb_pointer;
390
if (filename == NULL)
395
if ((file = fopen (filename, "w")))
397
g_hash_table_foreach (gimp->procedural_ht,
398
procedural_db_print_entry, file);
405
return procedural_db_return_args (&procedural_db_dump_proc, success);
408
static ProcArg procedural_db_dump_inargs[] =
417
static ProcRecord procedural_db_dump_proc =
419
"gimp_procedural_db_dump",
420
"Dumps the current contents of the procedural database",
421
"This procedure dumps the contents of the procedural database to the specified file. The file will contain all of the information provided for each registered procedure. This file is in a format appropriate for use with the supplied \"pdb_self_doc.el\" Elisp script, which generates a texinfo document.",
422
"Spencer Kimball & Josh MacDonald",
423
"Spencer Kimball & Josh MacDonald & Peter Mattis",
428
procedural_db_dump_inargs,
431
{ { procedural_db_dump_invoker } }
435
procedural_db_query_invoker (Gimp *gimp,
436
GimpContext *context,
437
GimpProgress *progress,
440
gboolean success = TRUE;
441
Argument *return_args;
451
name = (gchar *) args[0].value.pdb_pointer;
455
blurb = (gchar *) args[1].value.pdb_pointer;
459
help = (gchar *) args[2].value.pdb_pointer;
463
author = (gchar *) args[3].value.pdb_pointer;
467
copyright = (gchar *) args[4].value.pdb_pointer;
468
if (copyright == NULL)
471
date = (gchar *) args[5].value.pdb_pointer;
475
proc_type = (gchar *) args[6].value.pdb_pointer;
476
if (proc_type == NULL)
483
if (regcomp (&pdb_query.name_regex, name, 0))
485
if (regcomp (&pdb_query.blurb_regex, blurb, 0))
487
if (regcomp (&pdb_query.help_regex, help, 0))
489
if (regcomp (&pdb_query.author_regex, author, 0))
491
if (regcomp (&pdb_query.copyright_regex, copyright, 0))
493
if (regcomp (&pdb_query.date_regex, date, 0))
495
if (regcomp (&pdb_query.proc_type_regex, proc_type, 0))
500
pdb_query.gimp = gimp;
501
pdb_query.list_of_procs = NULL;
502
pdb_query.num_procs = 0;
503
pdb_query.querying_compat = FALSE;
505
g_hash_table_foreach (gimp->procedural_ht,
506
procedural_db_query_entry, &pdb_query);
508
pdb_query.querying_compat = TRUE;
510
g_hash_table_foreach (gimp->procedural_compat_ht,
511
procedural_db_query_entry, &pdb_query);
514
regfree (&pdb_query.proc_type_regex);
516
regfree (&pdb_query.date_regex);
518
regfree (&pdb_query.copyright_regex);
520
regfree (&pdb_query.author_regex);
522
regfree (&pdb_query.help_regex);
524
regfree (&pdb_query.blurb_regex);
526
regfree (&pdb_query.name_regex);
529
return_args = procedural_db_return_args (&procedural_db_query_proc, success);
533
return_args[1].value.pdb_int = pdb_query.num_procs;
534
return_args[2].value.pdb_pointer = pdb_query.list_of_procs;
540
static ProcArg procedural_db_query_inargs[] =
545
"The regex for procedure name"
550
"The regex for procedure blurb"
555
"The regex for procedure help"
560
"The regex for procedure author"
565
"The regex for procedure copyright"
570
"The regex for procedure date"
575
"The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-in', 'GIMP Extension' }"
579
static ProcArg procedural_db_query_outargs[] =
584
"The number of matching procedures"
587
GIMP_PDB_STRINGARRAY,
589
"The list of procedure names"
593
static ProcRecord procedural_db_query_proc =
595
"gimp_procedural_db_query",
596
"Queries the procedural database for its contents using regular expression matching.",
597
"This procedure queries the contents of the procedural database. It is supplied with seven arguments matching procedures on { name, blurb, help, author, copyright, date, procedure type}. This is accomplished using regular expression matching. For instance, to find all procedures with \"jpeg\" listed in the blurb, all seven arguments can be supplied as \".*\", except for the second, which can be supplied as \".*jpeg.*\". There are two return arguments for this procedure. The first is the number of procedures matching the query. The second is a concatenated list of procedure names corresponding to those matching the query. If no matching entries are found, then the returned string is NULL and the number of entries is 0.",
598
"Spencer Kimball & Peter Mattis",
599
"Spencer Kimball & Peter Mattis",
604
procedural_db_query_inargs,
606
procedural_db_query_outargs,
607
{ { procedural_db_query_invoker } }
611
procedural_db_proc_info_invoker (Gimp *gimp,
612
GimpContext *context,
613
GimpProgress *progress,
616
gboolean success = TRUE;
617
Argument *return_args;
620
ProcRecord *proc = NULL;
622
proc_name = (gchar *) args[0].value.pdb_pointer;
623
if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL))
628
proc = procedural_db_lookup (gimp, proc_name);
632
get_pdb_strings (&strings, proc, FALSE);
636
const gchar *compat_name;
638
compat_name = g_hash_table_lookup (gimp->procedural_compat_ht, proc_name);
642
proc = procedural_db_lookup (gimp, compat_name);
645
get_pdb_strings (&strings, proc, TRUE);
649
success = (proc != NULL);
652
return_args = procedural_db_return_args (&procedural_db_proc_info_proc, success);
656
return_args[1].value.pdb_pointer = strings.compat ? strings.blurb : g_strdup (strings.blurb);
657
return_args[2].value.pdb_pointer = strings.compat ? strings.help : g_strdup (strings.help);
658
return_args[3].value.pdb_pointer = strings.compat ? strings.author : g_strdup (strings.author);
659
return_args[4].value.pdb_pointer = strings.compat ? strings.copyright : g_strdup (strings.copyright);
660
return_args[5].value.pdb_pointer = strings.compat ? strings.date : g_strdup (strings.date);
661
return_args[6].value.pdb_int = proc->proc_type;
662
return_args[7].value.pdb_int = proc->num_args;
663
return_args[8].value.pdb_int = proc->num_values;
669
static ProcArg procedural_db_proc_info_inargs[] =
678
static ProcArg procedural_db_proc_info_outargs[] =
688
"Detailed procedure help"
693
"Author(s) of the procedure"
708
"The procedure type: { GIMP_INTERNAL (0), GIMP_PLUGIN (1), GIMP_EXTENSION (2), GIMP_TEMPORARY (3) }"
713
"The number of input arguments"
718
"The number of return values"
722
static ProcRecord procedural_db_proc_info_proc =
724
"gimp_procedural_db_proc_info",
725
"Queries the procedural database for information on the specified procedure.",
726
"This procedure returns information on the specified procedure. A short blurb, detailed help, author(s), 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.",
727
"Spencer Kimball & Peter Mattis",
728
"Spencer Kimball & Peter Mattis",
733
procedural_db_proc_info_inargs,
735
procedural_db_proc_info_outargs,
736
{ { procedural_db_proc_info_invoker } }
740
procedural_db_proc_arg_invoker (Gimp *gimp,
741
GimpContext *context,
742
GimpProgress *progress,
745
gboolean success = TRUE;
746
Argument *return_args;
54
temp_name = g_strdup_printf ("temp-procedure-number-%d", proc_number++);
56
return_vals = gimp_procedure_get_return_values (procedure, TRUE);
57
g_value_take_string (&return_vals->values[1], temp_name);
63
procedural_db_dump_invoker (GimpProcedure *procedure,
66
GimpProgress *progress,
67
const GValueArray *args)
69
gboolean success = TRUE;
70
const gchar *filename;
72
filename = g_value_get_string (&args->values[0]);
76
success = gimp_pdb_dump (gimp->pdb, filename);
79
return gimp_procedure_get_return_values (procedure, success);
83
procedural_db_query_invoker (GimpProcedure *procedure,
86
GimpProgress *progress,
87
const GValueArray *args)
89
gboolean success = TRUE;
90
GValueArray *return_vals;
95
const gchar *copyright;
97
const gchar *proc_type;
98
gint32 num_matches = 0;
99
gchar **procedure_names = NULL;
101
name = g_value_get_string (&args->values[0]);
102
blurb = g_value_get_string (&args->values[1]);
103
help = g_value_get_string (&args->values[2]);
104
author = g_value_get_string (&args->values[3]);
105
copyright = g_value_get_string (&args->values[4]);
106
date = g_value_get_string (&args->values[5]);
107
proc_type = g_value_get_string (&args->values[6]);
111
success = gimp_pdb_query (gimp->pdb,
112
name, blurb, help, author,
113
copyright, date, proc_type,
114
&num_matches, &procedure_names);
117
return_vals = gimp_procedure_get_return_values (procedure, success);
121
g_value_set_int (&return_vals->values[1], num_matches);
122
gimp_value_take_stringarray (&return_vals->values[2], procedure_names, num_matches);
129
procedural_db_proc_info_invoker (GimpProcedure *procedure,
131
GimpContext *context,
132
GimpProgress *progress,
133
const GValueArray *args)
135
gboolean success = TRUE;
136
GValueArray *return_vals;
137
const gchar *procedure_name;
140
gchar *author = NULL;
141
gchar *copyright = NULL;
143
gint32 proc_type = 0;
145
gint32 num_values = 0;
147
procedure_name = g_value_get_string (&args->values[0]);
151
GimpPDBProcType ptype;
154
canonical = gimp_canonicalize_identifier (procedure_name);
156
success = gimp_pdb_proc_info (gimp->pdb, canonical,
157
&blurb, &help, &author,
158
©right, &date, &ptype,
159
&num_args, &num_values);
165
return_vals = gimp_procedure_get_return_values (procedure, success);
169
g_value_take_string (&return_vals->values[1], blurb);
170
g_value_take_string (&return_vals->values[2], help);
171
g_value_take_string (&return_vals->values[3], author);
172
g_value_take_string (&return_vals->values[4], copyright);
173
g_value_take_string (&return_vals->values[5], date);
174
g_value_set_enum (&return_vals->values[6], proc_type);
175
g_value_set_int (&return_vals->values[7], num_args);
176
g_value_set_int (&return_vals->values[8], num_values);
183
procedural_db_proc_arg_invoker (GimpProcedure *procedure,
185
GimpContext *context,
186
GimpProgress *progress,
187
const GValueArray *args)
189
gboolean success = TRUE;
190
GValueArray *return_vals;
191
const gchar *procedure_name;
752
proc_name = (gchar *) args[0].value.pdb_pointer;
753
if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL))
756
arg_num = args[1].value.pdb_int;
194
gchar *arg_name = NULL;
195
gchar *arg_desc = NULL;
197
procedure_name = g_value_get_string (&args->values[0]);
198
arg_num = g_value_get_int (&args->values[1]);
760
proc = procedural_db_lookup (gimp, proc_name);
205
canonical = gimp_canonicalize_identifier (procedure_name);
207
proc = gimp_pdb_lookup_procedure (gimp->pdb, canonical);
764
211
const gchar *compat_name;
766
compat_name = g_hash_table_lookup (gimp->procedural_compat_ht, proc_name);
213
compat_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical);
769
proc = procedural_db_lookup (gimp, compat_name);
216
proc = gimp_pdb_lookup_procedure (gimp->pdb, compat_name);
772
221
if (proc && (arg_num >= 0 && arg_num < proc->num_args))
773
arg = &proc->args[arg_num];
223
GParamSpec *pspec = proc->args[arg_num];
225
arg_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec));
226
arg_name = g_strdup (g_param_spec_get_name (pspec));
227
arg_desc = gimp_param_spec_get_desc (pspec);
778
return_args = procedural_db_return_args (&procedural_db_proc_arg_proc, success);
233
return_vals = gimp_procedure_get_return_values (procedure, success);
782
return_args[1].value.pdb_int = arg->arg_type;
783
return_args[2].value.pdb_pointer = g_strdup (arg->name);
784
return_args[3].value.pdb_pointer = g_strdup (arg->description);
237
g_value_set_enum (&return_vals->values[1], arg_type);
238
g_value_take_string (&return_vals->values[2], arg_name);
239
g_value_take_string (&return_vals->values[3], arg_desc);
790
static ProcArg procedural_db_proc_arg_inargs[] =
800
"The argument number"
804
static ProcArg procedural_db_proc_arg_outargs[] =
809
"The type of argument { GIMP_PDB_INT32 (0), GIMP_PDB_INT16 (1), GIMP_PDB_INT8 (2), GIMP_PDB_FLOAT (3), GIMP_PDB_STRING (4), GIMP_PDB_INT32ARRAY (5), GIMP_PDB_INT16ARRAY (6), GIMP_PDB_INT8ARRAY (7), GIMP_PDB_FLOATARRAY (8), GIMP_PDB_STRINGARRAY (9), GIMP_PDB_COLOR (10), GIMP_PDB_REGION (11), GIMP_PDB_DISPLAY (12), GIMP_PDB_IMAGE (13), GIMP_PDB_LAYER (14), GIMP_PDB_CHANNEL (15), GIMP_PDB_DRAWABLE (16), GIMP_PDB_SELECTION (17), GIMP_PDB_BOUNDARY (18), GIMP_PDB_PATH (19), GIMP_PDB_PARASITE (20), GIMP_PDB_STATUS (21) }"
814
"The name of the argument"
819
"A description of the argument"
823
static ProcRecord procedural_db_proc_arg_proc =
825
"gimp_procedural_db_proc_arg",
826
"Queries the procedural database for information on the specified procedure's argument.",
827
"This procedure returns information on the specified procedure's argument. The argument type, name, and a description are retrieved.",
828
"Spencer Kimball & Peter Mattis",
829
"Spencer Kimball & Peter Mattis",
834
procedural_db_proc_arg_inargs,
836
procedural_db_proc_arg_outargs,
837
{ { procedural_db_proc_arg_invoker } }
841
procedural_db_proc_val_invoker (Gimp *gimp,
842
GimpContext *context,
843
GimpProgress *progress,
246
procedural_db_proc_val_invoker (GimpProcedure *procedure,
248
GimpContext *context,
249
GimpProgress *progress,
250
const GValueArray *args)
846
252
gboolean success = TRUE;
847
Argument *return_args;
253
GValueArray *return_vals;
254
const gchar *procedure_name;
853
proc_name = (gchar *) args[0].value.pdb_pointer;
854
if (proc_name == NULL || !g_utf8_validate (proc_name, -1, NULL))
857
val_num = args[1].value.pdb_int;
257
gchar *val_name = NULL;
258
gchar *val_desc = NULL;
260
procedure_name = g_value_get_string (&args->values[0]);
261
val_num = g_value_get_int (&args->values[1]);
861
proc = procedural_db_lookup (gimp, proc_name);
268
canonical = gimp_canonicalize_identifier (procedure_name);
270
proc = gimp_pdb_lookup_procedure (gimp->pdb, canonical);
865
274
const gchar *compat_name;
867
compat_name = g_hash_table_lookup (gimp->procedural_compat_ht, proc_name);
276
compat_name = gimp_pdb_lookup_compat_proc_name (gimp->pdb, canonical);
870
proc = procedural_db_lookup (gimp, compat_name);
279
proc = gimp_pdb_lookup_procedure (gimp->pdb, compat_name);
873
284
if (proc && (val_num >= 0 && val_num < proc->num_values))
874
val = &proc->values[val_num];
879
return_args = procedural_db_return_args (&procedural_db_proc_val_proc, success);
883
return_args[1].value.pdb_int = val->arg_type;
884
return_args[2].value.pdb_pointer = g_strdup (val->name);
885
return_args[3].value.pdb_pointer = g_strdup (val->description);
891
static ProcArg procedural_db_proc_val_inargs[] =
901
"The return value number"
905
static ProcArg procedural_db_proc_val_outargs[] =
910
"The type of return value { GIMP_PDB_INT32 (0), GIMP_PDB_INT16 (1), GIMP_PDB_INT8 (2), GIMP_PDB_FLOAT (3), GIMP_PDB_STRING (4), GIMP_PDB_INT32ARRAY (5), GIMP_PDB_INT16ARRAY (6), GIMP_PDB_INT8ARRAY (7), GIMP_PDB_FLOATARRAY (8), GIMP_PDB_STRINGARRAY (9), GIMP_PDB_COLOR (10), GIMP_PDB_REGION (11), GIMP_PDB_DISPLAY (12), GIMP_PDB_IMAGE (13), GIMP_PDB_LAYER (14), GIMP_PDB_CHANNEL (15), GIMP_PDB_DRAWABLE (16), GIMP_PDB_SELECTION (17), GIMP_PDB_BOUNDARY (18), GIMP_PDB_PATH (19), GIMP_PDB_PARASITE (20), GIMP_PDB_STATUS (21) }"
915
"The name of the return value"
920
"A description of the return value"
924
static ProcRecord procedural_db_proc_val_proc =
926
"gimp_procedural_db_proc_val",
927
"Queries the procedural database for information on the specified procedure's return value.",
928
"This procedure returns information on the specified procedure's return value. The return value type, name, and a description are retrieved.",
929
"Spencer Kimball & Peter Mattis",
930
"Spencer Kimball & Peter Mattis",
935
procedural_db_proc_val_inargs,
937
procedural_db_proc_val_outargs,
938
{ { procedural_db_proc_val_invoker } }
942
procedural_db_get_data_invoker (Gimp *gimp,
943
GimpContext *context,
944
GimpProgress *progress,
947
gboolean success = TRUE;
948
Argument *return_args;
951
guint8 *data_copy = NULL;
954
identifier = (gchar *) args[0].value.pdb_pointer;
955
if (identifier == NULL || !g_utf8_validate (identifier, -1, NULL))
960
data = procedural_db_get_data (gimp, identifier, &bytes);
961
success = (data != NULL);
964
data_copy = g_memdup (data, bytes);
967
return_args = procedural_db_return_args (&procedural_db_get_data_proc, success);
971
return_args[1].value.pdb_int = bytes;
972
return_args[2].value.pdb_pointer = data_copy;
978
static ProcArg procedural_db_get_data_inargs[] =
983
"The identifier associated with data"
987
static ProcArg procedural_db_get_data_outargs[] =
992
"The number of bytes in the data"
997
"A byte array containing data"
1001
static ProcRecord procedural_db_get_data_proc =
1003
"gimp_procedural_db_get_data",
1004
"Returns data associated with the specified identifier.",
1005
"This procedure returns any data which may have been associated with the specified identifier. The data is a variable length array of bytes. If no data has been associated with the identifier, an error is returned.",
1006
"Spencer Kimball & Peter Mattis",
1007
"Spencer Kimball & Peter Mattis",
1012
procedural_db_get_data_inargs,
1014
procedural_db_get_data_outargs,
1015
{ { procedural_db_get_data_invoker } }
1019
procedural_db_get_data_size_invoker (Gimp *gimp,
1020
GimpContext *context,
1021
GimpProgress *progress,
1024
gboolean success = TRUE;
1025
Argument *return_args;
1030
identifier = (gchar *) args[0].value.pdb_pointer;
1031
if (identifier == NULL || !g_utf8_validate (identifier, -1, NULL))
1036
data = procedural_db_get_data (gimp, identifier, &bytes);
1037
success = (data != NULL);
1040
return_args = procedural_db_return_args (&procedural_db_get_data_size_proc, success);
1043
return_args[1].value.pdb_int = bytes;
1048
static ProcArg procedural_db_get_data_size_inargs[] =
1053
"The identifier associated with data"
1057
static ProcArg procedural_db_get_data_size_outargs[] =
1062
"The number of bytes in the data"
1066
static ProcRecord procedural_db_get_data_size_proc =
1068
"gimp_procedural_db_get_data_size",
1069
"Returns size of data associated with the specified identifier.",
1070
"This procedure returns the size of any data which may have been associated with the specified identifier. If no data has been associated with the identifier, an error is returned.",
1077
procedural_db_get_data_size_inargs,
1079
procedural_db_get_data_size_outargs,
1080
{ { procedural_db_get_data_size_invoker } }
1084
procedural_db_set_data_invoker (Gimp *gimp,
1085
GimpContext *context,
1086
GimpProgress *progress,
1089
gboolean success = TRUE;
1094
identifier = (gchar *) args[0].value.pdb_pointer;
1095
if (identifier == NULL || !g_utf8_validate (identifier, -1, NULL))
1098
bytes = args[1].value.pdb_int;
1102
data = (guint8 *) args[2].value.pdb_pointer;
1105
procedural_db_set_data (gimp, identifier, bytes, data);
1107
return procedural_db_return_args (&procedural_db_set_data_proc, success);
1110
static ProcArg procedural_db_set_data_inargs[] =
1115
"The identifier associated with data"
1120
"The number of bytes in the data"
1125
"A byte array containing data"
1129
static ProcRecord procedural_db_set_data_proc =
1131
"gimp_procedural_db_set_data",
1132
"Associates the specified identifier with the supplied data.",
1133
"This procedure associates the supplied data with the provided identifier. The data may be subsequently retrieved by a call to 'procedural-db-get-data'.",
1134
"Spencer Kimball & Peter Mattis",
1135
"Spencer Kimball & Peter Mattis",
1140
procedural_db_set_data_inargs,
1143
{ { procedural_db_set_data_invoker } }
286
GParamSpec *pspec = proc->values[val_num];
288
val_type = gimp_pdb_compat_arg_type_from_gtype (G_PARAM_SPEC_VALUE_TYPE (pspec));
289
val_name = g_strdup (g_param_spec_get_name (pspec));
290
val_desc = gimp_param_spec_get_desc (pspec);
296
return_vals = gimp_procedure_get_return_values (procedure, success);
300
g_value_set_enum (&return_vals->values[1], val_type);
301
g_value_take_string (&return_vals->values[2], val_name);
302
g_value_take_string (&return_vals->values[3], val_desc);
309
procedural_db_get_data_invoker (GimpProcedure *procedure,
311
GimpContext *context,
312
GimpProgress *progress,
313
const GValueArray *args)
315
gboolean success = TRUE;
316
GValueArray *return_vals;
317
const gchar *identifier;
321
identifier = g_value_get_string (&args->values[0]);
325
gchar *canonical = gimp_canonicalize_identifier (identifier);
326
const guint8 *orig_data;
328
orig_data = gimp_plug_in_manager_get_data (gimp->plug_in_manager,
334
data = g_memdup (orig_data, bytes);
339
return_vals = gimp_procedure_get_return_values (procedure, success);
343
g_value_set_int (&return_vals->values[1], bytes);
344
gimp_value_take_int8array (&return_vals->values[2], data, bytes);
351
procedural_db_get_data_size_invoker (GimpProcedure *procedure,
353
GimpContext *context,
354
GimpProgress *progress,
355
const GValueArray *args)
357
gboolean success = TRUE;
358
GValueArray *return_vals;
359
const gchar *identifier;
362
identifier = g_value_get_string (&args->values[0]);
366
gchar *canonical = gimp_canonicalize_identifier (identifier);
368
if (! gimp_plug_in_manager_get_data (gimp->plug_in_manager,
375
return_vals = gimp_procedure_get_return_values (procedure, success);
378
g_value_set_int (&return_vals->values[1], bytes);
384
procedural_db_set_data_invoker (GimpProcedure *procedure,
386
GimpContext *context,
387
GimpProgress *progress,
388
const GValueArray *args)
390
gboolean success = TRUE;
391
const gchar *identifier;
395
identifier = g_value_get_string (&args->values[0]);
396
bytes = g_value_get_int (&args->values[1]);
397
data = gimp_value_get_int8array (&args->values[2]);
401
gchar *canonical = gimp_canonicalize_identifier (identifier);
403
gimp_plug_in_manager_set_data (gimp->plug_in_manager,
404
canonical, bytes, data);
409
return gimp_procedure_get_return_values (procedure, success);
413
register_procedural_db_procs (GimpPDB *pdb)
415
GimpProcedure *procedure;
418
* gimp-procedural-db-temp-name
420
procedure = gimp_procedure_new (procedural_db_temp_name_invoker);
421
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-temp-name");
422
gimp_procedure_set_static_strings (procedure,
423
"gimp-procedural-db-temp-name",
424
"Generates a unique temporary PDB name.",
425
"This procedure generates a temporary PDB entry name that is guaranteed to be unique.",
430
gimp_procedure_add_return_value (procedure,
431
gimp_param_spec_string ("temp-name",
433
"A unique temporary name for a temporary PDB entry",
436
GIMP_PARAM_READWRITE));
437
gimp_pdb_register_procedure (pdb, procedure);
438
g_object_unref (procedure);
441
* gimp-procedural-db-dump
443
procedure = gimp_procedure_new (procedural_db_dump_invoker);
444
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-dump");
445
gimp_procedure_set_static_strings (procedure,
446
"gimp-procedural-db-dump",
447
"Dumps the current contents of the procedural database",
448
"This procedure dumps the contents of the procedural database to the specified file. The file will contain all of the information provided for each registered procedure. This file is in a format appropriate for use with the supplied \"pdb_self_doc.el\" Elisp script, which generates a texinfo document.",
449
"Spencer Kimball & Josh MacDonald",
450
"Spencer Kimball & Josh MacDonald & Peter Mattis",
453
gimp_procedure_add_argument (procedure,
454
gimp_param_spec_string ("filename",
459
GIMP_PARAM_READWRITE));
460
gimp_pdb_register_procedure (pdb, procedure);
461
g_object_unref (procedure);
464
* gimp-procedural-db-query
466
procedure = gimp_procedure_new (procedural_db_query_invoker);
467
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-query");
468
gimp_procedure_set_static_strings (procedure,
469
"gimp-procedural-db-query",
470
"Queries the procedural database for its contents using regular expression matching.",
471
"This procedure queries the contents of the procedural database. It is supplied with seven arguments matching procedures on { name, blurb, help, author, copyright, date, procedure type}. This is accomplished using regular expression matching. For instance, to find all procedures with \"jpeg\" listed in the blurb, all seven arguments can be supplied as \".*\", except for the second, which can be supplied as \".*jpeg.*\". There are two return arguments for this procedure. The first is the number of procedures matching the query. The second is a concatenated list of procedure names corresponding to those matching the query. If no matching entries are found, then the returned string is NULL and the number of entries is 0.",
472
"Spencer Kimball & Peter Mattis",
473
"Spencer Kimball & Peter Mattis",
476
gimp_procedure_add_argument (procedure,
477
gimp_param_spec_string ("name",
479
"The regex for procedure name",
482
GIMP_PARAM_READWRITE));
483
gimp_procedure_add_argument (procedure,
484
gimp_param_spec_string ("blurb",
486
"The regex for procedure blurb",
489
GIMP_PARAM_READWRITE));
490
gimp_procedure_add_argument (procedure,
491
gimp_param_spec_string ("help",
493
"The regex for procedure help",
496
GIMP_PARAM_READWRITE));
497
gimp_procedure_add_argument (procedure,
498
gimp_param_spec_string ("author",
500
"The regex for procedure author",
503
GIMP_PARAM_READWRITE));
504
gimp_procedure_add_argument (procedure,
505
gimp_param_spec_string ("copyright",
507
"The regex for procedure copyright",
510
GIMP_PARAM_READWRITE));
511
gimp_procedure_add_argument (procedure,
512
gimp_param_spec_string ("date",
514
"The regex for procedure date",
517
GIMP_PARAM_READWRITE));
518
gimp_procedure_add_argument (procedure,
519
gimp_param_spec_string ("proc-type",
521
"The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-In', 'GIMP Extension', 'Temporary Procedure' }",
524
GIMP_PARAM_READWRITE));
525
gimp_procedure_add_return_value (procedure,
526
gimp_param_spec_int32 ("num-matches",
528
"The number of matching procedures",
530
GIMP_PARAM_READWRITE));
531
gimp_procedure_add_return_value (procedure,
532
gimp_param_spec_string_array ("procedure-names",
534
"The list of procedure names",
535
GIMP_PARAM_READWRITE));
536
gimp_pdb_register_procedure (pdb, procedure);
537
g_object_unref (procedure);
540
* gimp-procedural-db-proc-info
542
procedure = gimp_procedure_new (procedural_db_proc_info_invoker);
543
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-proc-info");
544
gimp_procedure_set_static_strings (procedure,
545
"gimp-procedural-db-proc-info",
546
"Queries the procedural database for information on the specified procedure.",
547
"This procedure returns information on the specified procedure. A short blurb, detailed help, author(s), 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.",
548
"Spencer Kimball & Peter Mattis",
549
"Spencer Kimball & Peter Mattis",
552
gimp_procedure_add_argument (procedure,
553
gimp_param_spec_string ("procedure-name",
555
"The procedure name",
558
GIMP_PARAM_READWRITE));
559
gimp_procedure_add_return_value (procedure,
560
gimp_param_spec_string ("blurb",
565
GIMP_PARAM_READWRITE));
566
gimp_procedure_add_return_value (procedure,
567
gimp_param_spec_string ("help",
569
"Detailed procedure help",
572
GIMP_PARAM_READWRITE));
573
gimp_procedure_add_return_value (procedure,
574
gimp_param_spec_string ("author",
576
"Author(s) of the procedure",
579
GIMP_PARAM_READWRITE));
580
gimp_procedure_add_return_value (procedure,
581
gimp_param_spec_string ("copyright",
586
GIMP_PARAM_READWRITE));
587
gimp_procedure_add_return_value (procedure,
588
gimp_param_spec_string ("date",
593
GIMP_PARAM_READWRITE));
594
gimp_procedure_add_return_value (procedure,
595
g_param_spec_enum ("proc-type",
597
"The procedure type",
598
GIMP_TYPE_PDB_PROC_TYPE,
600
GIMP_PARAM_READWRITE));
601
gimp_procedure_add_return_value (procedure,
602
gimp_param_spec_int32 ("num-args",
604
"The number of input arguments",
605
G_MININT32, G_MAXINT32, 0,
606
GIMP_PARAM_READWRITE));
607
gimp_procedure_add_return_value (procedure,
608
gimp_param_spec_int32 ("num-values",
610
"The number of return values",
611
G_MININT32, G_MAXINT32, 0,
612
GIMP_PARAM_READWRITE));
613
gimp_pdb_register_procedure (pdb, procedure);
614
g_object_unref (procedure);
617
* gimp-procedural-db-proc-arg
619
procedure = gimp_procedure_new (procedural_db_proc_arg_invoker);
620
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-proc-arg");
621
gimp_procedure_set_static_strings (procedure,
622
"gimp-procedural-db-proc-arg",
623
"Queries the procedural database for information on the specified procedure's argument.",
624
"This procedure returns information on the specified procedure's argument. The argument type, name, and a description are retrieved.",
625
"Spencer Kimball & Peter Mattis",
626
"Spencer Kimball & Peter Mattis",
629
gimp_procedure_add_argument (procedure,
630
gimp_param_spec_string ("procedure-name",
632
"The procedure name",
635
GIMP_PARAM_READWRITE));
636
gimp_procedure_add_argument (procedure,
637
gimp_param_spec_int32 ("arg-num",
639
"The argument number",
640
G_MININT32, G_MAXINT32, 0,
641
GIMP_PARAM_READWRITE));
642
gimp_procedure_add_return_value (procedure,
643
gimp_param_spec_enum ("arg-type",
645
"The type of argument",
646
GIMP_TYPE_PDB_ARG_TYPE,
648
GIMP_PARAM_READWRITE));
649
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]),
651
gimp_procedure_add_return_value (procedure,
652
gimp_param_spec_string ("arg-name",
654
"The name of the argument",
657
GIMP_PARAM_READWRITE));
658
gimp_procedure_add_return_value (procedure,
659
gimp_param_spec_string ("arg-desc",
661
"A description of the argument",
664
GIMP_PARAM_READWRITE));
665
gimp_pdb_register_procedure (pdb, procedure);
666
g_object_unref (procedure);
669
* gimp-procedural-db-proc-val
671
procedure = gimp_procedure_new (procedural_db_proc_val_invoker);
672
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-proc-val");
673
gimp_procedure_set_static_strings (procedure,
674
"gimp-procedural-db-proc-val",
675
"Queries the procedural database for information on the specified procedure's return value.",
676
"This procedure returns information on the specified procedure's return value. The return value type, name, and a description are retrieved.",
677
"Spencer Kimball & Peter Mattis",
678
"Spencer Kimball & Peter Mattis",
681
gimp_procedure_add_argument (procedure,
682
gimp_param_spec_string ("procedure-name",
684
"The procedure name",
687
GIMP_PARAM_READWRITE));
688
gimp_procedure_add_argument (procedure,
689
gimp_param_spec_int32 ("val-num",
691
"The return value number",
692
G_MININT32, G_MAXINT32, 0,
693
GIMP_PARAM_READWRITE));
694
gimp_procedure_add_return_value (procedure,
695
gimp_param_spec_enum ("val-type",
697
"The type of return value",
698
GIMP_TYPE_PDB_ARG_TYPE,
700
GIMP_PARAM_READWRITE));
701
gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM (procedure->values[0]),
703
gimp_procedure_add_return_value (procedure,
704
gimp_param_spec_string ("val-name",
706
"The name of the return value",
709
GIMP_PARAM_READWRITE));
710
gimp_procedure_add_return_value (procedure,
711
gimp_param_spec_string ("val-desc",
713
"A description of the return value",
716
GIMP_PARAM_READWRITE));
717
gimp_pdb_register_procedure (pdb, procedure);
718
g_object_unref (procedure);
721
* gimp-procedural-db-get-data
723
procedure = gimp_procedure_new (procedural_db_get_data_invoker);
724
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-get-data");
725
gimp_procedure_set_static_strings (procedure,
726
"gimp-procedural-db-get-data",
727
"Returns data associated with the specified identifier.",
728
"This procedure returns any data which may have been associated with the specified identifier. The data is a variable length array of bytes. If no data has been associated with the identifier, an error is returned.",
729
"Spencer Kimball & Peter Mattis",
730
"Spencer Kimball & Peter Mattis",
733
gimp_procedure_add_argument (procedure,
734
gimp_param_spec_string ("identifier",
736
"The identifier associated with data",
739
GIMP_PARAM_READWRITE));
740
gimp_procedure_add_return_value (procedure,
741
gimp_param_spec_int32 ("bytes",
743
"The number of bytes in the data",
745
GIMP_PARAM_READWRITE));
746
gimp_procedure_add_return_value (procedure,
747
gimp_param_spec_int8_array ("data",
749
"A byte array containing data",
750
GIMP_PARAM_READWRITE));
751
gimp_pdb_register_procedure (pdb, procedure);
752
g_object_unref (procedure);
755
* gimp-procedural-db-get-data-size
757
procedure = gimp_procedure_new (procedural_db_get_data_size_invoker);
758
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-get-data-size");
759
gimp_procedure_set_static_strings (procedure,
760
"gimp-procedural-db-get-data-size",
761
"Returns size of data associated with the specified identifier.",
762
"This procedure returns the size of any data which may have been associated with the specified identifier. If no data has been associated with the identifier, an error is returned.",
767
gimp_procedure_add_argument (procedure,
768
gimp_param_spec_string ("identifier",
770
"The identifier associated with data",
773
GIMP_PARAM_READWRITE));
774
gimp_procedure_add_return_value (procedure,
775
gimp_param_spec_int32 ("bytes",
777
"The number of bytes in the data",
779
GIMP_PARAM_READWRITE));
780
gimp_pdb_register_procedure (pdb, procedure);
781
g_object_unref (procedure);
784
* gimp-procedural-db-set-data
786
procedure = gimp_procedure_new (procedural_db_set_data_invoker);
787
gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-procedural-db-set-data");
788
gimp_procedure_set_static_strings (procedure,
789
"gimp-procedural-db-set-data",
790
"Associates the specified identifier with the supplied data.",
791
"This procedure associates the supplied data with the provided identifier. The data may be subsequently retrieved by a call to 'procedural-db-get-data'.",
792
"Spencer Kimball & Peter Mattis",
793
"Spencer Kimball & Peter Mattis",
796
gimp_procedure_add_argument (procedure,
797
gimp_param_spec_string ("identifier",
799
"The identifier associated with data",
802
GIMP_PARAM_READWRITE));
803
gimp_procedure_add_argument (procedure,
804
gimp_param_spec_int32 ("bytes",
806
"The number of bytes in the data",
808
GIMP_PARAM_READWRITE));
809
gimp_procedure_add_argument (procedure,
810
gimp_param_spec_int8_array ("data",
812
"A byte array containing data",
813
GIMP_PARAM_READWRITE));
814
gimp_pdb_register_procedure (pdb, procedure);
815
g_object_unref (procedure);