aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-marshal-utils.c
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>1999-10-09 03:21:51 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-10-09 03:21:51 +0800
commitf1d9513767d88c68505af3564acc54388c9cc6ce (patch)
treefcf151dc48894840e3054ee8a39316cb0c042ace /camel/camel-marshal-utils.c
parent182bac9d134bba25fa3b576aea1b5fd32c06faad (diff)
downloadgsoc2013-evolution-f1d9513767d88c68505af3564acc54388c9cc6ce.tar.gz
gsoc2013-evolution-f1d9513767d88c68505af3564acc54388c9cc6ce.tar.zst
gsoc2013-evolution-f1d9513767d88c68505af3564acc54388c9cc6ce.zip
weekly commit
svn path=/trunk/; revision=1322
Diffstat (limited to 'camel/camel-marshal-utils.c')
-rw-r--r--camel/camel-marshal-utils.c195
1 files changed, 160 insertions, 35 deletions
diff --git a/camel/camel-marshal-utils.c b/camel/camel-marshal-utils.c
index 95cf1577bb..bb12318837 100644
--- a/camel/camel-marshal-utils.c
+++ b/camel/camel-marshal-utils.c
@@ -27,8 +27,13 @@
#include "config.h"
#include "camel-log.h"
#include "camel-marshal-utils.h"
+#include "camel-arg-collector.c"
+#define NB_OP_CHUNKS 20
+static GMemChunk *op_chunk=NULL;
+static GStaticMutex op_chunk_mutex = G_STATIC_MUTEX_INIT;
+
CamelFuncDef *
camel_func_def_new (CamelMarshal marshal, guint n_params, ...)
{
@@ -60,20 +65,22 @@ _collect_params (GtkArg *params,
CamelFuncDef *func_def,
va_list var_args)
{
- register GtkArg *last_param;
- register gboolean failed = FALSE;
-
- for (last_param = params + func_def->n_params;
- params < last_param;
- params++)
+ GtkArg *last_param;
+ int i;
+ gboolean failed = FALSE;
+
+
+ for (i=0;
+ i<func_def->n_params;
+ i++, params++)
{
- register gchar *error;
+ gchar *error;
params->name = NULL;
- params->type = *(func_def->params_type++);
- GTK_ARG_COLLECT_VALUE (params,
- var_args,
- error);
+ params->type = (func_def->params_type) [i];
+ CAMEL_ARG_COLLECT_VALUE (params,
+ var_args,
+ error);
if (error)
{
failed = TRUE;
@@ -85,30 +92,20 @@ _collect_params (GtkArg *params,
}
-gboolean
-camel_marshal_exec_func (CamelFuncDef *func_def, ...)
-{
- GtkArg *params;
- gboolean error;
- va_list args;
-
- g_assert (func_def);
-
- params = g_new (GtkArg, func_def->n_params);
-
- va_start (args, func_def);
- error = _collect_params (params, func_def, args);
- va_end (args);
- if (!error)
- error = func_def->marshal (func_def->func, params);
-
- g_free (params);
- return (!error);
-}
-
+/**
+ * camel_marshal_create_op: create an operation
+ * @func_def: function definition object
+ * @func: function to call
+ *
+ * create a function ready to be executed. The
+ * vari
+ *
+ *
+ * Return value: operation ready to be executed
+ **/
CamelOp *
-camel_marshal_create_op (CamelFuncDef *func_def, ...)
+camel_marshal_create_op (CamelFuncDef *func_def, CamelFunc func, ...)
{
GtkArg *params;
gboolean error;
@@ -118,8 +115,9 @@ camel_marshal_create_op (CamelFuncDef *func_def, ...)
g_assert (func_def);
op = camel_op_new (func_def);
-
- va_start (args, func_def);
+ op->func = func;
+
+ va_start (args, func);
error = _collect_params (op->params, func_def, args);
va_end (args);
@@ -133,6 +131,102 @@ camel_marshal_create_op (CamelFuncDef *func_def, ...)
+/**
+ * camel_op_new: return a new CamelOp object
+ *
+ * The obtained object must be destroyed with
+ * camel_op_free ()
+ *
+ * Return value: the newly allocated CamelOp object
+ **/
+CamelOp *
+camel_op_new (CamelFuncDef *func_def)
+{
+ CamelOp *op;
+
+ g_static_mutex_lock (&op_chunk_mutex);
+ if (!op_chunk)
+ op_chunk = g_mem_chunk_create (CamelOp,
+ NB_OP_CHUNKS,
+ G_ALLOC_AND_FREE);
+ g_static_mutex_unlock (&op_chunk_mutex);
+
+ op = g_chunk_new (CamelOp, op_chunk);
+ op->func_def = func_def;
+ op->params = g_new (GtkArg, func_def->n_params);
+
+ return op;
+}
+
+/**
+ * camel_op_free: free a CamelOp object allocated with camel_op_new
+ * @op: CamelOp object to free
+ *
+ * Free a CamelOp object allocated with camel_op_new ()
+ * this routine won't work with CamelOp objects allocated
+ * with other allocators.
+ **/
+void
+camel_op_free (CamelOp *op)
+{
+ g_free (op->params);
+ g_chunk_free (op, op_chunk);
+}
+
+
+/**
+ * camel_op_run: run an operation
+ * @op: the operation object
+ *
+ * run an operation
+ *
+ **/
+void
+camel_op_run (CamelOp *op)
+{
+ GtkArg *params;
+ gboolean error;
+
+ g_assert (op);
+ g_assert (op->func_def);
+ g_assert (op->params);
+
+ op->func_def->marshal (op->func, op->params);
+}
+
+
+
+
+/**
+ * camel_op_set_user_data: set the private field
+ * @op: operation
+ * @user_data: private field
+ *
+ * associate a field to an operation object
+ **/
+void
+camel_op_set_user_data (CamelOp *op, gpointer user_data)
+{
+ g_assert (op);
+ op->user_data = user_data;
+}
+
+
+/**
+ * camel_op_get_user_data: return the private field
+ * @op: operation object
+ *
+ * return the private field associated to
+ * an operation object.
+ *
+ * Return value:
+ **/
+gpointer
+camel_op_get_user_data (CamelOp *op)
+{
+ g_assert (op);
+ return op->user_data;
+}
@@ -166,3 +260,34 @@ void camel_marshal_NONE__POINTER_INT_POINTER (CamelFunc func,
GTK_VALUE_INT(args[1]),
GTK_VALUE_POINTER(args[2]));
}
+
+typedef void (*CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) (gpointer arg1,
+ gint arg2,
+ gpointer arg3,
+ gpointer arg4);
+void camel_marshal_NONE__POINTER_INT_POINTER_POINTER (CamelFunc func,
+ GtkArg *args)
+{
+ CamelMarshal_NONE__POINTER_INT_POINTER_POINTER rfunc;
+ rfunc = (CamelMarshal_NONE__POINTER_INT_POINTER_POINTER) func;
+ (* rfunc) (GTK_VALUE_POINTER(args[0]),
+ GTK_VALUE_INT(args[1]),
+ GTK_VALUE_POINTER(args[2]),
+ GTK_VALUE_POINTER(args[3]));
+}
+
+
+typedef void (*CamelMarshal_NONE__INT) (gint arg1);
+void camel_marshal_NONE__INT (CamelFunc func,
+ GtkArg *args)
+{
+ CamelMarshal_NONE__INT rfunc;
+ rfunc = (CamelMarshal_NONE__INT) func;
+ (* rfunc) (GTK_VALUE_INT (args[0]));
+}
+
+
+
+
+
+
al&id=e705f15465e71f1859f2ade3193bde40195669d0'>- Update to 2013.12.29sunpoet2013-12-302-3/+3 * Update to version 4.5.17.bsam2013-12-251-2/+2 * - Update to 2013.12.15sunpoet2013-12-192-3/+3 * - Update Calligra Suite to 2.7.5.avilla2013-12-173-5/+4 * - Update to 20131206sunpoet2013-12-092-3/+3 * - Update to 2013.12.08sunpoet2013-12-092-3/+3 * - Update to 2013.12.01sunpoet2013-12-022-3/+3 * - Update to 2013.11.24sunpoet2013-11-252-3/+3 * - Remove now needless qmake_build from USE_QT4makc2013-11-221-1/+1 * . svn copy tryton -> tryton28 ports;bsam2013-11-216-1/+50 * - Convert to dos2unix.mkmat2013-11-202-5/+4 * - Add my LOCAL to MASTER_SITESsunpoet2013-11-191-4/+8 * Restore "created by" header missing at some trytond* ports (in preparationbsam2013-11-181-0/+1 * Support STAGE (in preparation to commit PR/181691)..bsam2013-11-181-1/+0 * - Update to 2013.11.17sunpoet2013-11-182-3/+3 * - Use single space after WWW:sunpoet2013-11-182-2/+2 * - Update to 2013.11.10sunpoet2013-11-112-3/+3 * Update to version 4.5.15.bsam2013-11-111-2/+2 * - Update to 3.7.1sunpoet2013-11-102-3/+3 * Stagifybapt2013-11-041-5/+4 * Stagifybapt2013-11-041-6/+4 * Support stage, use bsdtar to extractbapt2013-11-041-9/+7 * - Update to 2013.11.03sunpoet2013-11-042-3/+3 * Stagifybapt2013-11-041-1/+0 * german/tipp10: Finish C++ fixes for gcc48marino2013-10-304-0/+53 * - revert r331810dinoex2013-10-291-5/+4 * - Update to 2013.10.27sunpoet2013-10-292-3/+3 * - use STAGEDIRdinoex2013-10-281-13/+11 * Update to libmpc version 1.0.1 which brings the following fixes:gerald2013-10-261-0/+1 * - Update to 4.0.6.jkim2013-10-262-5/+4 * Support staging.ehaupt2013-10-241-2/+1 * - Update to 2013.10.20sunpoet2013-10-212-3/+3 * - update german bugzilla templatesohauer2013-10-196-11/+10 * - fix RUN_DEPENDSohauer2013-10-181-1/+1 * - adjust include pathohauer2013-10-181-1/+1 * - update to latest release [1]ohauer2013-10-188-10/+4 * - Update to 2013.10.13sunpoet2013-10-142-3/+3 * - Convert unmaintained ports to USES=qmakemakc2013-10-132-27/+23 * Update to version 4.5.15.bsam2013-10-091-2/+2 * - Update to 2013.10.06sunpoet2013-10-082-3/+3 * . support staging;bsam2013-10-061-1/+0 * german/tipp10: Fix c++ -fpermissive errors on gcc 4.7+marino2013-10-021-0/+46 * - Update to 2013.09.29sunpoet2013-09-302-3/+3 * - Update to 3.6.1sunpoet2013-09-292-5/+4 * - add STAGE support to bugzilla portsohauer2013-09-273-24/+6 * - Update to 3.3.0lme2013-09-255-27/+32 * - Update to 2013.09.22sunpoet2013-09-232-3/+3 * Fix NO_STAGE attributionbapt2013-09-233-3/+3 * - fix misplaced NO_STAGE in slaveports and ifdefsdinoex2013-09-213-3/+4 * Add NO_STAGE all over the place in preparation for the staging support (cat: ...bapt2013-09-2142-100/+61 * - Update to 2013.09.15sunpoet2013-09-162-3/+3 * - convert to the new perl5 frameworkaz2013-09-114-19/+7 * - Update to 2013.09.08sunpoet2013-09-092-3/+3 * - Update to 2013.09.01sunpoet2013-09-022-3/+3 * - remove expired bugzilla3 portsohauer2013-08-306-341/+0 * Update to version 4.5.14.bsam2013-08-231-2/+2 * Update to 4.0.5.jkim2013-08-231-4/+4 * - Update to 2013.08.18sunpoet2013-08-192-3/+3 * - Update to 2013.08.11sunpoet2013-08-162-3/+3 * - Convert to new perl frameworkaz2013-08-041-2/+2 * KDE3 and QT3 expired on 2013-07-01, remove these ports.rene2013-07-2713-2937/+0 * - fix buildohauer2013-07-211-1/+2 * - Update to 3.5.2miwi2013-07-203-4/+4 * Fix INDEX by really fixing the kde4-l10n portsbapt2013-07-101-0/+1 * KDE4 l10n fixes.rakuco2013-07-102-3/+1 * - Convert USE_GMAKE to USES=gmakeehaupt2013-07-091-5/+1 * Update to version 4.5.13.bsam2013-07-081-2/+2 * - Fix plistlme2013-07-062-7/+3 * Update the KDE Software Compilation to 4.10.5.rakuco2013-07-051-2/+2 * Update to KDE SC 4.10.4, proudly presented by the KDE on FreeBSD team.rakuco2013-07-031-2/+2 * New ports for bugzilla44ohauer2013-06-216-0/+339 * Update to 4.0.4.jkim2013-06-201-4/+4 * Update to version 4.5.12.bsam2013-06-101-2/+2 * - update bugzilla42 to version 4.2.6 (bugfix release)ohauer2013-05-242-3/+3 * - Update MASTER_SITES and COMMENTwen2013-05-191-3/+4 * KDE/FreeBSD team presents KDE SC 4.10.3 ports!makc2013-05-192-4/+3 * Update to 4.0.3.jkim2013-05-101-4/+4 * - Update to 2013.05.05sunpoet2013-05-082-3/+3 * Add some shebangfix to allow building most of the ports tree without /usr/bin...bapt2013-05-071-5/+2 * Chase textproc/libebml, multimedia/libmatroska update.ehaupt2013-05-071-1/+1 * Update to 3.18.stefan2013-04-274-19/+78 * - Convert USE_GETTEXT to USES (part 2)ak2013-04-241-1/+1 * Update to version 4.5.10.bsam2013-04-231-2/+2 * Update to 4.0.2.jkim2013-04-171-4/+4 * - Update Calligra and l10n ports to 2.6.2:avilla2013-03-302-7/+5 * KDE/FreeBSD team presents KDE SC 4.10.1 ports!makc2013-03-274-36/+45 * Update to version 4.5.9.bsam2013-03-112-3/+2 * Update to 4.0.1.jkim2013-03-091-4/+4 * - remove german, french and japanese localization of www/MT. They wererm2013-02-243-22/+0 * - update german bugzilla templatesohauer2013-02-216-9/+9 * Merge from area51 repository:makc2013-02-052-3/+3 * Update to 3.6.5.jkim2013-02-051-4/+4 * KDE/FreeBSD team presents KDE SC 4.9.5 ports!makc2013-02-044-32/+242 * Bump PORTREVISON after devel/py-sip and devel/qscintilla2 update.makc2013-02-041-1/+1 * Update to 3.5.1.delphij2013-01-302-5/+4 * Bump PORTREVISION after DESKTOP_ENTRIES updatemakc2013-01-231-0/+1 * - Update to 3.1.0lme2013-01-183-7/+13 * - Change MAINTAINER addresstabthorpe2013-01-102-10/+2 * Fix pkg-descr, this is a KDE4 port, not a KDE3 one.rakuco2012-12-311-1/+1 * - Deprecate QT3, KDE3 and unmaintained ports depending on them. QT 3.3.8beat2012-12-302-0/+6 * - Reassign to the heap at maintainer's requesttabthorpe2012-12-291-6/+2 * 2012-11-27 java/jmp: Java 1.5 is EOLedbapt2012-11-285-71/+0 * - update german and russian bugzilla templates to official new versionsohauer2012-11-169-240/+21 * - fix german bugzilla templates (security fixes)ohauer2012-11-156-13/+231 * Remove the patch to poll.C (note the uppercase .C extension). It is an_hibma2012-11-011-11/+0 * - Update to 3.5.7.jkim2012-10-272-9/+4 * Deprecate a bunch of ports that are either abandonware and/or for which no morebapt2012-10-261-0/+3 * Update to version 4.5.7. This along with fixing other bugs shouldbsam2012-10-152-2/+3 * - Update to 3.4.2swills2012-10-143-11/+10 * - cleanup commentsdinoex2012-10-134-19/+0 * - Update to 2012.10.07sunpoet2012-10-132-3/+3 * - Update to 2012.09.07sunpoet2012-10-092-3/+3 * . update to version 4.5.6;bsam2012-10-032-7/+3 * - Update to 2012.09.30sunpoet2012-10-012-8/+4 * Add trytond_account_de_skr03 2.4.0, the SKR03 chart of account which isbsam2012-09-195-0/+47 * - Update Calligra Suite to 2.5.2.avilla2012-09-171-2/+2 * - Update to 2012.09.09sunpoet2012-09-112-3/+3 * - update bugzilla language tempatesohauer2012-09-067-133/+22 * Update to latest versionscrees2012-09-042-3/+3 * - update bugzilla bugzilla3 and bugzilla42ohauer2012-09-024-18/+130 * - Update Calligra to 2.5.1.avilla2012-09-012-7/+2 * The KDE/FreeBSD team is pleased to announce version 2.5 of Calligra,avilla2012-08-262-16/+6 * - Update to 3.5.6.jkim2012-08-241-4/+4 * - Update to 2012.08.19sunpoet2012-08-202-3/+3 * - Update to 2012.08.12sunpoet2012-08-142-3/+3 * - Update to 2012.08.05sunpoet2012-08-072-3/+3 * - Update to 3.0.0lme2012-08-044-30/+24 * - Fix typos in COMMENTcs2012-08-021-1/+1 * Update to version 4.5.5.bsam2012-07-311-2/+2 * - Update to 2012.07.29sunpoet2012-07-312-3/+3 * Fix typos in COMMENTcs2012-07-297-7/+7 * - update to official versionohauer2012-07-292-11/+3 * - update to official release (just published)ohauer2012-07-297-266/+6 * - patch language templates so they match current bugzilla.ohauer2012-07-295-5/+228 * - new port german/bugzilla42ohauer2012-07-289-6/+378 * - Update to 2012.07.22sunpoet2012-07-232-3/+3 * - Update to 2012.07.15sunpoet2012-07-182-3/+3 * - Update LibreOffice and the language packs to 3.5.5.jkim2012-07-181-4/+4 * - Update to 2012.07.08sunpoet2012-07-092-3/+3 * - Update to 3.4.1sunpoet2012-07-053-11/+9 * - Update Calligra to 2.4.3.avilla2012-07-051-2/+2 * - Update to 2012.07.01sunpoet2012-07-032-3/+3 * - The FreeBSD Office team is proud to announce LibreOffice.org 3.5.4 releasefluffy2012-07-011-4/+4 * - Remove SITE_PERL from *_DEPENDSaz2012-06-301-3/+3 * - Update to 20120607sunpoet2012-06-282-4/+3 * - reset MAINTAINERdinoex2012-06-261-1/+1 * - Update to 2012.06.24sunpoet2012-06-252-3/+3 * Update to version 4.5.4.bsam2012-06-192-3/+2 * - Update to 2012.06.17sunpoet2012-06-182-3/+3 * KDE/FreeBSD team presents KDE SC 4.8.4, probably the last release in 4.8.x se...makc2012-06-153-3/+18 * - Update to 2012.06.10sunpoet2012-06-112-3/+3 * - Convert USE_QT_VER=4 and QT_COMPONETS to USE_QT4miwi2012-06-061-2/+1 * - Update to 2012.05.30sunpoet2012-06-052-3/+3 * - update png to 1.5.10dinoex2012-06-018-5/+8 * - Remove koffice-i18n ports, as they are not very useful withoutavilla2012-05-315-438/+0 * The KDE/FreeBSD team is pleased to announce Calligra Suite 2.4.2, KDEavilla2012-05-319-320/+71 * - Update to 2012.05.27sunpoet2012-05-292-3/+3 * - Update to 3.3.2scheidell2012-05-274-5/+21 * KDE/FreeBSD team presents long awaited KDE SC 4.8.3!makc2012-05-253-16/+96 * Chase PyQT updatemakc2012-05-251-0/+1 * - Update to 2012.05.20sunpoet2012-05-212-3/+3 * - Switch to php53miwi2012-05-171-0/+1 * - Update to 2012.05.13sunpoet2012-05-152-3/+3 * Update to version 4.5.3.bsam2012-05-091-2/+2 * - Update to 2012.05.05sunpoet2012-05-072-3/+3 * - Use USE_DOS2UNIX instead of homemade equivalentak2012-05-061-14/+3 * - Update to 2012.04.29sunpoet2012-04-302-3/+3 * - Update to 2012.04.22sunpoet2012-04-242-3/+3 * - upgrade to 3.5.2bapt2012-04-234-0/+22 * - security update to bugzilla 3.0.9 and 4.0.6ohauer2012-04-222-0/+14 * - update to 4.0.5ohauer2012-04-102-3/+3 * - Update to 2012.04.08sunpoet2012-04-102-3/+3 * Update to version 4.5.2.bsam2012-04-031-2/+2 * - Update to 2012.04.01sunpoet2012-04-022-3/+3 * - Update to 2012.03.25sunpoet2012-03-262-3/+3 * - Update to 2012.03.11sunpoet2012-03-122-3/+3 * - Update to 2012.03.04sunpoet2012-03-052-3/+3 * - Update to 2012.02.19sunpoet2012-02-202-3/+3 * - Bump PORTREVISION to chase the update of multimedia/libvpxashish2012-02-161-0/+1 * - Update to 0.5pgollucci2012-02-162-3/+3 * - update german bugzilla templatesohauer2012-02-144-6/+6 * - Update to 2012.02.12sunpoet2012-02-132-3/+3 * - Update to 2012.02.05sunpoet2012-02-062-3/+3 * - Update to 2012.01.29sunpoet2012-01-302-3/+3 * The KDE/FreeBSD team is pleased to announce KDE SC 4.7.4, whichavilla2012-01-252-3/+3 * - Update to 2012.01.22sunpoet2012-01-232-3/+3 * - Update to 9.4.7 (English version only)hrs2012-01-221-0/+2 * Update to version 4.4.20.bsam2012-01-161-2/+2 * - Update to 2012.01.15sunpoet2012-01-162-3/+3 * - Update to 3.3.1miwi2012-01-142-6/+7 * - Update to 2012.01.08sunpoet2012-01-092-3/+3 * - update german bugzilla translationsohauer2012-01-064-6/+6 * - Update to 2012.01.01sunpoet2012-01-022-3/+3 * - Update to 2011.12.25sunpoet2011-12-262-3/+3 * - Update to 2011.12.18sunpoet2011-12-192-3/+3 * - Update to 2011.12.11sunpoet2011-12-122-3/+3 * Update to version 4.4.19.bsam2011-12-061-2/+2 * - Update to 2011.12.04sunpoet2011-12-052-3/+3 * - Pass maintainership to office@FreeBSD.orgsunpoet2011-11-295-5/+5 * - Update to 2011.11.27sunpoet2011-11-282-3/+3