[gimp] pdb, libgimp: annotate input arrays with (array length=foo)



commit a40f139fdc8d05a7e2289d6e4fb03e050432ef31
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 31 19:08:01 2019 +0200

    pdb, libgimp: annotate input arrays with (array length=foo)

 libgimp/gimpcontext_pdb.c           |  2 +-
 libgimp/gimpdrawable_pdb.c          |  2 +-
 libgimp/gimpdrawablecolor_pdb.c     |  4 ++--
 libgimp/gimpgradient_pdb.c          |  2 +-
 libgimp/gimpimage_pdb.c             |  2 +-
 libgimp/gimpimagecolorprofile_pdb.c |  4 ++--
 libgimp/gimpimageconvert_pdb.c      |  2 +-
 libgimp/gimpimageselect_pdb.c       |  2 +-
 libgimp/gimppainttools_pdb.c        | 34 +++++++++++++++++-----------------
 libgimp/gimpplugin_pdb.c            |  2 +-
 libgimp/gimpproceduraldb_pdb.c      |  2 +-
 libgimp/gimpvectors_pdb.c           |  2 +-
 pdb/lib.pl                          |  4 ++++
 13 files changed, 34 insertions(+), 30 deletions(-)
---
diff --git a/libgimp/gimpcontext_pdb.c b/libgimp/gimpcontext_pdb.c
index c06c3d191a..7966ca1e66 100644
--- a/libgimp/gimpcontext_pdb.c
+++ b/libgimp/gimpcontext_pdb.c
@@ -1143,7 +1143,7 @@ gimp_context_get_line_dash_pattern (gint     *num_dashes,
 /**
  * gimp_context_set_line_dash_pattern:
  * @num_dashes: The number of dashes in the dash_pattern array.
- * @dashes: (element-type gdouble) The line dash pattern setting.
+ * @dashes: (array length=num_dashes) (element-type gdouble) The line dash pattern setting.
  *
  * Set the line dash pattern setting.
  *
diff --git a/libgimp/gimpdrawable_pdb.c b/libgimp/gimpdrawable_pdb.c
index 9f760342f7..0cc2ae5b28 100644
--- a/libgimp/gimpdrawable_pdb.c
+++ b/libgimp/gimpdrawable_pdb.c
@@ -757,7 +757,7 @@ gimp_drawable_get_pixel (gint32  drawable_ID,
  * @x_coord: The x coordinate.
  * @y_coord: The y coordinate.
  * @num_channels: The number of channels for the pixel.
- * @pixel: (element-type guint8) The pixel value.
+ * @pixel: (array length=num_channels) (element-type guint8) The pixel value.
  *
  * Sets the value of the pixel at the specified coordinates.
  *
diff --git a/libgimp/gimpdrawablecolor_pdb.c b/libgimp/gimpdrawablecolor_pdb.c
index 34f211184d..257a90b014 100644
--- a/libgimp/gimpdrawablecolor_pdb.c
+++ b/libgimp/gimpdrawablecolor_pdb.c
@@ -194,7 +194,7 @@ gimp_drawable_colorize_hsl (gint32  drawable_ID,
  * @drawable_ID: The drawable.
  * @channel: The channel to modify.
  * @num_values: The number of values in the new curve.
- * @values: (element-type gdouble) The explicit curve.
+ * @values: (array length=num_values) (element-type gdouble) The explicit curve.
  *
  * Modifies the intensity curve(s) for specified drawable.
  *
@@ -245,7 +245,7 @@ gimp_drawable_curves_explicit (gint32                drawable_ID,
  * @drawable_ID: The drawable.
  * @channel: The channel to modify.
  * @num_points: The number of values in the control point array.
- * @points: (element-type gdouble) The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y, ... }.
+ * @points: (array length=num_points) (element-type gdouble) The spline control points: { cp1.x, cp1.y, 
cp2.x, cp2.y, ... }.
  *
  * Modifies the intensity curve(s) for specified drawable.
  *
diff --git a/libgimp/gimpgradient_pdb.c b/libgimp/gimpgradient_pdb.c
index b775ac1dc1..be77f64d99 100644
--- a/libgimp/gimpgradient_pdb.c
+++ b/libgimp/gimpgradient_pdb.c
@@ -313,7 +313,7 @@ gimp_gradient_get_uniform_samples (const gchar  *name,
  * gimp_gradient_get_custom_samples:
  * @name: The gradient name.
  * @num_samples: The number of samples to take.
- * @positions: (element-type gdouble) The list of positions to sample along the gradient.
+ * @positions: (array length=num_samples) (element-type gdouble) The list of positions to sample along the 
gradient.
  * @reverse: Use the reverse gradient.
  * @num_color_samples: (out) Length of the color_samples array (4 * num_samples).
  * @color_samples: (out) (element-type gdouble) (transfer full) Color samples: { R1, G1, B1, A1, ..., Rn, 
Gn, Bn, An }.
diff --git a/libgimp/gimpimage_pdb.c b/libgimp/gimpimage_pdb.c
index 061e9ccce0..4f01eb9a12 100644
--- a/libgimp/gimpimage_pdb.c
+++ b/libgimp/gimpimage_pdb.c
@@ -1767,7 +1767,7 @@ _gimp_image_get_colormap (gint32  image_ID,
  * _gimp_image_set_colormap:
  * @image_ID: The image.
  * @num_bytes: Number of bytes in the colormap array.
- * @colormap: (element-type guint8) The new colormap values.
+ * @colormap: (array length=num_bytes) (element-type guint8) The new colormap values.
  *
  * Sets the entries in the image's colormap.
  *
diff --git a/libgimp/gimpimagecolorprofile_pdb.c b/libgimp/gimpimagecolorprofile_pdb.c
index edee45a62e..109cce16e9 100644
--- a/libgimp/gimpimagecolorprofile_pdb.c
+++ b/libgimp/gimpimagecolorprofile_pdb.c
@@ -131,7 +131,7 @@ _gimp_image_get_effective_color_profile (gint32  image_ID,
  * _gimp_image_set_color_profile:
  * @image_ID: The image.
  * @num_bytes: Number of bytes in the color_profile array.
- * @color_profile: (element-type guint8) The new serialized color profile.
+ * @color_profile: (array length=num_bytes) (element-type guint8) The new serialized color profile.
  *
  * Sets the image's color profile
  *
@@ -220,7 +220,7 @@ gimp_image_set_color_profile_from_file (gint32       image_ID,
  * _gimp_image_convert_color_profile:
  * @image_ID: The image.
  * @num_bytes: Number of bytes in the color_profile array.
- * @color_profile: (element-type guint8) The serialized color profile.
+ * @color_profile: (array length=num_bytes) (element-type guint8) The serialized color profile.
  * @intent: Rendering intent.
  * @bpc: Black point compensation.
  *
diff --git a/libgimp/gimpimageconvert_pdb.c b/libgimp/gimpimageconvert_pdb.c
index 2896fb1c9a..ba209c7821 100644
--- a/libgimp/gimpimageconvert_pdb.c
+++ b/libgimp/gimpimageconvert_pdb.c
@@ -175,7 +175,7 @@ gimp_image_convert_indexed (gint32                  image_ID,
  * @width: Width of the matrix (0 to reset to default matrix).
  * @height: Height of the matrix (0 to reset to default matrix).
  * @matrix_length: The length of 'matrix'.
- * @matrix: (element-type guint8) The matrix -- all values must be >= 1.
+ * @matrix: (array length=matrix_length) (element-type guint8) The matrix -- all values must be >= 1.
  *
  * Set dither matrix for conversion to indexed
  *
diff --git a/libgimp/gimpimageselect_pdb.c b/libgimp/gimpimageselect_pdb.c
index 6fabf9b1d6..2383a300cd 100644
--- a/libgimp/gimpimageselect_pdb.c
+++ b/libgimp/gimpimageselect_pdb.c
@@ -365,7 +365,7 @@ gimp_image_select_ellipse (gint32         image_ID,
  * @image_ID: The image.
  * @operation: The selection operation.
  * @num_segs: Number of points (count 1 coordinate as two points).
- * @segs: (element-type gdouble) Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}.
+ * @segs: (array length=num_segs) (element-type gdouble) Array of points: { p1.x, p1.y, p2.x, p2.y, ..., 
pn.x, pn.y}.
  *
  * Create a polygonal selection over the specified image.
  *
diff --git a/libgimp/gimppainttools_pdb.c b/libgimp/gimppainttools_pdb.c
index b6824007a6..36320645d6 100644
--- a/libgimp/gimppainttools_pdb.c
+++ b/libgimp/gimppainttools_pdb.c
@@ -39,7 +39,7 @@
  * @drawable_ID: The affected drawable.
  * @pressure: The pressure of the airbrush strokes.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Paint in the current brush with varying pressure. Paint application
  * is time-dependent.
@@ -86,7 +86,7 @@ gimp_airbrush (gint32         drawable_ID,
  * gimp_airbrush_default:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Paint in the current brush with varying pressure. Paint application
  * is time-dependent.
@@ -134,7 +134,7 @@ gimp_airbrush_default (gint32         drawable_ID,
  * @src_x: The x coordinate in the source image.
  * @src_y: The y coordinate in the source image.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Clone from the source to the dest drawable using the current brush
  *
@@ -197,7 +197,7 @@ gimp_clone (gint32         drawable_ID,
  * gimp_clone_default:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Clone from the source to the dest drawable using the current brush
  *
@@ -244,7 +244,7 @@ gimp_clone_default (gint32         drawable_ID,
  * @pressure: The pressure.
  * @convolve_type: Convolve type.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Convolve (Blur, Sharpen) using the current brush.
  *
@@ -293,7 +293,7 @@ gimp_convolve (gint32            drawable_ID,
  * gimp_convolve_default:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Convolve (Blur, Sharpen) using the current brush.
  *
@@ -340,7 +340,7 @@ gimp_convolve_default (gint32         drawable_ID,
  * @dodgeburn_type: The type either dodge or burn.
  * @dodgeburn_mode: The mode.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Dodgeburn image with varying exposure.
  *
@@ -389,7 +389,7 @@ gimp_dodgeburn (gint32             drawable_ID,
  * gimp_dodgeburn_default:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Dodgeburn image with varying exposure. This is the same as the
  * gimp_dodgeburn() function except that the exposure, type and mode
@@ -432,7 +432,7 @@ gimp_dodgeburn_default (gint32         drawable_ID,
  * gimp_eraser:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  * @hardness: How to apply the brush.
  * @method: The paint method to use.
  *
@@ -484,7 +484,7 @@ gimp_eraser (gint32                    drawable_ID,
  * gimp_eraser_default:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Erase using the current brush.
  *
@@ -531,7 +531,7 @@ gimp_eraser_default (gint32         drawable_ID,
  * @src_x: The x coordinate in the source image.
  * @src_y: The y coordinate in the source image.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Heal from the source to the dest drawable using the current brush
  *
@@ -587,7 +587,7 @@ gimp_heal (gint32         drawable_ID,
  * gimp_heal_default:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Heal from the source to the dest drawable using the current brush
  *
@@ -635,7 +635,7 @@ gimp_heal_default (gint32         drawable_ID,
  * @drawable_ID: The affected drawable.
  * @fade_out: Fade out parameter.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  * @method: The paint method to use.
  * @gradient_length: Length of gradient to draw.
  *
@@ -695,7 +695,7 @@ gimp_paintbrush (gint32                    drawable_ID,
  * gimp_paintbrush_default:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Paint in the current brush. The fade out parameter and pull colors
  * from a gradient parameter are set from the paintbrush options
@@ -748,7 +748,7 @@ gimp_paintbrush_default (gint32         drawable_ID,
  * gimp_pencil:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Paint in the current brush without sub-pixel sampling.
  *
@@ -794,7 +794,7 @@ gimp_pencil (gint32         drawable_ID,
  * @drawable_ID: The affected drawable.
  * @pressure: The pressure of the smudge strokes.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Smudge image with varying pressure.
  *
@@ -839,7 +839,7 @@ gimp_smudge (gint32         drawable_ID,
  * gimp_smudge_default:
  * @drawable_ID: The affected drawable.
  * @num_strokes: Number of stroke control points (count each coordinate as 2 points).
- * @strokes: (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }.
+ * @strokes: (array length=num_strokes) (element-type gdouble) Array of stroke coordinates: { s1.x, s1.y, 
s2.x, s2.y, ..., sn.x, sn.y }.
  *
  * Smudge image with varying pressure.
  *
diff --git a/libgimp/gimpplugin_pdb.c b/libgimp/gimpplugin_pdb.c
index 2d96b3652d..c69c76c34d 100644
--- a/libgimp/gimpplugin_pdb.c
+++ b/libgimp/gimpplugin_pdb.c
@@ -203,7 +203,7 @@ gimp_plugin_menu_branch_register (const gchar *menu_path,
  * @procedure_name: The procedure for which to install the icon.
  * @icon_type: The type of the icon.
  * @icon_data_length: The length of 'icon-data'.
- * @icon_data: (element-type guint8) The procedure's icon. The format depends on the 'icon_type' parameter.
+ * @icon_data: (array length=icon_data_length) (element-type guint8) The procedure's icon. The format 
depends on the 'icon_type' parameter.
  *
  * Register an icon for a plug-in procedure.
  *
diff --git a/libgimp/gimpproceduraldb_pdb.c b/libgimp/gimpproceduraldb_pdb.c
index f65f1d8f87..8403e1beb4 100644
--- a/libgimp/gimpproceduraldb_pdb.c
+++ b/libgimp/gimpproceduraldb_pdb.c
@@ -491,7 +491,7 @@ gimp_procedural_db_get_data_size (const gchar *identifier)
  * _gimp_procedural_db_set_data:
  * @identifier: The identifier associated with data.
  * @bytes: The number of bytes in the data.
- * @data: (element-type guint8) A byte array containing data.
+ * @data: (array length=bytes) (element-type guint8) A byte array containing data.
  *
  * Associates the specified identifier with the supplied data.
  *
diff --git a/libgimp/gimpvectors_pdb.c b/libgimp/gimpvectors_pdb.c
index f993de799f..1022cf9d97 100644
--- a/libgimp/gimpvectors_pdb.c
+++ b/libgimp/gimpvectors_pdb.c
@@ -691,7 +691,7 @@ gimp_vectors_stroke_get_points (gint32     vectors_ID,
  * @vectors_ID: The vectors object.
  * @type: type of the stroke (always GIMP_VECTORS_STROKE_TYPE_BEZIER for now).
  * @num_points: The number of elements in the array, i.e. the number of controlpoints in the stroke * 2 (x- 
and y-coordinate).
- * @controlpoints: (element-type gdouble) List of the x- and y-coordinates of the control points.
+ * @controlpoints: (array length=num_points) (element-type gdouble) List of the x- and y-coordinates of the 
control points.
  * @closed: Whether the stroke is to be closed or not.
  *
  * Adds a stroke of a given type to the vectors object.
diff --git a/pdb/lib.pl b/pdb/lib.pl
index 8c739dc7bf..29c2d1b994 100644
--- a/pdb/lib.pl
+++ b/pdb/lib.pl
@@ -203,6 +203,10 @@ sub generate {
            $argdesc .= '_ID' if $arg->{id};
            $argdesc .= ": ";
 
+           if (exists $arg->{array}) {
+               $argdesc .= "(array length=@inargs[$argc - 1]->{name}) ";
+           }
+
            if (exists $arg->{in_annotate}) {
                $argdesc .= "$arg->{in_annotate} ";
            }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]