From ad5e1cd055db9b2c991a7b79fa45ff140d4b1135 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Mon, 8 Dec 2003 12:28:29 +0000 Subject: [PATCH] tools/pdbgen/pdb/channel.pdb tools/pdbgen/pdb/display.pdb 2003-12-08 Michael Natterer * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/image.pdb: don't use "alias"es just to rename variables, they just clutter the code and there is no reason why e.g. a GimpDisplay variable must be called "gdisp" instead of "display". Cleanup. * app/pdb/channel_cmds.c * app/pdb/display_cmds.c * app/pdb/drawable_cmds.c * app/pdb/image_cmds.c: regenerated. --- ChangeLog | 15 ++++++++++++++ app/pdb/channel_cmds.c | 10 ++++++--- app/pdb/display_cmds.c | 30 +++++++++++++-------------- app/pdb/drawable_cmds.c | 12 +++++------ app/pdb/image_cmds.c | 38 +++++++++++++++++++---------------- tools/pdbgen/pdb/channel.pdb | 12 +++++++++-- tools/pdbgen/pdb/display.pdb | 18 ++++++++--------- tools/pdbgen/pdb/drawable.pdb | 12 +++++------ tools/pdbgen/pdb/image.pdb | 34 ++++++++++++++++--------------- 9 files changed, 106 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 774aa968aa..bf741c295d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2003-12-08 Michael Natterer + + * tools/pdbgen/pdb/channel.pdb + * tools/pdbgen/pdb/display.pdb + * tools/pdbgen/pdb/drawable.pdb + * tools/pdbgen/pdb/image.pdb: don't use "alias"es just to rename + variables, they just clutter the code and there is no reason why + e.g. a GimpDisplay variable must be called "gdisp" instead of + "display". Cleanup. + + * app/pdb/channel_cmds.c + * app/pdb/display_cmds.c + * app/pdb/drawable_cmds.c + * app/pdb/image_cmds.c: regenerated. + 2003-12-08 Michael Natterer * tools/pdbgen/pdb/brushes.pdb diff --git a/app/pdb/channel_cmds.c b/app/pdb/channel_cmds.c index 8622ee57b5..7982bdfe91 100644 --- a/app/pdb/channel_cmds.c +++ b/app/pdb/channel_cmds.c @@ -177,19 +177,23 @@ channel_copy_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; GimpChannel *channel; - GimpChannel *copy = NULL; + GimpChannel *channel_copy = NULL; channel = (GimpChannel *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int); if (! GIMP_IS_CHANNEL (channel)) success = FALSE; if (success) - success = (copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel), G_TYPE_FROM_INSTANCE (channel), FALSE))) != NULL; + { + channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel), + G_TYPE_FROM_INSTANCE (channel), FALSE)); + success = (channel_copy != NULL); + } return_args = procedural_db_return_args (&channel_copy_proc, success); if (success) - return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (copy)); + return_args[1].value.pdb_int = gimp_item_get_ID (GIMP_ITEM (channel_copy)); return return_args; } diff --git a/app/pdb/display_cmds.c b/app/pdb/display_cmds.c index 2eade1436c..d682f5b33a 100644 --- a/app/pdb/display_cmds.c +++ b/app/pdb/display_cmds.c @@ -56,7 +56,7 @@ display_new_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; GimpImage *gimage; - GimpDisplay *gdisp = NULL; + GimpDisplay *display = NULL; gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); if (! GIMP_IS_IMAGE (gimage)) @@ -64,9 +64,9 @@ display_new_invoker (Gimp *gimp, if (success) { - gdisp = (GimpDisplay *) gimp_create_display (gimp, gimage, 0x0101); + display = (GimpDisplay *) gimp_create_display (gimp, gimage, 0x0101); - success = (gdisp != NULL); + success = (display != NULL); /* the first display takes ownership of the image */ if (success && gimage->disp_count == 1) @@ -76,7 +76,7 @@ display_new_invoker (Gimp *gimp, return_args = procedural_db_return_args (&display_new_proc, success); if (success) - return_args[1].value.pdb_int = gimp_display_get_ID (gdisp); + return_args[1].value.pdb_int = gimp_display_get_ID (display); return return_args; } @@ -120,14 +120,14 @@ display_delete_invoker (Gimp *gimp, Argument *args) { gboolean success = TRUE; - GimpDisplay *gdisp; + GimpDisplay *display; - gdisp = gimp_display_get_by_ID (gimp, args[0].value.pdb_int); - if (! GIMP_IS_DISPLAY (gdisp)) + display = gimp_display_get_by_ID (gimp, args[0].value.pdb_int); + if (! GIMP_IS_DISPLAY (display)) success = FALSE; if (success) - gimp_display_delete (gdisp); + gimp_display_delete (display); return procedural_db_return_args (&display_delete_proc, success); } @@ -186,19 +186,19 @@ displays_reconnect_invoker (Gimp *gimp, Argument *args) { gboolean success = TRUE; - GimpImage *gimage_old; - GimpImage *gimage_new; + GimpImage *old_image; + GimpImage *new_image; - gimage_old = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); - if (! GIMP_IS_IMAGE (gimage_old)) + old_image = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); + if (! GIMP_IS_IMAGE (old_image)) success = FALSE; - gimage_new = gimp_image_get_by_ID (gimp, args[1].value.pdb_int); - if (! GIMP_IS_IMAGE (gimage_new)) + new_image = gimp_image_get_by_ID (gimp, args[1].value.pdb_int); + if (! GIMP_IS_IMAGE (new_image)) success = FALSE; if (success) - gimp_displays_reconnect (gimp, gimage_old, gimage_new); + gimp_displays_reconnect (gimp, old_image, new_image); return procedural_db_return_args (&displays_reconnect_proc, success); } diff --git a/app/pdb/drawable_cmds.c b/app/pdb/drawable_cmds.c index 1df9d9a4f2..edfa85cf0d 100644 --- a/app/pdb/drawable_cmds.c +++ b/app/pdb/drawable_cmds.c @@ -1871,8 +1871,8 @@ drawable_thumbnail_invoker (Gimp *gimp, if (success) { - TempBuf * buf; - gint dwidth, dheight; + TempBuf *buf; + gint dwidth, dheight; if (req_width <= 128 && req_height <= 128) { @@ -1890,11 +1890,11 @@ drawable_thumbnail_invoker (Gimp *gimp, if (buf) { - num_bytes = buf->height * buf->width * buf->bytes; + num_bytes = buf->height * buf->width * buf->bytes; thumbnail_data = g_memdup (temp_buf_data (buf), num_bytes); - width = buf->width; - height = buf->height; - bpp = buf->bytes; + width = buf->width; + height = buf->height; + bpp = buf->bytes; } } } diff --git a/app/pdb/image_cmds.c b/app/pdb/image_cmds.c index 14b7fad8c2..91b34067eb 100644 --- a/app/pdb/image_cmds.c +++ b/app/pdb/image_cmds.c @@ -207,7 +207,7 @@ image_list_invoker (Gimp *gimp, gint32 num_images = 0; gint32 *image_ids = NULL; GList *list = NULL; - int i; + gint i; gimp_container_foreach (gimp->images, gimlist_cb, &list); num_images = g_list_length (list); @@ -266,7 +266,7 @@ image_new_invoker (Gimp *gimp, gint32 width; gint32 height; gint32 type; - GimpImage *gimage = NULL; + GimpImage *image = NULL; width = args[0].value.pdb_int; if (width <= 0) @@ -281,12 +281,15 @@ image_new_invoker (Gimp *gimp, success = FALSE; if (success) - success = (gimage = gimp_create_image (gimp, width, height, type, FALSE)) != NULL; + { + image = gimp_create_image (gimp, width, height, type, FALSE); + success = (image != NULL); + } return_args = procedural_db_return_args (&image_new_proc, success); if (success) - return_args[1].value.pdb_int = gimp_image_get_ID (gimage); + return_args[1].value.pdb_int = gimp_image_get_ID (image); return return_args; } @@ -783,7 +786,7 @@ image_get_layers_invoker (Gimp *gimp, gint32 num_layers = 0; gint32 *layer_ids = NULL; GList *list = NULL; - int i; + gint i; gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); if (! GIMP_IS_IMAGE (gimage)) @@ -862,7 +865,7 @@ image_get_channels_invoker (Gimp *gimp, gint32 num_channels = 0; gint32 *channel_ids = NULL; GList *list = NULL; - int i; + gint i; gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); if (! GIMP_IS_IMAGE (gimage)) @@ -2373,8 +2376,8 @@ image_thumbnail_invoker (Gimp *gimp, if (success) { - TempBuf * buf; - gint dwidth, dheight; + TempBuf *buf; + gint dwidth, dheight; g_assert (GIMP_VIEWABLE_MAX_PREVIEW_SIZE >= 1024); @@ -2392,11 +2395,12 @@ image_thumbnail_invoker (Gimp *gimp, if (buf) { - num_bytes = buf->height * buf->width * buf->bytes; + num_bytes = buf->height * buf->width * buf->bytes; thumbnail_data = g_memdup (temp_buf_data (buf), num_bytes); - width = buf->width; - height = buf->height; - bpp = buf->bytes; + width = buf->width; + height = buf->height; + bpp = buf->bytes; + temp_buf_free (buf); } } @@ -2495,7 +2499,7 @@ image_set_tattoo_state_invoker (Gimp *gimp, if (success) { - success = gimp_image_set_tattoo_state(gimage,tattoo); + success = gimp_image_set_tattoo_state (gimage, tattoo); } return procedural_db_return_args (&image_set_tattoo_state_proc, success); @@ -2546,7 +2550,7 @@ image_get_tattoo_state_invoker (Gimp *gimp, if (success) { - tattoo = gimp_image_get_tattoo_state(gimage); + tattoo = gimp_image_get_tattoo_state (gimage); } return_args = procedural_db_return_args (&image_get_tattoo_state_proc, success); @@ -2598,19 +2602,19 @@ image_duplicate_invoker (Gimp *gimp, gboolean success = TRUE; Argument *return_args; GimpImage *gimage; - GimpImage *new_gimage = NULL; + GimpImage *new_image = NULL; gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int); if (! GIMP_IS_IMAGE (gimage)) success = FALSE; if (success) - success = (new_gimage = gimp_image_duplicate (gimage)) != NULL; + success = (new_image = gimp_image_duplicate (gimage)) != NULL; return_args = procedural_db_return_args (&image_duplicate_proc, success); if (success) - return_args[1].value.pdb_int = gimp_image_get_ID (new_gimage); + return_args[1].value.pdb_int = gimp_image_get_ID (new_image); return return_args; } diff --git a/tools/pdbgen/pdb/channel.pdb b/tools/pdbgen/pdb/channel.pdb index c2df9516cd..56d612d045 100644 --- a/tools/pdbgen/pdb/channel.pdb +++ b/tools/pdbgen/pdb/channel.pdb @@ -193,10 +193,18 @@ HELP @outargs = ( { name => 'channel_copy', type => 'channel', init => 1, - desc => 'The newly copied channel', alias => 'copy' } + desc => 'The newly copied channel' } ); - %invoke = ( code => 'success = (copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel), G_TYPE_FROM_INSTANCE (channel), FALSE))) != NULL;' ); + %invoke = ( + code => <<'CODE' +{ + channel_copy = GIMP_CHANNEL (gimp_item_duplicate (GIMP_ITEM (channel), + G_TYPE_FROM_INSTANCE (channel), FALSE)); + success = (channel_copy != NULL); +} +CODE + ); } sub channel_combine_masks { diff --git a/tools/pdbgen/pdb/display.pdb b/tools/pdbgen/pdb/display.pdb index 8a6b629aff..a9e65620a2 100644 --- a/tools/pdbgen/pdb/display.pdb +++ b/tools/pdbgen/pdb/display.pdb @@ -36,15 +36,15 @@ HELP @outargs = ( { name => 'display', type => 'display', - desc => 'The new display', alias => 'gdisp', init => 1 } + desc => 'The new display', init => 1 } ); %invoke = ( code => <<'CODE' { - gdisp = (GimpDisplay *) gimp_create_display (gimp, gimage, 0x0101); + display = (GimpDisplay *) gimp_create_display (gimp, gimage, 0x0101); - success = (gdisp != NULL); + success = (display != NULL); /* the first display takes ownership of the image */ if (success && gimage->disp_count == 1) @@ -66,10 +66,10 @@ HELP @inargs = ( { name => 'display', type => 'display', - desc => 'The display to delete', alias => 'gdisp' } + desc => 'The display to delete' } ); - %invoke = ( code => 'gimp_display_delete (gdisp);' ); + %invoke = ( code => 'gimp_display_delete (display);' ); } sub displays_flush { @@ -104,14 +104,12 @@ HELP @inargs = ( { name => 'old_image', type => 'image', - desc => 'The old image (should have at least one display)', - alias => 'gimage_old' }, + desc => 'The old image (should have at least one display)' }, { name => 'new_image', type => 'image', - desc => 'The new image (must not have a display)', - alias => 'gimage_new' } + desc => 'The new image (must not have a display)' } ); - %invoke = ( code => 'gimp_displays_reconnect (gimp, gimage_old, gimage_new);' ); + %invoke = ( code => 'gimp_displays_reconnect (gimp, old_image, new_image);' ); } @headers = qw("core/gimp.h" "display/display-types.h" "display/gimpdisplay.h" diff --git a/tools/pdbgen/pdb/drawable.pdb b/tools/pdbgen/pdb/drawable.pdb index ed86a8b630..7f2ae12de6 100644 --- a/tools/pdbgen/pdb/drawable.pdb +++ b/tools/pdbgen/pdb/drawable.pdb @@ -596,8 +596,8 @@ HELP %invoke = ( code => <<'CODE' { - TempBuf * buf; - gint dwidth, dheight; + TempBuf *buf; + gint dwidth, dheight; if (req_width <= 128 && req_height <= 128) { @@ -615,11 +615,11 @@ HELP if (buf) { - num_bytes = buf->height * buf->width * buf->bytes; + num_bytes = buf->height * buf->width * buf->bytes; thumbnail_data = g_memdup (temp_buf_data (buf), num_bytes); - width = buf->width; - height = buf->height; - bpp = buf->bytes; + width = buf->width; + height = buf->height; + bpp = buf->bytes; } } } diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index 23d8f374e4..202e2f70d4 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -57,7 +57,7 @@ HELP ); %invoke = ( - vars => [ 'GList *list = NULL', 'int i' ], + vars => [ 'GList *list = NULL', 'gint i' ], code => <${type}s)->list; @@ -256,13 +256,16 @@ HELP } @outargs = ( - { name => 'image', type => 'image', alias => 'gimage', init => 1, + { name => 'image', type => 'image', init => 1, desc => 'The ID of the newly created image' } ); %invoke = ( code => <<'CODE' -success = (gimage = gimp_create_image (gimp, width, height, type, FALSE)) != NULL; +{ + image = gimp_create_image (gimp, width, height, type, FALSE); + success = (image != NULL); +} CODE ); } @@ -1325,8 +1328,8 @@ HELP headers => [ qw( "core/gimpviewable.h") ], code => <<'CODE' { - TempBuf * buf; - gint dwidth, dheight; + TempBuf *buf; + gint dwidth, dheight; g_assert (GIMP_VIEWABLE_MAX_PREVIEW_SIZE >= 1024); @@ -1344,11 +1347,12 @@ HELP if (buf) { - num_bytes = buf->height * buf->width * buf->bytes; + num_bytes = buf->height * buf->width * buf->bytes; thumbnail_data = g_memdup (temp_buf_data (buf), num_bytes); - width = buf->width; - height = buf->height; - bpp = buf->bytes; + width = buf->width; + height = buf->height; + bpp = buf->bytes; + temp_buf_free (buf); } } @@ -1378,7 +1382,7 @@ HELP %invoke = ( code => <<'CODE' { -tattoo = gimp_image_get_tattoo_state(gimage); + tattoo = gimp_image_get_tattoo_state (gimage); } CODE ); @@ -1406,14 +1410,13 @@ HELP @inargs = ( &std_image_arg, { name => 'tattoo', type => 'int32', - desc => 'The new tattoo state of the image' - } + desc => 'The new tattoo state of the image' } ); %invoke = ( code => <<'CODE' { - success = gimp_image_set_tattoo_state(gimage,tattoo); + success = gimp_image_set_tattoo_state (gimage, tattoo); } CODE ); @@ -1434,14 +1437,13 @@ HELP @outargs = ( { name => 'new_image', type => 'image', - desc => 'The new, duplicated image', - alias => 'new_gimage', init => 1 } + desc => 'The new, duplicated image', init => 1 } ); %invoke = ( headers => [ qw("core/gimpimage-duplicate.h") ], code => <<'CODE' -success = (new_gimage = gimp_image_duplicate (gimage)) != NULL; +success = (new_image = gimp_image_duplicate (gimage)) != NULL; CODE ); }