libgimpbase/gimpprotocol.[ch] pass "gpointer user_data" to all functions,

2002-05-16  Michael Natterer  <mitch@gimp.org>

	* libgimpbase/gimpprotocol.[ch]
	* libgimpbase/gimpwire.[ch]: pass "gpointer user_data" to all
	functions, which in gets turn passed to the registered reader,
	writer, and flusher funcs.

	* libgimp/gimp.c
	* libgimp/gimptile.c: pass NULL as user_data. We have only one
	pipe on the plug-in side.

	* app/plug-in/plug-in.c: pass the PlugIn as user_data. As a
	consequence, got rid of more global variables. The global
	"current_plug_in" and the plug_in_push()/pop() madness are still
	there. Will reeplace them by some less ugly hack later...

2002-05-16  Michael Natterer  <mitch@gimp.org>

	* libgimpbase/tmpl/gimpprotocol.sgml
	* libgimpbase/tmpl/gimpwire.sgml: regenerated after API change.
This commit is contained in:
Michael Natterer 2002-05-16 17:41:38 +00:00 committed by Michael Natterer
parent 9af4c5d6d2
commit dba356d815
19 changed files with 1102 additions and 777 deletions

View File

@ -1,3 +1,19 @@
2002-05-16 Michael Natterer <mitch@gimp.org>
* libgimpbase/gimpprotocol.[ch]
* libgimpbase/gimpwire.[ch]: pass "gpointer user_data" to all
functions, which in gets turn passed to the registered reader,
writer, and flusher funcs.
* libgimp/gimp.c
* libgimp/gimptile.c: pass NULL as user_data. We have only one
pipe on the plug-in side.
* app/plug-in/plug-in.c: pass the PlugIn as user_data. As a
consequence, got rid of more global variables. The global
"current_plug_in" and the plug_in_push()/pop() madness are still
there. Will reeplace them by some less ugly hack later...
2002-05-16 Sven Neumann <sven@gimp.org> 2002-05-16 Sven Neumann <sven@gimp.org>
* app/gui/splash.c: don't allow to close the splash screen. Fixes * app/gui/splash.c: don't allow to close the splash screen. Fixes

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean plug_in_flush (GIOChannel *channel); gpointer user_data);
static gboolean plug_in_flush (GIOChannel *channel,
gpointer user_data);
static void plug_in_push (PlugIn *plug_in); static void plug_in_push (PlugIn *plug_in);
static void plug_in_pop (void); static void plug_in_pop (void);
static gboolean plug_in_recv_message (GIOChannel *channel, static gboolean plug_in_recv_message (GIOChannel *channel,
@ -169,8 +171,6 @@ static GSList *open_plug_ins = NULL;
static GSList *blocked_plug_ins = NULL; static GSList *blocked_plug_ins = NULL;
static GSList *plug_in_stack = NULL; static GSList *plug_in_stack = NULL;
static gint current_write_buffer_index = 0;
static gchar *current_write_buffer = NULL;
static Argument *current_return_vals = NULL; static Argument *current_return_vals = NULL;
static gint current_return_nvals = 0; static gint current_return_nvals = 0;
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
while (plug_in->open) while (plug_in->open)
{ {
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
if (kill_it && plug_in->pid) if (kill_it && plug_in->pid)
{ {
plug_in_push (plug_in); plug_in_push (plug_in);
gp_quit_write (plug_in->my_write); gp_quit_write (plug_in->my_write, plug_in);
plug_in_pop (); plug_in_pop ();
/* give the plug-in some time (10 ms) */ /* give the plug-in some time (10 ms) */
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_config_write (plug_in->my_write, &config) || if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
! gp_proc_run_write (plug_in->my_write, &proc_run) || ! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
memset (&msg, 0, sizeof (WireMessage)); memset (&msg, 0, sizeof (WireMessage));
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
} }
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE; tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
tile_data.data = NULL; tile_data.data = NULL;
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
return; return;
} }
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, TRUE); tile_release (tile, TRUE);
wire_destroy (&msg); wire_destroy (&msg);
if (! gp_tile_ack_write (plug_in->my_write)) if (! gp_tile_ack_write (plug_in->my_write, plug_in))
{ {
g_warning ("plug_in_handle_tile_req: ERROR"); g_warning ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
else else
tile_data.data = tile_data_pointer (tile, 0, 0); tile_data.data = tile_data_pointer (tile, 0, 0);
if (! gp_tile_data_write (plug_in->my_write, &tile_data)) if (! gp_tile_data_write (plug_in->my_write, &tile_data, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
tile_release (tile, FALSE); tile_release (tile, FALSE);
if (! wire_read_msg (plug_in->my_read, &msg)) if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
{ {
g_message ("plug_in_handle_tile_req: ERROR"); g_message ("plug_in_handle_tile_req: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1255,7 +1255,7 @@ plug_in_handle_proc_run (PlugIn *plug_in,
proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE); proc_return.params = plug_in_args_to_params (return_vals, 1, FALSE);
} }
if (! gp_proc_return_write (plug_in->my_write, &proc_return)) if (! gp_proc_return_write (plug_in->my_write, &proc_return, plug_in))
{ {
g_warning ("plug_in_handle_proc_run: ERROR"); g_warning ("plug_in_handle_proc_run: ERROR");
plug_in_close (plug_in, TRUE); plug_in_close (plug_in, TRUE);
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
PlugInBlocked *blocked; PlugInBlocked *blocked;
GSList *tmp; GSList *tmp;
if (current_plug_in->recurse) if (plug_in->recurse)
{ {
current_return_vals = plug_in_params_to_args (proc_return->params, current_return_vals = plug_in_params_to_args (proc_return->params,
proc_return->nparams, proc_return->nparams,
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
plug_in_push (blocked->plug_in); plug_in_push (blocked->plug_in);
if (! gp_proc_return_write (blocked->plug_in->my_write, if (! gp_proc_return_write (blocked->plug_in->my_write,
proc_return)) proc_return,
blocked->plug_in))
{ {
g_message ("plug_in_handle_proc_run: ERROR"); g_message ("plug_in_handle_proc_run: ERROR");
plug_in_close (blocked->plug_in, TRUE); plug_in_close (blocked->plug_in, TRUE);
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
static gboolean static gboolean
plug_in_write (GIOChannel *channel, plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
PlugIn *plug_in;
gulong bytes; gulong bytes;
plug_in = (PlugIn *) user_data;
while (count > 0) while (count > 0)
{ {
if ((current_write_buffer_index + count) >= WRITE_BUFFER_SIZE) if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
{ {
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index; bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
if (! wire_flush (channel)) plug_in->write_buffer_index += bytes;
if (! wire_flush (channel, plug_in))
return FALSE; return FALSE;
} }
else else
{ {
bytes = count; bytes = count;
memcpy (&current_write_buffer[current_write_buffer_index], buf, bytes); memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
current_write_buffer_index += bytes; buf, bytes);
plug_in->write_buffer_index += bytes;
} }
buf += bytes; buf += bytes;
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
} }
static gboolean static gboolean
plug_in_flush (GIOChannel *channel) plug_in_flush (GIOChannel *channel,
gpointer user_data)
{ {
PlugIn *plug_in;
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
gint count; gint count;
guint bytes; guint bytes;
if (current_write_buffer_index > 0) plug_in = (PlugIn *) user_data;
if (plug_in->write_buffer_index > 0)
{ {
count = 0; count = 0;
while (count != current_write_buffer_index) while (count != plug_in->write_buffer_index)
{ {
do do
{ {
bytes = 0; bytes = 0;
status = g_io_channel_write_chars (channel, status = g_io_channel_write_chars (channel,
&current_write_buffer[count], &plug_in->write_buffer[count],
(current_write_buffer_index - count), (plug_in->write_buffer_index - count),
&bytes, &bytes,
&error); &error);
} }
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
count += bytes; count += bytes;
} }
current_write_buffer_index = 0; plug_in->write_buffer_index = 0;
} }
return TRUE; return TRUE;
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
current_plug_in = plug_in; current_plug_in = plug_in;
plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in); plug_in_stack = g_slist_prepend (plug_in_stack, current_plug_in);
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
static void static void
@ -1756,8 +1764,6 @@ plug_in_pop (void)
if (current_plug_in) if (current_plug_in)
{ {
current_plug_in->write_buffer_index = current_write_buffer_index;
tmp = plug_in_stack; tmp = plug_in_stack;
plug_in_stack = plug_in_stack->next; plug_in_stack = plug_in_stack->next;
tmp->next = NULL; tmp->next = NULL;
@ -1767,14 +1773,10 @@ plug_in_pop (void)
if (plug_in_stack) if (plug_in_stack)
{ {
current_plug_in = plug_in_stack->data; current_plug_in = plug_in_stack->data;
current_write_buffer_index = current_plug_in->write_buffer_index;
current_write_buffer = current_plug_in->write_buffer;
} }
else else
{ {
current_plug_in = NULL; current_plug_in = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
} }
} }
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
proc_run.nparams = argc; proc_run.nparams = argc;
proc_run.params = plug_in_args_to_params (args, argc, FALSE); proc_run.params = plug_in_args_to_params (args, argc, FALSE);
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) || if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
! wire_flush (plug_in->my_write)) ! wire_flush (plug_in->my_write, plug_in))
{ {
return_vals = procedural_db_return_args (proc_rec, FALSE); return_vals = procedural_db_return_args (proc_rec, FALSE);
goto done; goto done;

View File

@ -1,3 +1,8 @@
2002-05-16 Michael Natterer <mitch@gimp.org>
* libgimpbase/tmpl/gimpprotocol.sgml
* libgimpbase/tmpl/gimpwire.sgml: regenerated after API change.
2002-05-14 Sven Neumann <sven@gimp.org> 2002-05-14 Sven Neumann <sven@gimp.org>
* libgimpmath/libgimpmath-sections.txt * libgimpmath/libgimpmath-sections.txt

View File

@ -148,6 +148,7 @@ The communication protocol between GIMP and it's plug-ins.
</para> </para>
@channel: @channel:
@user_data:
@Returns: @Returns:
@ -157,6 +158,7 @@ The communication protocol between GIMP and it's plug-ins.
</para> </para>
@channel: @channel:
@user_data:
@Returns: @Returns:
@ -167,6 +169,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@config: @config:
@user_data:
@Returns: @Returns:
@ -177,6 +180,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@tile_req: @tile_req:
@user_data:
@Returns: @Returns:
@ -186,6 +190,7 @@ The communication protocol between GIMP and it's plug-ins.
</para> </para>
@channel: @channel:
@user_data:
@Returns: @Returns:
@ -196,6 +201,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@tile_data: @tile_data:
@user_data:
@Returns: @Returns:
@ -206,6 +212,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@proc_run: @proc_run:
@user_data:
@Returns: @Returns:
@ -216,6 +223,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@proc_return: @proc_return:
@user_data:
@Returns: @Returns:
@ -226,6 +234,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@proc_run: @proc_run:
@user_data:
@Returns: @Returns:
@ -236,6 +245,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@proc_return: @proc_return:
@user_data:
@Returns: @Returns:
@ -246,6 +256,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@proc_install: @proc_install:
@user_data:
@Returns: @Returns:
@ -256,6 +267,7 @@ The communication protocol between GIMP and it's plug-ins.
@channel: @channel:
@proc_uninstall: @proc_uninstall:
@user_data:
@Returns: @Returns:
@ -265,6 +277,7 @@ The communication protocol between GIMP and it's plug-ins.
</para> </para>
@channel: @channel:
@user_data:
@Returns: @Returns:

View File

@ -32,6 +32,7 @@ it's plug-ins.
@channel: @channel:
@msg: @msg:
@user_data:
<!-- ##### USER_FUNCTION WireWriteFunc ##### --> <!-- ##### USER_FUNCTION WireWriteFunc ##### -->
@ -41,6 +42,7 @@ it's plug-ins.
@channel: @channel:
@msg: @msg:
@user_data:
<!-- ##### USER_FUNCTION WireDestroyFunc ##### --> <!-- ##### USER_FUNCTION WireDestroyFunc ##### -->
@ -59,6 +61,7 @@ it's plug-ins.
@channel: @channel:
@buf: @buf:
@count: @count:
@user_data:
@Returns: @Returns:
@ -68,6 +71,7 @@ it's plug-ins.
</para> </para>
@channel: @channel:
@user_data:
@Returns: @Returns:
@ -114,6 +118,7 @@ it's plug-ins.
@channel: @channel:
@buf: @buf:
@count: @count:
@user_data:
@Returns: @Returns:
@ -125,6 +130,7 @@ it's plug-ins.
@channel: @channel:
@buf: @buf:
@count: @count:
@user_data:
@Returns: @Returns:
@ -134,6 +140,7 @@ it's plug-ins.
</para> </para>
@channel: @channel:
@user_data:
@Returns: @Returns:
@ -159,6 +166,7 @@ it's plug-ins.
@channel: @channel:
@msg: @msg:
@user_data:
@Returns: @Returns:
@ -169,6 +177,7 @@ it's plug-ins.
@channel: @channel:
@msg: @msg:
@user_data:
@Returns: @Returns:
@ -188,6 +197,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -199,6 +209,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -210,6 +221,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -221,6 +233,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -232,6 +245,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -243,6 +257,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -254,6 +269,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -265,6 +281,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -276,6 +293,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:
@ -287,6 +305,7 @@ it's plug-ins.
@channel: @channel:
@data: @data:
@count: @count:
@user_data:
@Returns: @Returns:

View File

@ -103,8 +103,10 @@ static gboolean gimp_plugin_io_error_handler (GIOChannel *channel,
static gboolean gimp_write (GIOChannel *channel, static gboolean gimp_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
static gboolean gimp_flush (GIOChannel *channel); gpointer user_data);
static gboolean gimp_flush (GIOChannel *channel,
gpointer user_data);
static void gimp_loop (void); static void gimp_loop (void);
static void gimp_config (GPConfig *config); static void gimp_config (GPConfig *config);
static void gimp_proc_run (GPProcRun *proc_run); static void gimp_proc_run (GPProcRun *proc_run);
@ -283,7 +285,7 @@ gimp_main (int argc,
if (strcmp (argv[4], "-query") == 0) if (strcmp (argv[4], "-query") == 0)
{ {
if (PLUG_IN_INFO.init_proc) if (PLUG_IN_INFO.init_proc)
gp_has_init_write(_writechannel); gp_has_init_write (_writechannel, NULL);
if (PLUG_IN_INFO.query_proc) if (PLUG_IN_INFO.query_proc)
(* PLUG_IN_INFO.query_proc) (); (* PLUG_IN_INFO.query_proc) ();
@ -327,7 +329,7 @@ gimp_close (void)
#endif #endif
#endif #endif
gp_quit_write (_writechannel); gp_quit_write (_writechannel, NULL);
} }
void void
@ -384,7 +386,7 @@ gimp_install_procedure (gchar *name,
proc_install.params = (GPParamDef *) params; proc_install.params = (GPParamDef *) params;
proc_install.return_vals = (GPParamDef *) return_vals; proc_install.return_vals = (GPParamDef *) return_vals;
if (!gp_proc_install_write (_writechannel, &proc_install)) if (! gp_proc_install_write (_writechannel, &proc_install, NULL))
gimp_quit (); gimp_quit ();
} }
@ -425,7 +427,7 @@ gimp_uninstall_temp_proc (gchar *name)
gboolean found; gboolean found;
proc_uninstall.name = name; proc_uninstall.name = name;
if (!gp_proc_uninstall_write (_writechannel, &proc_uninstall)) if (! gp_proc_uninstall_write (_writechannel, &proc_uninstall, NULL))
gimp_quit (); gimp_quit ();
found = g_hash_table_lookup_extended (temp_proc_ht, name, &hash_name, NULL); found = g_hash_table_lookup_extended (temp_proc_ht, name, &hash_name, NULL);
@ -612,7 +614,7 @@ gimp_run_procedure (gchar *name,
va_end (args); va_end (args);
if (!gp_proc_run_write (_writechannel, &proc_run)) if (! gp_proc_run_write (_writechannel, &proc_run, NULL))
gimp_quit (); gimp_quit ();
gimp_read_expect_msg (&msg, GP_PROC_RETURN); gimp_read_expect_msg (&msg, GP_PROC_RETURN);
@ -646,7 +648,7 @@ gimp_read_expect_msg (WireMessage *msg,
{ {
while (TRUE) while (TRUE)
{ {
if (!wire_read_msg (_readchannel, msg)) if (! wire_read_msg (_readchannel, msg, NULL))
gimp_quit (); gimp_quit ();
if (msg->type != type) if (msg->type != type)
@ -680,7 +682,7 @@ gimp_run_procedure2 (gchar *name,
proc_run.nparams = nparams; proc_run.nparams = nparams;
proc_run.params = (GPParam *) params; proc_run.params = (GPParam *) params;
if (!gp_proc_run_write (_writechannel, &proc_run)) if (! gp_proc_run_write (_writechannel, &proc_run, NULL))
gimp_quit (); gimp_quit ();
gimp_read_expect_msg (&msg, GP_PROC_RETURN); gimp_read_expect_msg (&msg, GP_PROC_RETURN);
@ -790,7 +792,7 @@ gimp_single_message (void)
WireMessage msg; WireMessage msg;
/* Run a temp function */ /* Run a temp function */
if (!wire_read_msg (_readchannel, &msg)) if (! wire_read_msg (_readchannel, &msg, NULL))
gimp_quit (); gimp_quit ();
gimp_process_message (&msg); gimp_process_message (&msg);
@ -849,7 +851,7 @@ void
gimp_extension_ack (void) gimp_extension_ack (void)
{ {
/* Send an extension initialization acknowledgement */ /* Send an extension initialization acknowledgement */
if (! gp_extension_ack_write (_writechannel)) if (! gp_extension_ack_write (_writechannel, NULL))
gimp_quit (); gimp_quit ();
} }
@ -945,7 +947,8 @@ gimp_plugin_io_error_handler (GIOChannel *channel,
static gboolean static gboolean
gimp_write (GIOChannel *channel, gimp_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count) gulong count,
gpointer user_data)
{ {
gulong bytes; gulong bytes;
@ -956,7 +959,7 @@ gimp_write (GIOChannel *channel,
bytes = WRITE_BUFFER_SIZE - write_buffer_index; bytes = WRITE_BUFFER_SIZE - write_buffer_index;
memcpy (&write_buffer[write_buffer_index], buf, bytes); memcpy (&write_buffer[write_buffer_index], buf, bytes);
write_buffer_index += bytes; write_buffer_index += bytes;
if (!wire_flush (channel)) if (! wire_flush (channel, NULL))
return FALSE; return FALSE;
} }
else else
@ -974,7 +977,8 @@ gimp_write (GIOChannel *channel,
} }
static gboolean static gboolean
gimp_flush (GIOChannel *channel) gimp_flush (GIOChannel *channel,
gpointer user_data)
{ {
GIOStatus status; GIOStatus status;
GError *error = NULL; GError *error = NULL;
@ -1030,7 +1034,7 @@ gimp_loop (void)
while (TRUE) while (TRUE)
{ {
if (!wire_read_msg (_readchannel, &msg)) if (! wire_read_msg (_readchannel, &msg, NULL))
{ {
gimp_close (); gimp_close ();
return; return;
@ -1170,7 +1174,7 @@ gimp_proc_run (GPProcRun *proc_run)
proc_return.nparams = nreturn_vals; proc_return.nparams = nreturn_vals;
proc_return.params = (GPParam*) return_vals; proc_return.params = (GPParam*) return_vals;
if (!gp_proc_return_write (_writechannel, &proc_return)) if (! gp_proc_return_write (_writechannel, &proc_return, NULL))
gimp_quit (); gimp_quit ();
} }
} }
@ -1198,7 +1202,7 @@ gimp_temp_proc_run (GPProcRun *proc_run)
/* proc_return.nparams = nreturn_vals; */ /* proc_return.nparams = nreturn_vals; */
/* proc_return.params = (GPParam*) return_vals; */ /* proc_return.params = (GPParam*) return_vals; */
/* if (!gp_temp_proc_return_write (_writechannel, &proc_return)) */ /* if (! gp_temp_proc_return_write (_writechannel, &proc_return, NULL)) */
/* gimp_quit (); */ /* gimp_quit (); */
} }
} }

View File

@ -160,7 +160,7 @@ gimp_tile_get (GimpTile *tile)
tile_req.drawable_ID = tile->drawable->drawable_id; tile_req.drawable_ID = tile->drawable->drawable_id;
tile_req.tile_num = tile->tile_num; tile_req.tile_num = tile->tile_num;
tile_req.shadow = tile->shadow; tile_req.shadow = tile->shadow;
if (!gp_tile_req_write (_writechannel, &tile_req)) if (! gp_tile_req_write (_writechannel, &tile_req, NULL))
gimp_quit (); gimp_quit ();
gimp_read_expect_msg (&msg, GP_TILE_DATA); gimp_read_expect_msg (&msg, GP_TILE_DATA);
@ -188,7 +188,7 @@ gimp_tile_get (GimpTile *tile)
tile_data->data = NULL; tile_data->data = NULL;
} }
if (!gp_tile_ack_write (_writechannel)) if (! gp_tile_ack_write (_writechannel, NULL))
gimp_quit (); gimp_quit ();
wire_destroy (&msg); wire_destroy (&msg);
@ -208,7 +208,7 @@ gimp_tile_put (GimpTile *tile)
tile_req.drawable_ID = -1; tile_req.drawable_ID = -1;
tile_req.tile_num = 0; tile_req.tile_num = 0;
tile_req.shadow = 0; tile_req.shadow = 0;
if (!gp_tile_req_write (_writechannel, &tile_req)) if (! gp_tile_req_write (_writechannel, &tile_req, NULL))
gimp_quit (); gimp_quit ();
gimp_read_expect_msg (&msg, GP_TILE_DATA); gimp_read_expect_msg (&msg, GP_TILE_DATA);
@ -229,7 +229,7 @@ gimp_tile_put (GimpTile *tile)
else else
tile_data.data = tile->data; tile_data.data = tile->data;
if (!gp_tile_data_write (_writechannel, &tile_data)) if (! gp_tile_data_write (_writechannel, &tile_data, NULL))
gimp_quit (); gimp_quit ();
gimp_read_expect_msg (&msg, GP_TILE_ACK); gimp_read_expect_msg (&msg, GP_TILE_ACK);

File diff suppressed because it is too large Load Diff

View File

@ -181,28 +181,41 @@ struct _GPProcUninstall
void gp_init (void); void gp_init (void);
gboolean gp_quit_write (GIOChannel *channel); gboolean gp_quit_write (GIOChannel *channel,
gpointer user_data);
gboolean gp_config_write (GIOChannel *channel, gboolean gp_config_write (GIOChannel *channel,
GPConfig *config); GPConfig *config,
gpointer user_data);
gboolean gp_tile_req_write (GIOChannel *channel, gboolean gp_tile_req_write (GIOChannel *channel,
GPTileReq *tile_req); GPTileReq *tile_req,
gboolean gp_tile_ack_write (GIOChannel *channel); gpointer user_data);
gboolean gp_tile_ack_write (GIOChannel *channel,
gpointer user_data);
gboolean gp_tile_data_write (GIOChannel *channel, gboolean gp_tile_data_write (GIOChannel *channel,
GPTileData *tile_data); GPTileData *tile_data,
gpointer user_data);
gboolean gp_proc_run_write (GIOChannel *channel, gboolean gp_proc_run_write (GIOChannel *channel,
GPProcRun *proc_run); GPProcRun *proc_run,
gpointer user_data);
gboolean gp_proc_return_write (GIOChannel *channel, gboolean gp_proc_return_write (GIOChannel *channel,
GPProcReturn *proc_return); GPProcReturn *proc_return,
gpointer user_data);
gboolean gp_temp_proc_run_write (GIOChannel *channel, gboolean gp_temp_proc_run_write (GIOChannel *channel,
GPProcRun *proc_run); GPProcRun *proc_run,
gpointer user_data);
gboolean gp_temp_proc_return_write (GIOChannel *channel, gboolean gp_temp_proc_return_write (GIOChannel *channel,
GPProcReturn *proc_return); GPProcReturn *proc_return,
gpointer user_data);
gboolean gp_proc_install_write (GIOChannel *channel, gboolean gp_proc_install_write (GIOChannel *channel,
GPProcInstall *proc_install); GPProcInstall *proc_install,
gpointer user_data);
gboolean gp_proc_uninstall_write (GIOChannel *channel, gboolean gp_proc_uninstall_write (GIOChannel *channel,
GPProcUninstall *proc_uninstall); GPProcUninstall *proc_uninstall,
gboolean gp_extension_ack_write (GIOChannel *channel); gpointer user_data);
gboolean gp_has_init_write (GIOChannel *channel); gboolean gp_extension_ack_write (GIOChannel *channel,
gpointer user_data);
gboolean gp_has_init_write (GIOChannel *channel,
gpointer user_data);
G_END_DECLS G_END_DECLS

View File

@ -109,11 +109,12 @@ wire_set_flusher (WireFlushFunc flush_func)
gboolean gboolean
wire_read (GIOChannel *channel, wire_read (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gsize count) gsize count,
gpointer user_data)
{ {
if (wire_read_func) if (wire_read_func)
{ {
if (!(* wire_read_func) (channel, buf, count)) if (!(* wire_read_func) (channel, buf, count, user_data))
{ {
g_warning ("%s: wire_read: error", g_get_prgname ()); g_warning ("%s: wire_read: error", g_get_prgname ());
wire_error_val = TRUE; wire_error_val = TRUE;
@ -174,11 +175,12 @@ wire_read (GIOChannel *channel,
gboolean gboolean
wire_write (GIOChannel *channel, wire_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gsize count) gsize count,
gpointer user_data)
{ {
if (wire_write_func) if (wire_write_func)
{ {
if (!(* wire_write_func) (channel, buf, count)) if (!(* wire_write_func) (channel, buf, count, user_data))
{ {
g_warning ("%s: wire_write: error", g_get_prgname ()); g_warning ("%s: wire_write: error", g_get_prgname ());
wire_error_val = TRUE; wire_error_val = TRUE;
@ -230,10 +232,11 @@ wire_write (GIOChannel *channel,
} }
gboolean gboolean
wire_flush (GIOChannel *channel) wire_flush (GIOChannel *channel,
gpointer user_data)
{ {
if (wire_flush_func) if (wire_flush_func)
return (* wire_flush_func) (channel); return (* wire_flush_func) (channel, user_data);
return FALSE; return FALSE;
} }
@ -252,28 +255,30 @@ wire_clear_error (void)
gboolean gboolean
wire_read_msg (GIOChannel *channel, wire_read_msg (GIOChannel *channel,
WireMessage *msg) WireMessage *msg,
gpointer user_data)
{ {
WireHandler *handler; WireHandler *handler;
if (wire_error_val) if (wire_error_val)
return !wire_error_val; return !wire_error_val;
if (! wire_read_int32 (channel, &msg->type, 1)) if (! wire_read_int32 (channel, &msg->type, 1, user_data))
return FALSE; return FALSE;
handler = g_hash_table_lookup (wire_ht, &msg->type); handler = g_hash_table_lookup (wire_ht, &msg->type);
if (!handler) if (!handler)
g_error ("could not find handler for message: %d", msg->type); g_error ("could not find handler for message: %d", msg->type);
(* handler->read_func) (channel, msg); (* handler->read_func) (channel, msg, user_data);
return !wire_error_val; return !wire_error_val;
} }
gboolean gboolean
wire_write_msg (GIOChannel *channel, wire_write_msg (GIOChannel *channel,
WireMessage *msg) WireMessage *msg,
gpointer user_data)
{ {
WireHandler *handler; WireHandler *handler;
@ -284,10 +289,10 @@ wire_write_msg (GIOChannel *channel,
if (!handler) if (!handler)
g_error ("could not find handler for message: %d", msg->type); g_error ("could not find handler for message: %d", msg->type);
if (! wire_write_int32 (channel, &msg->type, 1)) if (! wire_write_int32 (channel, &msg->type, 1, user_data))
return FALSE; return FALSE;
(* handler->write_func) (channel, msg); (* handler->write_func) (channel, msg, user_data);
return !wire_error_val; return !wire_error_val;
} }
@ -307,11 +312,12 @@ wire_destroy (WireMessage *msg)
gboolean gboolean
wire_read_int32 (GIOChannel *channel, wire_read_int32 (GIOChannel *channel,
guint32 *data, guint32 *data,
gint count) gint count,
gpointer user_data)
{ {
if (count > 0) if (count > 0)
{ {
if (! wire_read_int8 (channel, (guint8 *) data, count * 4)) if (! wire_read_int8 (channel, (guint8 *) data, count * 4, user_data))
return FALSE; return FALSE;
while (count--) while (count--)
@ -327,11 +333,12 @@ wire_read_int32 (GIOChannel *channel,
gboolean gboolean
wire_read_int16 (GIOChannel *channel, wire_read_int16 (GIOChannel *channel,
guint16 *data, guint16 *data,
gint count) gint count,
gpointer user_data)
{ {
if (count > 0) if (count > 0)
{ {
if (! wire_read_int8 (channel, (guint8 *) data, count * 2)) if (! wire_read_int8 (channel, (guint8 *) data, count * 2, user_data))
return FALSE; return FALSE;
while (count--) while (count--)
@ -347,15 +354,17 @@ wire_read_int16 (GIOChannel *channel,
gboolean gboolean
wire_read_int8 (GIOChannel *channel, wire_read_int8 (GIOChannel *channel,
guint8 *data, guint8 *data,
gint count) gint count,
gpointer user_data)
{ {
return wire_read (channel, data, count); return wire_read (channel, data, count, user_data);
} }
gboolean gboolean
wire_read_double (GIOChannel *channel, wire_read_double (GIOChannel *channel,
gdouble *data, gdouble *data,
gint count) gint count,
gpointer user_data)
{ {
gdouble *t; gdouble *t;
guint32 tmp[2]; guint32 tmp[2];
@ -368,7 +377,7 @@ wire_read_double (GIOChannel *channel,
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (! wire_read_int8 (channel, (guint8 *) tmp, 8)) if (! wire_read_int8 (channel, (guint8 *) tmp, 8, user_data))
return FALSE; return FALSE;
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN) #if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
@ -386,20 +395,21 @@ wire_read_double (GIOChannel *channel,
gboolean gboolean
wire_read_string (GIOChannel *channel, wire_read_string (GIOChannel *channel,
gchar **data, gchar **data,
gint count) gint count,
gpointer user_data)
{ {
guint32 tmp; guint32 tmp;
gint i; gint i;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (!wire_read_int32 (channel, &tmp, 1)) if (!wire_read_int32 (channel, &tmp, 1, user_data))
return FALSE; return FALSE;
if (tmp > 0) if (tmp > 0)
{ {
data[i] = g_new (gchar, tmp); data[i] = g_new (gchar, tmp);
if (! wire_read_int8 (channel, (guint8 *) data[i], tmp)) if (! wire_read_int8 (channel, (guint8 *) data[i], tmp, user_data))
{ {
g_free (data[i]); g_free (data[i]);
return FALSE; return FALSE;
@ -417,7 +427,8 @@ wire_read_string (GIOChannel *channel,
gboolean gboolean
wire_write_int32 (GIOChannel *channel, wire_write_int32 (GIOChannel *channel,
guint32 *data, guint32 *data,
gint count) gint count,
gpointer user_data)
{ {
guint32 tmp; guint32 tmp;
gint i; gint i;
@ -427,7 +438,7 @@ wire_write_int32 (GIOChannel *channel,
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
tmp = g_htonl (data[i]); tmp = g_htonl (data[i]);
if (! wire_write_int8 (channel, (guint8 *) &tmp, 4)) if (! wire_write_int8 (channel, (guint8 *) &tmp, 4, user_data))
return FALSE; return FALSE;
} }
} }
@ -438,7 +449,8 @@ wire_write_int32 (GIOChannel *channel,
gboolean gboolean
wire_write_int16 (GIOChannel *channel, wire_write_int16 (GIOChannel *channel,
guint16 *data, guint16 *data,
gint count) gint count,
gpointer user_data)
{ {
guint16 tmp; guint16 tmp;
gint i; gint i;
@ -448,7 +460,7 @@ wire_write_int16 (GIOChannel *channel,
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
tmp = g_htons (data[i]); tmp = g_htons (data[i]);
if (! wire_write_int8 (channel, (guint8 *) &tmp, 2)) if (! wire_write_int8 (channel, (guint8 *) &tmp, 2, user_data))
return FALSE; return FALSE;
} }
} }
@ -459,15 +471,17 @@ wire_write_int16 (GIOChannel *channel,
gboolean gboolean
wire_write_int8 (GIOChannel *channel, wire_write_int8 (GIOChannel *channel,
guint8 *data, guint8 *data,
gint count) gint count,
gpointer user_data)
{ {
return wire_write (channel, data, count); return wire_write (channel, data, count, user_data);
} }
gboolean gboolean
wire_write_double (GIOChannel *channel, wire_write_double (GIOChannel *channel,
gdouble *data, gdouble *data,
gint count) gint count,
gpointer user_data)
{ {
gdouble *t; gdouble *t;
guint32 tmp[2]; guint32 tmp[2];
@ -488,7 +502,7 @@ wire_write_double (GIOChannel *channel,
tmp[0] = swap; tmp[0] = swap;
#endif #endif
if (! wire_write_int8 (channel, (guint8 *) tmp, 8)) if (! wire_write_int8 (channel, (guint8 *) tmp, 8, user_data))
return FALSE; return FALSE;
#if 0 #if 0
@ -513,7 +527,8 @@ wire_write_double (GIOChannel *channel,
gboolean gboolean
wire_write_string (GIOChannel *channel, wire_write_string (GIOChannel *channel,
gchar **data, gchar **data,
gint count) gint count,
gpointer user_data)
{ {
guint32 tmp; guint32 tmp;
gint i; gint i;
@ -525,10 +540,10 @@ wire_write_string (GIOChannel *channel,
else else
tmp = 0; tmp = 0;
if (! wire_write_int32 (channel, &tmp, 1)) if (! wire_write_int32 (channel, &tmp, 1, user_data))
return FALSE; return FALSE;
if (tmp > 0) if (tmp > 0)
if (! wire_write_int8 (channel, (guint8 *) data[i], tmp)) if (! wire_write_int8 (channel, (guint8 *) data[i], tmp, user_data))
return FALSE; return FALSE;
} }

View File

@ -28,14 +28,18 @@ G_BEGIN_DECLS
typedef struct _WireMessage WireMessage; typedef struct _WireMessage WireMessage;
typedef void (* WireReadFunc) (GIOChannel *channel, typedef void (* WireReadFunc) (GIOChannel *channel,
WireMessage *msg); WireMessage *msg,
gpointer user_data);
typedef void (* WireWriteFunc) (GIOChannel *channel, typedef void (* WireWriteFunc) (GIOChannel *channel,
WireMessage *msg); WireMessage *msg,
gpointer user_data);
typedef void (* WireDestroyFunc) (WireMessage *msg); typedef void (* WireDestroyFunc) (WireMessage *msg);
typedef gboolean (* WireIOFunc) (GIOChannel *channel, typedef gboolean (* WireIOFunc) (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count,
typedef gboolean (* WireFlushFunc) (GIOChannel *channel); gpointer user_data);
typedef gboolean (* WireFlushFunc) (GIOChannel *channel,
gpointer user_data);
struct _WireMessage struct _WireMessage
@ -56,52 +60,67 @@ void wire_set_flusher (WireFlushFunc flush_func);
gboolean wire_read (GIOChannel *channel, gboolean wire_read (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gsize count); gsize count,
gpointer user_data);
gboolean wire_write (GIOChannel *channel, gboolean wire_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gsize count); gsize count,
gboolean wire_flush (GIOChannel *channel); gpointer user_data);
gboolean wire_flush (GIOChannel *channel,
gpointer user_data);
gboolean wire_error (void); gboolean wire_error (void);
void wire_clear_error (void); void wire_clear_error (void);
gboolean wire_read_msg (GIOChannel *channel, gboolean wire_read_msg (GIOChannel *channel,
WireMessage *msg); WireMessage *msg,
gpointer user_data);
gboolean wire_write_msg (GIOChannel *channel, gboolean wire_write_msg (GIOChannel *channel,
WireMessage *msg); WireMessage *msg,
gpointer user_data);
void wire_destroy (WireMessage *msg); void wire_destroy (WireMessage *msg);
gboolean wire_read_int32 (GIOChannel *channel, gboolean wire_read_int32 (GIOChannel *channel,
guint32 *data, guint32 *data,
gint count); gint count,
gpointer user_data);
gboolean wire_read_int16 (GIOChannel *channel, gboolean wire_read_int16 (GIOChannel *channel,
guint16 *data, guint16 *data,
gint count); gint count,
gpointer user_data);
gboolean wire_read_int8 (GIOChannel *channel, gboolean wire_read_int8 (GIOChannel *channel,
guint8 *data, guint8 *data,
gint count); gint count,
gpointer user_data);
gboolean wire_read_double (GIOChannel *channel, gboolean wire_read_double (GIOChannel *channel,
gdouble *data, gdouble *data,
gint count); gint count,
gpointer user_data);
gboolean wire_read_string (GIOChannel *channel, gboolean wire_read_string (GIOChannel *channel,
gchar **data, gchar **data,
gint count); gint count,
gpointer user_data);
gboolean wire_write_int32 (GIOChannel *channel, gboolean wire_write_int32 (GIOChannel *channel,
guint32 *data, guint32 *data,
gint count); gint count,
gpointer user_data);
gboolean wire_write_int16 (GIOChannel *channel, gboolean wire_write_int16 (GIOChannel *channel,
guint16 *data, guint16 *data,
gint count); gint count,
gpointer user_data);
gboolean wire_write_int8 (GIOChannel *channel, gboolean wire_write_int8 (GIOChannel *channel,
guint8 *data, guint8 *data,
gint count); gint count,
gpointer user_data);
gboolean wire_write_double (GIOChannel *channel, gboolean wire_write_double (GIOChannel *channel,
gdouble *data, gdouble *data,
gint count); gint count,
gpointer user_data);
gboolean wire_write_string (GIOChannel *channel, gboolean wire_write_string (GIOChannel *channel,
gchar **data, gchar **data,
gint count); gint count,
gpointer user_data);
G_END_DECLS G_END_DECLS