~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to tools/pdbgen/app.pl

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# The GIMP -- an image manipulation program
 
1
# GIMP - The GNU Image Manipulation Program
2
2
# Copyright (C) 1998-2003 Manish Singh <yosh@gimp.org>
3
3
 
4
4
# This program is free software; you can redistribute it and/or modify
21
21
 
22
22
*arg_types = \%Gimp::CodeGen::pdb::arg_types;
23
23
*arg_parse = \&Gimp::CodeGen::pdb::arg_parse;
24
 
*arg_ptype = \&Gimp::CodeGen::pdb::arg_ptype;
25
 
*arg_vname = \&Gimp::CodeGen::pdb::arg_vname;
26
24
 
27
25
*enums = \%Gimp::CodeGen::enums::enums;
28
26
 
61
59
    $code;
62
60
}
63
61
 
64
 
sub arg_value {
65
 
    my ($arg, $argc) = @_;
66
 
    my $cast = "";
67
 
 
68
 
    my $type = &arg_ptype($arg);
69
 
 
70
 
    if ($type eq 'pointer' || $arg->{type} =~ /int(16|8)$/) {
71
 
        $cast = "($arg->{type}) ";
72
 
    }
73
 
 
74
 
    return "${cast}args[$argc].value.pdb_$type";
75
 
}
76
 
 
77
 
sub make_arg_test {
78
 
    my ($arg, $reverse, $test) = @_;
79
 
    my $result = "";
80
 
 
81
 
    my $yes = exists $arg->{on_success};
82
 
    my $no  = !exists $arg->{no_success} || exists $arg->{on_fail};
83
 
 
84
 
    if ($yes || $no) {
85
 
        &$reverse(\$test) if $yes;
86
 
 
87
 
        if (exists $arg->{cond}) {
88
 
            my $cond = "";
89
 
            foreach (@{$arg->{cond}}) {
90
 
                $cond .= '!' if $yes;
91
 
                $cond .= /\W/ ? "($_)" : $_;
92
 
                $cond .= $yes ? ' !! ' : ' && ';
93
 
            }
94
 
            $test = "$cond($test)";
95
 
        }
96
 
 
97
 
        $result = ' ' x 2 . "if ($test)\n";
98
 
 
99
 
        $result .= &format_code_frag($arg->{on_success}, 1) if $yes;
100
 
 
101
 
        if ($no) {
102
 
            $result .= ' ' x 2 . "else\n" if $yes;
103
 
 
104
 
            if (!exists $arg->{no_success}) {
105
 
                $success = 1;
106
 
                $result .= ' ' x 4 . "success = FALSE;\n";
107
 
            }
108
 
 
109
 
            if (exists $arg->{on_fail}) {
110
 
                $result .= &format_code_frag($_->{on_fail}, 1);
111
 
            }
112
 
        }
113
 
    }
114
 
 
115
 
    $result;
116
 
}
117
 
 
118
62
sub declare_args {
119
63
    my $proc = shift;
120
64
    my $out = shift;
 
65
    my $outargs = shift;
121
66
 
122
67
    local $result = "";
123
68
 
133
78
            }
134
79
 
