mirror of https://github.com/GNOME/gimp.git
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:
parent
9af4c5d6d2
commit
dba356d815
16
ChangeLog
16
ChangeLog
|
@ -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>
|
||||
|
||||
* app/gui/splash.c: don't allow to close the splash screen. Fixes
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -131,8 +131,10 @@ struct _PlugInHelpPathDef
|
|||
|
||||
static gboolean plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean plug_in_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
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_pop (void);
|
||||
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 *plug_in_stack = NULL;
|
||||
static gint current_write_buffer_index = 0;
|
||||
static gchar *current_write_buffer = NULL;
|
||||
static Argument *current_return_vals = NULL;
|
||||
static gint current_return_nvals = 0;
|
||||
|
||||
|
@ -327,7 +327,7 @@ plug_in_call_query (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ plug_in_call_init (Gimp *gimp,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
if (kill_it && plug_in->pid)
|
||||
{
|
||||
plug_in_push (plug_in);
|
||||
gp_quit_write (plug_in->my_write);
|
||||
gp_quit_write (plug_in->my_write, plug_in);
|
||||
plug_in_pop ();
|
||||
|
||||
/* give the plug-in some time (10 ms) */
|
||||
|
@ -872,9 +872,9 @@ plug_in_run (Gimp *gimp,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_config_write (plug_in->my_write, &config) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_config_write (plug_in->my_write, &config, plug_in) ||
|
||||
! gp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
@ -965,7 +965,7 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1085,14 +1085,14 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_data.use_shm = (shm_ID == -1) ? FALSE : TRUE;
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1140,7 +1140,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_release (tile, TRUE);
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1186,7 +1186,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
else
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1195,7 +1195,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
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");
|
||||
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);
|
||||
}
|
||||
|
||||
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");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
@ -1284,7 +1284,7 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
PlugInBlocked *blocked;
|
||||
GSList *tmp;
|
||||
|
||||
if (current_plug_in->recurse)
|
||||
if (plug_in->recurse)
|
||||
{
|
||||
current_return_vals = plug_in_params_to_args (proc_return->params,
|
||||
proc_return->nparams,
|
||||
|
@ -1305,7 +1305,8 @@ plug_in_handle_proc_return (PlugIn *plug_in,
|
|||
plug_in_push (blocked->plug_in);
|
||||
|
||||
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");
|
||||
plug_in_close (blocked->plug_in, TRUE);
|
||||
|
@ -1658,25 +1659,31 @@ plug_in_handle_has_init (PlugIn *plug_in)
|
|||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
PlugIn *plug_in;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
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;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
if (! wire_flush (channel))
|
||||
bytes = WRITE_BUFFER_SIZE - plug_in->write_buffer_index;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = count;
|
||||
memcpy (¤t_write_buffer[current_write_buffer_index], buf, bytes);
|
||||
current_write_buffer_index += bytes;
|
||||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
}
|
||||
|
||||
buf += bytes;
|
||||
|
@ -1687,24 +1694,28 @@ plug_in_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
plug_in_flush (GIOChannel *channel)
|
||||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
gint count;
|
||||
guint bytes;
|
||||
|
||||
if (current_write_buffer_index > 0)
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
count = 0;
|
||||
while (count != current_write_buffer_index)
|
||||
while (count != plug_in->write_buffer_index)
|
||||
{
|
||||
do
|
||||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
¤t_write_buffer[count],
|
||||
(current_write_buffer_index - count),
|
||||
&plug_in->write_buffer[count],
|
||||
(plug_in->write_buffer_index - count),
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
@ -1730,7 +1741,7 @@ plug_in_flush (GIOChannel *channel)
|
|||
count += bytes;
|
||||
}
|
||||
|
||||
current_write_buffer_index = 0;
|
||||
plug_in->write_buffer_index = 0;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -1744,9 +1755,6 @@ plug_in_push (PlugIn *plug_in)
|
|||
current_plug_in = 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
|
||||
|
@ -1756,8 +1764,6 @@ plug_in_pop (void)
|
|||
|
||||
if (current_plug_in)
|
||||
{
|
||||
current_plug_in->write_buffer_index = current_write_buffer_index;
|
||||
|
||||
tmp = plug_in_stack;
|
||||
plug_in_stack = plug_in_stack->next;
|
||||
tmp->next = NULL;
|
||||
|
@ -1766,15 +1772,11 @@ plug_in_pop (void)
|
|||
|
||||
if (plug_in_stack)
|
||||
{
|
||||
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;
|
||||
current_plug_in = plug_in_stack->data;
|
||||
}
|
||||
else
|
||||
{
|
||||
current_plug_in = NULL;
|
||||
current_write_buffer_index = 0;
|
||||
current_write_buffer = NULL;
|
||||
current_plug_in = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1807,8 +1809,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.nparams = argc;
|
||||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run) ||
|
||||
! wire_flush (plug_in->my_write))
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
|
|
|
@ -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>
|
||||
|
||||
* libgimpmath/libgimpmath-sections.txt
|
||||
|
|
|
@ -148,6 +148,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
</para>
|
||||
|
||||
@channel:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -157,6 +158,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
</para>
|
||||
|
||||
@channel:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -167,6 +169,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@config:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -177,6 +180,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@tile_req:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -186,6 +190,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
</para>
|
||||
|
||||
@channel:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -196,6 +201,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@tile_data:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -206,6 +212,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@proc_run:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -216,6 +223,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@proc_return:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -226,6 +234,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@proc_run:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -236,6 +245,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@proc_return:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -246,6 +256,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@proc_install:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -256,6 +267,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@proc_uninstall:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -265,6 +277,7 @@ The communication protocol between GIMP and it's plug-ins.
|
|||
</para>
|
||||
|
||||
@channel:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@msg:
|
||||
@user_data:
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION WireWriteFunc ##### -->
|
||||
|
@ -41,6 +42,7 @@ it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@msg:
|
||||
@user_data:
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION WireDestroyFunc ##### -->
|
||||
|
@ -59,6 +61,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@buf:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -68,6 +71,7 @@ it's plug-ins.
|
|||
</para>
|
||||
|
||||
@channel:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -114,6 +118,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@buf:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -125,6 +130,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@buf:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -134,6 +140,7 @@ it's plug-ins.
|
|||
</para>
|
||||
|
||||
@channel:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -159,6 +166,7 @@ it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@msg:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -169,6 +177,7 @@ it's plug-ins.
|
|||
|
||||
@channel:
|
||||
@msg:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -188,6 +197,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -199,6 +209,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -210,6 +221,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -221,6 +233,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -232,6 +245,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -243,6 +257,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -254,6 +269,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -265,6 +281,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -276,6 +293,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
@ -287,6 +305,7 @@ it's plug-ins.
|
|||
@channel:
|
||||
@data:
|
||||
@count:
|
||||
@user_data:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
|
|
@ -103,8 +103,10 @@ static gboolean gimp_plugin_io_error_handler (GIOChannel *channel,
|
|||
|
||||
static gboolean gimp_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gboolean gimp_flush (GIOChannel *channel);
|
||||
gulong count,
|
||||
gpointer user_data);
|
||||
static gboolean gimp_flush (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
static void gimp_loop (void);
|
||||
static void gimp_config (GPConfig *config);
|
||||
static void gimp_proc_run (GPProcRun *proc_run);
|
||||
|
@ -283,7 +285,7 @@ gimp_main (int argc,
|
|||
if (strcmp (argv[4], "-query") == 0)
|
||||
{
|
||||
if (PLUG_IN_INFO.init_proc)
|
||||
gp_has_init_write(_writechannel);
|
||||
gp_has_init_write (_writechannel, NULL);
|
||||
|
||||
if (PLUG_IN_INFO.query_proc)
|
||||
(* PLUG_IN_INFO.query_proc) ();
|
||||
|
@ -327,7 +329,7 @@ gimp_close (void)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
gp_quit_write (_writechannel);
|
||||
gp_quit_write (_writechannel, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -384,7 +386,7 @@ gimp_install_procedure (gchar *name,
|
|||
proc_install.params = (GPParamDef *) params;
|
||||
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 ();
|
||||
}
|
||||
|
||||
|
@ -425,7 +427,7 @@ gimp_uninstall_temp_proc (gchar *name)
|
|||
gboolean found;
|
||||
proc_uninstall.name = name;
|
||||
|
||||
if (!gp_proc_uninstall_write (_writechannel, &proc_uninstall))
|
||||
if (! gp_proc_uninstall_write (_writechannel, &proc_uninstall, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
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);
|
||||
|
||||
if (!gp_proc_run_write (_writechannel, &proc_run))
|
||||
if (! gp_proc_run_write (_writechannel, &proc_run, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
gimp_read_expect_msg (&msg, GP_PROC_RETURN);
|
||||
|
@ -646,7 +648,7 @@ gimp_read_expect_msg (WireMessage *msg,
|
|||
{
|
||||
while (TRUE)
|
||||
{
|
||||
if (!wire_read_msg (_readchannel, msg))
|
||||
if (! wire_read_msg (_readchannel, msg, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
if (msg->type != type)
|
||||
|
@ -680,10 +682,10 @@ gimp_run_procedure2 (gchar *name,
|
|||
proc_run.nparams = nparams;
|
||||
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_read_expect_msg(&msg,GP_PROC_RETURN);
|
||||
gimp_read_expect_msg (&msg, GP_PROC_RETURN);
|
||||
|
||||
proc_return = msg.data;
|
||||
*nreturn_vals = proc_return->nparams;
|
||||
|
@ -790,7 +792,7 @@ gimp_single_message (void)
|
|||
WireMessage msg;
|
||||
|
||||
/* Run a temp function */
|
||||
if (!wire_read_msg (_readchannel, &msg))
|
||||
if (! wire_read_msg (_readchannel, &msg, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
gimp_process_message (&msg);
|
||||
|
@ -849,7 +851,7 @@ void
|
|||
gimp_extension_ack (void)
|
||||
{
|
||||
/* Send an extension initialization acknowledgement */
|
||||
if (! gp_extension_ack_write (_writechannel))
|
||||
if (! gp_extension_ack_write (_writechannel, NULL))
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
|
@ -945,7 +947,8 @@ gimp_plugin_io_error_handler (GIOChannel *channel,
|
|||
static gboolean
|
||||
gimp_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count)
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gulong bytes;
|
||||
|
||||
|
@ -956,7 +959,7 @@ gimp_write (GIOChannel *channel,
|
|||
bytes = WRITE_BUFFER_SIZE - write_buffer_index;
|
||||
memcpy (&write_buffer[write_buffer_index], buf, bytes);
|
||||
write_buffer_index += bytes;
|
||||
if (!wire_flush (channel))
|
||||
if (! wire_flush (channel, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
@ -974,7 +977,8 @@ gimp_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_flush (GIOChannel *channel)
|
||||
gimp_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
GIOStatus status;
|
||||
GError *error = NULL;
|
||||
|
@ -1030,7 +1034,7 @@ gimp_loop (void)
|
|||
|
||||
while (TRUE)
|
||||
{
|
||||
if (!wire_read_msg (_readchannel, &msg))
|
||||
if (! wire_read_msg (_readchannel, &msg, NULL))
|
||||
{
|
||||
gimp_close ();
|
||||
return;
|
||||
|
@ -1154,9 +1158,9 @@ gimp_config (GPConfig *config)
|
|||
static void
|
||||
gimp_proc_run (GPProcRun *proc_run)
|
||||
{
|
||||
GPProcReturn proc_return;
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
GPProcReturn proc_return;
|
||||
GimpParam *return_vals;
|
||||
gint nreturn_vals;
|
||||
|
||||
if (PLUG_IN_INFO.run_proc)
|
||||
{
|
||||
|
@ -1170,7 +1174,7 @@ gimp_proc_run (GPProcRun *proc_run)
|
|||
proc_return.nparams = nreturn_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 ();
|
||||
}
|
||||
}
|
||||
|
@ -1198,7 +1202,7 @@ gimp_temp_proc_run (GPProcRun *proc_run)
|
|||
/* proc_return.nparams = nreturn_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 (); */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,10 +160,10 @@ gimp_tile_get (GimpTile *tile)
|
|||
tile_req.drawable_ID = tile->drawable->drawable_id;
|
||||
tile_req.tile_num = tile->tile_num;
|
||||
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_read_expect_msg(&msg,GP_TILE_DATA);
|
||||
gimp_read_expect_msg (&msg, GP_TILE_DATA);
|
||||
|
||||
tile_data = msg.data;
|
||||
if ((tile_data->drawable_ID != tile->drawable->drawable_id) ||
|
||||
|
@ -188,7 +188,7 @@ gimp_tile_get (GimpTile *tile)
|
|||
tile_data->data = NULL;
|
||||
}
|
||||
|
||||
if (!gp_tile_ack_write (_writechannel))
|
||||
if (! gp_tile_ack_write (_writechannel, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
wire_destroy (&msg);
|
||||
|
@ -208,31 +208,31 @@ gimp_tile_put (GimpTile *tile)
|
|||
tile_req.drawable_ID = -1;
|
||||
tile_req.tile_num = 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_read_expect_msg(&msg,GP_TILE_DATA);
|
||||
gimp_read_expect_msg (&msg, GP_TILE_DATA);
|
||||
|
||||
tile_info = msg.data;
|
||||
|
||||
tile_data.drawable_ID = tile->drawable->drawable_id;
|
||||
tile_data.tile_num = tile->tile_num;
|
||||
tile_data.shadow = tile->shadow;
|
||||
tile_data.bpp = tile->bpp;
|
||||
tile_data.width = tile->ewidth;
|
||||
tile_data.height = tile->eheight;
|
||||
tile_data.use_shm = tile_info->use_shm;
|
||||
tile_data.data = NULL;
|
||||
tile_data.tile_num = tile->tile_num;
|
||||
tile_data.shadow = tile->shadow;
|
||||
tile_data.bpp = tile->bpp;
|
||||
tile_data.width = tile->ewidth;
|
||||
tile_data.height = tile->eheight;
|
||||
tile_data.use_shm = tile_info->use_shm;
|
||||
tile_data.data = NULL;
|
||||
|
||||
if (tile_info->use_shm)
|
||||
memcpy (_shm_addr, tile->data, tile->ewidth * tile->eheight * tile->bpp);
|
||||
else
|
||||
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_read_expect_msg(&msg,GP_TILE_ACK);
|
||||
gimp_read_expect_msg (&msg, GP_TILE_ACK);
|
||||
|
||||
wire_destroy (&msg);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -181,28 +181,41 @@ struct _GPProcUninstall
|
|||
|
||||
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,
|
||||
GPConfig *config);
|
||||
GPConfig *config,
|
||||
gpointer user_data);
|
||||
gboolean gp_tile_req_write (GIOChannel *channel,
|
||||
GPTileReq *tile_req);
|
||||
gboolean gp_tile_ack_write (GIOChannel *channel);
|
||||
GPTileReq *tile_req,
|
||||
gpointer user_data);
|
||||
gboolean gp_tile_ack_write (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
gboolean gp_tile_data_write (GIOChannel *channel,
|
||||
GPTileData *tile_data);
|
||||
GPTileData *tile_data,
|
||||
gpointer user_data);
|
||||
gboolean gp_proc_run_write (GIOChannel *channel,
|
||||
GPProcRun *proc_run);
|
||||
GPProcRun *proc_run,
|
||||
gpointer user_data);
|
||||
gboolean gp_proc_return_write (GIOChannel *channel,
|
||||
GPProcReturn *proc_return);
|
||||
GPProcReturn *proc_return,
|
||||
gpointer user_data);
|
||||
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,
|
||||
GPProcReturn *proc_return);
|
||||
GPProcReturn *proc_return,
|
||||
gpointer user_data);
|
||||
gboolean gp_proc_install_write (GIOChannel *channel,
|
||||
GPProcInstall *proc_install);
|
||||
GPProcInstall *proc_install,
|
||||
gpointer user_data);
|
||||
gboolean gp_proc_uninstall_write (GIOChannel *channel,
|
||||
GPProcUninstall *proc_uninstall);
|
||||
gboolean gp_extension_ack_write (GIOChannel *channel);
|
||||
gboolean gp_has_init_write (GIOChannel *channel);
|
||||
GPProcUninstall *proc_uninstall,
|
||||
gpointer user_data);
|
||||
gboolean gp_extension_ack_write (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
gboolean gp_has_init_write (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -109,11 +109,12 @@ wire_set_flusher (WireFlushFunc flush_func)
|
|||
gboolean
|
||||
wire_read (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count)
|
||||
gsize count,
|
||||
gpointer user_data)
|
||||
{
|
||||
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 ());
|
||||
wire_error_val = TRUE;
|
||||
|
@ -174,11 +175,12 @@ wire_read (GIOChannel *channel,
|
|||
gboolean
|
||||
wire_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count)
|
||||
gsize count,
|
||||
gpointer user_data)
|
||||
{
|
||||
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 ());
|
||||
wire_error_val = TRUE;
|
||||
|
@ -230,10 +232,11 @@ wire_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_flush (GIOChannel *channel)
|
||||
wire_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (wire_flush_func)
|
||||
return (* wire_flush_func) (channel);
|
||||
return (* wire_flush_func) (channel, user_data);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -252,28 +255,30 @@ wire_clear_error (void)
|
|||
|
||||
gboolean
|
||||
wire_read_msg (GIOChannel *channel,
|
||||
WireMessage *msg)
|
||||
WireMessage *msg,
|
||||
gpointer user_data)
|
||||
{
|
||||
WireHandler *handler;
|
||||
|
||||
if (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;
|
||||
|
||||
handler = g_hash_table_lookup (wire_ht, &msg->type);
|
||||
if (!handler)
|
||||
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;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wire_write_msg (GIOChannel *channel,
|
||||
WireMessage *msg)
|
||||
WireMessage *msg,
|
||||
gpointer user_data)
|
||||
{
|
||||
WireHandler *handler;
|
||||
|
||||
|
@ -284,10 +289,10 @@ wire_write_msg (GIOChannel *channel,
|
|||
if (!handler)
|
||||
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;
|
||||
|
||||
(* handler->write_func) (channel, msg);
|
||||
(* handler->write_func) (channel, msg, user_data);
|
||||
|
||||
return !wire_error_val;
|
||||
}
|
||||
|
@ -307,11 +312,12 @@ wire_destroy (WireMessage *msg)
|
|||
gboolean
|
||||
wire_read_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
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;
|
||||
|
||||
while (count--)
|
||||
|
@ -327,11 +333,12 @@ wire_read_int32 (GIOChannel *channel,
|
|||
gboolean
|
||||
wire_read_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
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;
|
||||
|
||||
while (count--)
|
||||
|
@ -347,15 +354,17 @@ wire_read_int16 (GIOChannel *channel,
|
|||
gboolean
|
||||
wire_read_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
return wire_read (channel, data, count);
|
||||
return wire_read (channel, data, count, user_data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
wire_read_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gdouble *t;
|
||||
guint32 tmp[2];
|
||||
|
@ -368,7 +377,7 @@ wire_read_double (GIOChannel *channel,
|
|||
|
||||
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;
|
||||
|
||||
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
||||
|
@ -386,20 +395,21 @@ wire_read_double (GIOChannel *channel,
|
|||
gboolean
|
||||
wire_read_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint32 tmp;
|
||||
gint 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;
|
||||
|
||||
if (tmp > 0)
|
||||
{
|
||||
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]);
|
||||
return FALSE;
|
||||
|
@ -417,7 +427,8 @@ wire_read_string (GIOChannel *channel,
|
|||
gboolean
|
||||
wire_write_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint32 tmp;
|
||||
gint i;
|
||||
|
@ -427,7 +438,7 @@ wire_write_int32 (GIOChannel *channel,
|
|||
for (i = 0; i < count; 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;
|
||||
}
|
||||
}
|
||||
|
@ -438,7 +449,8 @@ wire_write_int32 (GIOChannel *channel,
|
|||
gboolean
|
||||
wire_write_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint16 tmp;
|
||||
gint i;
|
||||
|
@ -448,7 +460,7 @@ wire_write_int16 (GIOChannel *channel,
|
|||
for (i = 0; i < count; 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;
|
||||
}
|
||||
}
|
||||
|
@ -459,15 +471,17 @@ wire_write_int16 (GIOChannel *channel,
|
|||
gboolean
|
||||
wire_write_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
return wire_write (channel, data, count);
|
||||
return wire_write (channel, data, count, user_data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
wire_write_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gdouble *t;
|
||||
guint32 tmp[2];
|
||||
|
@ -488,7 +502,7 @@ wire_write_double (GIOChannel *channel,
|
|||
tmp[0] = swap;
|
||||
#endif
|
||||
|
||||
if (! wire_write_int8 (channel, (guint8 *) tmp, 8))
|
||||
if (! wire_write_int8 (channel, (guint8 *) tmp, 8, user_data))
|
||||
return FALSE;
|
||||
|
||||
#if 0
|
||||
|
@ -513,7 +527,8 @@ wire_write_double (GIOChannel *channel,
|
|||
gboolean
|
||||
wire_write_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count)
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint32 tmp;
|
||||
gint i;
|
||||
|
@ -525,10 +540,10 @@ wire_write_string (GIOChannel *channel,
|
|||
else
|
||||
tmp = 0;
|
||||
|
||||
if (! wire_write_int32 (channel, &tmp, 1))
|
||||
if (! wire_write_int32 (channel, &tmp, 1, user_data))
|
||||
return FALSE;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,14 +28,18 @@ G_BEGIN_DECLS
|
|||
typedef struct _WireMessage WireMessage;
|
||||
|
||||
typedef void (* WireReadFunc) (GIOChannel *channel,
|
||||
WireMessage *msg);
|
||||
WireMessage *msg,
|
||||
gpointer user_data);
|
||||
typedef void (* WireWriteFunc) (GIOChannel *channel,
|
||||
WireMessage *msg);
|
||||
WireMessage *msg,
|
||||
gpointer user_data);
|
||||
typedef void (* WireDestroyFunc) (WireMessage *msg);
|
||||
typedef gboolean (* WireIOFunc) (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
typedef gboolean (* WireFlushFunc) (GIOChannel *channel);
|
||||
gulong count,
|
||||
gpointer user_data);
|
||||
typedef gboolean (* WireFlushFunc) (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
struct _WireMessage
|
||||
|
@ -56,52 +60,67 @@ void wire_set_flusher (WireFlushFunc flush_func);
|
|||
|
||||
gboolean wire_read (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count);
|
||||
gsize count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count);
|
||||
gboolean wire_flush (GIOChannel *channel);
|
||||
gsize count,
|
||||
gpointer user_data);
|
||||
gboolean wire_flush (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean wire_error (void);
|
||||
void wire_clear_error (void);
|
||||
|
||||
gboolean wire_read_msg (GIOChannel *channel,
|
||||
WireMessage *msg);
|
||||
WireMessage *msg,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_msg (GIOChannel *channel,
|
||||
WireMessage *msg);
|
||||
WireMessage *msg,
|
||||
gpointer user_data);
|
||||
|
||||
void wire_destroy (WireMessage *msg);
|
||||
|
||||
gboolean wire_read_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_read_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_read_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_read_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_read_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count);
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in New Issue