let the private wire methods live in the GIMP namespace. Declare internal
2005-12-13 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpwire.[ch]: let the private wire methods live in
the GIMP namespace. Declare internal functions as such and prefix
them with an underscore.
* libgimp/gimp.c
* libgimp/gimptile.c
* libgimpbase/gimpbase.def
* libgimpbase/gimpprotocol.c
* app/plug-in/plug-in-message.[ch]
* app/plug-in/plug-in-run.c
* app/plug-in/plug-in.c: changed accordingly.
This commit is contained in:
parent
8b8c784a5b
commit
4467e1cd4b
16 changed files with 1069 additions and 1029 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
|||
2005-12-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimpbase/gimpwire.[ch]: let the private wire methods live in
|
||||
the GIMP namespace. Declare internal functions as such and prefix
|
||||
them with an underscore.
|
||||
|
||||
* libgimp/gimp.c
|
||||
* libgimp/gimptile.c
|
||||
* libgimpbase/gimpbase.def
|
||||
* libgimpbase/gimpprotocol.c
|
||||
* app/plug-in/plug-in-message.[ch]
|
||||
* app/plug-in/plug-in-run.c
|
||||
* app/plug-in/plug-in.c: changed accordingly.
|
||||
|
||||
2005-12-13 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/tools/*.c: port to G_DEFINE_TYPE() and friends. Some related
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ static GSList *blocked_plug_ins = NULL;
|
|||
/* public functions */
|
||||
|
||||
void
|
||||
plug_in_handle_message (PlugIn *plug_in,
|
||||
WireMessage *msg)
|
||||
plug_in_handle_message (PlugIn *plug_in,
|
||||
GimpWireMessage *msg)
|
||||
{
|
||||
switch (msg->type)
|
||||
{
|
||||
|
|
@ -171,13 +171,13 @@ static void
|
|||
plug_in_handle_tile_req (PlugIn *plug_in,
|
||||
GPTileReq *tile_req)
|
||||
{
|
||||
GPTileData tile_data;
|
||||
GPTileData *tile_info;
|
||||
WireMessage msg;
|
||||
GimpDrawable *drawable;
|
||||
TileManager *tm;
|
||||
Tile *tile;
|
||||
gint shm_ID;
|
||||
GPTileData tile_data;
|
||||
GPTileData *tile_info;
|
||||
GimpWireMessage msg;
|
||||
GimpDrawable *drawable;
|
||||
TileManager *tm;
|
||||
Tile *tile;
|
||||
gint shm_ID;
|
||||
|
||||
shm_ID = plug_in_shm_get_ID (plug_in->gimp);
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
return;
|
||||
}
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
g_warning ("plug_in_handle_tile_req: ERROR");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
|
@ -257,8 +257,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_size (tile));
|
||||
|
||||
tile_release (tile, TRUE);
|
||||
gimp_wire_destroy (&msg);
|
||||
|
||||
wire_destroy (&msg);
|
||||
if (! gp_tile_ack_write (plug_in->my_write, plug_in))
|
||||
{
|
||||
g_warning ("plug_in_handle_tile_req: ERROR");
|
||||
|
|
@ -324,7 +324,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
g_message ("plug_in_handle_tile_req: ERROR");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
|
@ -338,7 +338,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
return;
|
||||
}
|
||||
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#define __PLUG_IN_MESSAGE_H__
|
||||
|
||||
|
||||
void plug_in_handle_message (PlugIn *plug_in,
|
||||
WireMessage *msg);
|
||||
void plug_in_handle_message (PlugIn *plug_in,
|
||||
GimpWireMessage *msg);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_MESSAGE_H__ */
|
||||
|
|
|
|||
|
|
@ -115,8 +115,9 @@ plug_in_init (Gimp *gimp)
|
|||
* write handlers.
|
||||
*/
|
||||
gp_init ();
|
||||
wire_set_writer (plug_in_write);
|
||||
wire_set_flusher (plug_in_flush);
|
||||
|
||||
gimp_wire_set_writer (plug_in_write);
|
||||
gimp_wire_set_flusher (plug_in_flush);
|
||||
|
||||
/* allocate a piece of shared memory for use in transporting tiles
|
||||
* to plug-ins. if we can't allocate a piece of shared memory then
|
||||
|
|
@ -179,16 +180,16 @@ plug_in_call_query (Gimp *gimp,
|
|||
{
|
||||
while (plug_in->open)
|
||||
{
|
||||
WireMessage msg;
|
||||
GimpWireMessage msg;
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (plug_in, &msg);
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -220,16 +221,16 @@ plug_in_call_init (Gimp *gimp,
|
|||
{
|
||||
while (plug_in->open)
|
||||
{
|
||||
WireMessage msg;
|
||||
GimpWireMessage msg;
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (plug_in, &msg);
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -679,7 +680,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
gimp_wire_clear_error ();
|
||||
|
||||
for (list = plug_in->temp_proc_frames; list; list = g_list_next (list))
|
||||
{
|
||||
|
|
@ -747,11 +748,9 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
PlugIn *plug_in = data;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
plug_in = (PlugIn *) data;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* Workaround for GLib bug #137968: sometimes we are called for no
|
||||
* reason...
|
||||
|
|
@ -765,18 +764,18 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
GimpWireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
memset (&msg, 0, sizeof (GimpWireMessage));
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (plug_in, &msg);
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -805,15 +804,13 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
guint8 *buf,
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
PlugIn *plug_in = user_data;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
|
||||
|
|
@ -822,7 +819,7 @@ plug_in_write (GIOChannel *channel,
|
|||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
if (! gimp_wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
|
@ -844,9 +841,7 @@ static gboolean
|
|||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
PlugIn *plug_in = user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ plug_in_run (Gimp *gimp,
|
|||
|
||||
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))
|
||||
! gimp_wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
! gimp_wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ plug_in_run (Gimp *gimp,
|
|||
|
||||
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))
|
||||
! gimp_wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
! gimp_wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ static GSList *blocked_plug_ins = NULL;
|
|||
/* public functions */
|
||||
|
||||
void
|
||||
plug_in_handle_message (PlugIn *plug_in,
|
||||
WireMessage *msg)
|
||||
plug_in_handle_message (PlugIn *plug_in,
|
||||
GimpWireMessage *msg)
|
||||
{
|
||||
switch (msg->type)
|
||||
{
|
||||
|
|
@ -171,13 +171,13 @@ static void
|
|||
plug_in_handle_tile_req (PlugIn *plug_in,
|
||||
GPTileReq *tile_req)
|
||||
{
|
||||
GPTileData tile_data;
|
||||
GPTileData *tile_info;
|
||||
WireMessage msg;
|
||||
GimpDrawable *drawable;
|
||||
TileManager *tm;
|
||||
Tile *tile;
|
||||
gint shm_ID;
|
||||
GPTileData tile_data;
|
||||
GPTileData *tile_info;
|
||||
GimpWireMessage msg;
|
||||
GimpDrawable *drawable;
|
||||
TileManager *tm;
|
||||
Tile *tile;
|
||||
gint shm_ID;
|
||||
|
||||
shm_ID = plug_in_shm_get_ID (plug_in->gimp);
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
return;
|
||||
}
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
g_warning ("plug_in_handle_tile_req: ERROR");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
|
@ -257,8 +257,8 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
tile_size (tile));
|
||||
|
||||
tile_release (tile, TRUE);
|
||||
gimp_wire_destroy (&msg);
|
||||
|
||||
wire_destroy (&msg);
|
||||
if (! gp_tile_ack_write (plug_in->my_write, plug_in))
|
||||
{
|
||||
g_warning ("plug_in_handle_tile_req: ERROR");
|
||||
|
|
@ -324,7 +324,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
|
||||
tile_release (tile, FALSE);
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
g_message ("plug_in_handle_tile_req: ERROR");
|
||||
plug_in_close (plug_in, TRUE);
|
||||
|
|
@ -338,7 +338,7 @@ plug_in_handle_tile_req (PlugIn *plug_in,
|
|||
return;
|
||||
}
|
||||
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
#define __PLUG_IN_MESSAGE_H__
|
||||
|
||||
|
||||
void plug_in_handle_message (PlugIn *plug_in,
|
||||
WireMessage *msg);
|
||||
void plug_in_handle_message (PlugIn *plug_in,
|
||||
GimpWireMessage *msg);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_MESSAGE_H__ */
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ plug_in_run (Gimp *gimp,
|
|||
|
||||
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))
|
||||
! gimp_wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
proc_run.params = plug_in_args_to_params (args, argc, FALSE);
|
||||
|
||||
if (! gp_temp_proc_run_write (plug_in->my_write, &proc_run, plug_in) ||
|
||||
! wire_flush (plug_in->my_write, plug_in))
|
||||
! gimp_wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
|
|
|
|||
|
|
@ -115,8 +115,9 @@ plug_in_init (Gimp *gimp)
|
|||
* write handlers.
|
||||
*/
|
||||
gp_init ();
|
||||
wire_set_writer (plug_in_write);
|
||||
wire_set_flusher (plug_in_flush);
|
||||
|
||||
gimp_wire_set_writer (plug_in_write);
|
||||
gimp_wire_set_flusher (plug_in_flush);
|
||||
|
||||
/* allocate a piece of shared memory for use in transporting tiles
|
||||
* to plug-ins. if we can't allocate a piece of shared memory then
|
||||
|
|
@ -179,16 +180,16 @@ plug_in_call_query (Gimp *gimp,
|
|||
{
|
||||
while (plug_in->open)
|
||||
{
|
||||
WireMessage msg;
|
||||
GimpWireMessage msg;
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (plug_in, &msg);
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -220,16 +221,16 @@ plug_in_call_init (Gimp *gimp,
|
|||
{
|
||||
while (plug_in->open)
|
||||
{
|
||||
WireMessage msg;
|
||||
GimpWireMessage msg;
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (plug_in, &msg);
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -679,7 +680,7 @@ plug_in_close (PlugIn *plug_in,
|
|||
plug_in->his_write = NULL;
|
||||
}
|
||||
|
||||
wire_clear_error ();
|
||||
gimp_wire_clear_error ();
|
||||
|
||||
for (list = plug_in->temp_proc_frames; list; list = g_list_next (list))
|
||||
{
|
||||
|
|
@ -747,11 +748,9 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
PlugIn *plug_in = data;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
plug_in = (PlugIn *) data;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* Workaround for GLib bug #137968: sometimes we are called for no
|
||||
* reason...
|
||||
|
|
@ -765,18 +764,18 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
GimpWireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
memset (&msg, 0, sizeof (GimpWireMessage));
|
||||
|
||||
if (! wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
if (! gimp_wire_read_msg (plug_in->my_read, &msg, plug_in))
|
||||
{
|
||||
plug_in_close (plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (plug_in, &msg);
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -805,15 +804,13 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
|
||||
static gboolean
|
||||
plug_in_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
guint8 *buf,
|
||||
gulong count,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
PlugIn *plug_in = user_data;
|
||||
gulong bytes;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
if ((plug_in->write_buffer_index + count) >= WRITE_BUFFER_SIZE)
|
||||
|
|
@ -822,7 +819,7 @@ plug_in_write (GIOChannel *channel,
|
|||
memcpy (&plug_in->write_buffer[plug_in->write_buffer_index],
|
||||
buf, bytes);
|
||||
plug_in->write_buffer_index += bytes;
|
||||
if (! wire_flush (channel, plug_in))
|
||||
if (! gimp_wire_flush (channel, plug_in))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
|
@ -844,9 +841,7 @@ static gboolean
|
|||
plug_in_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
PlugIn *plug_in;
|
||||
|
||||
plug_in = (PlugIn *) user_data;
|
||||
PlugIn *plug_in = user_data;
|
||||
|
||||
if (plug_in->write_buffer_index > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ typedef enum
|
|||
|
||||
#define WRITE_BUFFER_SIZE 1024
|
||||
|
||||
void gimp_read_expect_msg (WireMessage *msg,
|
||||
gint type);
|
||||
void gimp_read_expect_msg (GimpWireMessage *msg,
|
||||
gint type);
|
||||
|
||||
|
||||
static void gimp_close (void);
|
||||
|
|
@ -138,24 +138,24 @@ static void gimp_message_func (const gchar *log_domain,
|
|||
#ifndef G_OS_WIN32
|
||||
static void gimp_plugin_sigfatal_handler (gint sig_num);
|
||||
#endif
|
||||
static gboolean gimp_plugin_io_error_handler (GIOChannel *channel,
|
||||
GIOCondition cond,
|
||||
gpointer data);
|
||||
static gboolean gimp_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count,
|
||||
gpointer user_data);
|
||||
static gboolean gimp_flush (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
static gboolean gimp_plugin_io_error_handler (GIOChannel *channel,
|
||||
GIOCondition cond,
|
||||
gpointer data);
|
||||
static gboolean gimp_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
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);
|
||||
static void gimp_temp_proc_run (GPProcRun *proc_run);
|
||||
static void gimp_process_message (WireMessage *msg);
|
||||
static void gimp_config (GPConfig *config);
|
||||
static void gimp_proc_run (GPProcRun *proc_run);
|
||||
static void gimp_temp_proc_run (GPProcRun *proc_run);
|
||||
static void gimp_process_message (GimpWireMessage *msg);
|
||||
static void gimp_single_message (void);
|
||||
static gboolean gimp_extension_read (GIOChannel *channel,
|
||||
GIOCondition condition,
|
||||
gpointer data);
|
||||
static gboolean gimp_extension_read (GIOChannel *channel,
|
||||
GIOCondition condition,
|
||||
gpointer data);
|
||||
|
||||
|
||||
static GIOChannel *_readchannel = NULL;
|
||||
|
|
@ -359,8 +359,9 @@ gimp_main (const GimpPlugInInfo *info,
|
|||
g_io_channel_set_close_on_unref (_writechannel, TRUE);
|
||||
|
||||
gp_init ();
|
||||
wire_set_writer (gimp_write);
|
||||
wire_set_flusher (gimp_flush);
|
||||
|
||||
gimp_wire_set_writer (gimp_write);
|
||||
gimp_wire_set_flusher (gimp_flush);
|
||||
|
||||
g_type_init ();
|
||||
gimp_enums_init ();
|
||||
|
|
@ -885,12 +886,12 @@ gimp_run_procedure (const gchar *name,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_read_expect_msg (WireMessage *msg,
|
||||
gint type)
|
||||
gimp_read_expect_msg (GimpWireMessage *msg,
|
||||
gint type)
|
||||
{
|
||||
while (TRUE)
|
||||
{
|
||||
if (! wire_read_msg (_readchannel, msg, NULL))
|
||||
if (! gimp_wire_read_msg (_readchannel, msg, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
if (msg->type == type)
|
||||
|
|
@ -905,7 +906,7 @@ gimp_read_expect_msg (WireMessage *msg,
|
|||
g_error ("unexpected message: %d", msg->type);
|
||||
}
|
||||
|
||||
wire_destroy (msg);
|
||||
gimp_wire_destroy (msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -932,10 +933,10 @@ gimp_run_procedure2 (const gchar *name,
|
|||
gint n_params,
|
||||
const GimpParam *params)
|
||||
{
|
||||
GPProcRun proc_run;
|
||||
GPProcReturn *proc_return;
|
||||
WireMessage msg;
|
||||
GimpParam *return_vals;
|
||||
GPProcRun proc_run;
|
||||
GPProcReturn *proc_return;
|
||||
GimpWireMessage msg;
|
||||
GimpParam *return_vals;
|
||||
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
g_return_val_if_fail (n_return_vals != NULL, NULL);
|
||||
|
|
@ -985,9 +986,9 @@ void
|
|||
gimp_destroy_params (GimpParam *params,
|
||||
gint n_params)
|
||||
{
|
||||
extern void _gp_params_destroy (GPParam *params, gint n_params);
|
||||
extern void gp_params_destroy (GPParam *params, gint n_params);
|
||||
|
||||
_gp_params_destroy ((GPParam*) params, n_params);
|
||||
gp_params_destroy ((GPParam *) params, n_params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1535,7 +1536,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, NULL))
|
||||
if (! gimp_wire_flush (channel, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
|
@ -1605,11 +1606,11 @@ gimp_flush (GIOChannel *channel,
|
|||
static void
|
||||
gimp_loop (void)
|
||||
{
|
||||
WireMessage msg;
|
||||
GimpWireMessage msg;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
if (! wire_read_msg (_readchannel, &msg, NULL))
|
||||
if (! gimp_wire_read_msg (_readchannel, &msg, NULL))
|
||||
{
|
||||
gimp_close ();
|
||||
return;
|
||||
|
|
@ -1618,7 +1619,7 @@ gimp_loop (void)
|
|||
switch (msg.type)
|
||||
{
|
||||
case GP_QUIT:
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
gimp_close ();
|
||||
return;
|
||||
|
||||
|
|
@ -1634,7 +1635,7 @@ gimp_loop (void)
|
|||
|
||||
case GP_PROC_RUN:
|
||||
gimp_proc_run (msg.data);
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
gimp_close ();
|
||||
return;
|
||||
|
||||
|
|
@ -1659,7 +1660,7 @@ gimp_loop (void)
|
|||
break;
|
||||
}
|
||||
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1798,7 +1799,7 @@ gimp_proc_run (GPProcRun *proc_run)
|
|||
|
||||
(* PLUG_IN_INFO.run_proc) (proc_run->name,
|
||||
proc_run->nparams,
|
||||
(GimpParam*) proc_run->params,
|
||||
(GimpParam *) proc_run->params,
|
||||
&n_return_vals,
|
||||
&return_vals);
|
||||
|
||||
|
|
@ -1842,7 +1843,7 @@ gimp_temp_proc_run (GPProcRun *proc_run)
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_process_message (WireMessage *msg)
|
||||
gimp_process_message (GimpWireMessage *msg)
|
||||
{
|
||||
switch (msg->type)
|
||||
{
|
||||
|
|
@ -1881,15 +1882,15 @@ gimp_process_message (WireMessage *msg)
|
|||
static void
|
||||
gimp_single_message (void)
|
||||
{
|
||||
WireMessage msg;
|
||||
GimpWireMessage msg;
|
||||
|
||||
/* Run a temp function */
|
||||
if (! wire_read_msg (_readchannel, &msg, NULL))
|
||||
if (! gimp_wire_read_msg (_readchannel, &msg, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
gimp_process_message (&msg);
|
||||
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
|
|
@ -39,13 +39,13 @@
|
|||
#define FREE_QUANTUM 0.1
|
||||
|
||||
|
||||
void gimp_read_expect_msg (WireMessage *msg,
|
||||
gint type);
|
||||
void gimp_read_expect_msg (GimpWireMessage *msg,
|
||||
gint type);
|
||||
|
||||
static void gimp_tile_get (GimpTile *tile);
|
||||
static void gimp_tile_put (GimpTile *tile);
|
||||
static void gimp_tile_cache_insert (GimpTile *tile);
|
||||
static void gimp_tile_cache_flush (GimpTile *tile);
|
||||
static void gimp_tile_get (GimpTile *tile);
|
||||
static void gimp_tile_put (GimpTile *tile);
|
||||
static void gimp_tile_cache_insert (GimpTile *tile);
|
||||
static void gimp_tile_cache_flush (GimpTile *tile);
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
|
@ -182,9 +182,9 @@ gimp_tile_get (GimpTile *tile)
|
|||
{
|
||||
extern GIOChannel *_writechannel;
|
||||
|
||||
GPTileReq tile_req;
|
||||
GPTileData *tile_data;
|
||||
WireMessage msg;
|
||||
GPTileReq tile_req;
|
||||
GPTileData *tile_data;
|
||||
GimpWireMessage msg;
|
||||
|
||||
tile_req.drawable_ID = tile->drawable->drawable_id;
|
||||
tile_req.tile_num = tile->tile_num;
|
||||
|
|
@ -221,7 +221,7 @@ gimp_tile_get (GimpTile *tile)
|
|||
if (! gp_tile_ack_write (_writechannel, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -229,10 +229,10 @@ gimp_tile_put (GimpTile *tile)
|
|||
{
|
||||
extern GIOChannel *_writechannel;
|
||||
|
||||
GPTileReq tile_req;
|
||||
GPTileData tile_data;
|
||||
GPTileData *tile_info;
|
||||
WireMessage msg;
|
||||
GPTileReq tile_req;
|
||||
GPTileData tile_data;
|
||||
GPTileData *tile_info;
|
||||
GimpWireMessage msg;
|
||||
|
||||
tile_req.drawable_ID = -1;
|
||||
tile_req.tile_num = 0;
|
||||
|
|
@ -264,10 +264,10 @@ gimp_tile_put (GimpTile *tile)
|
|||
if (! gp_tile_data_write (_writechannel, &tile_data, NULL))
|
||||
gimp_quit ();
|
||||
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
|
||||
gimp_read_expect_msg (&msg, GP_TILE_ACK);
|
||||
wire_destroy (&msg);
|
||||
gimp_wire_destroy (&msg);
|
||||
}
|
||||
|
||||
/* This function is nearly identical to the function 'tile_cache_insert'
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
EXPORTS
|
||||
_gp_params_destroy
|
||||
gimp_add_mask_type_get_type
|
||||
gimp_any_to_utf8
|
||||
gimp_base_init
|
||||
|
|
@ -101,10 +100,23 @@ EXPORTS
|
|||
gimp_unit_new
|
||||
gimp_unit_set_deletion_flag
|
||||
gimp_utf8_strtrim
|
||||
gimp_wire_clear_error
|
||||
gimp_wire_destroy
|
||||
gimp_wire_error
|
||||
gimp_wire_flush
|
||||
gimp_wire_read
|
||||
gimp_wire_read_msg
|
||||
gimp_wire_register
|
||||
gimp_wire_set_flusher
|
||||
gimp_wire_set_reader
|
||||
gimp_wire_set_writer
|
||||
gimp_wire_write
|
||||
gimp_wire_write_msg
|
||||
gp_config_write
|
||||
gp_extension_ack_write
|
||||
gp_has_init_write
|
||||
gp_init
|
||||
gp_params_destroy
|
||||
gp_proc_install_write
|
||||
gp_proc_return_write
|
||||
gp_proc_run_write
|
||||
|
|
@ -115,25 +127,3 @@ EXPORTS
|
|||
gp_tile_ack_write
|
||||
gp_tile_data_write
|
||||
gp_tile_req_write
|
||||
wire_clear_error
|
||||
wire_destroy
|
||||
wire_error
|
||||
wire_flush
|
||||
wire_read
|
||||
wire_read_double
|
||||
wire_read_int16
|
||||
wire_read_int32
|
||||
wire_read_int8
|
||||
wire_read_msg
|
||||
wire_read_string
|
||||
wire_register
|
||||
wire_set_flusher
|
||||
wire_set_reader
|
||||
wire_set_writer
|
||||
wire_write
|
||||
wire_write_double
|
||||
wire_write_int16
|
||||
wire_write_int32
|
||||
wire_write_int8
|
||||
wire_write_msg
|
||||
wire_write_string
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -19,66 +19,49 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <process.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "gimpwire.h"
|
||||
|
||||
|
||||
typedef struct _WireHandler WireHandler;
|
||||
typedef struct _GimpWireHandler GimpWireHandler;
|
||||
|
||||
struct _WireHandler
|
||||
struct _GimpWireHandler
|
||||
{
|
||||
guint32 type;
|
||||
WireReadFunc read_func;
|
||||
WireWriteFunc write_func;
|
||||
WireDestroyFunc destroy_func;
|
||||
guint32 type;
|
||||
GimpWireReadFunc read_func;
|
||||
GimpWireWriteFunc write_func;
|
||||
GimpWireDestroyFunc destroy_func;
|
||||
};
|
||||
|
||||
|
||||
static void wire_init (void);
|
||||
static guint wire_hash (guint32 *key);
|
||||
static gboolean wire_compare (guint32 *a,
|
||||
guint32 *b);
|
||||
static GHashTable *wire_ht = NULL;
|
||||
static GimpWireIOFunc wire_read_func = NULL;
|
||||
static GimpWireIOFunc wire_write_func = NULL;
|
||||
static GimpWireFlushFunc wire_flush_func = NULL;
|
||||
static gboolean wire_error_val = FALSE;
|
||||
|
||||
|
||||
static GHashTable *wire_ht = NULL;
|
||||
static WireIOFunc wire_read_func = NULL;
|
||||
static WireIOFunc wire_write_func = NULL;
|
||||
static WireFlushFunc wire_flush_func = NULL;
|
||||
static gboolean wire_error_val = FALSE;
|
||||
static void gimp_wire_init (void);
|
||||
|
||||
|
||||
void
|
||||
wire_register (guint32 type,
|
||||
WireReadFunc read_func,
|
||||
WireWriteFunc write_func,
|
||||
WireDestroyFunc destroy_func)
|
||||
gimp_wire_register (guint32 type,
|
||||
GimpWireReadFunc read_func,
|
||||
GimpWireWriteFunc write_func,
|
||||
GimpWireDestroyFunc destroy_func)
|
||||
{
|
||||
WireHandler *handler;
|
||||
GimpWireHandler *handler;
|
||||
|
||||
if (! wire_ht)
|
||||
wire_init ();
|
||||
gimp_wire_init ();
|
||||
|
||||
handler = g_hash_table_lookup (wire_ht, &type);
|
||||
|
||||
if (! handler)
|
||||
handler = g_new0 (WireHandler, 1);
|
||||
handler = g_new0 (GimpWireHandler, 1);
|
||||
|
||||
handler->type = type;
|
||||
handler->read_func = read_func;
|
||||
|
|
@ -89,28 +72,28 @@ wire_register (guint32 type,
|
|||
}
|
||||
|
||||
void
|
||||
wire_set_reader (WireIOFunc read_func)
|
||||
gimp_wire_set_reader (GimpWireIOFunc read_func)
|
||||
{
|
||||
wire_read_func = read_func;
|
||||
}
|
||||
|
||||
void
|
||||
wire_set_writer (WireIOFunc write_func)
|
||||
gimp_wire_set_writer (GimpWireIOFunc write_func)
|
||||
{
|
||||
wire_write_func = write_func;
|
||||
}
|
||||
|
||||
void
|
||||
wire_set_flusher (WireFlushFunc flush_func)
|
||||
gimp_wire_set_flusher (GimpWireFlushFunc flush_func)
|
||||
{
|
||||
wire_flush_func = flush_func;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wire_read (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count,
|
||||
gpointer user_data)
|
||||
gimp_wire_read (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
|
|
@ -175,16 +158,16 @@ wire_read (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count,
|
||||
gpointer user_data)
|
||||
gimp_wire_write (GIOChannel *channel,
|
||||
const guint8 *buf,
|
||||
gsize count,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
if (wire_write_func)
|
||||
{
|
||||
if (!(* wire_write_func) (channel, buf, count, user_data))
|
||||
if (!(* wire_write_func) (channel, (guint8 *) buf, count, user_data))
|
||||
{
|
||||
g_warning ("%s: wire_write: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
|
|
@ -203,7 +186,7 @@ wire_write (GIOChannel *channel,
|
|||
{
|
||||
bytes = 0;
|
||||
status = g_io_channel_write_chars (channel,
|
||||
(gchar *) buf, count,
|
||||
(const gchar *) buf, count,
|
||||
&bytes,
|
||||
&error);
|
||||
}
|
||||
|
|
@ -236,8 +219,8 @@ wire_write (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
gimp_wire_flush (GIOChannel *channel,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (wire_flush_func)
|
||||
return (* wire_flush_func) (channel, user_data);
|
||||
|
|
@ -246,28 +229,28 @@ wire_flush (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_error (void)
|
||||
gimp_wire_error (void)
|
||||
{
|
||||
return wire_error_val;
|
||||
}
|
||||
|
||||
void
|
||||
wire_clear_error (void)
|
||||
gimp_wire_clear_error (void)
|
||||
{
|
||||
wire_error_val = FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
wire_read_msg (GIOChannel *channel,
|
||||
WireMessage *msg,
|
||||
gpointer user_data)
|
||||
gimp_wire_read_msg (GIOChannel *channel,
|
||||
GimpWireMessage *msg,
|
||||
gpointer user_data)
|
||||
{
|
||||
WireHandler *handler;
|
||||
GimpWireHandler *handler;
|
||||
|
||||
if (wire_error_val)
|
||||
return !wire_error_val;
|
||||
|
||||
if (! wire_read_int32 (channel, &msg->type, 1, user_data))
|
||||
if (! _gimp_wire_read_int32 (channel, &msg->type, 1, user_data))
|
||||
return FALSE;
|
||||
|
||||
handler = g_hash_table_lookup (wire_ht, &msg->type);
|
||||
|
|
@ -280,11 +263,11 @@ wire_read_msg (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_write_msg (GIOChannel *channel,
|
||||
WireMessage *msg,
|
||||
gpointer user_data)
|
||||
gimp_wire_write_msg (GIOChannel *channel,
|
||||
GimpWireMessage *msg,
|
||||
gpointer user_data)
|
||||
{
|
||||
WireHandler *handler;
|
||||
GimpWireHandler *handler;
|
||||
|
||||
if (wire_error_val)
|
||||
return !wire_error_val;
|
||||
|
|
@ -293,7 +276,7 @@ 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, user_data))
|
||||
if (! _gimp_wire_write_int32 (channel, &msg->type, 1, user_data))
|
||||
return FALSE;
|
||||
|
||||
(* handler->write_func) (channel, msg, user_data);
|
||||
|
|
@ -302,9 +285,9 @@ wire_write_msg (GIOChannel *channel,
|
|||
}
|
||||
|
||||
void
|
||||
wire_destroy (WireMessage *msg)
|
||||
gimp_wire_destroy (GimpWireMessage *msg)
|
||||
{
|
||||
WireHandler *handler;
|
||||
GimpWireHandler *handler;
|
||||
|
||||
handler = g_hash_table_lookup (wire_ht, &msg->type);
|
||||
if (!handler)
|
||||
|
|
@ -314,16 +297,17 @@ wire_destroy (WireMessage *msg)
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_read_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_read_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
if (! wire_read_int8 (channel, (guint8 *) data, count * 4, user_data))
|
||||
if (! _gimp_wire_read_int8 (channel,
|
||||
(guint8 *) data, count * 4, user_data))
|
||||
return FALSE;
|
||||
|
||||
while (count--)
|
||||
|
|
@ -337,16 +321,17 @@ wire_read_int32 (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_read_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_read_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
if (! wire_read_int8 (channel, (guint8 *) data, count * 2, user_data))
|
||||
if (! _gimp_wire_read_int8 (channel,
|
||||
(guint8 *) data, count * 2, user_data))
|
||||
return FALSE;
|
||||
|
||||
while (count--)
|
||||
|
|
@ -360,21 +345,21 @@ wire_read_int16 (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_read_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_read_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
return wire_read (channel, data, count, user_data);
|
||||
return gimp_wire_read (channel, data, count, user_data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
wire_read_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_read_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gdouble *t;
|
||||
guint8 tmp[8];
|
||||
|
|
@ -390,7 +375,7 @@ wire_read_double (GIOChannel *channel,
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (! wire_read_int8 (channel, tmp, 8, user_data))
|
||||
if (! _gimp_wire_read_int8 (channel, tmp, 8, user_data))
|
||||
return FALSE;
|
||||
|
||||
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
||||
|
|
@ -409,10 +394,10 @@ wire_read_double (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_read_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_read_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint32 tmp;
|
||||
gint i;
|
||||
|
|
@ -421,13 +406,14 @@ wire_read_string (GIOChannel *channel,
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (!wire_read_int32 (channel, &tmp, 1, user_data))
|
||||
if (! _gimp_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, user_data))
|
||||
if (! _gimp_wire_read_int8 (channel,
|
||||
(guint8 *) data[i], tmp, user_data))
|
||||
{
|
||||
g_free (data[i]);
|
||||
return FALSE;
|
||||
|
|
@ -443,10 +429,10 @@ wire_read_string (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_write_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_write_int32 (GIOChannel *channel,
|
||||
const guint32 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint32 tmp;
|
||||
gint i;
|
||||
|
|
@ -458,7 +444,8 @@ wire_write_int32 (GIOChannel *channel,
|
|||
for (i = 0; i < count; i++)
|
||||
{
|
||||
tmp = g_htonl (data[i]);
|
||||
if (! wire_write_int8 (channel, (guint8 *) &tmp, 4, user_data))
|
||||
if (! _gimp_wire_write_int8 (channel,
|
||||
(const guint8 *) &tmp, 4, user_data))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -467,10 +454,10 @@ wire_write_int32 (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_write_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_write_int16 (GIOChannel *channel,
|
||||
const guint16 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint16 tmp;
|
||||
gint i;
|
||||
|
|
@ -482,7 +469,8 @@ wire_write_int16 (GIOChannel *channel,
|
|||
for (i = 0; i < count; i++)
|
||||
{
|
||||
tmp = g_htons (data[i]);
|
||||
if (! wire_write_int8 (channel, (guint8 *) &tmp, 2, user_data))
|
||||
if (! _gimp_wire_write_int8 (channel,
|
||||
(const guint8 *) &tmp, 2, user_data))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -491,21 +479,21 @@ wire_write_int16 (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_write_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_write_int8 (GIOChannel *channel,
|
||||
const guint8 *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
|
||||
return wire_write (channel, data, count, user_data);
|
||||
return gimp_wire_write (channel, data, count, user_data);
|
||||
}
|
||||
|
||||
gboolean
|
||||
wire_write_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_write_double (GIOChannel *channel,
|
||||
const gdouble *data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
gdouble *t;
|
||||
guint8 tmp[8];
|
||||
|
|
@ -532,7 +520,7 @@ wire_write_double (GIOChannel *channel,
|
|||
}
|
||||
#endif
|
||||
|
||||
if (! wire_write_int8 (channel, tmp, 8, user_data))
|
||||
if (! _gimp_wire_write_int8 (channel, tmp, 8, user_data))
|
||||
return FALSE;
|
||||
|
||||
#if 0
|
||||
|
|
@ -553,10 +541,10 @@ wire_write_double (GIOChannel *channel,
|
|||
}
|
||||
|
||||
gboolean
|
||||
wire_write_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
_gimp_wire_write_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint32 tmp;
|
||||
gint i;
|
||||
|
|
@ -570,33 +558,35 @@ wire_write_string (GIOChannel *channel,
|
|||
else
|
||||
tmp = 0;
|
||||
|
||||
if (! wire_write_int32 (channel, &tmp, 1, user_data))
|
||||
if (! _gimp_wire_write_int32 (channel, &tmp, 1, user_data))
|
||||
return FALSE;
|
||||
|
||||
if (tmp > 0)
|
||||
if (! wire_write_int8 (channel, (guint8 *) data[i], tmp, user_data))
|
||||
if (! _gimp_wire_write_int8 (channel,
|
||||
(const guint8 *) data[i], tmp, user_data))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
wire_init (void)
|
||||
{
|
||||
if (! wire_ht)
|
||||
wire_ht = g_hash_table_new ((GHashFunc) wire_hash,
|
||||
(GCompareFunc) wire_compare);
|
||||
}
|
||||
|
||||
static guint
|
||||
wire_hash (guint32 *key)
|
||||
gimp_wire_hash (const guint32 *key)
|
||||
{
|
||||
return *key;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wire_compare (guint32 *a,
|
||||
guint32 *b)
|
||||
gimp_wire_compare (const guint32 *a,
|
||||
const guint32 *b)
|
||||
{
|
||||
return (*a == *b);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_wire_init (void)
|
||||
{
|
||||
if (! wire_ht)
|
||||
wire_ht = g_hash_table_new ((GHashFunc) gimp_wire_hash,
|
||||
(GCompareFunc) gimp_wire_compare);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,102 +25,102 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
typedef struct _WireMessage WireMessage;
|
||||
typedef struct _GimpWireMessage GimpWireMessage;
|
||||
|
||||
typedef void (* WireReadFunc) (GIOChannel *channel,
|
||||
WireMessage *msg,
|
||||
gpointer user_data);
|
||||
typedef void (* WireWriteFunc) (GIOChannel *channel,
|
||||
WireMessage *msg,
|
||||
gpointer user_data);
|
||||
typedef void (* WireDestroyFunc) (WireMessage *msg);
|
||||
typedef gboolean (* WireIOFunc) (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count,
|
||||
gpointer user_data);
|
||||
typedef gboolean (* WireFlushFunc) (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
typedef void (* GimpWireReadFunc) (GIOChannel *channel,
|
||||
GimpWireMessage *msg,
|
||||
gpointer user_data);
|
||||
typedef void (* GimpWireWriteFunc) (GIOChannel *channel,
|
||||
GimpWireMessage *msg,
|
||||
gpointer user_data);
|
||||
typedef void (* GimpWireDestroyFunc) (GimpWireMessage *msg);
|
||||
typedef gboolean (* GimpWireIOFunc) (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count,
|
||||
gpointer user_data);
|
||||
typedef gboolean (* GimpWireFlushFunc) (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
|
||||
|
||||
struct _WireMessage
|
||||
struct _GimpWireMessage
|
||||
{
|
||||
guint32 type;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
|
||||
void wire_register (guint32 type,
|
||||
WireReadFunc read_func,
|
||||
WireWriteFunc write_func,
|
||||
WireDestroyFunc destroy_func);
|
||||
void gimp_wire_register (guint32 type,
|
||||
GimpWireReadFunc read_func,
|
||||
GimpWireWriteFunc write_func,
|
||||
GimpWireDestroyFunc destroy_func);
|
||||
|
||||
void wire_set_reader (WireIOFunc read_func);
|
||||
void wire_set_writer (WireIOFunc write_func);
|
||||
void wire_set_flusher (WireFlushFunc flush_func);
|
||||
void gimp_wire_set_reader (GimpWireIOFunc read_func);
|
||||
void gimp_wire_set_writer (GimpWireIOFunc write_func);
|
||||
void gimp_wire_set_flusher (GimpWireFlushFunc flush_func);
|
||||
|
||||
gboolean wire_read (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count,
|
||||
gpointer user_data);
|
||||
gboolean wire_flush (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
gboolean gimp_wire_read (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gsize count,
|
||||
gpointer user_data);
|
||||
gboolean gimp_wire_write (GIOChannel *channel,
|
||||
const guint8 *buf,
|
||||
gsize count,
|
||||
gpointer user_data);
|
||||
gboolean gimp_wire_flush (GIOChannel *channel,
|
||||
gpointer user_data);
|
||||
|
||||
gboolean wire_error (void);
|
||||
void wire_clear_error (void);
|
||||
gboolean gimp_wire_error (void);
|
||||
void gimp_wire_clear_error (void);
|
||||
|
||||
gboolean wire_read_msg (GIOChannel *channel,
|
||||
WireMessage *msg,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_msg (GIOChannel *channel,
|
||||
WireMessage *msg,
|
||||
gpointer user_data);
|
||||
gboolean gimp_wire_read_msg (GIOChannel *channel,
|
||||
GimpWireMessage *msg,
|
||||
gpointer user_data);
|
||||
gboolean gimp_wire_write_msg (GIOChannel *channel,
|
||||
GimpWireMessage *msg,
|
||||
gpointer user_data);
|
||||
|
||||
void wire_destroy (WireMessage *msg);
|
||||
void gimp_wire_destroy (GimpWireMessage *msg);
|
||||
|
||||
gboolean wire_read_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_read_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_read_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_read_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_read_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean wire_write_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count,
|
||||
gpointer user_data);
|
||||
gboolean _gimp_wire_read_int32 (GIOChannel *channel,
|
||||
guint32 *data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_read_int16 (GIOChannel *channel,
|
||||
guint16 *data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_read_int8 (GIOChannel *channel,
|
||||
guint8 *data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_read_double (GIOChannel *channel,
|
||||
gdouble *data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_read_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_write_int32 (GIOChannel *channel,
|
||||
const guint32 *data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_write_int16 (GIOChannel *channel,
|
||||
const guint16 *data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_write_int8 (GIOChannel *channel,
|
||||
const guint8 *data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_write_double (GIOChannel *channel,
|
||||
const gdouble *data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
gboolean _gimp_wire_write_string (GIOChannel *channel,
|
||||
gchar **data,
|
||||
gint count,
|
||||
gpointer user_data) G_GNUC_INTERNAL;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
|||
Loading…
Reference in a new issue