home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / libgimp / gimpprotocol.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-04  |  35.0 KB  |  1,419 lines

  1. /* LIBGIMP - The GIMP Library                                                   
  2.  * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball                
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Lesser General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.             
  8.  *                                                                              
  9.  * This library is distributed in the hope that it will be useful,              
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of               
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU            
  12.  * Library General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Lesser General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */                                                                             
  19. #include <stdio.h>
  20.  
  21. #include <glib.h>
  22.  
  23. #include "gimpenums.h"
  24. #include "gimpparasite.h"
  25. #include "gimpprotocol.h"
  26. #include "gimpwire.h"
  27.  
  28.  
  29. static void _gp_quit_read                (GIOChannel   *channel,
  30.                       WireMessage  *msg);
  31. static void _gp_quit_write               (GIOChannel   *channel,
  32.                       WireMessage  *msg);
  33. static void _gp_quit_destroy             (WireMessage  *msg);
  34.  
  35. static void _gp_config_read              (GIOChannel   *channel,
  36.                       WireMessage  *msg);
  37. static void _gp_config_write             (GIOChannel   *channel,
  38.                       WireMessage  *msg);
  39. static void _gp_config_destroy           (WireMessage  *msg);
  40.  
  41. static void _gp_tile_req_read            (GIOChannel   *channel,
  42.                       WireMessage  *msg);
  43. static void _gp_tile_req_write           (GIOChannel   *channel,
  44.                       WireMessage  *msg);
  45. static void _gp_tile_req_destroy         (WireMessage  *msg);
  46.  
  47. static void _gp_tile_ack_read            (GIOChannel   *channel,
  48.                       WireMessage  *msg);
  49. static void _gp_tile_ack_write           (GIOChannel   *channel,
  50.                       WireMessage  *msg);
  51. static void _gp_tile_ack_destroy         (WireMessage  *msg);
  52.  
  53. static void _gp_tile_data_read           (GIOChannel   *channel,
  54.                       WireMessage  *msg);
  55. static void _gp_tile_data_write          (GIOChannel   *channel,
  56.                       WireMessage  *msg);
  57. static void _gp_tile_data_destroy        (WireMessage  *msg);
  58.  
  59. static void _gp_proc_run_read            (GIOChannel   *channel,
  60.                       WireMessage  *msg);
  61. static void _gp_proc_run_write           (GIOChannel   *channel,
  62.                       WireMessage  *msg);
  63. static void _gp_proc_run_destroy         (WireMessage  *msg);
  64.  
  65. static void _gp_proc_return_read         (GIOChannel   *channel,
  66.                       WireMessage  *msg);
  67. static void _gp_proc_return_write        (GIOChannel   *channel,
  68.                       WireMessage  *msg);
  69. static void _gp_proc_return_destroy      (WireMessage  *msg);
  70.  
  71. static void _gp_temp_proc_run_read       (GIOChannel   *channel,
  72.                       WireMessage  *msg);
  73. static void _gp_temp_proc_run_write      (GIOChannel   *channel,
  74.                       WireMessage  *msg);
  75. static void _gp_temp_proc_run_destroy    (WireMessage  *msg);
  76.  
  77. static void _gp_temp_proc_return_read    (GIOChannel   *channel,
  78.                       WireMessage  *msg);
  79. static void _gp_temp_proc_return_write   (GIOChannel   *channel,
  80.                       WireMessage  *msg);
  81. static void _gp_temp_proc_return_destroy (WireMessage  *msg);
  82.  
  83. static void _gp_proc_install_read        (GIOChannel   *channel,
  84.                       WireMessage  *msg);
  85. static void _gp_proc_install_write       (GIOChannel   *channel,
  86.                       WireMessage  *msg);
  87. static void _gp_proc_install_destroy     (WireMessage  *msg);
  88.  
  89. static void _gp_proc_uninstall_read      (GIOChannel   *channel,
  90.                       WireMessage  *msg);
  91. static void _gp_proc_uninstall_write     (GIOChannel   *channel,
  92.                       WireMessage  *msg);
  93. static void _gp_proc_uninstall_destroy   (WireMessage  *msg);
  94.  
  95. static void _gp_extension_ack_read       (GIOChannel   *channel,
  96.                       WireMessage  *msg);
  97. static void _gp_extension_ack_write      (GIOChannel   *channel,
  98.                       WireMessage  *msg);
  99. static void _gp_extension_ack_destroy    (WireMessage  *msg);
  100.  
  101. static void _gp_params_read              (GIOChannel   *channel,
  102.                       GPParam     **params,
  103.                       guint        *nparams);
  104. static void _gp_params_write             (GIOChannel   *channel,
  105.                       GPParam      *params,
  106.                       gint          nparams);
  107.  
  108. /* used by gimp.c:gimp_destroy_params() */
  109. void        _gp_params_destroy           (GPParam      *params,
  110.                       gint          nparams);
  111.  
  112.  
  113. void
  114. gp_init (void)
  115. {
  116.   wire_register (GP_QUIT,
  117.          _gp_quit_read,
  118.          _gp_quit_write,
  119.          _gp_quit_destroy);
  120.   wire_register (GP_CONFIG,
  121.          _gp_config_read,
  122.          _gp_config_write,
  123.          _gp_config_destroy);
  124.   wire_register (GP_TILE_REQ,
  125.          _gp_tile_req_read,
  126.          _gp_tile_req_write,
  127.          _gp_tile_req_destroy);
  128.   wire_register (GP_TILE_ACK,
  129.          _gp_tile_ack_read,
  130.          _gp_tile_ack_write,
  131.          _gp_tile_ack_destroy);
  132.   wire_register (GP_TILE_DATA,
  133.          _gp_tile_data_read,
  134.          _gp_tile_data_write,
  135.          _gp_tile_data_destroy);
  136.   wire_register (GP_PROC_RUN,
  137.          _gp_proc_run_read,
  138.          _gp_proc_run_write,
  139.          _gp_proc_run_destroy);
  140.   wire_register (GP_PROC_RETURN,
  141.          _gp_proc_return_read,
  142.          _gp_proc_return_write,
  143.          _gp_proc_return_destroy);
  144.   wire_register (GP_TEMP_PROC_RUN,
  145.          _gp_temp_proc_run_read,
  146.          _gp_temp_proc_run_write,
  147.          _gp_temp_proc_run_destroy);
  148.   wire_register (GP_TEMP_PROC_RETURN,
  149.          _gp_temp_proc_return_read,
  150.          _gp_temp_proc_return_write,
  151.          _gp_temp_proc_return_destroy);
  152.   wire_register (GP_PROC_INSTALL,
  153.          _gp_proc_install_read,
  154.          _gp_proc_install_write,
  155.          _gp_proc_install_destroy);
  156.   wire_register (GP_PROC_UNINSTALL,
  157.          _gp_proc_uninstall_read,
  158.          _gp_proc_uninstall_write,
  159.          _gp_proc_uninstall_destroy);
  160.   wire_register (GP_EXTENSION_ACK,
  161.          _gp_extension_ack_read,
  162.          _gp_extension_ack_write,
  163.          _gp_extension_ack_destroy);
  164. }
  165.  
  166. gboolean
  167. gp_quit_write (GIOChannel *channel)
  168. {
  169.   WireMessage msg;
  170.  
  171.   msg.type = GP_QUIT;
  172.   msg.data = NULL;
  173.  
  174.   if (!wire_write_msg (channel, &msg))
  175.     return FALSE;
  176.   if (!wire_flush (channel))
  177.     return FALSE;
  178.   return TRUE;
  179. }
  180.  
  181. gboolean
  182. gp_config_write (GIOChannel *channel,
  183.          GPConfig   *config)
  184. {
  185.   WireMessage msg;
  186.  
  187.   msg.type = GP_CONFIG;
  188.   msg.data = config;
  189.  
  190.   if (!wire_write_msg (channel, &msg))
  191.     return FALSE;
  192.   if (!wire_flush (channel))
  193.     return FALSE;
  194.   return TRUE;
  195. }
  196.  
  197. gboolean
  198. gp_tile_req_write (GIOChannel *channel,
  199.            GPTileReq  *tile_req)
  200. {
  201.   WireMessage msg;
  202.  
  203.   msg.type = GP_TILE_REQ;
  204.   msg.data = tile_req;
  205.  
  206.   if (!wire_write_msg (channel, &msg))
  207.     return FALSE;
  208.   if (!wire_flush (channel))
  209.     return FALSE;
  210.   return TRUE;
  211. }
  212.  
  213. gboolean
  214. gp_tile_ack_write (GIOChannel *channel)
  215. {
  216.   WireMessage msg;
  217.  
  218.   msg.type = GP_TILE_ACK;
  219.   msg.data = NULL;
  220.  
  221.   if (!wire_write_msg (channel, &msg))
  222.     return FALSE;
  223.   if (!wire_flush (channel))
  224.     return FALSE;
  225.   return TRUE;
  226. }
  227.  
  228. gboolean
  229. gp_tile_data_write (GIOChannel *channel,
  230.             GPTileData *tile_data)
  231. {
  232.   WireMessage msg;
  233.  
  234.   msg.type = GP_TILE_DATA;
  235.   msg.data = tile_data;
  236.  
  237.   if (!wire_write_msg (channel, &msg))
  238.     return FALSE;
  239.   if (!wire_flush (channel))
  240.     return FALSE;
  241.   return TRUE;
  242. }
  243.  
  244. gboolean
  245. gp_proc_run_write (GIOChannel *channel,
  246.            GPProcRun  *proc_run)
  247. {
  248.   WireMessage msg;
  249.  
  250.   msg.type = GP_PROC_RUN;
  251.   msg.data = proc_run;
  252.  
  253.   if (!wire_write_msg (channel, &msg))
  254.     return FALSE;
  255.   if (!wire_flush (channel))
  256.     return FALSE;
  257.   return TRUE;
  258. }
  259.  
  260. gboolean
  261. gp_proc_return_write (GIOChannel   *channel,
  262.               GPProcReturn *proc_return)
  263. {
  264.   WireMessage msg;
  265.  
  266.   msg.type = GP_PROC_RETURN;
  267.   msg.data = proc_return;
  268.  
  269.   if (!wire_write_msg (channel, &msg))
  270.     return FALSE;
  271.   if (!wire_flush (channel))
  272.     return FALSE;
  273.   return TRUE;
  274. }
  275.  
  276. gboolean
  277. gp_temp_proc_run_write (GIOChannel *channel,
  278.             GPProcRun  *proc_run)
  279. {
  280.   WireMessage msg;
  281.  
  282.   msg.type = GP_TEMP_PROC_RUN;
  283.   msg.data = proc_run;
  284.  
  285.   if (!wire_write_msg (channel, &msg))
  286.     return FALSE;
  287.   if (!wire_flush (channel))
  288.     return FALSE;
  289.   return TRUE;
  290. }
  291.  
  292. gboolean
  293. gp_temp_proc_return_write (GIOChannel   *channel,
  294.                GPProcReturn *proc_return)
  295. {
  296.   WireMessage msg;
  297.  
  298.   msg.type = GP_TEMP_PROC_RETURN;
  299.   msg.data = proc_return;
  300.  
  301.   if (!wire_write_msg (channel, &msg))
  302.     return FALSE;
  303.   if (!wire_flush (channel))
  304.     return FALSE;
  305.   return TRUE;
  306. }
  307.  
  308. gboolean
  309. gp_proc_install_write (GIOChannel    *channel,
  310.                GPProcInstall *proc_install)
  311. {
  312.   WireMessage msg;
  313.  
  314.   msg.type = GP_PROC_INSTALL;
  315.   msg.data = proc_install;
  316.  
  317.   if (!wire_write_msg (channel, &msg))
  318.     return FALSE;
  319.   if (!wire_flush (channel))
  320.     return FALSE;
  321.   return TRUE;
  322. }
  323.  
  324. gboolean
  325. gp_proc_uninstall_write (GIOChannel      *channel,
  326.              GPProcUninstall *proc_uninstall)
  327. {
  328.   WireMessage msg;
  329.  
  330.   msg.type = GP_PROC_UNINSTALL;
  331.   msg.data = proc_uninstall;
  332.  
  333.   if (!wire_write_msg (channel, &msg))
  334.     return FALSE;
  335.   if (!wire_flush (channel))
  336.     return FALSE;
  337.   return TRUE;
  338. }
  339.  
  340. gboolean
  341. gp_extension_ack_write (GIOChannel *channel)
  342. {
  343.   WireMessage msg;
  344.  
  345.   msg.type = GP_EXTENSION_ACK;
  346.   msg.data = NULL;
  347.  
  348.   if (!wire_write_msg (channel, &msg))
  349.     return FALSE;
  350.   if (!wire_flush (channel))
  351.     return FALSE;
  352.   return TRUE;
  353. }
  354.  
  355. /*  quit  */
  356.  
  357. static void
  358. _gp_quit_read (GIOChannel  *channel,
  359.            WireMessage *msg)
  360. {
  361. }
  362.  
  363. static void
  364. _gp_quit_write (GIOChannel  *channel,
  365.         WireMessage *msg)
  366. {
  367. }
  368.  
  369. static void
  370. _gp_quit_destroy (WireMessage *msg)
  371. {
  372. }
  373.  
  374. /*  config  */
  375.  
  376. static void
  377. _gp_config_read (GIOChannel  *channel,
  378.          WireMessage *msg)
  379. {
  380.   GPConfig *config;
  381.  
  382.   config = g_new (GPConfig, 1);
  383.  
  384.   if (!wire_read_int32 (channel, &config->version, 1))
  385.     goto cleanup;
  386.   if (!wire_read_int32 (channel, &config->tile_width, 1))
  387.     goto cleanup;
  388.   if (!wire_read_int32 (channel, &config->tile_height, 1))
  389.     goto cleanup;
  390.   if (!wire_read_int32 (channel, (guint32*) &config->shm_ID, 1))
  391.     goto cleanup;
  392.   if (!wire_read_double (channel, &config->gamma, 1))
  393.     goto cleanup;
  394.   if (!wire_read_int8 (channel, (guint8*) &config->install_cmap, 1))
  395.     goto cleanup;
  396.   if (!wire_read_int8 (channel, (guint8*) &config->use_xshm, 1))
  397.     goto cleanup;
  398.   if (!wire_read_int32 (channel, (guint32*) &config->min_colors, 1))
  399.     goto cleanup;
  400.   if (!wire_read_int32 (channel, (guint32*) &config->gdisp_ID, 1))
  401.     goto cleanup;
  402.  
  403.   msg->data = config;
  404.   return;
  405.  
  406.  cleanup:
  407.   g_free (config);
  408. }
  409.  
  410. static void
  411. _gp_config_write (GIOChannel  *channel,
  412.           WireMessage *msg)
  413. {
  414.   GPConfig *config;
  415.  
  416.   config = msg->data;
  417.   if (!wire_write_int32 (channel, &config->version, 1))
  418.     return;
  419.   if (!wire_write_int32 (channel, &config->tile_width, 1))
  420.     return;
  421.   if (!wire_write_int32 (channel, &config->tile_height, 1))
  422.     return;
  423.   if (!wire_write_int32 (channel, (guint32*) &config->shm_ID, 1))
  424.     return;
  425.   if (!wire_write_double (channel, &config->gamma, 1))
  426.     return;
  427.   if (!wire_write_int8 (channel, (guint8*) &config->install_cmap, 1))
  428.     return;
  429.   if (!wire_write_int8 (channel, (guint8*) &config->use_xshm, 1))
  430.     return;
  431.   if (!wire_write_int32 (channel, (guint32*) &config->min_colors, 1))
  432.     return;
  433.   if (!wire_write_int32 (channel, (guint32*) &config->gdisp_ID, 1))
  434.     return;
  435. }
  436.  
  437. static void
  438. _gp_config_destroy (WireMessage *msg)
  439. {
  440.   g_free (msg->data);
  441. }
  442.  
  443. /*  tile_req  */
  444.  
  445. static void
  446. _gp_tile_req_read (GIOChannel  *channel,
  447.            WireMessage *msg)
  448. {
  449.   GPTileReq *tile_req;
  450.  
  451.   tile_req = g_new (GPTileReq, 1);
  452.  
  453.   if (!wire_read_int32 (channel, (guint32*) &tile_req->drawable_ID, 1))
  454.     goto cleanup;
  455.   if (!wire_read_int32 (channel, &tile_req->tile_num, 1))
  456.     goto cleanup;
  457.   if (!wire_read_int32 (channel, &tile_req->shadow, 1))
  458.     goto cleanup;
  459.  
  460.   msg->data = tile_req;
  461.   return;
  462.  
  463.  cleanup:
  464.   g_free (tile_req);
  465. }
  466.  
  467. static void
  468. _gp_tile_req_write (GIOChannel  *channel,
  469.             WireMessage *msg)
  470. {
  471.   GPTileReq *tile_req;
  472.  
  473.   tile_req = msg->data;
  474.   if (!wire_write_int32 (channel, (guint32*) &tile_req->drawable_ID, 1))
  475.     return;
  476.   if (!wire_write_int32 (channel, &tile_req->tile_num, 1))
  477.     return;
  478.   if (!wire_write_int32 (channel, &tile_req->shadow, 1))
  479.     return;
  480. }
  481.  
  482. static void
  483. _gp_tile_req_destroy (WireMessage *msg)
  484. {
  485.   g_free (msg->data);
  486. }
  487.  
  488. /*  tile_ack  */
  489.  
  490. static void
  491. _gp_tile_ack_read (GIOChannel  *channel,
  492.            WireMessage *msg)
  493. {
  494. }
  495.  
  496. static void
  497. _gp_tile_ack_write (GIOChannel  *channel,
  498.             WireMessage *msg)
  499. {
  500. }
  501.  
  502. static void
  503. _gp_tile_ack_destroy (WireMessage *msg)
  504. {
  505. }
  506.  
  507. /*  tile_data  */
  508.  
  509. static void
  510. _gp_tile_data_read (GIOChannel  *channel,
  511.             WireMessage *msg)
  512. {
  513.   GPTileData *tile_data;
  514.   guint length;
  515.  
  516.   tile_data = g_new0 (GPTileData, 1);
  517.  
  518.   if (!wire_read_int32 (channel, (guint32*) &tile_data->drawable_ID, 1))
  519.     goto cleanup;
  520.   if (!wire_read_int32 (channel, &tile_data->tile_num, 1))
  521.     goto cleanup;
  522.   if (!wire_read_int32 (channel, &tile_data->shadow, 1))
  523.     goto cleanup;
  524.   if (!wire_read_int32 (channel, &tile_data->bpp, 1))
  525.     goto cleanup;
  526.   if (!wire_read_int32 (channel, &tile_data->width, 1))
  527.     goto cleanup;
  528.   if (!wire_read_int32 (channel, &tile_data->height, 1))
  529.     goto cleanup;
  530.   if (!wire_read_int32 (channel, &tile_data->use_shm, 1))
  531.     goto cleanup;
  532.  
  533.   if (!tile_data->use_shm)
  534.     {
  535.       length = tile_data->width * tile_data->height * tile_data->bpp;
  536.       tile_data->data = g_new (guchar, length);
  537.  
  538.       if (!wire_read_int8 (channel, (guint8*) tile_data->data, length))
  539.     goto cleanup;
  540.     }
  541.  
  542.   msg->data = tile_data;
  543.   return;
  544.  
  545.  cleanup:
  546.   g_free (tile_data->data);
  547.   g_free (tile_data);
  548. }
  549.  
  550. static void
  551. _gp_tile_data_write (GIOChannel  *channel,
  552.              WireMessage *msg)
  553. {
  554.   GPTileData *tile_data;
  555.   guint length;
  556.  
  557.   tile_data = msg->data;
  558.   if (!wire_write_int32 (channel, (guint32*) &tile_data->drawable_ID, 1))
  559.     return;
  560.   if (!wire_write_int32 (channel, &tile_data->tile_num, 1))
  561.     return;
  562.   if (!wire_write_int32 (channel, &tile_data->shadow, 1))
  563.     return;
  564.   if (!wire_write_int32 (channel, &tile_data->bpp, 1))
  565.     return;
  566.   if (!wire_write_int32 (channel, &tile_data->width, 1))
  567.     return;
  568.   if (!wire_write_int32 (channel, &tile_data->height, 1))
  569.     return;
  570.   if (!wire_write_int32 (channel, &tile_data->use_shm, 1))
  571.     return;
  572.  
  573.   if (!tile_data->use_shm)
  574.     {
  575.       length = tile_data->width * tile_data->height * tile_data->bpp;
  576.       if (!wire_write_int8 (channel, (guint8*) tile_data->data, length))
  577.     return;
  578.     }
  579. }
  580.  
  581. static void
  582. _gp_tile_data_destroy (WireMessage *msg)
  583. {
  584.   GPTileData *tile_data;
  585.  
  586.   tile_data = msg->data;
  587.  
  588.   g_free (tile_data->data);
  589.   g_free (tile_data);
  590. }
  591.  
  592. /*  proc_run  */
  593.  
  594. static void
  595. _gp_proc_run_read (GIOChannel  *channel,
  596.            WireMessage *msg)
  597. {
  598.   GPProcRun *proc_run;
  599.  
  600.   proc_run = g_new (GPProcRun, 1);
  601.  
  602.   if (!wire_read_string (channel, &proc_run->name, 1))
  603.     goto cleanup;
  604.  
  605.   _gp_params_read (channel, &proc_run->params, (guint*) &proc_run->nparams);
  606.  
  607.   msg->data = proc_run;
  608.   return;
  609.  
  610.  cleanup:
  611.   g_free (proc_run);
  612. }
  613.  
  614. static void
  615. _gp_proc_run_write (GIOChannel  *channel,
  616.             WireMessage *msg)
  617. {
  618.   GPProcRun *proc_run;
  619.  
  620.   proc_run = msg->data;
  621.  
  622.   if (!wire_write_string (channel, &proc_run->name, 1))
  623.     return;
  624.  
  625.   _gp_params_write (channel, proc_run->params, proc_run->nparams);
  626. }
  627.  
  628. static void
  629. _gp_proc_run_destroy (WireMessage *msg)
  630. {
  631.   GPProcRun *proc_run;
  632.  
  633.   proc_run = msg->data;
  634.   _gp_params_destroy (proc_run->params, proc_run->nparams);
  635.  
  636.   g_free (proc_run->name);
  637.   g_free (proc_run);
  638. }
  639.  
  640. /*  proc_return  */
  641.  
  642. static void
  643. _gp_proc_return_read (GIOChannel  *channel,
  644.               WireMessage *msg)
  645. {
  646.   GPProcReturn *proc_return;
  647.  
  648.   proc_return = g_new (GPProcReturn, 1);
  649.  
  650.   if (!wire_read_string (channel, &proc_return->name, 1))
  651.     goto cleanup;
  652.  
  653.   _gp_params_read (channel, &proc_return->params, (guint*) &proc_return->nparams);
  654.  
  655.   msg->data = proc_return;
  656.   return;
  657.  
  658.  cleanup:
  659.   g_free (proc_return);
  660. }
  661.  
  662. static void
  663. _gp_proc_return_write (GIOChannel  *channel,
  664.                WireMessage *msg)
  665. {
  666.   GPProcReturn *proc_return;
  667.  
  668.   proc_return = msg->data;
  669.  
  670.   if (!wire_write_string (channel, &proc_return->name, 1))
  671.     return;
  672.   _gp_params_write (channel, proc_return->params, proc_return->nparams);
  673. }
  674.  
  675. static void
  676. _gp_proc_return_destroy (WireMessage *msg)
  677. {
  678.   GPProcReturn *proc_return;
  679.  
  680.   proc_return = msg->data;
  681.   _gp_params_destroy (proc_return->params, proc_return->nparams);
  682.  
  683.   g_free (proc_return->name);
  684.   g_free (proc_return);
  685. }
  686.  
  687. /*  temp_proc_run  */
  688.  
  689. static void
  690. _gp_temp_proc_run_read (GIOChannel  *channel,
  691.             WireMessage *msg)
  692. {
  693.   _gp_proc_run_read (channel, msg);
  694. }
  695.  
  696. static void
  697. _gp_temp_proc_run_write (GIOChannel  *channel,
  698.              WireMessage *msg)
  699. {
  700.   _gp_proc_run_write (channel, msg);
  701. }
  702.  
  703. static void
  704. _gp_temp_proc_run_destroy (WireMessage *msg)
  705. {
  706.   _gp_proc_run_destroy (msg);
  707. }
  708.  
  709. /*  temp_proc_return  */
  710.  
  711. static void
  712. _gp_temp_proc_return_read (GIOChannel  *channel,
  713.                WireMessage *msg)
  714. {
  715.   _gp_proc_return_read (channel, msg);
  716. }
  717.  
  718. static void
  719. _gp_temp_proc_return_write (GIOChannel  *channel,
  720.                 WireMessage *msg)
  721. {
  722.   _gp_proc_return_write (channel, msg);
  723. }
  724.  
  725. static void
  726. _gp_temp_proc_return_destroy (WireMessage *msg)
  727. {
  728.   _gp_proc_return_destroy (msg);
  729. }
  730.  
  731. /*  proc_install  */
  732.  
  733. static void
  734. _gp_proc_install_read (GIOChannel  *channel,
  735.                WireMessage *msg)
  736. {
  737.   GPProcInstall *proc_install;
  738.   gint i;
  739.  
  740.   proc_install = g_new0 (GPProcInstall, 1);
  741.  
  742.   if (!wire_read_string (channel, &proc_install->name, 1))
  743.     goto cleanup;
  744.   if (!wire_read_string (channel, &proc_install->blurb, 1))
  745.     goto cleanup;
  746.   if (!wire_read_string (channel, &proc_install->help, 1))
  747.     goto cleanup;
  748.   if (!wire_read_string (channel, &proc_install->author, 1))
  749.     goto cleanup;
  750.   if (!wire_read_string (channel, &proc_install->copyright, 1))
  751.     goto cleanup;
  752.   if (!wire_read_string (channel, &proc_install->date, 1))
  753.     goto cleanup;
  754.   if (!wire_read_string (channel, &proc_install->menu_path, 1))
  755.     goto cleanup;
  756.   if (!wire_read_string (channel, &proc_install->image_types, 1))
  757.     goto cleanup;
  758.  
  759.   if (!wire_read_int32 (channel, &proc_install->type, 1))
  760.     goto cleanup;
  761.   if (!wire_read_int32 (channel, &proc_install->nparams, 1))
  762.     goto cleanup;
  763.   if (!wire_read_int32 (channel, &proc_install->nreturn_vals, 1))
  764.     goto cleanup;
  765.  
  766.   proc_install->params = g_new0 (GPParamDef, proc_install->nparams);
  767.  
  768.   for (i = 0; i < proc_install->nparams; i++)
  769.     {
  770.       if (!wire_read_int32 (channel, (guint32*) &proc_install->params[i].type, 1))
  771.     goto cleanup;
  772.       if (!wire_read_string (channel, &proc_install->params[i].name, 1))
  773.     goto cleanup;
  774.       if (!wire_read_string (channel, &proc_install->params[i].description, 1))
  775.     goto cleanup;
  776.     }
  777.  
  778.   proc_install->return_vals = g_new0 (GPParamDef, proc_install->nreturn_vals);
  779.  
  780.   for (i = 0; i < proc_install->nreturn_vals; i++)
  781.     {
  782.       if (!wire_read_int32 (channel, (guint32*) &proc_install->return_vals[i].type, 1))
  783.     goto cleanup;
  784.       if (!wire_read_string (channel, &proc_install->return_vals[i].name, 1))
  785.     goto cleanup;
  786.       if (!wire_read_string (channel, &proc_install->return_vals[i].description, 1))
  787.     goto cleanup;
  788.     }
  789.  
  790.   msg->data = proc_install;
  791.   return;
  792.  
  793.  cleanup:
  794.   g_free (proc_install->name);
  795.   g_free (proc_install->blurb);
  796.   g_free (proc_install->help);
  797.   g_free (proc_install->author);
  798.   g_free (proc_install->copyright);
  799.   g_free (proc_install->date);
  800.   g_free (proc_install->menu_path);
  801.   g_free (proc_install->image_types);
  802.  
  803.   if (proc_install->params)
  804.     {
  805.       for (i = 0; i < proc_install->nparams; i++)
  806.     {
  807.       if (!proc_install->params[i].name)
  808.         break;
  809.  
  810.       g_free (proc_install->params[i].name);
  811.       g_free (proc_install->params[i].description);
  812.     }
  813.  
  814.       g_free (proc_install->params);
  815.     }
  816.  
  817.   if (proc_install->return_vals)
  818.     {
  819.       for (i = 0; i < proc_install->nreturn_vals; i++)
  820.     {
  821.       if (!proc_install->return_vals[i].name)
  822.         break;
  823.  
  824.       g_free (proc_install->return_vals[i].name);
  825.       g_free (proc_install->return_vals[i].description);
  826.     }
  827.  
  828.       g_free (proc_install->return_vals);
  829.     }
  830.  
  831.   g_free (proc_install);
  832. }
  833.  
  834. static void
  835. _gp_proc_install_write (GIOChannel  *channel,
  836.             WireMessage *msg)
  837. {
  838.   GPProcInstall *proc_install;
  839.   gint i;
  840.  
  841.   proc_install = msg->data;
  842.  
  843.   if (!wire_write_string (channel, &proc_install->name, 1))
  844.     return;
  845.   if (!wire_write_string (channel, &proc_install->blurb, 1))
  846.     return;
  847.   if (!wire_write_string (channel, &proc_install->help, 1))
  848.     return;
  849.   if (!wire_write_string (channel, &proc_install->author, 1))
  850.     return;
  851.   if (!wire_write_string (channel, &proc_install->copyright, 1))
  852.     return;
  853.   if (!wire_write_string (channel, &proc_install->date, 1))
  854.     return;
  855.   if (!wire_write_string (channel, &proc_install->menu_path, 1))
  856.     return;
  857.   if (!wire_write_string (channel, &proc_install->image_types, 1))
  858.     return;
  859.  
  860.   if (!wire_write_int32 (channel, &proc_install->type, 1))
  861.     return;
  862.   if (!wire_write_int32 (channel, &proc_install->nparams, 1))
  863.     return;
  864.   if (!wire_write_int32 (channel, &proc_install->nreturn_vals, 1))
  865.     return;
  866.  
  867.   for (i = 0; i < proc_install->nparams; i++)
  868.     {
  869.       if (!wire_write_int32 (channel, (guint32*) &proc_install->params[i].type, 1))
  870.     return;
  871.       if (!wire_write_string (channel, &proc_install->params[i].name, 1))
  872.     return;
  873.       if (!wire_write_string (channel, &proc_install->params[i].description, 1))
  874.     return;
  875.     }
  876.  
  877.   for (i = 0; i < proc_install->nreturn_vals; i++)
  878.     {
  879.       if (!wire_write_int32 (channel, (guint32*) &proc_install->return_vals[i].type, 1))
  880.     return;
  881.       if (!wire_write_string (channel, &proc_install->return_vals[i].name, 1))
  882.     return;
  883.       if (!wire_write_string (channel, &proc_install->return_vals[i].description, 1))
  884.     return;
  885.     }
  886. }
  887.  
  888. static void
  889. _gp_proc_install_destroy (WireMessage *msg)
  890. {
  891.   GPProcInstall *proc_install;
  892.   gint i;
  893.  
  894.   proc_install = msg->data;
  895.  
  896.   g_free (proc_install->name);
  897.   g_free (proc_install->blurb);
  898.   g_free (proc_install->help);
  899.   g_free (proc_install->author);
  900.   g_free (proc_install->copyright);
  901.   g_free (proc_install->date);
  902.   g_free (proc_install->menu_path);
  903.   g_free (proc_install->image_types);
  904.  
  905.   for (i = 0; i < proc_install->nparams; i++)
  906.     {
  907.       g_free (proc_install->params[i].name);
  908.       g_free (proc_install->params[i].description);
  909.     }
  910.  
  911.   for (i = 0; i < proc_install->nreturn_vals; i++)
  912.     {
  913.       g_free (proc_install->return_vals[i].name);
  914.       g_free (proc_install->return_vals[i].description);
  915.     }
  916.  
  917.   g_free (proc_install->params);
  918.   g_free (proc_install->return_vals);
  919.   g_free (proc_install);
  920. }
  921.  
  922. /*  proc_uninstall  */
  923.  
  924. static void
  925. _gp_proc_uninstall_read (GIOChannel  *channel,
  926.              WireMessage *msg)
  927. {
  928.   GPProcUninstall *proc_uninstall;
  929.  
  930.   proc_uninstall = g_new (GPProcUninstall, 1);
  931.  
  932.   if (!wire_read_string (channel, &proc_uninstall->name, 1))
  933.     goto cleanup;
  934.  
  935.   msg->data = proc_uninstall;
  936.   return;
  937.  
  938.  cleanup:
  939.   g_free (proc_uninstall);
  940. }
  941.  
  942. static void
  943. _gp_proc_uninstall_write (GIOChannel *channel, WireMessage *msg)
  944. {
  945.   GPProcUninstall *proc_uninstall;
  946.  
  947.   proc_uninstall = msg->data;
  948.  
  949.   if (!wire_write_string (channel, &proc_uninstall->name, 1))
  950.     return;
  951. }
  952.  
  953. static void
  954. _gp_proc_uninstall_destroy (WireMessage *msg)
  955. {
  956.   GPProcUninstall *proc_uninstall;
  957.  
  958.   proc_uninstall = msg->data;
  959.  
  960.   g_free (proc_uninstall->name);
  961.   g_free (proc_uninstall);
  962. }
  963.  
  964. /*  extension_ack  */
  965.  
  966. static void
  967. _gp_extension_ack_read (GIOChannel  *channel,
  968.             WireMessage *msg)
  969. {
  970. }
  971.  
  972. static void
  973. _gp_extension_ack_write (GIOChannel  *channel,
  974.              WireMessage *msg)
  975. {
  976. }
  977.  
  978. static void
  979. _gp_extension_ack_destroy (WireMessage *msg)
  980. {
  981. }
  982.  
  983. /*  params  */
  984.  
  985. static void
  986. _gp_params_read (GIOChannel  *channel,
  987.          GPParam    **params,
  988.          guint       *nparams)
  989. {
  990.   gint i, j;
  991.  
  992.   if (!wire_read_int32 (channel, (guint32*) nparams, 1))
  993.     return;
  994.  
  995.   if (*nparams == 0)
  996.     {
  997.       *params = NULL;
  998.       return;
  999.     }
  1000.  
  1001.   *params = g_new (GPParam, *nparams);
  1002.  
  1003.   for (i = 0; i < *nparams; i++)
  1004.     {
  1005.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].type, 1))
  1006.     goto cleanup;
  1007.  
  1008.       switch ((*params)[i].type)
  1009.     {
  1010.     case GIMP_PDB_INT32:
  1011.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_int32, 1))
  1012.         goto cleanup;
  1013.       break;
  1014.  
  1015.     case GIMP_PDB_INT16:
  1016.       if (!wire_read_int16 (channel, (guint16*) &(*params)[i].data.d_int16, 1))
  1017.         goto cleanup;
  1018.       break;
  1019.  
  1020.     case GIMP_PDB_INT8:
  1021.       if (!wire_read_int8 (channel, (guint8*) &(*params)[i].data.d_int8, 1))
  1022.         goto cleanup;
  1023.       break;
  1024.  
  1025.         case GIMP_PDB_FLOAT:
  1026.       if (!wire_read_double (channel, &(*params)[i].data.d_float, 1))
  1027.         goto cleanup;
  1028.           break;
  1029.  
  1030.         case GIMP_PDB_STRING:
  1031.       if (!wire_read_string (channel, &(*params)[i].data.d_string, 1))
  1032.         goto cleanup;
  1033.           break;
  1034.  
  1035.         case GIMP_PDB_INT32ARRAY:
  1036.       (*params)[i].data.d_int32array =
  1037.         g_new (gint32, (*params)[i-1].data.d_int32);
  1038.       if (!wire_read_int32 (channel, (guint32*) (*params)[i].data.d_int32array,
  1039.                 (*params)[i-1].data.d_int32))
  1040.         {
  1041.           g_free ((*params)[i].data.d_int32array);
  1042.           goto cleanup;
  1043.         }
  1044.           break;
  1045.  
  1046.         case GIMP_PDB_INT16ARRAY:
  1047.       (*params)[i].data.d_int16array =
  1048.         g_new (gint16, (*params)[i-1].data.d_int32);
  1049.       if (!wire_read_int16 (channel, (guint16*) (*params)[i].data.d_int16array,
  1050.                 (*params)[i-1].data.d_int32))
  1051.         {
  1052.           g_free ((*params)[i].data.d_int16array);
  1053.           goto cleanup;
  1054.         }
  1055.           break;
  1056.  
  1057.         case GIMP_PDB_INT8ARRAY:
  1058.       (*params)[i].data.d_int8array =
  1059.         g_new (gint8, (*params)[i-1].data.d_int32);
  1060.       if (!wire_read_int8 (channel, (guint8*) (*params)[i].data.d_int8array,
  1061.                    (*params)[i-1].data.d_int32))
  1062.         {
  1063.           g_free ((*params)[i].data.d_int8array);
  1064.           goto cleanup;
  1065.         }
  1066.           break;
  1067.  
  1068.         case GIMP_PDB_FLOATARRAY:
  1069.       (*params)[i].data.d_floatarray =
  1070.         g_new (gdouble, (*params)[i-1].data.d_int32);
  1071.       if (!wire_read_double (channel, (*params)[i].data.d_floatarray,
  1072.                  (*params)[i-1].data.d_int32))
  1073.         {
  1074.           g_free ((*params)[i].data.d_floatarray);
  1075.           goto cleanup;
  1076.         }
  1077.           break;
  1078.  
  1079.         case GIMP_PDB_STRINGARRAY:
  1080.       (*params)[i].data.d_stringarray =
  1081.         g_new0 (gchar*, (*params)[i-1].data.d_int32);
  1082.       if (!wire_read_string (channel, (*params)[i].data.d_stringarray,
  1083.                  (*params)[i-1].data.d_int32))
  1084.         {
  1085.           for (j = 0; j < (*params)[i-1].data.d_int32; j++)
  1086.         g_free (((*params)[i].data.d_stringarray)[j]);
  1087.           g_free ((*params)[i].data.d_stringarray);
  1088.           goto cleanup;
  1089.         }
  1090.           break;
  1091.  
  1092.         case GIMP_PDB_COLOR:
  1093.       if (!wire_read_int8 (channel, (guint8*) &(*params)[i].data.d_color.red, 1))
  1094.         goto cleanup;
  1095.       if (!wire_read_int8 (channel, (guint8*) &(*params)[i].data.d_color.green, 1))
  1096.         goto cleanup;
  1097.       if (!wire_read_int8 (channel, (guint8*) &(*params)[i].data.d_color.blue, 1))
  1098.         goto cleanup;
  1099.           break;
  1100.  
  1101.         case GIMP_PDB_REGION:
  1102.           break;
  1103.  
  1104.         case GIMP_PDB_DISPLAY:
  1105.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_display, 1))
  1106.         goto cleanup;
  1107.           break;
  1108.  
  1109.         case GIMP_PDB_IMAGE:
  1110.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_image, 1))
  1111.         goto cleanup;
  1112.           break;
  1113.  
  1114.         case GIMP_PDB_LAYER:
  1115.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_layer, 1))
  1116.         goto cleanup;
  1117.           break;
  1118.  
  1119.         case GIMP_PDB_CHANNEL:
  1120.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_channel, 1))
  1121.         goto cleanup;
  1122.           break;
  1123.  
  1124.         case GIMP_PDB_DRAWABLE:
  1125.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_drawable, 1))
  1126.         goto cleanup;
  1127.           break;
  1128.  
  1129.         case GIMP_PDB_SELECTION:
  1130.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_selection, 1))
  1131.         goto cleanup;
  1132.           break;
  1133.  
  1134.         case GIMP_PDB_BOUNDARY:
  1135.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_boundary, 1))
  1136.         goto cleanup;
  1137.           break;
  1138.  
  1139.         case GIMP_PDB_PATH:
  1140.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_path, 1))
  1141.         goto cleanup;
  1142.           break;
  1143.  
  1144.         case GIMP_PDB_PARASITE:
  1145.       if (!wire_read_string (channel, &(*params)[i].data.d_parasite.name, 1))
  1146.         goto cleanup;
  1147.       if ((*params)[i].data.d_parasite.name == NULL)
  1148.         {
  1149.           /* we have a null parasite */
  1150.           (*params)[i].data.d_parasite.data = NULL;
  1151.           break;
  1152.         }
  1153.       if (!wire_read_int32 (channel, &((*params)[i].data.d_parasite.flags), 1))
  1154.         goto cleanup;
  1155.       if (!wire_read_int32 (channel, &((*params)[i].data.d_parasite.size), 1))
  1156.         goto cleanup;
  1157.       if ((*params)[i].data.d_parasite.size > 0)
  1158.         {
  1159.           (*params)[i].data.d_parasite.data = g_malloc ((*params)[i].data.d_parasite.size);
  1160.           if (!wire_read_int8 (channel, (*params)[i].data.d_parasite.data,
  1161.                    (*params)[i].data.d_parasite.size))
  1162.         {
  1163.           g_free ((*params)[i].data.d_parasite.data);
  1164.           goto cleanup;
  1165.         }
  1166.         }
  1167.       else
  1168.         (*params)[i].data.d_parasite.data = NULL;
  1169.       break;
  1170.  
  1171.         case GIMP_PDB_STATUS:
  1172.       if (!wire_read_int32 (channel, (guint32*) &(*params)[i].data.d_status, 1))
  1173.         goto cleanup;
  1174.           break;
  1175.  
  1176.     case GIMP_PDB_END:
  1177.       break;
  1178.     }
  1179.     }
  1180.  
  1181.   return;
  1182.  
  1183.  cleanup:
  1184.   *nparams = 0;
  1185.   g_free (*params);
  1186.   *params = NULL;
  1187. }
  1188.  
  1189. static void
  1190. _gp_params_write (GIOChannel *channel,
  1191.           GPParam    *params,
  1192.           gint        nparams)
  1193. {
  1194.   gint i;
  1195.  
  1196.   if (!wire_write_int32 (channel, (guint32*) &nparams, 1))
  1197.     return;
  1198.  
  1199.   for (i = 0; i < nparams; i++)
  1200.     {
  1201.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].type, 1))
  1202.     return;
  1203.  
  1204.       switch (params[i].type)
  1205.     {
  1206.     case GIMP_PDB_INT32:
  1207.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_int32, 1))
  1208.         return;
  1209.       break;
  1210.  
  1211.     case GIMP_PDB_INT16:
  1212.       if (!wire_write_int16 (channel, (guint16*) ¶ms[i].data.d_int16, 1))
  1213.         return;
  1214.       break;
  1215.  
  1216.     case GIMP_PDB_INT8:
  1217.       if (!wire_write_int8 (channel, (guint8*) ¶ms[i].data.d_int8, 1))
  1218.         return;
  1219.       break;
  1220.  
  1221.         case GIMP_PDB_FLOAT:
  1222.       if (!wire_write_double (channel, ¶ms[i].data.d_float, 1))
  1223.         return;
  1224.           break;
  1225.  
  1226.         case GIMP_PDB_STRING:
  1227.       if (!wire_write_string (channel, ¶ms[i].data.d_string, 1))
  1228.         return;
  1229.           break;
  1230.  
  1231.         case GIMP_PDB_INT32ARRAY:
  1232.       if (!wire_write_int32 (channel, (guint32*) params[i].data.d_int32array,
  1233.                  params[i-1].data.d_int32))
  1234.         return;
  1235.           break;
  1236.  
  1237.         case GIMP_PDB_INT16ARRAY:
  1238.       if (!wire_write_int16 (channel, (guint16*) params[i].data.d_int16array,
  1239.                  params[i-1].data.d_int32))
  1240.         return;
  1241.           break;
  1242.  
  1243.         case GIMP_PDB_INT8ARRAY:
  1244.       if (!wire_write_int8 (channel, (guint8*) params[i].data.d_int8array,
  1245.                 params[i-1].data.d_int32))
  1246.         return;
  1247.           break;
  1248.  
  1249.         case GIMP_PDB_FLOATARRAY:
  1250.       if (!wire_write_double (channel, params[i].data.d_floatarray,
  1251.                   params[i-1].data.d_int32))
  1252.         return;
  1253.           break;
  1254.  
  1255.         case GIMP_PDB_STRINGARRAY:
  1256.       if (!wire_write_string (channel, params[i].data.d_stringarray,
  1257.                   params[i-1].data.d_int32))
  1258.         return;
  1259.           break;
  1260.  
  1261.         case GIMP_PDB_COLOR:
  1262.       if (!wire_write_int8 (channel, (guint8*) ¶ms[i].data.d_color.red, 1))
  1263.         return;
  1264.       if (!wire_write_int8 (channel, (guint8*) ¶ms[i].data.d_color.green, 1))
  1265.         return;
  1266.       if (!wire_write_int8 (channel, (guint8*) ¶ms[i].data.d_color.blue, 1))
  1267.         return;
  1268.           break;
  1269.  
  1270.         case GIMP_PDB_REGION:
  1271.           break;
  1272.  
  1273.         case GIMP_PDB_DISPLAY:
  1274.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_display, 1))
  1275.         return;
  1276.           break;
  1277.  
  1278.         case GIMP_PDB_IMAGE:
  1279.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_image, 1))
  1280.         return;
  1281.           break;
  1282.  
  1283.         case GIMP_PDB_LAYER:
  1284.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_layer, 1))
  1285.         return;
  1286.           break;
  1287.  
  1288.         case GIMP_PDB_CHANNEL:
  1289.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_channel, 1))
  1290.         return;
  1291.           break;
  1292.  
  1293.         case GIMP_PDB_DRAWABLE:
  1294.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_drawable, 1))
  1295.         return;
  1296.           break;
  1297.  
  1298.         case GIMP_PDB_SELECTION:
  1299.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_selection, 1))
  1300.         return;
  1301.           break;
  1302.  
  1303.         case GIMP_PDB_BOUNDARY:
  1304.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_boundary, 1))
  1305.         return;
  1306.           break;
  1307.  
  1308.         case GIMP_PDB_PATH:
  1309.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_path, 1))
  1310.         return;
  1311.           break;
  1312.  
  1313.         case GIMP_PDB_PARASITE:
  1314.       {
  1315.         GimpParasite *p = (GimpParasite *) ¶ms[i].data.d_parasite;
  1316.         if (p->name == NULL)
  1317.           {
  1318.         /* write a null string to signifly a null parasite */
  1319.         wire_write_string (channel,  &p->name, 1);
  1320.         break;
  1321.           }
  1322.         if (!wire_write_string (channel, &p->name, 1))
  1323.           return;
  1324.         if (!wire_write_int32 (channel, &p->flags, 1))
  1325.           return;
  1326.         if (!wire_write_int32 (channel, &p->size, 1))
  1327.           return;
  1328.         if (p->size > 0)
  1329.           {
  1330.         if (!wire_write_int8 (channel, p->data, p->size))
  1331.           return;
  1332.           }
  1333.       }
  1334.       break;
  1335.  
  1336.         case GIMP_PDB_STATUS:
  1337.       if (!wire_write_int32 (channel, (guint32*) ¶ms[i].data.d_status, 1))
  1338.         return;
  1339.           break;
  1340.  
  1341.     case GIMP_PDB_END:
  1342.       break;
  1343.     }
  1344.     }
  1345. }
  1346.  
  1347. void
  1348. _gp_params_destroy (GPParam *params,
  1349.             gint     nparams)
  1350. {
  1351.   gint count;
  1352.   gint i, j;
  1353.  
  1354.   for (i = 0; i < nparams; i++)
  1355.     {
  1356.       switch (params[i].type)
  1357.     {
  1358.     case GIMP_PDB_INT32:
  1359.     case GIMP_PDB_INT16:
  1360.     case GIMP_PDB_INT8:
  1361.     case GIMP_PDB_FLOAT:
  1362.     case GIMP_PDB_COLOR:
  1363.     case GIMP_PDB_REGION:
  1364.     case GIMP_PDB_DISPLAY:
  1365.     case GIMP_PDB_IMAGE:
  1366.     case GIMP_PDB_LAYER:
  1367.     case GIMP_PDB_CHANNEL:
  1368.     case GIMP_PDB_DRAWABLE:
  1369.     case GIMP_PDB_SELECTION:
  1370.     case GIMP_PDB_BOUNDARY:
  1371.     case GIMP_PDB_PATH:
  1372.     case GIMP_PDB_STATUS:
  1373.       break;
  1374.  
  1375.     case GIMP_PDB_STRING:
  1376.       g_free (params[i].data.d_string);
  1377.       break;
  1378.  
  1379.     case GIMP_PDB_INT32ARRAY:
  1380.       g_free (params[i].data.d_int32array);
  1381.       break;
  1382.  
  1383.     case GIMP_PDB_INT16ARRAY:
  1384.       g_free (params[i].data.d_int16array);
  1385.       break;
  1386.  
  1387.     case GIMP_PDB_INT8ARRAY:
  1388.       g_free (params[i].data.d_int8array);
  1389.       break;
  1390.  
  1391.     case GIMP_PDB_FLOATARRAY:
  1392.       g_free (params[i].data.d_floatarray);
  1393.       break;
  1394.  
  1395.     case GIMP_PDB_STRINGARRAY:
  1396.       if ((i > 0) && (params[i-1].type == GIMP_PDB_INT32))
  1397.         {
  1398.           count = params[i-1].data.d_int32;
  1399.           for (j = 0; j < count; j++)
  1400.         g_free (params[i].data.d_stringarray[j]);
  1401.           g_free (params[i].data.d_stringarray);
  1402.         }
  1403.       break;
  1404.  
  1405.     case GIMP_PDB_PARASITE:
  1406.       if (params[i].data.d_parasite.name)
  1407.         g_free(params[i].data.d_parasite.name);
  1408.       if (params[i].data.d_parasite.data)
  1409.         g_free(params[i].data.d_parasite.data);
  1410.       break;
  1411.  
  1412.     case GIMP_PDB_END:
  1413.       break;
  1414.     }
  1415.     }
  1416.  
  1417.   g_free (params);
  1418. }
  1419.