Commit 350f9882 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

fixed dependencies for test-config.

2003-10-12  Sven Neumann  <sven@gimp.org>

	* app/config/Makefile.am: fixed dependencies for test-config.

	* app/config/gimpconfigwriter.[ch]: code cleanup and documentation.

	* app/composite/gimp-composite-generic.[ch]: made prototype for
	gimp_composite_color_any_any_any_generic() match the implementation.

	* app/composite/gimp-composite.c: fixed some issues with the
	comment templates.
parent 0b2b9e19
2003-10-12 Sven Neumann <sven@gimp.org>
* app/config/Makefile.am: fixed dependencies for test-config.
* app/config/gimpconfigwriter.[ch]: code cleanup and documentation.
* app/composite/gimp-composite-generic.[ch]: made prototype for
gimp_composite_color_any_any_any_generic() match the implementation.
* app/composite/gimp-composite.c: fixed some issues with the
comment templates.
2003-10-12 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/script-fu-scripts.c (script_fu_interface):
......@@ -35,6 +35,7 @@
#include "base/base-types.h"
#include "gimp-composite.h"
#include "gimp-composite-generic.h"
#define OPAQUE_OPACITY 255
......@@ -78,9 +79,9 @@ static gint32 random_table[RANDOM_TABLE_SIZE];
*/
/**
* gimp_composite_convert_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_convert_any_any_any_generic (GimpCompositeContext *ctx)
......@@ -104,17 +105,20 @@ gimp_composite_convert_any_any_any_generic (GimpCompositeContext *ctx)
/**
* gimp_composite_color_any_any_any_generic:
* @dest:
* @color:
* @w:
* @bytes:
*
*
* @dest:
* @color:
* @w:
* @bytes:
*
*
**/
void
gimp_composite_color_any_any_any_generic (guchar * dest, const guchar * color, guint w, guint bytes)
gimp_composite_color_any_any_any_generic (guchar *dest,
const guchar *color,
guint w,
guint bytes)
{
/* dest % bytes and color % bytes must be 0 or we will crash
/* dest % bytes and color % bytes must be 0 or we will crash
when bytes = 2 or 4.
Is this safe to assume? Lets find out.
This is 4-7X as fast as the simple version.
......@@ -204,9 +208,9 @@ gimp_composite_color_any_any_any_generic (guchar * dest, const guchar * color, g
/**
* gimp_composite_blend_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_blend_any_any_any_generic (GimpCompositeContext *ctx)
......@@ -256,9 +260,9 @@ gimp_composite_shade_generic (const guchar *src, guchar *dest, const guchar *col
/**
* gimp_composite_darken_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_darken_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -297,9 +301,9 @@ gimp_composite_darken_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_lighten_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_lighten_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -339,9 +343,9 @@ gimp_composite_lighten_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_hue_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_hue_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -392,9 +396,9 @@ gimp_composite_hue_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_saturation_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_saturation_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -445,9 +449,9 @@ gimp_composite_saturation_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_value_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_value_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -498,9 +502,9 @@ gimp_composite_value_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_color_only_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_color_only_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -552,9 +556,9 @@ gimp_composite_color_only_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_behind_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_behind_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -567,9 +571,9 @@ gimp_composite_behind_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_multiply_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_multiply_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -602,9 +606,9 @@ gimp_composite_multiply_any_any_any_generic (GimpCompositeContext * ctx)
{
for (b = 0; b < alpha; b++)
dest[b] = INT_MULT(src1[b], src2[b], tmp);
dest[alpha] = src2[alpha];
src1 += bytes1;
src2 += bytes2;
dest += bytes2;
......@@ -614,7 +618,7 @@ gimp_composite_multiply_any_any_any_generic (GimpCompositeContext * ctx)
{
for (b = 0; b < alpha; b++)
dest[b] = INT_MULT(src1[b], src2[b], tmp);
src1 += bytes1;
src2 += bytes2;
dest += bytes2;
......@@ -625,9 +629,9 @@ gimp_composite_multiply_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_divide_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_divide_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -665,9 +669,9 @@ gimp_composite_divide_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_screen_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_screen_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -702,9 +706,9 @@ gimp_composite_screen_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_overlay_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_overlay_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -741,9 +745,9 @@ gimp_composite_overlay_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_dodge_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_dodge_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -782,9 +786,9 @@ gimp_composite_dodge_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_burn_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_burn_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -826,9 +830,9 @@ gimp_composite_burn_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_hardlight_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_hardlight_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -874,9 +878,9 @@ gimp_composite_hardlight_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_softlight_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_softlight_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -916,9 +920,9 @@ gimp_composite_softlight_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_grain_extract_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_grain_extract_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -957,9 +961,9 @@ gimp_composite_grain_extract_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_grain_merge_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_grain_merge_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -998,9 +1002,9 @@ gimp_composite_grain_merge_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_addition_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_addition_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -1051,9 +1055,9 @@ gimp_composite_addition_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_subtract_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_subtract_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -1092,9 +1096,9 @@ gimp_composite_subtract_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_difference_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_difference_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -1133,9 +1137,9 @@ gimp_composite_difference_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_dissolve_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_dissolve_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -1212,9 +1216,9 @@ gimp_composite_dissolve_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_replace_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_replace_any_any_any_generic (GimpCompositeContext *ctx)
......@@ -1226,9 +1230,9 @@ gimp_composite_replace_any_any_any_generic (GimpCompositeContext *ctx)
/**
* gimp_composite_swap_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_swap_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -1251,9 +1255,9 @@ gimp_composite_swap_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_normal_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_normal_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -1264,9 +1268,9 @@ gimp_composite_normal_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_erase_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_erase_any_any_any_generic (GimpCompositeContext *ctx)
......@@ -1277,9 +1281,9 @@ gimp_composite_erase_any_any_any_generic (GimpCompositeContext *ctx)
/**
* gimp_composite_anti_erase_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_anti_erase_any_any_any_generic (GimpCompositeContext *ctx)
......@@ -1290,9 +1294,9 @@ gimp_composite_anti_erase_any_any_any_generic (GimpCompositeContext *ctx)
/**
* gimp_composite_color_erase_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_color_erase_any_any_any_generic (GimpCompositeContext *ctx)
......@@ -1306,9 +1310,9 @@ gimp_composite_color_erase_any_any_any_generic (GimpCompositeContext *ctx)
/**
* gimp_composite_scale_any_any_any_generic:
* @ctx:
*
*
* @ctx:
*
*
**/
void
gimp_composite_scale_any_any_any_generic (GimpCompositeContext * ctx)
......@@ -1332,11 +1336,10 @@ gimp_composite_scale_any_any_any_generic (GimpCompositeContext * ctx)
/**
* gimp_composite_generic_init:
* @void:
*
*
*
* Return value:
*
*
*
* Return value:
**/
gboolean
gimp_composite_generic_init (void)
......
......@@ -3,8 +3,9 @@
extern gboolean gimp_composite_generic_init (void);
/*
* The function gimp_composite_*_install() is defined in the code generated by make-install.py
* I hate to create a .h file just for that declaration, so I do it here (for now).
* The function gimp_composite_*_install() is defined in the code
* generated by make-install.py I hate to create a .h file just for
* that declaration, so I do it here (for now).
*/
extern gboolean gimp_composite_generic_install (void);
......@@ -12,7 +13,10 @@ void gimp_composite_addition_any_any_any_generic (GimpCompositeContext *ctx);
void gimp_composite_anti_erase_any_any_any_generic (GimpCompositeContext *ctx);
void gimp_composite_blend_any_any_any_generic (GimpCompositeContext *ctx);
void gimp_composite_burn_any_any_any_generic (GimpCompositeContext *ctx);
void gimp_composite_color_any_any_any_generic (GimpCompositeContext *ctx);
void gimp_composite_color_any_any_any_generic (guchar *dest,
const guchar *color,
guint w,
guint bytes);
void gimp_composite_color_erase_any_any_any_generic (GimpCompositeContext *ctx);
void gimp_composite_color_only_any_any_any_generic (GimpCompositeContext *ctx);
void gimp_composite_convert_any_any_any_generic (GimpCompositeContext *ctx);
......
......@@ -191,7 +191,7 @@ void (*gimp_composite_function[GIMP_COMPOSITE_N][GIMP_PIXELFORMAT_N][GIMP_PIXELF
/**
* gimp_composite_dispatch:
* @ctx: The compositing context
*
*
* Given a compositing context, perform the compositing function
* dictated by the compositing context operation. There is no return
* value, all results are in the compositing context.
......@@ -230,10 +230,8 @@ gimp_composite_dispatch (GimpCompositeContext *ctx)
/**
* gimp_composite_context_print:
* @ctx: The context to print
*
*
* Print a human readable form of a GimpCompositeContext on stdout.
*
* Return value: void
**/
void
gimp_composite_context_print (GimpCompositeContext *ctx)
......@@ -250,12 +248,12 @@ gimp_composite_context_print (GimpCompositeContext *ctx)
/**
* gimp_composite_mode_astext:
* @op:
*
* @op:
*
* Given a GimpCompositeOperatin, return a string representation of the name
* of that operation.
*
* Return value: const gchar *
*
* Return value:
**/
const gchar *
gimp_composite_mode_astext (GimpCompositeOperation op)
......@@ -304,11 +302,11 @@ gimp_composite_mode_astext (GimpCompositeOperation op)
/**
* gimp_composite_pixelformat_astext:
* @format: The format.
*
*
* Given a GimpPixelFormat, return a string representation of the name
* of that format.
*
* Return value: const gchar *
*
* Return value:
**/
const gchar *
gimp_composite_pixelformat_astext (GimpPixelFormat format)
......@@ -341,8 +339,7 @@ gimp_composite_pixelformat_astext (GimpPixelFormat format)
/**
* gimp_composite_init:
* @void:
*
*
* Initialise the Gimp Compositing subsystem. This includes checking
* for user options and environment, installing the generic set of
* compositing operation handlers, followed by overloading those which
......
......@@ -92,7 +92,7 @@ man: gimpconfig-dump
TESTS = test-config
test_config_DEPENDENCIES = $(gimpconfig_dependencies)
test_config_DEPENDENCIES = $(gimpconfig_libs)
test_config_LDADD = $(GLIB_LIBS) $(gimpconfig_libs)
......
......@@ -168,6 +168,18 @@ gimp_config_writer_new_string (GString *string)
return writer;
}
/**
* gimp_config_writer_comment_mode:
* @writer: a #GimpConfigWriter
* @enable: %TRUE to enable comment mode, %FALSE to disable it
*
* This function toggles whether the @writer should create commented
* or uncommented output. This feature is used to generate the
* system-wide installed gimprc that documents the default settings.
*
* Since comments have to start at the beginning of a line, this
* funtion will insert a newline if necessary.
**/
void
gimp_config_writer_comment_mode (GimpConfigWriter *writer,
gboolean enable)
......@@ -179,13 +191,30 @@ gimp_config_writer_comment_mode (GimpConfigWriter *writer,
enable = (enable ? TRUE : FALSE);
if (enable)
g_string_append_len (writer->buffer, "# ", 2);
if (writer->comment == enable)
return;
writer->comment = enable;
if (enable)
{
if (writer->buffer->len == 0)
g_string_append_len (writer->buffer, "# ", 2);
else
gimp_config_writer_newline (writer);
}
}
/**
* gimp_config_writer_open:
* @writer: a #GimpConfigWriter
* @name: name of the element to open
*
* This function writes the opening parenthese followed by @name.
* It also increases the indentation level and sets a mark that
* can be used by gimp_config_writer_revert().
**/
void
gimp_config_writer_open (GimpConfigWriter *writer,
const gchar *name)
......@@ -207,6 +236,15 @@ gimp_config_writer_open (GimpConfigWriter *writer,
g_string_append_printf (writer->buffer, "(%s", name);
}
/**
* gimp_config_writer_print:
* @writer: a #GimpConfigWriter
* @string: a string to write
* @len: number of bytes from @string or -1 if @string is NUL-terminated.
*
* Appends a space followed by @string to the @writer. Note that string
* must not contain any special characters that might need to be escaped.
**/
void
gimp_config_writer_print (GimpConfigWriter *writer,
const gchar *string,
......@@ -228,6 +266,14 @@ gimp_config_writer_print (GimpConfigWriter *writer,
}
}
/**
* gimp_config_writer_printf:
* @writer: a #GimpConfigWriter
* @format: a format string as described for g_strdup_printf().
* @Varargs: list of arguments according to @format
*
* A printf-like function for #GimpConfigWriter.
**/
void
gimp_config_writer_printf (GimpConfigWriter *writer,
const gchar *format,
......@@ -252,6 +298,14 @@ gimp_config_writer_printf (GimpConfigWriter *writer,
g_free (buffer);
}
/**
* gimp_config_writer_string:
* @writer: a #GimpConfigWriter
* @string: a NUL-terminated string
*
* Writes a string value to @writer. The @string is quoted and special
* characters are escaped.
**/
void
gimp_config_writer_string (GimpConfigWriter *writer,
const gchar *string)
......@@ -265,6 +319,14 @@ gimp_config_writer_string (GimpConfigWriter *writer,
gimp_config_string_append_escaped (writer->buffer, string);
}
/**
* gimp_config_writer_revert:
* @writer: a #GimpConfigWriter
*
* Reverts all changes to @writer that were done since the last call
* to gimp_config_writer_open(). This can only work if you didn't call
* gimp_config_writer_close() yet.
**/
void
gimp_config_writer_revert (GimpConfigWriter *writer)
{
......@@ -281,6 +343,12 @@ gimp_config_writer_revert (GimpConfigWriter *writer)
writer->marker = -1;
}
/**
* gimp_config_writer_close:
* @writer: a #GimpConfigWriter
*
* Closes an element opened with gimp_config_writer_open().
**/
void
gimp_config_writer_close (GimpConfigWriter *writer)
{
......@@ -301,6 +369,20 @@ gimp_config_writer_close (GimpConfigWriter *writer)
}
}
/**
* gimp_config_writer_finish:
* @writer: a #GimpConfigWriter
* @footer: text to include as comment at the bottom of the file
* @error: return location for possible errors
*
* This function finishes the work of @writer and frees it afterwards.
* It closes all open elements, appends an optional comment and
* releases all resources allocated by @writer. You must not access
* the @writer afterwards.
*
* Return value: %TRUE if everything could be successfully written,
* %FALSE otherwise
**/
gboolean
gimp_config_writer_finish (GimpConfigWriter *writer,
const gchar *footer,
......@@ -381,6 +463,7 @@ gimp_config_writer_comment (GimpConfigWriter *writer,
const gchar *comment)
{
const gchar *s;
gboolean comment_mode;
gint i, len, space;
#define LINE_LENGTH 75
......@@ -394,10 +477,10 @@ gimp_config_writer_comment (GimpConfigWriter *writer,
if (!comment)
return;
len = strlen (comment);
comment_mode = writer->comment;
gimp_config_writer_comment_mode (writer, TRUE);
if (! writer->comment)
g_string_append_len (writer->buffer, "# ", 2);
len = strlen (comment);
while (len > 0)
{
......@@ -413,15 +496,18 @@ gimp_config_writer_comment (GimpConfigWriter *writer,
i = space;
g_string_append_len (writer->buffer, comment, i);
g_string_append_len (writer->buffer, "\n# ", 3);
i++;
comment += i;
len -= i;
if (len > 0)
gimp_config_writer_newline (writer);
}
g_string_truncate (writer->buffer, writer->buffer->len - 2);
gimp_config_writer_comment_mode (writer, comment_mode);
gimp_config_writer_newline (writer);
if (writer->depth == 0)
gimp_config_writer_flush (writer);
......@@ -429,6 +515,7 @@ gimp_config_writer_comment (GimpConfigWriter *writer,
#undef LINE_LENGTH
}
static inline void
gimp_config_writer_flush (GimpConfigWriter *writer)
{
......
......@@ -44,7 +44,8 @@ void gimp_config_writer_printf (GimpConfigWriter *writer,