Commit 682ab691 authored by Michael Natterer's avatar Michael Natterer 😴

Revert "pdb: move PDB generation and sources to toplevel/pdb"

This reverts commit 3b639b1d.
parent 6dfb2ef5
......@@ -116,7 +116,7 @@ sources. All those files have a short notice about being generated
somewhere at the top. Among them are the files ending in pdb.[ch] in
the libgimp directory and the files ending in cmds.c in the app/pdb
subdirectory. Those are generated from the respective .pdb files in
pdb/groups.
tools/pdbgen/pdb.
Hackordnung
......
......@@ -2,10 +2,6 @@
ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
if WITH_PDBGEN
PDB = pdb
endif
SUBDIRS = \
m4macros \
cursors \
......@@ -21,7 +17,6 @@ SUBDIRS = \
menus \
libgimpbase \
tools \
$(PDB) \
icons \
libgimpcolor \
libgimpmath \
......
......@@ -118,7 +118,7 @@ app_libs_init (GOptionContext *context,
}
#endif
/* keep compat enum code in sync with pdb/enumcode.pl */
/* keep compat enum code in sync with tools/pdbgen/enumcode.pl */
quark = g_quark_from_static_string ("gimp-compat-enum");
g_type_set_qdata (GIMP_TYPE_CONVERT_DITHER_TYPE, quark,
......
......@@ -20,7 +20,7 @@
#if 0
This file is parsed by two scripts, enumgen.pl in pdb,
This file is parsed by two scripts, enumgen.pl in tools/pdbgen,
and gimp-mkenums. All enums that are not marked with
/*< pdb-skip >*/ are exported to libgimp and the PDB. Enums that are
not marked with /*< skip >*/ are registered with the GType system.
......
......@@ -19,7 +19,7 @@
#define __PAINT_ENUMS_H__
#if 0
This file is parsed by two scripts, enumgen.pl in pdb,
This file is parsed by two scripts, enumgen.pl in tools/pdbgen,
and gimp-mkenums. All enums that are not marked with
/*< pdb-skip >*/ are exported to libgimp and the PDB. Enums that are
not marked with /*< skip >*/ are registered with the GType system.
......
......@@ -3,5 +3,5 @@ Gimp functions.
THESE FILES ARE AUTOGENERATED AND CHANGES HERE ARE USELESS!
If you need to change the code please have a look in ../../pdb/groups.
If you need to change the code please have a look in ../../tools/pdbgen/pdb.
......@@ -2480,7 +2480,7 @@ _______EOF
AC_CONFIG_FILES([
INSTALL
tools/Makefile
pdb/Makefile
tools/pdbgen/Makefile
libgimp/Makefile
libgimpbase/Makefile
libgimpconfig/Makefile
......
#!/usr/bin/perl -w
use lib '../../pdb';
use lib '../../tools/pdbgen';
require 'util.pl';
......
......@@ -2,6 +2,12 @@
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
if WITH_PDBGEN
PDBGEN = pdbgen
endif
SUBDIRS = $(PDBGEN)
if OS_WIN32
bin_PROGRAMS = \
......@@ -88,3 +94,4 @@ EXTRA_DIST = \
gimp-mkenums \
gimppath2svg.py \
invert-svg.c
PDBGEN_BACKUP = 0
PDBGEN_GROUPS =
pdb_groups = \
groups/brush.pdb \
groups/brush_select.pdb \
groups/brushes.pdb \
groups/buffer.pdb \
groups/channel.pdb \
groups/color.pdb \
groups/context.pdb \
groups/debug.pdb \
groups/display.pdb \
groups/drawable.pdb \
groups/drawable_color.pdb \
groups/drawable_transform.pdb \
groups/dynamics.pdb \
groups/edit.pdb \
groups/fileops.pdb \
groups/floating_sel.pdb \
groups/font_select.pdb \
groups/fonts.pdb \
groups/gimp.pdb \
groups/gimprc.pdb \
groups/gradient.pdb \
groups/gradient_select.pdb \
groups/gradients.pdb \
groups/help.pdb \
groups/image.pdb \
groups/image_color_profile.pdb \
groups/image_convert.pdb \
groups/image_grid.pdb \
groups/image_guides.pdb \
groups/image_sample_points.pdb \
groups/image_select.pdb \
groups/image_transform.pdb \
groups/image_undo.pdb \
groups/item.pdb \
groups/item_transform.pdb \
groups/layer.pdb \
groups/message.pdb \
groups/paint_tools.pdb \
groups/palette.pdb \
groups/palette_select.pdb \
groups/palettes.pdb \
groups/paths.pdb \
groups/pattern.pdb \
groups/pattern_select.pdb \
groups/patterns.pdb \
groups/plug_in.pdb \
groups/plug_in_compat.pdb \
groups/procedural_db.pdb \
groups/progress.pdb \
groups/selection.pdb \
groups/selection_tools.pdb \
groups/text_layer.pdb \
groups/text_tool.pdb \
groups/transform_tools.pdb \
groups/unit.pdb \
groups/vectors.pdb
pdb_sources = \
pdb/brush.pdb \
pdb/brush_select.pdb \
pdb/brushes.pdb \
pdb/buffer.pdb \
pdb/channel.pdb \
pdb/color.pdb \
pdb/context.pdb \
pdb/debug.pdb \
pdb/display.pdb \
pdb/drawable.pdb \
pdb/drawable_color.pdb \
pdb/drawable_transform.pdb \
pdb/dynamics.pdb \
pdb/edit.pdb \
pdb/fileops.pdb \
pdb/floating_sel.pdb \
pdb/font_select.pdb \
pdb/fonts.pdb \
pdb/gimp.pdb \
pdb/gimprc.pdb \
pdb/gradient.pdb \
pdb/gradient_select.pdb \
pdb/gradients.pdb \
pdb/help.pdb \
pdb/image.pdb \
pdb/image_color_profile.pdb \
pdb/image_convert.pdb \
pdb/image_grid.pdb \
pdb/image_guides.pdb \
pdb/image_sample_points.pdb \
pdb/image_select.pdb \
pdb/image_transform.pdb \
pdb/image_undo.pdb \
pdb/item.pdb \
pdb/item_transform.pdb \
pdb/layer.pdb \
pdb/message.pdb \
pdb/paint_tools.pdb \
pdb/palette.pdb \
pdb/palette_select.pdb \
pdb/palettes.pdb \
pdb/paths.pdb \
pdb/pattern.pdb \
pdb/pattern_select.pdb \
pdb/patterns.pdb \
pdb/plug_in.pdb \
pdb/plug_in_compat.pdb \
pdb/procedural_db.pdb \
pdb/progress.pdb \
pdb/selection.pdb \
pdb/selection_tools.pdb \
pdb/text_layer.pdb \
pdb/text_tool.pdb \
pdb/transform_tools.pdb \
pdb/unit.pdb \
pdb/vectors.pdb
EXTRA_DIST = \
README \
......@@ -72,14 +72,14 @@ EXTRA_DIST = \
pdbgen.pl \
stddefs.pdb \
util.pl \
$(pdb_groups)
$(pdb_sources)
enum_headers = \
../libgimpbase/gimpbaseenums.h \
../libgimpconfig/gimpconfigenums.h \
../app/operations/operations-enums.h \
../app/core/core-enums.h \
../app/paint/paint-enums.h
../../libgimpbase/gimpbaseenums.h \
../../libgimpconfig/gimpconfigenums.h \
../../app/operations/operations-enums.h \
../../app/core/core-enums.h \
../../app/paint/paint-enums.h
pdb_scripts = \
pdbgen.pl \
......@@ -125,8 +125,8 @@ stamp-groups: Makefile.am
rootme=`pwd`; cd $(srcdir) \
&& echo "# This file is autogenerated" > $$rootme/groups.pl.tmp \
&& echo "@groups = qw(" >> $$rootme/groups.pl.tmp \
&& (for pdb in $(pdb_groups); do \
group=`echo $$pdb | sed -e 's%groups/\([^.]*\)\..*%\1%'`; \
&& (for pdb in $(pdb_sources); do \
group=`echo $$pdb | sed -e 's%pdb/\([^.]*\)\..*%\1%'`; \
echo " $$group" >> $$rootme/groups.pl.tmp; \
done) \
&& echo ");" >> $$rootme/groups.pl.tmp \
......@@ -135,7 +135,7 @@ stamp-groups: Makefile.am
&& rm $$rootme/groups.pl.tmp \
&& echo timestamp > $$rootme/stamp-groups
stamp-pdbgen: $(pdbgen_deps) $(pdb_scripts) $(pdb_groups) Makefile.am
stamp-pdbgen: $(pdbgen_deps) $(pdb_scripts) $(pdb_sources) Makefile.am
rootme=`pwd`; \
destdir=`cd $(top_srcdir) && pwd`; export destdir; \
builddir=`cd $(top_builddir) && pwd`; export builddir; \
......
......@@ -63,7 +63,7 @@ http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb[tools/pdbgen/pdb].
You can see many files with the .pdb suffix - these are special template
files which include the actual source of the PDB functions. Let's take a
quick look at one of these - text_layer_get_text in
http://git.gnome.org/browse/gimp/tree/pdb/groups/text_layer.pdb[pdb/groups/text_layer.pdb].
http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/text_layer.pdb[tools/pdbgen/pdb/text_layer.pdb].
[source,perl]
----
......@@ -337,7 +337,7 @@ this can be done automatically for you if the desired enum is one of the
enums which are already used by GIMP.
To make it clearer, let's take a look at +layer_get_mode+ in
http://git.gnome.org/browse/gimp/tree/pdb/groups/layer.pdb[pdb/groups/layer.pdb]:
http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/layer.pdb[tools/pdbgen/pdb/layer.pdb]:
[source,perl]
----
......@@ -388,7 +388,7 @@ function, and by that we can make sure it won't be called with values
out of range (GIMP will make sure the values are inside the specified
range before it calls our function). To see an example, let's take look
at the procedure image_new from
http://git.gnome.org/browse/gimp/tree/pdb/groups/image.pdb[pdb/groups/image.pdb]:
http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/image.pdb[tools/pdbgen/pdb/image.pdb]:
[source,perl]
----
......@@ -435,7 +435,7 @@ function which receives an array. Array arguments are specified in a
special way which is a bit different than the other arguments. To see
how array arguments are specified, let's take a look at the +@outargs+
of +vectors_stroke_get_points+ from
http://git.gnome.org/browse/gimp/tree/pdb/groups/vectors.pdb[pdb/groups/vectors.pdb]:
http://git.gnome.org/browse/gimp/tree/tools/pdbgen/pdb/vectors.pdb[tools/pdbgen/pdb/vectors.pdb]:
[source,perl]
----
......
# GIMP - The GNU Image Manipulation Program
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
sub brush_new {
$blurb = "Creates a new brush.";
$help = "This procedure creates a new, uninitialized brush.";
&mitch_pdb_misc('2004', '2.2');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The requested name of the new brush' }
);
@outargs = (
{ name => 'actual_name', type => 'string',
desc => 'The actual new brush name. The returned value must be freed with g_free()' }
);
%invoke = (
code => <<'CODE'
{
GimpData *data = gimp_data_factory_data_new (gimp->brush_factory,
context, name);
if (data)
actual_name = g_strdup (gimp_object_get_name (data));
else
success = FALSE;
}
CODE
);
}
sub brush_duplicate {
$blurb = "Duplicates a brush.";
$help = "This procedure creates an identical brush by a different name.";
&mitch_pdb_misc('2004', '2.2');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
@outargs = (
{ name => 'copy_name', type => 'string',
desc => "The name of the brush's copy. The returned value must be freed with g_free()" }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush)
{
GimpBrush *brush_copy = (GimpBrush *)
gimp_data_factory_data_duplicate (gimp->brush_factory,
GIMP_DATA (brush));
if (brush_copy)
copy_name = g_strdup (gimp_object_get_name (brush_copy));
else
success = FALSE;
}
else
success = FALSE;
}
CODE
);
}
sub brush_is_generated {
$blurb = "Tests if brush is generated.";
$help = "Returns TRUE if this brush is parametric, FALSE for other types.";
&bill_pdb_misc('2004', '2.4');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
@outargs = (
{ name => 'generated', type => 'boolean',
desc => 'TRUE if the brush is generated' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush)
generated = GIMP_IS_BRUSH_GENERATED (brush);
else
success = FALSE;
}
CODE
);
}
sub brush_is_editable {
$blurb = "Tests if brush can be edited.";
$help = "Returns TRUE if you have permission to change the brush.";
&bill_pdb_misc('2004', '2.4');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
@outargs = (
{ name => 'editable', type => 'boolean',
desc => 'TRUE if the brush can be edited' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush)
editable = gimp_data_is_writable (GIMP_DATA (brush));
else
success = FALSE;
}
CODE
);
}
sub brush_rename {
$blurb = "Renames a brush.";
$help = "This procedure renames a brush.";
&mitch_pdb_misc('2004', '2.2');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' },
{ name => 'new_name', type => 'string', non_empty => 1,
desc => 'The new name of the brush' }
);
@outargs = (
{ name => 'actual_name', type => 'string',
desc => 'The actual new name of the brush. The returned value must be freed with g_free()' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_RENAME, error);
if (brush)
{
gimp_object_set_name (GIMP_OBJECT (brush), new_name);
actual_name = g_strdup (gimp_object_get_name (brush));
}
else
success = FALSE;
}
CODE
);
}
sub brush_delete {
$blurb = "Deletes a brush.";
$help = "This procedure deletes a brush.";
&mitch_pdb_misc('2004', '2.2');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush && gimp_data_is_deletable (GIMP_DATA (brush)))
success = gimp_data_factory_data_delete (gimp->brush_factory,
GIMP_DATA (brush),
TRUE, error);
else
success = FALSE;
}
CODE
);
}
sub brush_get_info {
$blurb = "Retrieves information about the specified brush.";
$help = <<'HELP';
This procedure retrieves information about the specified brush:
brush extents (width and height), color depth and mask depth.
HELP
&mitch_pdb_misc('2004', '2.2');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
@outargs = (
{ name => 'width', type => 'int32', void_ret => 1,
desc => 'The brush width' },
{ name => 'height', type => 'int32',
desc => 'The brush height' },
{ name => 'mask_bpp', type => 'int32',
desc => 'The brush mask bpp' },
{ name => 'color_bpp', type => 'int32',
desc => 'The brush color bpp' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush)
{
GimpTempBuf *mask = gimp_brush_get_mask (brush);
GimpTempBuf *pixmap = gimp_brush_get_pixmap (brush);
width = gimp_brush_get_width (brush);
height = gimp_brush_get_height (brush);
mask_bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (mask));
color_bpp = pixmap ? babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (pixmap)) : 0;
}
else
success = FALSE;
}
CODE
);
}
sub brush_get_pixels {
$blurb = 'Retrieves information about the specified brush.';
$help = <<'HELP';
This procedure retrieves information about the specified brush. This
includes the brush extents (width and height) and its pixels data.
HELP
&mitch_pdb_misc('2004', '2.2');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
@outargs = (
{ name => 'width', type => 'int32', void_ret => 1,
desc => 'The brush width' },
{ name => 'height', type => 'int32',
desc => 'The brush height' },
{ name => 'mask_bpp', type => 'int32',
desc => 'The brush mask bpp' },
{ name => 'mask_bytes', type => 'int8array',
desc => 'The brush mask data',
array => { desc => 'Length of brush mask data' } },
{ name => 'color_bpp', type => 'int32',
desc => 'The brush color bpp' },
{ name => 'color_bytes', type => 'int8array',
desc => 'The brush color data',
array => { desc => 'Length of brush color data' } }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush)
{
GimpTempBuf *mask = gimp_brush_get_mask (brush);
GimpTempBuf *pixmap = gimp_brush_get_pixmap (brush);
width = gimp_temp_buf_get_width (mask);
height = gimp_temp_buf_get_height (mask);
mask_bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (mask));
num_mask_bytes = gimp_temp_buf_get_height (mask) *
gimp_temp_buf_get_width (mask) * mask_bpp;
mask_bytes = g_memdup (gimp_temp_buf_get_data (mask),
num_mask_bytes);
if (pixmap)
{
color_bpp = babl_format_get_bytes_per_pixel (gimp_temp_buf_get_format (pixmap));
num_color_bytes = gimp_temp_buf_get_height (pixmap) *
gimp_temp_buf_get_width (pixmap) *
color_bpp;
color_bytes = g_memdup (gimp_temp_buf_get_data (pixmap),
num_color_bytes);
}
}
else
success = FALSE;
}
CODE
);
}
sub brush_get_spacing {
$blurb = 'Gets the brush spacing.';
$help = <<'HELP';
This procedure returns the spacing setting for the specified brush.
The return value is an integer between 0 and 1000 which represents
percentage of the maximum of the width and height of the mask.
HELP
&mitch_pdb_misc('2004', '2.2');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
@outargs = (
{ name => 'spacing', type => '0 <= int32 <= 1000', void_ret => 1,
desc => 'The brush spacing' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush)
spacing = gimp_brush_get_spacing (brush);
else
success = FALSE;
}
CODE
);
}
sub brush_get_shape {
$blurb = 'Gets the shape of a generated brush.';
$help = <<'HELP';
This procedure gets the shape value for a generated brush. If
called for any other type of brush, it does not succeed. The
current possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE),
Square (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
(GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be
added in the future.
HELP
&bill_pdb_misc('2004', '2.4');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
@outargs = (
{ name => 'shape', type => 'enum GimpBrushGeneratedShape',
desc => 'The brush shape' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush)
shape = GIMP_BRUSH_GENERATED (brush)->shape;
else
success = FALSE;
}
CODE
);
}
sub brush_get_radius {
$blurb = 'Gets the radius of a generated brush.';
$help = <<'HELP';
This procedure gets the radius value for a generated brush. If
called for any other type of brush, it does not succeed.
HELP
&bill_pdb_misc('2004', '2.4');
@inargs = (
{ name => 'name', type => 'string', non_empty => 1,
desc => 'The brush name' }
);
@outargs = (
{ name => 'radius', type => 'float',
desc => 'The radius of the brush in pixels' }
);
%invoke = (
code => <<'CODE'
{
GimpBrush *brush = gimp_pdb_get_generated_brush (gimp, name, GIMP_PDB_DATA_ACCESS_READ, error);
if (brush)
radius = GIMP_BRUSH_GENERATED (brush)->radius;
else
success = FALSE;
}
CODE
);
}
sub brush_get_spikes {
$blurb = 'Gets the number of spikes for a generated brush.';