135
80
            unless (exists $_->{no_declare}) {
136
 
                my $type = exists $_->{no_id_lookup} ? 'gint32 ' : $arg->{type};
137
 
 
138
 
                $result .= ' ' x 2 . $type . &arg_vname($_);
139
 
                if (!exists $_->{no_init} && exists $_->{init} && 
140
 
                    !exists $arg->{struct}) {
141
 
                    for ($arg->{type}) {
142
 
                        /\*$/     && do { $result .= ' = NULL';  last };
143
 
                        /boolean/ && do { $result .= ' = FALSE'; last };
144
 
                                          $result .= ' = 0';
145
 
                    }
 
81
                if ($outargs) {
 
82
                    $result .= "  $arg->{type}$_->{name} = $arg->{init_value}";
 
83
                }
 
84
                else {
 
85
                    $result .= "  $arg->{const_type}$_->{name}";
146
86
                }
147
87
                $result .= ";\n";
148
88
 
158
98
    $result;
159
99
}
160
100
 
161
 
sub declare_vars {
162
 
    my $proc = shift;
163
 
    my $code = "";
164
 
    if (exists $proc->{invoke}->{vars}) {
165
 
        foreach (@{$proc->{invoke}->{vars}}) {
166
 
           $code .= ' ' x 2 . $_ . ";\n";
167
 
        }
168
 
    }
169
 
    $code;
170
 
}
171
 
 
172
 
sub make_arg_recs {
173
 
    my $proc = shift;
174
 
 
175
 
    my $result = "";
176
 
    my $once;
177
 
 
178
 
    foreach (@_) {
179
 
        my @args = @{$proc->{$_}} if exists $proc->{$_};
180
 
 
181
 
        if (scalar @args) {
182
 
            $result .= "\nstatic ProcArg $proc->{name}_${_}\[] =\n{\n";
183
 
 
184
 
            foreach $arg (@{$proc->{$_}}) {
185
 
                my ($type, $name, @remove) = &arg_parse($arg->{type});
186
 
                my $desc = $arg->{desc};
187
 
                my $info = $arg->{type};
188
 
 
189
 
                for ($type) {
190
 
                    /array/     && do {                                  last };
191
 
                    /boolean/   && do { $info = 'TRUE or FALSE';         last };
192
 
                    /int|float/ && do { $info =~ s/$type/$arg->{name}/e; last };
193
 
                    /enum/      && do { my $enum = $enums{$name};
194
 
                                        $info = $enum->{info};
195
 
                                        foreach (@remove) {
196
 
                                            $info =~ s/$_ \(.*?\)(, )?//
197
 
                                        }                                
198
 
                                        $info =~ s/, $//;
199
 
                                        if (!$#{[$info =~ /,/g]} &&
200
 
                                             $desc !~ /{ %%desc%% }/) {
201
 
                                            $info =~ s/,/ or/
202
 
                                        }                                last };
203
 
                }
204
 
 
205
 
                $desc =~ s/%%desc%%/$info/eg;
206
 
 
207
 
                $result .= <<CODE;
208
 
  {
209
 
    GIMP_PDB_$arg_types{$type}->{name},
210
 
    "$arg->{name}",
211
 
    @{[ &quotewrap($desc, 4) ]}
212
 
  },
213
 
CODE
214
 
            }
215
 
 
216
 
            $result =~ s/,\n$/\n/s;
217
 
            $result .= "};\n";
218
 
        }
219
 
    }
220
 
 
221
 
    $result;
222
 
}
223
 
 
224
101
sub marshal_inargs {
225
102
    my ($proc, $argc) = @_;
226
103
 
232
109
    foreach (@inargs) {
233
110
        my($pdbtype, @typeinfo) = &arg_parse($_->{type});
234
111
        my $arg = $arg_types{$pdbtype};
235
 
        my $var = &arg_vname($_);
236
 
        my $value = &arg_value($arg, $argc++);
237
 
        
238
 
        if (exists $arg->{id_func} && !exists $_->{no_id_lookup}) {
239
 
            my $id_func = $arg->{id_func};
240
 
            $id_func = $_->{id_func} if exists $_->{id_func};
241
 
 
242
 
            $result .= "  $var = $id_func (gimp, $value);\n";
243
 
 
244
 
            if (exists $arg->{check_func}) {
245
 
                my $check_func = eval qq/"$arg->{check_func}"/;
246
 
 
247
 
                $result .= &make_arg_test($_, sub { ${$_[0]} =~ s/==/!=/ },
248
 
                                          "! $check_func");
249
 
            } else {
250
 
                $result .= &make_arg_test($_, sub { ${$_[0]} =~ s/==/!=/ },
251
 
                                          "$var == NULL");
252
 
            }
253
 
        }
254
 
        else {
255
 
            $result .= ' ' x 2 . "$var = $value";
256
 
            $result .= ' ? TRUE : FALSE' if $pdbtype eq 'boolean';
257
 
            $result .= ";\n";
258
 
 
259
 
            if ($pdbtype eq 'string' || $pdbtype eq 'parasite') {
260
 
                my ($reverse, $test, $utf8, $utf8testvar);
261
 
 
262
 
                $test = "$var == NULL";
263
 
                $utf8 = 1;
264
 
 
265
 
                if ($pdbtype eq 'parasite') {
266
 
                    $test .= " || $var->name == NULL";
267
 
                    $utf8testvar = "$var->name";
268
 
                }
269
 
                else {
270
 
                    $utf8 = !exists $_->{no_validate};
271
 
                    $utf8testvar = "$var";
272
 
                }
273
 
 
274
 
                if (exists $_->{null_ok}) {
275
 
                    $reverse = sub { ${$_[0]} =~ s/!//; };
276
 
                    $test = "$var && !g_utf8_validate ($var, -1, NULL)";
277
 
                }
278
 
                elsif ($utf8) {
279
 
                    $reverse = sub { ${$_[0]} =~ s/!//;
280
 
                                     ${$_[0]} =~ s/||/&&/g;
281
 
                                     ${$_[0]} =~ s/==/!=/g };
282
 
                    $test .= " || !g_utf8_validate ($utf8testvar, -1, NULL)";
283
 
                }
284
 
                else {
285
 
                    $reverse = sub { ${$_[0]} =~ s/||/&&/g;
286
 
                                     ${$_[0]} =~ s/==/!=/g };
287
 
                }
288
 
 
289
 
                $result .= &make_arg_test($_, $reverse, $test);
290
 
            }
291
 
            elsif ($pdbtype eq 'tattoo') {
292
 
                $result .= &make_arg_test($_, sub { ${$_[0]} =~ s/==/!=/ },
293
 
                                          "$var == 0");
294
 
            }
295
 
            elsif ($pdbtype eq 'unit') {
296
 
                $typeinfo[0] = 'GIMP_UNIT_PIXEL' unless defined $typeinfo[0];
297
 
                $result .= &make_arg_test($_, sub { ${$_[0]} = "!(${$_[0]})" },
298
 
                                          "$var < $typeinfo[0] || $var >= " .
299
 
                                          '_gimp_unit_get_number_of_units (gimp)');
300
 
            }
301
 
            elsif ($pdbtype eq 'enum' && !$enums{$typeinfo[0]}->{contig}) {
302
 
                if (!exists $_->{no_success} || exists $_->{on_success} ||
303
 
                     exists $_->{on_fail}) {
304
 
                    my %vals; my $symbols = $enums{pop @typeinfo}->{symbols};
305
 
                    @vals{@$symbols}++; delete @vals{@typeinfo};
306
 
 
307
 
                    my $okvals = ""; my $failvals = "";
308
 
 
309
 
                    my $once = 0;
310
 
                    foreach (@$symbols) {
311
 
                        if (exists $vals{$_}) {
312
 
                            $okvals .= ' ' x 4 if $once++;
313
 
                            $okvals .= "case $_:\n";
314
 
                        }
315
 
                    }
316
 
 
317
 
                    sub format_switch_frag {
318
 
                        my ($arg, $key) = @_;
319
 
                        my $frag = "";
320
 
                        if (exists $arg->{$key}) {
321
 
                            $frag = &format_code_frag($arg->{$key}, 1);
322
 
                            $frag =~ s/\t/' ' x 8/eg;
323
 
                            $frag =~ s/^/' ' x 2/meg;
324
 
                        }
325
 
                        $frag;
326
 
                    }
327
 
 
328
 
                    $okvals .= &format_switch_frag($_, 'on_success');
329
 
                    chomp $okvals;
330
 
 
331
 
                    $failvals .= "default:\n";
332
 
                    if (!exists $_->{no_success}) {
333
 
                        $success = 1;
334
 
                        $failvals .= ' ' x 6 . "success = FALSE;\n"
335
 
                    }
336
 
                    $failvals .=  &format_switch_frag($_, 'on_fail');
337
 
                    chomp $failvals;
338
 
 
339
 
                    $result .= <<CODE;
340
 
  switch ($var)
341
 
    {
342
 
    $okvals
343
 
      break;
344
 
 
345
 
    $failvals
346
 
      break;
347
 
    }
348
 
CODE
349
 
                }
350
 
            }
351
 
            elsif (defined $typeinfo[0] || defined $typeinfo[2]) {
352
 
                my $code = ""; my $tests = 0; my $extra = "";
353
 
 
354
 
                if ($pdbtype eq 'enum') {
355
 
                    my $symbols = $enums{shift @typeinfo}->{symbols};
356
 
 
357
 
                    my ($start, $end) = (0, $#$symbols);
358
 
 
359
 
                    my $syms = "@$symbols "; my $test = $syms;
360
 
                    foreach (@typeinfo) { $test =~ s/$_ // }
361
 
 
362
 
                    if ($syms =~ /$test/g) {
363
 
                        if (pos $syms  == length $syms) {
364
 
                            $start = @typeinfo;
365
 
                        }
366
 
                        else {
367
 
                            $end -= @typeinfo;
368
 
                        }
369
 
                    }
370
 
                    else {
371
 
                        foreach (@typeinfo) {
372
 
                            $extra .= " || $var == $_";
373
 
                        }
374
 
                    }
375
 
 
376
 
                    $typeinfo[0] = $symbols->[$start];
377
 
                    if ($start != $end) {
378
 
                        $typeinfo[1] = '<';
379
 
                        $typeinfo[2] = $symbols->[$end];
380
 
                        $typeinfo[3] = '>';
381
 
                    }
382
 
                    else {
383
 
                        $typeinfo[1] = '!=';
384
 
                        undef @typeinf[2..3];
385
 
                    }
386
 
                }
387
 
                elsif ($pdbtype eq 'float') {
388
 
                    foreach (@typeinfo[0, 2]) {
389
 
                        $_ .= '.0' if defined $_ && !/\./
390
 
                    }
391
 
                }
392
 
 
393
 
                if (defined $typeinfo[0]) {
394
 
                    $code .= "$var $typeinfo[1] $typeinfo[0]";
395
 
                    $code .= '.0' if $pdbtype eq 'float' && $typeinfo[0] !~ /\./;
396
 
                    $tests++;
397
 
                }
398
 
 
399
 
                if (defined $typeinfo[2]) {
400
 
                    $code .= ' || ' if $tests;
401
 
                    $code .= "$var $typeinfo[3] $typeinfo[2]";
402
 
                }
403
 
 
404
 
                $code .= $extra;
405
 
 
406
 
                $result .= &make_arg_test($_, sub { ${$_[0]} = "!(${$_[0]})" },
407
 
                                          $code);
408
 
            }
409
 
        }
410
 
 
411
 
        $result .= "\n";
412
 
    }
413
 
 
414
 
    $result = "\n" . $result if $result;
 
112
        my $var = $_->{name};
 
113
        my $value;
 
114
 
 
115
        $value = "&args->values[$argc]";
 
116
        $result .= eval qq/"  $arg->{get_value_func};\n"/;
 
117
 
 
118
        $argc++;
 
119
 
 
120
        if (!exists $_->{no_success}) {
 
121
            $success = 1;
 
122
        }
 
123
    }
 
124
 
 
125
    $result = "\n" . $result . "\n" if $result;
415
126
    $result;
416
127
}
417
128
 
419
130
    my $proc = shift;
420
131
 
421
132
    my $result = <<CODE;
422
 
  return_args = procedural_db_return_args (\&$proc->{name}_proc, success);
 
133
  return_vals = gimp_procedure_get_return_values (procedure, success);
423
134
CODE
424
135
 
425
136
    my $argc = 0;
431
142
        foreach (@{$proc->{outargs}}) {
432
143
            my ($pdbtype) = &arg_parse($_->{type});
433
144
            my $arg = $arg_types{$pdbtype};
434
 
            my $type = &arg_ptype($arg);
435
 
            my $var = &arg_vname($_);
436
 
 
437
 
            $argc++; $outargs .= ' ' x 2;
438
 
 
439
 
            if (exists $arg->{id_ret_func}) {
440
 
                my $ret = eval qq/"$arg->{id_ret_func}"/;
441
 
                $ret = eval qq/"$_->{id_ret_func}"/ if exists $_->{id_ret_func};
442
 
 
443
 
                if (exists $_->{return_fail}) {
444
 
                    $var = "$var ? $ret : $_->{return_fail}";
 
145
            my $var = $_->{name};
 
146
            my $var_len;
 
147
            my $value;
 
148
 
 
149
            $argc++;
 
150
 
 
151
            $value = "&return_vals->values[$argc]";
 
152
 
 
153
            if (exists $_->{array}) {
 
154
                my $arrayarg = $_->{array};
 
155
 
 
156
                if (exists $arrayarg->{name}) {
 
157
                    $var_len = $arrayarg->{name};
445
158
                }
446
159
                else {
447
 
                    $var = $ret;
 
160
                    $var_len = 'num_' . $_->{name};
448
161
                }
449
162
            }
450
163
 
451
 
            $outargs .= "return_args[$argc].value.pdb_$type = $var;\n";
 
164
            $outargs .= eval qq/"  $arg->{set_value_func};\n"/;
452
165
        }
453
166
 
454
167
        $outargs =~ s/^/' ' x 2/meg if $success;
459
172
        $result .= ' ' x 4 . "{\n" if $success && $argc > 1;
460
173
        $result .= $outargs;
461
174
        $result .= ' ' x 4 . "}\n" if $success && $argc > 1;
462
 
        $result .= "\n" . ' ' x 2 . "return return_args;\n";
 
175
        $result .= "\n" . ' ' x 2 . "return return_vals;\n";
463
176
    }
464
177
    else {
465
 
        $result =~ s/_args =//;
 
178
        $result =~ s/_vals =//;
466
179
    }
467
180
 
468
181
    $result =~ s/, success\);$/, TRUE);/m unless $success;
469
182
    $result;
470
183
}
471
184
 
 
185
sub generate_pspec {
 
186
    my $arg = shift;
 
187
    my ($pdbtype, @typeinfo) = &arg_parse($arg->{type});
 
188
    my $name = $arg->{canonical_name};
 
189
    my $nick = $arg->{canonical_name};
 
190
    my $blurb = exists $arg->{desc} ? $arg->{desc} : "";
 
191
    my $min;
 
192
    my $max;
 
193
    my $default;
 
194
    my $flags = 'GIMP_PARAM_READWRITE';
 
195
    my $pspec = "";
 
196
    my $postproc = "";
 
197
 
 
198
    $nick =~ s/-/ /g;
 
199
 
 
200
    if (exists $arg->{no_success}) {
 
201
        $flags .= ' | GIMP_PARAM_NO_VALIDATE';
 
202
    }
 
203
 
 
204
    if ($pdbtype eq 'image') {
 
205
        $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
 
206
        $pspec = <<CODE;
 
207
gimp_param_spec_image_id ("$name",
 
208
                          "$nick",
 
209
                          "$blurb",
 
210
                          pdb->gimp, $none_ok,
 
211
                          GIMP_PARAM_READWRITE)
 
212
CODE
 
213
    }
 
214
    elsif ($pdbtype eq 'drawable') {
 
215
        $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
 
216
        $pspec = <<CODE;
 
217
gimp_param_spec_drawable_id ("$name",
 
218
                             "$nick",
 
219
                             "$blurb",
 
220
                             pdb->gimp, $none_ok,
 
221
                             $flags)
 
222
CODE
 
223
    }
 
224
    elsif ($pdbtype eq 'layer') {
 
225
        $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
 
226
        $pspec = <<CODE;
 
227
gimp_param_spec_layer_id ("$name",
 
228
                          "$nick",
 
229
                          "$blurb",
 
230
                          pdb->gimp, $none_ok,
 
231
                          $flags)
 
232
CODE
 
233
    }
 
234
    elsif ($pdbtype eq 'channel') {
 
235
        $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
 
236
        $pspec = <<CODE;
 
237
gimp_param_spec_channel_id ("$name",
 
238
                            "$nick",
 
239
                            "$blurb",
 
240
                            pdb->gimp, $none_ok,
 
241
                            $flags)
 
242
CODE
 
243
    }
 
244
    elsif ($pdbtype eq 'layer_mask') {
 
245
        $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
 
246
        $pspec = <<CODE;
 
247
gimp_param_spec_layer_mask_id ("$name",
 
248
                               "$nick",
 
249
                               "$blurb",
 
250
                               pdb->gimp, $none_ok,
 
251
                               $flags)
 
252
CODE
 
253
    }
 
254
    elsif ($pdbtype eq 'selection') {
 
255
        $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
 
256
        $pspec = <<CODE;
 
257
gimp_param_spec_selection_id ("$name",
 
258
                              "$nick",
 
259
                              "$blurb",
 
260
                              pdb->gimp, $none_ok,
 
261
                              $flags)
 
262
CODE
 
263
    }
 
264
    elsif ($pdbtype eq 'vectors') {
 
265
        $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
 
266
        $pspec = <<CODE;
 
267
gimp_param_spec_vectors_id ("$name",
 
268
                            "$nick",
 
269
                            "$blurb",
 
270
                            pdb->gimp, $none_ok,
 
271
                            $flags)
 
272
CODE
 
273
    }
 
274
    elsif ($pdbtype eq 'display') {
 
275
        $none_ok = exists $arg->{none_ok} ? 'TRUE' : 'FALSE';
 
276
        $pspec = <<CODE;
 
277
gimp_param_spec_display_id ("$name",
 
278
                            "$nick",
 
279
                            "$blurb",
 
280
                            pdb->gimp, $none_ok,
 
281
                            $flags)
 
282
CODE
 
283
    }
 
284
    elsif ($pdbtype eq 'tattoo') {
 
285
        $pspec = <<CODE;
 
286
g_param_spec_uint ("$name",
 
287
                   "$nick",
 
288
                   "$blurb",
 
289
                   1, G_MAXUINT32, 1,
 
290
                   $flags)
 
291
CODE
 
292
    }
 
293
    elsif ($pdbtype eq 'guide') {
 
294
        $pspec = <<CODE;
 
295
g_param_spec_uint ("$name",
 
296
                   "$nick",
 
297
                   "$blurb",
 
298
                   1, G_MAXUINT32, 1,
 
299
                   $flags)
 
300
CODE
 
301
    }
 
302
    elsif ($pdbtype eq 'float') {
 
303
        $min = defined $typeinfo[0] ? $typeinfo[0] : -G_MAXDOUBLE;
 
304
        $max = defined $typeinfo[2] ? $typeinfo[2] : G_MAXDOUBLE;
 
305
        $default = exists $arg->{default} ? $arg->{default} : defined $typeinfo[0] ? $typeinfo[0] : 0.0;
 
306
        $pspec = <<CODE;
 
307
g_param_spec_double ("$name",
 
308
                     "$nick",
 
309
                     "$blurb",
 
310
                     $min, $max, $default,
 
311
                     $flags)
 
312
CODE
 
313
    }
 
314
    elsif ($pdbtype eq 'int32') {
 
315
        $min = defined $typeinfo[0] ? $typeinfo[0] : G_MININT32;
 
316
        $max = defined $typeinfo[2] ? $typeinfo[2] : G_MAXINT32;
 
317
        $default = exists $arg->{default} ? $arg->{default} : defined $typeinfo[0] ? $typeinfo[0] : 0;
 
318
        $pspec = <<CODE;
 
319
gimp_param_spec_int32 ("$name",
 
320
                       "$nick",
 
321
                       "$blurb",
 
322
                       $min, $max, $default,
 
323
                       $flags)
 
324
CODE
 
325
    }
 
326
    elsif ($pdbtype eq 'int16') {
 
327
        $min = defined $typeinfo[0] ? $typeinfo[0] : G_MININT16;
 
328
        $max = defined $typeinfo[2] ? $typeinfo[2] : G_MAXINT16;
 
329
        $default = exists $arg->{default} ? $arg->{default} : defined $typeinfo[0] ? $typeinfo[0] : 0;
 
330
        $pspec = <<CODE;
 
331
gimp_param_spec_int16 ("$name",
 
332
                       "$nick",
 
333
                       "$blurb",
 
334
                       $min, $max, $default,
 
335
                       $flags)
 
336
CODE
 
337
    }
 
338
    elsif ($pdbtype eq 'int8') {
 
339
        $min = defined $typeinfo[0] ? $typeinfo[0] : 0;
 
340
        $max = defined $typeinfo[2] ? $typeinfo[2] : G_MAXUINT8;
 
341
        $default = exists $arg->{default} ? $arg->{default} : defined $typeinfo[0] ? $typeinfo[0] : 0;
 
342
        $pspec = <<CODE;
 
343
gimp_param_spec_int8 ("$name",
 
344
                      "$nick",
 
345
                      "$blurb",
 
346
                      $min, $max, $default,
 
347
                      $flags)
 
348
CODE
 
349
    }
 
350
    elsif ($pdbtype eq 'boolean') {
 
351
        $default = exists $arg->{default} ? $arg->{default} : FALSE;
 
352
        $pspec = <<CODE;
 
353
g_param_spec_boolean ("$name",
 
354
                      "$nick",
 
355
                      "$blurb",
 
356
                      $default,
 
357
                      $flags)
 
358
CODE
 
359
    }
 
360
    elsif ($pdbtype eq 'string') {
 
361
        $no_validate = exists $arg->{no_validate} ? 'TRUE' : 'FALSE';
 
362
        $null_ok = exists $arg->{null_ok} ? 'TRUE' : 'FALSE';
 
363
        $default = exists $arg->{default} ? $arg->{default} : NULL;
 
364
        $pspec = <<CODE;
 
365
gimp_param_spec_string ("$name",
 
366
                        "$nick",
 
367
                        "$blurb",
 
368
                        $no_validate, $null_ok,
 
369
                        $default,
 
370
                        $flags)
 
371
CODE
 
372
    }
 
373
    elsif ($pdbtype eq 'enum') {
 
374
        $enum_type = $typeinfo[0];
 
375
        $enum_type =~ s/([a-z])([A-Z])/$1_$2/g;
 
376
        $enum_type =~ s/([A-Z]+)([A-Z])/$1_$2/g;
 
377
        $enum_type =~ tr/[a-z]/[A-Z]/;
 
378
        $enum_type =~ s/^GIMP/GIMP_TYPE/;
 
379
        $default = exists $arg->{default} ? $arg->{default} : $enums{$typeinfo[0]}->{symbols}[0];
 
380
 
 
381
        my ($foo, $bar, @remove) = &arg_parse($arg->{type});
 
382
 
 
383
        foreach (@remove) {
 
384
            $postproc .= 'gimp_param_spec_enum_exclude_value (GIMP_PARAM_SPEC_ENUM ($pspec),';
 
385
            $postproc .= "\n                                    $_);\n";
 
386
        }
 
387
 
 
388
        if ($postproc eq '') {
 
389
            $pspec = <<CODE;
 
390
g_param_spec_enum ("$name",
 
391
                   "$nick",
 
392
                   "$blurb",
 
393
                   $enum_type,
 
394
                   $default,
 
395
                   $flags)
 
396
CODE
 
397
        }
 
398
        else {
 
399
            $pspec = <<CODE;
 
400
gimp_param_spec_enum ("$name",
 
401
                      "$nick",
 
402
                      "$blurb",
 
403
                      $enum_type,
 
404
                      $default,
 
405
                      $flags)
 
406
CODE
 
407
        }
 
408
    }
 
409
    elsif ($pdbtype eq 'unit') {
 
410
        $typeinfo[0] = 'GIMP_UNIT_PIXEL' unless defined $typeinfo[0];
 
411
        $allow_pixels = $typeinfo[0] eq 'GIMP_UNIT_PIXEL' ? TRUE : FALSE;
 
412
        $allow_percent = exists $arg->{allow_percent} ? TRUE : FALSE;
 
413
        $default = exists $arg->{default} ? $arg->{default} : $typeinfo[0];
 
414
        $pspec = <<CODE;
 
415
gimp_param_spec_unit ("$name",
 
416
                      "$nick",
 
417
                      "$blurb",
 
418
                      $allow_pixels,
 
419
                      $allow_percent,
 
420
                      $default,
 
421
                      $flags)
 
422
CODE
 
423
    }
 
424
    elsif ($pdbtype eq 'color') {
 
425
        $has_alpha = exists $arg->{has_alpha} ? TRUE : FALSE;
 
426
        $default = exists $arg->{default} ? $arg->{default} : NULL;
 
427
        $pspec = <<CODE;
 
428
gimp_param_spec_rgb ("$name",
 
429
                     "$nick",
 
430
                     "$blurb",
 
431
                     $has_alpha,
 
432
                     $default,
 
433
                     $flags)
 
434
CODE
 
435
    }
 
436
    elsif ($pdbtype eq 'parasite') {
 
437
        $pspec = <<CODE;
 
438
gimp_param_spec_parasite ("$name",
 
439
                          "$nick",
 
440
                          "$blurb",
 
441
                          $flags)
 
442
CODE
 
443
    }
 
444
    elsif ($pdbtype eq 'int32array') {
 
445
        $pspec = <<CODE;
 
446
gimp_param_spec_int32_array ("$name",
 
447
                             "$nick",
 
448
                             "$blurb",
 
449
                             $flags)
 
450
CODE
 
451
    }
 
452
    elsif ($pdbtype eq 'int16array') {
 
453
        $pspec = <<CODE;
 
454
gimp_param_spec_int16_array ("$name",
 
455
                             "$nick",
 
456
                             "$blurb",
 
457
                             $flags)
 
458
CODE
 
459
    }
 
460
    elsif ($pdbtype eq 'int8array') {
 
461
        $pspec = <<CODE;
 
462
gimp_param_spec_int8_array ("$name",
 
463
                            "$nick",
 
464
                            "$blurb",
 
465
                            $flags)
 
466
CODE
 
467
    }
 
468
    elsif ($pdbtype eq 'floatarray') {
 
469
        $pspec = <<CODE;
 
470
gimp_param_spec_float_array ("$name",
 
471
                             "$nick",
 
472
                             "$blurb",
 
473
                             $flags)
 
474
CODE
 
475
    }
 
476
    elsif ($pdbtype eq 'stringarray') {
 
477
        $pspec = <<CODE;
 
478
gimp_param_spec_string_array ("$name",
 
479
                              "$nick",
 
480
                              "$blurb",
 
481
                              $flags)
 
482
CODE
 
483
    }
 
484
    else {
 
485
        warn "Unsupported PDB type: $arg->{name} ($arg->{type})";
 
486
        exit -1;
 
487
    }
 
488
 
 
489
    $pspec =~ s/\s$//;
 
490
 
 
491
    return ($pspec, $postproc);
 
492
}
 
493
 
 
494
sub canonicalize {
 
495
    $_ = shift; s/_/-/g; return $_;
 
496
}
 
497
 
472
498
sub generate {
473
499
    my @procs = @{(shift)};
474
500
    my %out;
475
501
    my $total = 0.0;
 
502
    my $argc;
476
503
 
477
504
    foreach $name (@procs) {
478
505
        my $proc = $main::pdb{$name};
480
507
 
481
508
        my @inargs = @{$proc->{inargs}} if exists $proc->{inargs};
482
509
        my @outargs = @{$proc->{outargs}} if exists $proc->{outargs};
483
 
        
 
510
 
 
511
        my $help = $proc->{help};
 
512
 
484
513
        local $success = 0;
485
514
 
 
515
        $help =~ s/gimp(\w+)\(\s*\)/"'gimp".canonicalize($1)."'"/ge;
 
516
 
486
517
        $out->{pcount}++; $total++;
487
518
 
488
 
        $out->{procs} .= "static ProcRecord ${name}_proc;\n";
489
 
 
490
 
        $out->{register} .= <<CODE;
491
 
  procedural_db_register (gimp, \&${name}_proc);
 
519
        $out->{register} .= <<CODE;
 
520
 
 
521
  /*
 
522
   * gimp-$proc->{canonical_name}
 
523
   */
 
524
  procedure = gimp_procedure_new (${name}_invoker);
 
525
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-$proc->{canonical_name}");
 
526
  gimp_procedure_set_static_strings (procedure,
 
527
                                     "gimp-$proc->{canonical_name}",
 
528
                                     @{[ &quotewrap($proc->{blurb}, 2) ]},
 
529
                                     @{[ &quotewrap($help,  2) ]},
 
530
                                     "$proc->{author}",
 
531
                                     "$proc->{copyright}",
 
532
                                     "$proc->{date}",
 
533
                                     @{[$proc->{deprecated} ? "\"$proc->{deprecated}\"" : 'NULL']});
 
534
CODE
 
535
 
 
536
        $argc = 0;
 
537
 
 
538
        foreach $arg (@inargs) {
 
539
            my ($pspec, $postproc) = &generate_pspec($arg);
 
540
 
 
541
            $pspec =~ s/^/' ' x length("  gimp_procedure_add_argument (")/meg;
 
542
 
 
543
            $out->{register} .= <<CODE;
 
544
  gimp_procedure_add_argument (procedure,
 
545
${pspec});
 
546
CODE
 
547
 
 
548
            if ($postproc ne '') {
 
549
                $pspec = "procedure->args[$argc]";
 
550
                $postproc =~ s/^/'  '/meg;
 
551
                $out->{register} .= eval qq/"$postproc"/;
 
552
            }
 
553
 
 
554
            $argc++;
 
555
        }
 
556
 
 
557
        $argc = 0;
 
558
 
 
559
        foreach $arg (@outargs) {
 
560
            my ($pspec, $postproc) = &generate_pspec($arg);
 
561
            my $argc = 0;
 
562
 
 
563
            $pspec =~ s/^/' ' x length("  gimp_procedure_add_return_value (")/meg;
 
564
 
 
565
            $out->{register} .= <<CODE;
 
566
  gimp_procedure_add_return_value (procedure,
 
567
${pspec});
 
568
CODE
 
569
 
 
570
            if ($postproc ne '') {
 
571
                $pspec = "procedure->values[$argc]";
 
572
                $postproc =~ s/^/'  '/meg;
 
573
                $out->{register} .= eval qq/"$postproc"/;
 
574
            }
 
575
 
 
576
            $argc++;
 
577
        }
 
578
 
 
579
        $out->{register} .= <<CODE;
 
580
  gimp_pdb_register_procedure (pdb, procedure);
 
581
  g_object_unref (procedure);
492
582
CODE
493
583
 
494
584
        if (exists $proc->{invoke}->{headers}) {
497
587
            }
498
588
        }
499
589
 
500
 
        $out->{code} .= "\nstatic Argument *\n";
501
 
        $out->{code} .= "${name}_invoker (Gimp         *gimp,\n";
502
 
        $out->{code} .=  ' ' x length($name) . "          GimpContext  *context,\n";
503
 
        $out->{code} .=  ' ' x length($name) . "          GimpProgress *progress,\n";
504
 
        $out->{code} .=  ' ' x length($name) . "          Argument     *args)\n{\n";
 
590
        $out->{code} .= "\nstatic GValueArray *\n";
 
591
        $out->{code} .= "${name}_invoker (GimpProcedure     *procedure,\n";
 
592
        $out->{code} .=  ' ' x length($name) . "          Gimp              *gimp,\n";
 
593
        $out->{code} .=  ' ' x length($name) . "          GimpContext       *context,\n";
 
594
        $out->{code} .=  ' ' x length($name) . "          GimpProgress      *progress,\n";
 
595
        $out->{code} .=  ' ' x length($name) . "          const GValueArray *args)\n{\n";
505
596
 
506
597
        my $code = "";
507
598
 
508
 
        if (exists $proc->{invoke}->{proc}) {
509
 
            my ($procname, $args) = @{$proc->{invoke}->{proc}};
510
 
            my ($exec, $fail, $argtype);
511
 
            my $custom = $proc->{invoke}->{code};
512
 
 
513
 
            $exec = "procedural_db_execute (gimp, context, progress, $procname, $args)";
514
 
            $fail = "procedural_db_return_args (\&${name}_proc, FALSE)";
515
 
 
516
 
            $argtype = 'Argument';
517
 
            if (exists $proc->{invoke}->{args}) {
518
 
                foreach (@{$proc->{invoke}->{args}}) {
519
 
                    $code .= "  $argtype *$_;\n";
520
 
                }
521
 
            }
522
 
 
523
 
            foreach (qw(exec fail argtype)) { $custom =~ s/%%$_%%/"\$$_"/eeg }
524
 
 
525
 
            my $pos = 0;
526
 
            foreach (@{$proc->{inargs}}) {
527
 
                my $arg = $arg_types{(&arg_parse($_->{type}))[0]};
528
 
                my $var = &arg_vname($_);
529
 
                $custom =~ s/%%$var%%/&arg_value($arg, $pos)/e;
530
 
                $pos++;
531
 
            }
532
 
 
533
 
            $code .= &declare_vars($proc);
534
 
            $code .= "\n" if length($code);
535
 
            $code .= &format_code_frag($custom, 0) . "}\n";
536
 
        }
537
 
        elsif (exists $proc->{invoke}->{pass_through}) {
538
 
            my $invoke = $proc->{invoke};
539
 
 
540
 
            my $argc = 0;
541
 
            $argc += @{$invoke->{pass_args}} if exists $invoke->{pass_args};
542
 
            $argc += @{$invoke->{make_args}} if exists $invoke->{make_args};
543
 
 
544
 
            my %pass; my @passgroup;
545
 
            my $before = 0; my $contig = 0; my $pos = -1;
546
 
            if (exists $invoke->{pass_args}) {
547
 
                foreach (@{$invoke->{pass_args}}) {
548
 
                    $pass{$_}++;
549
 
                    $_ - 1 == $before ? $contig = 1 : $pos++;
550
 
                    push @{$passgroup[$pos]}, $_;
551
 
                    $before = $_;
552
 
                }
553
 
            } 
554
 
            $code .= ' ' x 2 . "int i;\n" if $contig;
555
 
 
556
 
            $code .= ' ' x 2 . "Argument argv[$argc];\n";
557
 
 
558
 
            my $tempproc; $pos = 0;
559
 
            foreach (@{$proc->{inargs}}) {
560
 
                $_->{argpos} = $pos++;
561
 
                push @{$tempproc->{inargs}}, $_ if !exists $pass{$_->{argpos}};
562
 
            }
563
 
 
564
 
            $code .= &declare_args($tempproc, $out, qw(inargs)) . "\n";
565
 
            $code .= &declare_vars($proc);
566
 
 
567
 
            my $marshal = "";
568
 
            foreach (@{$tempproc->{inargs}}) {
569
 
                my $argproc; $argproc->{inargs} = [ $_ ];
570
 
                $marshal .= &marshal_inargs($argproc, $_->{argpos});
571
 
                chop $marshal;
572
 
            }
573
 
            $marshal .= "\n" if $marshal;
574
 
 
575
 
            if ($success) {
576
 
                $marshal .= <<CODE;
577
 
  if (!success)
578
 
    return procedural_db_return_args (\&${name}_proc, FALSE);
579
 
 
580
 
CODE
581
 
            }
582
 
 
583
 
            $marshal = substr($marshal, 1) if $marshal;
584
 
            $code .= $marshal;
585
 
 
586
 
            foreach (@passgroup) {
587
 
                $code .= ($#$_ ? <<LOOP : <<CODE) . "\n";
588
 
  for (i = $_->[0]; i < @{[ $_->[$#$_] + 1 ]}; i++)
589
 
    argv[i] = args[i];
590
 
LOOP
591
 
  argv[$_->[0]] = args[$_->[0]];
592
 
CODE
593
 
            }
594
 
 
595
 
            if (exists $invoke->{make_args}) {
596
 
                $pos = 0;
597
 
                foreach (@{$invoke->{make_args}}) {
598
 
                    while (exists $pass{$pos}) { $pos++ }
599
 
                    
600
 
                    my $arg = $arg_types{(&arg_parse($_->{type}))[0]};
601
 
                    my $type = &arg_ptype($arg);
602
 
 
603
 
                    $code .= <<CODE;
604
 
  argv[$pos].arg_type = GIMP_PDB_$arg->{name};
605
 
CODE
606
 
 
607
 
                    my $frag = $_->{code};
608
 
                    $frag =~ s/%%arg%%/"argv[$pos].value.pdb_$type"/e;
609
 
                    $code .= &format_code_frag($frag, 0);
610
 
 
611
 
                    $pos++;
612
 
                }
613
 
                $code .= "\n";
614
 
            }
615
 
 
616
 
            $code .= <<CODE;
617
 
  return $invoke->{pass_through}_invoker (gimp, context, progress, argv);
618
 
}
619
 
CODE
 
599
        if (exists $proc->{invoke}->{no_marshalling}) {
 
600
            $code .= &format_code_frag($proc->{invoke}->{code}, 0) . "}\n";
620
601
        }
621
602
        else {
622
603
            my $invoker = "";
623
604
        
624
 
            $invoker .= ' ' x 2 . "Argument *return_args;\n" if scalar @outargs;
625
 
            $invoker .= &declare_args($proc, $out, qw(inargs outargs));
626
 
            $invoker .= &declare_vars($proc);
 
605
            $invoker .= ' ' x 2 . "GValueArray *return_vals;\n" if scalar @outargs;
 
606
            $invoker .= &declare_args($proc, $out, 0, qw(inargs));
 
607
            $invoker .= &declare_args($proc, $out, 1, qw(outargs));
627
608
 
628
609
            $invoker .= &marshal_inargs($proc, 0);
629
610
            $invoker .= "\n" if $invoker && $invoker !~ /\n\n/s;
651
632
        }
652
633
 
653
634
        $out->{code} .= $code;
654
 
 
655
 
        $out->{code} .= &make_arg_recs($proc, qw(inargs outargs));
656
 
 
657
 
        $out->{code} .= <<CODE;
658
 
 
659
 
static ProcRecord ${name}_proc =
660
 
{
661
 
  "gimp_$name",
662
 
  @{[ &quotewrap($proc->{blurb}, 2) ]},
663
 
  @{[ &quotewrap($proc->{help},  2) ]},
664
 
  "$proc->{author}",
665
 
  "$proc->{copyright}",
666
 
  "$proc->{date}",
667
 
  @{[$proc->{deprecated} ? "\"$proc->{deprecated}\"" : 'NULL']},
668
 
  GIMP_INTERNAL,
669
 
  @{[scalar @inargs]},
670
 
  @{[scalar @inargs ? "${name}_inargs" : 'NULL']},
671
 
  @{[scalar @outargs]},
672
 
  @{[scalar @outargs ? "${name}_outargs" : 'NULL']},
673
 
  { { ${name}_invoker } }
674
 
};
675
 
CODE
676
635
    }
677
636
 
678
637
    my $gpl = <<'GPL';
679
 
/* The GIMP -- an image manipulation program
 
638
/* GIMP - The GNU Image Manipulation Program
680
639
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
681
640
 *
682
641
 * This program is free software; you can redistribute it and/or modify
694
653
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
695
654
 */
696
655
 
697
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
656
/* NOTE: This file is auto-generated by pdbgen.pl. */
698
657
 
699
658
GPL
700
659
 
707
666
        my $out = $out{$group};
708
667
 
709
668
        foreach (@{$main::grp{$group}->{headers}}) { $out->{headers}->{$_}++ }
710
 
        delete $out->{headers}->{q/"procedural_db.h"/};
711
 
        delete $out->{headers}->{q/"config.h"/};
712
669
 
713
670
        my @headers = sort {
714
671
            my ($x, $y) = ($a, $b);
762
719
 
763
720
                    $headers .= '#include "pdb-types.h"';
764
721
                    $headers .= "\n";
765
 
                    $headers .= '#include "procedural_db.h"';
 
722
                    $headers .= '#include "gimppdb.h"';
 
723
                    $headers .= "\n";
 
724
                    $headers .= '#include "gimpprocedure.h"';
 
725
                    $headers .= "\n";
 
726
                    $headers .= '#include "core/gimpparamspecs.h"';
766
727
                    $headers .= "\n\n";
767
728
                }
768
729
            }
796
757
            $headers .= "\n" if $_ eq '"config.h"';
797
758
        }
798
759
 
 
760
        $headers .= "\n#include \"internal_procs.h\"\n";
 
761
 
799
762
        my $extra = {};
800
763
        if (exists $main::grp{$group}->{extra}->{app}) {
801
764
            $extra = $main::grp{$group}->{extra}->{app}
807
770
        print CFILE qq/#include "config.h"\n\n/;
808
771
        print CFILE $headers, "\n";
809
772
        print CFILE $extra->{decls}, "\n" if exists $extra->{decls};
810
 
        print CFILE $out->{procs};
811
 
        print CFILE "\nvoid\nregister_${group}_procs (Gimp *gimp)\n";
812
 
        print CFILE "{\n$out->{register}}\n";
813
773
        print CFILE "\n", $extra->{code} if exists $extra->{code};
814
774
        print CFILE $out->{code};
 
775
        print CFILE "\nvoid\nregister_${group}_procs (GimpPDB *pdb)\n";
 
776
        print CFILE "{\n  GimpProcedure *procedure;\n$out->{register}}\n";
815
777
        close CFILE;
816
778
        &write_file($cfile);
817
779
 
819
781
        push @group_decls, $decl;
820
782
        $longest = length $decl if $longest < length $decl;
821
783
 
822
 
        $group_procs .= ' ' x 2 . "(* status_callback) (";
823
 
        $group_procs .= q/_("Internal Procedures")/ unless $once;
824
 
        $group_procs .= 'NULL' if $once++;
825
 
        $group_procs .= qq/, _("$main::grp{$group}->{desc}"), /;
826
 
       ($group_procs .= sprintf "%.3f", $pcount / $total) =~ s/\.?0*$//s;
827
 
        $group_procs .= ($group_procs !~ /\.\d+$/s ? ".0" : "") . ");\n";
828
 
        $group_procs .=  ' ' x 2 . "register_${group}_procs (gimp);\n\n";
 
784
        $group_procs .=  ' ' x 2 . "register_${group}_procs (pdb);\n";
829
785
        $pcount += $out->{pcount};
830
786
    }
831
787
 
838
794
#ifndef $guard
839
795
#define $guard
840
796
 
841
 
void internal_procs_init (Gimp               *gimp,
842
 
                          GimpInitStatusFunc  status_callback);
 
797
HEADER
 
798
 
 
799
        print IFILE "void   internal_procs_init" . ' ' x ($longest - length "internal_procs_init") . " (GimpPDB *pdb);\n\n";
 
800
 
 
801
        print IFILE "/* Forward declarations for registering PDB procs */\n\n";
 
802
        foreach (@group_decls) {
 
803
            print IFILE "void   $_" . ' ' x ($longest - length $_) . " (GimpPDB *pdb);\n";
 
804
        }
 
805
 
 
806
        print IFILE <<HEADER;
843
807
 
844
808
#endif /* $guard */
845
809
HEADER
852
816
        print IFILE qq@#include "config.h"\n\n@;
853
817
        print IFILE qq@#include <glib-object.h>\n\n@;
854
818
        print IFILE qq@#include "pdb-types.h"\n\n@;
855
 
        print IFILE qq@#include "core/gimp.h"\n\n@;
856
 
        print IFILE qq@#include "gimp-intl.h"\n\n@;
857
 
        print IFILE "/* Forward declarations for registering PDB procs */\n\n";
858
 
        foreach (@group_decls) {
859
 
            print IFILE "void $_" . ' ' x ($longest - length $_) . " (Gimp *gimp);\n";
860
 
        }
 
819
        print IFILE qq@#include "gimppdb.h"\n\n@;
 
820
        print IFILE qq@#include "internal_procs.h"\n\n@;
861
821
        chop $group_procs;
862
822
        print IFILE "\n/* $total procedures registered total */\n\n";
863
823
        print IFILE <<BODY;
864
824
void
865
 
internal_procs_init (Gimp               *gimp,
866
 
                     GimpInitStatusFunc  status_callback)
 
825
internal_procs_init (GimpPDB *pdb)
867
826
{
868
 
  g_return_if_fail (GIMP_IS_GIMP (gimp));
869
 
  g_return_if_fail (status_callback != NULL);
 
827
  g_return_if_fail (GIMP_IS_PDB (pdb));
870
828
 
871
829
$group_procs
872
830
}