pdb, libgimp: add (array length=foo) annotations for out args

This commit is contained in:
Michael Natterer 2019-07-31 19:19:06 +02:00
parent a40f139fdc
commit 05e68da4d4
21 changed files with 95 additions and 70 deletions

View file

@ -213,9 +213,9 @@ gimp_get_parasite (const gchar *name)
*
* Returns a list of all currently attached global parasites.
*
* Returns: (element-type gchar*) (transfer full) The names of
* currently attached parasites. The returned value must be freed with
* g_strfreev().
* Returns: (array length=num_parasites) (element-type gchar*)
* (transfer full) The names of currently attached parasites. The
* returned value must be freed with g_strfreev().
*
* Since: 2.8
**/

View file

@ -313,10 +313,10 @@ gimp_brush_get_info (const gchar *name,
* @height: (out) The brush height.
* @mask_bpp: (out) The brush mask bpp.
* @num_mask_bytes: (out) Length of brush mask data.
* @mask_bytes: (out) (element-type guint8) (transfer full) The brush mask data.
* @mask_bytes: (out) (array length=num_mask_bytes) (element-type guint8) (transfer full) The brush mask data.
* @color_bpp: (out) The brush color bpp.
* @num_color_bytes: (out) Length of brush color data.
* @color_bytes: (out) (element-type guint8) (transfer full) The brush color data.
* @color_bytes: (out) (array length=num_color_bytes) (element-type guint8) (transfer full) The brush color data.
*
* Retrieves information about the specified brush.
*

View file

@ -75,8 +75,9 @@ gimp_brushes_refresh (void)
* Each name returned can be used as input to the
* gimp_context_set_brush() procedure.
*
* Returns: (element-type gchar*) (transfer full) The list of brush
* names. The returned value must be freed with g_strfreev().
* Returns: (array length=num_brushes) (element-type gchar*) (transfer
* full) The list of brush names. The returned value must be freed with
* g_strfreev().
**/
gchar **
gimp_brushes_get_list (const gchar *filter,

View file

@ -44,8 +44,9 @@
* This procedure returns a complete listing of available named
* buffers.
*
* Returns: (element-type gchar*) (transfer full) The list of buffer
* names. The returned value must be freed with g_strfreev().
* Returns: (array length=num_buffers) (element-type gchar*) (transfer
* full) The list of buffer names. The returned value must be freed
* with g_strfreev().
*
* Since: 2.4
**/

View file

@ -139,7 +139,7 @@ gimp_context_set_defaults (void)
/**
* gimp_context_list_paint_methods:
* @num_paint_methods: (out) The number of the available paint methods.
* @paint_methods: (out) (element-type gchar*) (transfer full) The names of the available paint methods.
* @paint_methods: (out) (array length=num_paint_methods) (element-type gchar*) (transfer full) The names of the available paint methods.
*
* Lists the available paint methods.
*
@ -1100,7 +1100,7 @@ gimp_context_set_line_dash_offset (gdouble dash_offset)
/**
* gimp_context_get_line_dash_pattern:
* @num_dashes: (out) The number of dashes in the dash_pattern array.
* @dashes: (out) (element-type gdouble) (transfer full) The line dash pattern setting.
* @dashes: (out) (array length=num_dashes) (element-type gdouble) (transfer full) The line dash pattern setting.
*
* Get the line dash pattern setting.
*

View file

@ -714,7 +714,8 @@ gimp_drawable_update (gint32 drawable_ID,
* The 'num_channels' argument must always be equal to the
* bytes-per-pixel value for the specified drawable.
*
* Returns: (element-type guint8) (transfer full) The pixel value.
* Returns: (array length=num_channels) (element-type guint8) (transfer
* full) The pixel value.
**/
guint8 *
gimp_drawable_get_pixel (gint32 drawable_ID,
@ -912,7 +913,7 @@ gimp_drawable_offset (gint32 drawable_ID,
* @actual_height: (out) The previews height.
* @bpp: (out) The previews bpp.
* @thumbnail_data_count: (out) The number of bytes in thumbnail data.
* @thumbnail_data: (out) (element-type guint8) (transfer full) The thumbnail data.
* @thumbnail_data: (out) (array length=thumbnail_data_count) (element-type guint8) (transfer full) The thumbnail data.
*
* Get a thumbnail of a drawable.
*
@ -984,7 +985,7 @@ _gimp_drawable_thumbnail (gint32 drawable_ID,
* @height: (out) The previews height.
* @bpp: (out) The previews bpp.
* @thumbnail_data_count: (out) The number of bytes in thumbnail data.
* @thumbnail_data: (out) (element-type guint8) (transfer full) The thumbnail data.
* @thumbnail_data: (out) (array length=thumbnail_data_count) (element-type guint8) (transfer full) The thumbnail data.
*
* Get a thumbnail of a sub-area of a drawable drawable.
*

View file

@ -77,8 +77,9 @@ gimp_dynamics_refresh (void)
* This procedure returns a list of the paint dynamics that are
* currently available.
*
* Returns: (element-type gchar*) (transfer full) The list of paint
* dynamics names. The returned value must be freed with g_strfreev().
* Returns: (array length=num_dynamics) (element-type gchar*) (transfer
* full) The list of paint dynamics names. The returned value must be
* freed with g_strfreev().
*
* Since: 2.8
**/

View file

@ -141,8 +141,8 @@ gimp_file_load_layer (GimpRunMode run_mode,
* needs to be added to the existing image with
* gimp_image_insert_layer().
*
* Returns: (element-type gint32) (transfer full) The list of loaded
* layers.
* Returns: (array length=num_layers) (element-type gint32) (transfer
* full) The list of loaded layers.
*
* Since: 2.4
**/

View file

@ -75,8 +75,9 @@ gimp_fonts_refresh (void)
* This procedure returns a list of the fonts that are currently
* available.
*
* Returns: (element-type gchar*) (transfer full) The list of font
* names. The returned value must be freed with g_strfreev().
* Returns: (array length=num_fonts) (element-type gchar*) (transfer
* full) The list of font names. The returned value must be freed with
* g_strfreev().
**/
gchar **
gimp_fonts_get_list (const gchar *filter,

View file

@ -254,7 +254,7 @@ gimp_gradient_get_number_of_segments (const gchar *name)
* @num_samples: The number of samples to take.
* @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 }.
* @color_samples: (out) (array length=num_color_samples) (element-type gdouble) (transfer full) Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
*
* Sample the specified in uniform parts.
*
@ -316,7 +316,7 @@ gimp_gradient_get_uniform_samples (const gchar *name,
* @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 }.
* @color_samples: (out) (array length=num_color_samples) (element-type gdouble) (transfer full) Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
*
* Sample the specified gradient in custom positions.
*

View file

@ -75,8 +75,9 @@ gimp_gradients_refresh (void)
* loaded. You can later use the gimp_context_set_gradient() function
* to set the active gradient.
*
* Returns: (element-type gchar*) (transfer full) The list of gradient
* names. The returned value must be freed with g_strfreev().
* Returns: (array length=num_gradients) (element-type gchar*)
* (transfer full) The list of gradient names. The returned value must
* be freed with g_strfreev().
**/
gchar **
gimp_gradients_get_list (const gchar *filter,

View file

@ -79,8 +79,9 @@ gimp_image_is_valid (gint32 image_ID)
*
* This procedure returns the list of images currently open in GIMP.
*
* Returns: (element-type gint32) (transfer full) The list of images
* currently open. The returned value must be freed with g_free().
* Returns: (array length=num_images) (element-type gint32) (transfer
* full) The list of images currently open. The returned value must be
* freed with g_free().
**/
gint *
gimp_image_list (gint *num_images)
@ -462,9 +463,9 @@ gimp_image_height (gint32 image_ID)
* This procedure returns the list of layers contained in the specified
* image. The order of layers is from topmost to bottommost.
*
* Returns: (element-type gint32) (transfer full) The list of layers
* contained in the image. The returned value must be freed with
* g_free().
* Returns: (array length=num_layers) (element-type gint32) (transfer
* full) The list of layers contained in the image. The returned value
* must be freed with g_free().
**/
gint *
gimp_image_get_layers (gint32 image_ID,
@ -508,9 +509,9 @@ gimp_image_get_layers (gint32 image_ID,
* \"channels\" are custom channels and do not include the image's
* color components.
*
* Returns: (element-type gint32) (transfer full) The list of channels
* contained in the image. The returned value must be freed with
* g_free().
* Returns: (array length=num_channels) (element-type gint32) (transfer
* full) The list of channels contained in the image. The returned
* value must be freed with g_free().
**/
gint *
gimp_image_get_channels (gint32 image_ID,
@ -551,9 +552,9 @@ gimp_image_get_channels (gint32 image_ID,
* This procedure returns the list of vectors contained in the
* specified image.
*
* Returns: (element-type gint32) (transfer full) The list of vectors
* contained in the image. The returned value must be freed with
* g_free().
* Returns: (array length=num_vectors) (element-type gint32) (transfer
* full) The list of vectors contained in the image. The returned value
* must be freed with g_free().
*
* Since: 2.4
**/
@ -1731,8 +1732,9 @@ gimp_image_merge_down (gint32 image_ID,
* 3. If the image is not in Indexed color mode, no colormap is
* returned.
*
* Returns: (element-type guint8) (transfer full) The image's colormap.
* The returned value must be freed with g_free().
* Returns: (array length=num_bytes) (element-type guint8) (transfer
* full) The image's colormap. The returned value must be freed with
* g_free().
**/
guint8 *
_gimp_image_get_colormap (gint32 image_ID,
@ -1958,7 +1960,7 @@ gimp_image_is_dirty (gint32 image_ID)
* @actual_height: (out) The previews height.
* @bpp: (out) The previews bpp.
* @thumbnail_data_count: (out) The number of bytes in thumbnail data.
* @thumbnail_data: (out) (element-type guint8) (transfer full) The thumbnail data.
* @thumbnail_data: (out) (array length=thumbnail_data_count) (element-type guint8) (transfer full) The thumbnail data.
*
* Get a thumbnail of an image.
*
@ -3314,9 +3316,9 @@ gimp_image_get_parasite (gint32 image_ID,
*
* Returns a list of all currently attached parasites.
*
* Returns: (element-type gchar*) (transfer full) The names of
* currently attached parasites. The returned value must be freed with
* g_strfreev().
* Returns: (array length=num_parasites) (element-type gchar*)
* (transfer full) The names of currently attached parasites. The
* returned value must be freed with g_strfreev().
*
* Since: 2.8
**/

View file

@ -44,9 +44,9 @@
* This procedure returns the image's color profile, or NULL if the
* image has no color profile assigned.
*
* Returns: (element-type guint8) (transfer full) The image's
* serialized color profile. The returned value must be freed with
* g_free().
* Returns: (array length=num_bytes) (element-type guint8) (transfer
* full) The image's serialized color profile. The returned value must
* be freed with g_free().
*
* Since: 2.10
**/
@ -92,9 +92,9 @@ _gimp_image_get_color_profile (gint32 image_ID,
* or a generated default RGB or grayscale profile, according to the
* image's type.
*
* Returns: (element-type guint8) (transfer full) The image's
* serialized color profile. The returned value must be freed with
* g_free().
* Returns: (array length=num_bytes) (element-type guint8) (transfer
* full) The image's serialized color profile. The returned value must
* be freed with g_free().
*
* Since: 2.10
**/

View file

@ -469,8 +469,8 @@ gimp_item_get_parent (gint32 item_ID)
* This procedure returns the list of items which are children of the
* specified item. The order is topmost to bottommost.
*
* Returns: (element-type gint32) (transfer full) The item's list of
* children.
* Returns: (array length=num_children) (element-type gint32) (transfer
* full) The item's list of children.
*
* Since: 2.8
**/
@ -1217,9 +1217,9 @@ gimp_item_get_parasite (gint32 item_ID,
*
* Returns a list of all parasites currently attached the an item.
*
* Returns: (element-type gchar*) (transfer full) The names of
* currently attached parasites. The returned value must be freed with
* g_strfreev().
* Returns: (array length=num_parasites) (element-type gchar*)
* (transfer full) The names of currently attached parasites. The
* returned value must be freed with g_strfreev().
*
* Since: 2.8
**/

View file

@ -263,8 +263,8 @@ gimp_palette_get_info (const gchar *name,
*
* This procedure retrieves all color entries of the specified palette.
*
* Returns: (element-type GimpRGB) (transfer full) The colors in the
* palette.
* Returns: (array length=num_colors) (element-type GimpRGB) (transfer
* full) The colors in the palette.
*
* Since: 2.6
**/

View file

@ -75,8 +75,9 @@ gimp_palettes_refresh (void)
* Each name returned can be used as input to the command
* gimp_context_set_palette().
*
* Returns: (element-type gchar*) (transfer full) The list of palette
* names. The returned value must be freed with g_strfreev().
* Returns: (array length=num_palettes) (element-type gchar*) (transfer
* full) The list of palette names. The returned value must be freed
* with g_strfreev().
**/
gchar **
gimp_palettes_get_list (const gchar *filter,

View file

@ -93,7 +93,7 @@ gimp_pattern_get_info (const gchar *name,
* @height: (out) The pattern height.
* @bpp: (out) The pattern bpp.
* @num_color_bytes: (out) Number of pattern bytes.
* @color_bytes: (out) (element-type guint8) (transfer full) The pattern data.
* @color_bytes: (out) (array length=num_color_bytes) (element-type guint8) (transfer full) The pattern data.
*
* Retrieve information about the specified pattern (including pixels).
*

View file

@ -75,8 +75,9 @@ gimp_patterns_refresh (void)
* patterns. Each name returned can be used as input to the
* gimp_context_set_pattern().
*
* Returns: (element-type gchar*) (transfer full) The list of pattern
* names. The returned value must be freed with g_strfreev().
* Returns: (array length=num_patterns) (element-type gchar*) (transfer
* full) The list of pattern names. The returned value must be freed
* with g_strfreev().
**/
gchar **
gimp_patterns_get_list (const gchar *filter,

View file

@ -111,7 +111,7 @@ gimp_procedural_db_dump (const gchar *filename)
* @date: The regex for procedure date.
* @proc_type: The regex for procedure type: { 'Internal GIMP procedure', 'GIMP Plug-in', 'GIMP Extension', 'Temporary Procedure' }.
* @num_matches: (out) The number of matching procedures.
* @procedure_names: (out) (element-type gchar*) (transfer full) The list of procedure names.
* @procedure_names: (out) (array length=num_matches) (element-type gchar*) (transfer full) The list of procedure names.
*
* Queries the procedural database for its contents using regular
* expression matching.
@ -408,7 +408,7 @@ gimp_procedural_db_proc_val (const gchar *procedure_name,
* _gimp_procedural_db_get_data:
* @identifier: The identifier associated with data.
* @bytes: (out) The number of bytes in the data.
* @data: (out) (element-type guint8) (transfer full) A byte array containing data.
* @data: (out) (array length=bytes) (element-type guint8) (transfer full) A byte array containing data.
*
* Returns data associated with the specified identifier.
*

View file

@ -161,8 +161,8 @@ gimp_vectors_copy (gint32 vectors_ID)
* Returns an Array with the stroke-IDs associated with the passed
* path.
*
* Returns: (element-type gint32) (transfer full) List of the strokes
* belonging to the path.
* Returns: (array length=num_strokes) (element-type gint32) (transfer
* full) List of the strokes belonging to the path.
*
* Since: 2.4
**/
@ -635,7 +635,7 @@ gimp_vectors_stroke_flip_free (gint32 vectors_ID,
* @vectors_ID: The vectors object.
* @stroke_id: The stroke ID.
* @num_points: (out) The number of floats returned.
* @controlpoints: (out) (element-type gdouble) (transfer full) List of the control points for the stroke (x0, y0, x1, y1, ...).
* @controlpoints: (out) (array length=num_points) (element-type gdouble) (transfer full) List of the control points for the stroke (x0, y0, x1, y1, ...).
* @closed: (out) Whether the stroke is closed or not.
*
* returns the control points of a stroke.
@ -756,8 +756,8 @@ gimp_vectors_stroke_new_from_points (gint32 vectors_ID,
*
* returns polygonal approximation of the stroke.
*
* Returns: (element-type gdouble) (transfer full) List of the coords
* along the path (x0, y0, x1, y1, ...).
* Returns: (array length=coords) (element-type gdouble) (transfer
* full) List of the coords along the path (x0, y0, x1, y1, ...).
*
* Since: 2.4
**/
@ -1067,7 +1067,7 @@ gimp_vectors_bezier_stroke_new_ellipse (gint32 vectors_ID,
* @merge: Merge paths into a single vectors object.
* @scale: Scale the SVG to image dimensions.
* @num_vectors: (out) The number of newly created vectors.
* @vectors_ids: (out) (element-type gint32) (transfer full) The list of newly created vectors.
* @vectors_ids: (out) (array length=num_vectors) (element-type gint32) (transfer full) The list of newly created vectors.
*
* Import paths from an SVG file.
*
@ -1128,7 +1128,7 @@ gimp_vectors_import_from_file (gint32 image_ID,
* @merge: Merge paths into a single vectors object.
* @scale: Scale the SVG to image dimensions.
* @num_vectors: (out) The number of newly created vectors.
* @vectors_ids: (out) (element-type gint32) (transfer full) The list of newly created vectors.
* @vectors_ids: (out) (array length=num_vectors) (element-type gint32) (transfer full) The list of newly created vectors.
*
* Import paths from an SVG string.
*

View file

@ -104,8 +104,14 @@ sub generate {
# Find the return argument (defaults to the first arg if not
# explicitly set
my $retarg = undef; $retvoid = 0;
foreach (@outargs) { $retarg = $_, last if exists $_->{retval} }
my $retarg = undef;
my $retindex = 0;
$retvoid = 0;
foreach (@outargs) {
$retarg = $_, last if exists $_->{retval};
$retindex++;
}
unless ($retarg) {
if (scalar @outargs) {
if (exists $outargs[0]->{void_ret}) {
@ -127,6 +133,10 @@ sub generate {
$retarg->{retval} = 1;
if (exists $argtype->{array}) {
$retdesc .= "(array length=@outargs[$retindex - 2]->{name}) ";
}
if (exists $argtype->{out_annotate}) {
$retdesc .= "$argtype->{out_annotate} ";
}
@ -338,6 +348,10 @@ CODE
$argdesc .= '_ID' if $arg->{id};
$argdesc .= ": (out) ";
if (exists $arg->{array}) {
$argdesc .= "(array length=@outargs[$argc - 2]->{name}) ";
}
if (exists $arg->{out_annotate}) {
$argdesc .= "$arg->{out_annotate} ";
}
@ -358,6 +372,7 @@ CODE
unless ($argdesc =~ /[\.\!\?]$/) { $argdesc .= '.' }
unless ($argdesc =~ /\n$/) { $argdesc .= "\n" }
}
$argc++;
}