aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-03-20 03:02:14 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-03-20 03:02:14 +0800
commit790c00fa27ac1ff7ae72447cb679dc21403f62e0 (patch)
treee5f1a88517d27d87b5722d898760fe1368cba67e /e-util
parentec3cf6dfcd221bbce0a79df5431c4a737a2a7161 (diff)
downloadgsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.tar
gsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.tar.gz
gsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.tar.bz2
gsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.tar.lz
gsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.tar.xz
gsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.tar.zst
gsoc2013-evolution-790c00fa27ac1ff7ae72447cb679dc21403f62e0.zip
Fix ESExpClass to never be an empty struct. Also make ESExp optionally a
2003-03-19 Jeffrey Stedfast <fejj@ximian.com> * e-sexp.h: Fix ESExpClass to never be an empty struct. Also make ESExp optionally a subclass of GObject rather than GtkObject (not that we'll probably ever make it so, but for completeness sake?). 2003-03-18 Jeffrey Stedfast <fejj@ximian.com> * e-trie.c (trie_utf8_getc): Don't use __inline__ as it is not always defined. svn path=/trunk/; revision=20360
Diffstat (limited to 'e-util')
-rw-r--r--e-util/ChangeLog11
-rw-r--r--e-util/e-sexp.c54
-rw-r--r--e-util/e-sexp.h58
-rw-r--r--e-util/e-trie.c2
4 files changed, 77 insertions, 48 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 391046c654..73c2d16380 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,14 @@
+2003-03-19 Jeffrey Stedfast <fejj@ximian.com>
+
+ * e-sexp.h: Fix ESExpClass to never be an empty struct. Also make
+ ESExp optionally a subclass of GObject rather than GtkObject (not
+ that we'll probably ever make it so, but for completeness sake?).
+
+2003-03-18 Jeffrey Stedfast <fejj@ximian.com>
+
+ * e-trie.c (trie_utf8_getc): Don't use __inline__ as it is not
+ always defined.
+
2003-03-13 Dan Winship <danw@ximian.com>
* ename/e-address-western.c (e_address_western_parse): When
diff --git a/e-util/e-sexp.c b/e-util/e-sexp.c
index 6487b1e024..33fecc18ce 100644
--- a/e-util/e-sexp.c
+++ b/e-util/e-sexp.c
@@ -82,15 +82,19 @@
Execute a sequence. The last function return is the return type.
*/
-#include "e-sexp.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
-#include <glib.h>
+#include "e-sexp.h"
#include "e-memory.h"
+
#define p(x) /* parse debug */
#define r(x) /* run debug */
#define d(x) /* general debug */
@@ -102,7 +106,7 @@ static struct _ESExpTerm * parse_value(ESExp *f);
static void parse_dump_term(struct _ESExpTerm *t, int depth);
#ifdef E_SEXP_IS_GTK_OBJECT
-static GtkObjectClass *parent_class;
+static GObjectClass *parent_class;
#endif
static GScannerConfig scanner_config =
@@ -1107,29 +1111,31 @@ e_sexp_init (ESExp *s)
}
}
-#ifndef E_SEXP_IS_GTK_OBJECT
+#ifndef E_SEXP_IS_G_OBJECT
s->refcount = 1;
#endif
}
-#ifdef E_SEXP_IS_GTK_OBJECT
-guint
+#ifdef E_SEXP_IS_G_OBJECT
+GType
e_sexp_get_type (void)
{
- static guint type = 0;
+ static GType type = 0;
if (!type) {
- GtkTypeInfo type_info = {
- "ESExp",
- sizeof (ESExp),
+ static const GTypeInfo info = {
sizeof (ESExpClass),
- (GtkClassInitFunc) e_sexp_class_init,
- (GtkObjectInitFunc) e_sexp_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL
+ NULL, /* base_class_init */
+ NULL, /* base_class_finalize */
+ (GClassInitFunc) e_sexp_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (ESExp),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) e_sexp_init,
};
- type = gtk_type_unique (gtk_object_get_type (), &type_info);
+ type = g_type_register_static (G_TYPE_OBJECT, "ESExp", &info, 0);
}
return type;
@@ -1139,23 +1145,25 @@ e_sexp_get_type (void)
ESExp *
e_sexp_new (void)
{
-#ifdef E_SEXP_IS_GTK_OBJECT
- ESExp *f = E_SEXP ( gtk_type_new (e_sexp_get_type ()));
+#ifdef E_SEXP_IS_G_OBJECT
+ ESExp *f = (ESexp *) g_object_new (E_TYPE_SEXP, NULL);
#else
- ESExp *f = g_malloc0(sizeof(*f));
- e_sexp_init(f);
+ ESExp *f = g_malloc0 (sizeof (ESExp));
+ e_sexp_init (f);
#endif
-
+
return f;
}
-#ifndef E_SEXP_IS_GTK_OBJECT
-void e_sexp_ref (ESExp *f)
+#ifndef E_SEXP_IS_G_OBJECT
+void
+e_sexp_ref (ESExp *f)
{
f->refcount++;
}
-void e_sexp_unref (ESExp *f)
+void
+e_sexp_unref (ESExp *f)
{
f->refcount--;
if (f->refcount == 0) {
diff --git a/e-util/e-sexp.h b/e-util/e-sexp.h
index d4b8795c3e..ee2c6079ed 100644
--- a/e-util/e-sexp.h
+++ b/e-util/e-sexp.h
@@ -8,18 +8,24 @@
#include <time.h>
#include <glib.h>
-#ifdef E_SEXP_IS_GTK_OBJECT
-#include <gtk/gtkobject.h>
+#ifdef E_SEXP_IS_G_OBJECT
+#include <glib-object.h>
#endif
#ifdef E_SEXP_IS_GTK_OBJECT
-#define E_SEXP(obj) GTK_CHECK_CAST (obj, e_sexp_get_type (), ESExp)
-#define E_SEXP_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, e_sexp_get_type (), ESExpClass)
-#define FILTER_IS_SEXP(obj) GTK_CHECK_TYPE (obj, e_sexp_get_type ())
+#define E_TYPE_SEXP (e_sexp_get_type ())
+#define E_SEXP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SEXP, ESExp))
+#define E_SEXP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SEXP, ESExpClass))
+#define IS_E_SEXP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SEXP))
+#define IS_E_SEXP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SEXP))
+#define E_SEXP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_SEXP, ESExpClass))
#else
-#define E_SEXP(obj) ((struct _ESExp *)(obj))
-#define E_SEXP_CLASS(klass) ((struct _ESExpClass *)(klass))
-#define FILTER_IS_SEXP(obj) (1)
+#define E_TYPE_SEXP (0)
+#define E_SEXP(obj) ((struct _ESExp *) (obj))
+#define E_SEXP_CLASS(klass) ((struct _ESExpClass *) (klass))
+#define IS_E_SEXP(obj) (1)
+#define IS_E_SEXP_CLASS(obj) (1)
+#define E_SEXP_GET_CLASS(obj) (NULL)
#endif
typedef struct _ESExp ESExp;
@@ -29,15 +35,14 @@ typedef struct _ESExpSymbol ESExpSymbol;
typedef struct _ESExpResult ESExpResult;
typedef struct _ESExpTerm ESExpTerm;
-typedef struct _ESExpResult *(ESExpFunc)(struct _ESExp *sexp,
- int argc,
- struct _ESExpResult **argv,
- void *data);
+typedef struct _ESExpResult *(ESExpFunc)(struct _ESExp *sexp, int argc,
+ struct _ESExpResult **argv,
+ void *data);
+
+typedef struct _ESExpResult *(ESExpIFunc)(struct _ESExp *sexp, int argc,
+ struct _ESExpTerm **argv,
+ void *data);
-typedef struct _ESExpResult *(ESExpIFunc)(struct _ESExp *sexp,
- int argc,
- struct _ESExpTerm **argv,
- void *data);
enum _ESExpResultType {
ESEXP_RES_ARRAY_PTR=0, /* type is a ptrarray, what it points to is implementation dependant */
ESEXP_RES_INT, /* type is a number */
@@ -97,18 +102,18 @@ struct _ESExpTerm {
struct _ESExp {
-#ifdef E_SEXP_IS_GTK_OBJECT
- GtkObject object;
+#ifdef E_SEXP_IS_G_OBJECT
+ GObject parent_object;
#else
int refcount;
#endif
GScanner *scanner; /* for parsing text version */
ESExpTerm *tree; /* root of expression tree */
-
+
/* private stuff */
jmp_buf failenv;
char *error;
-
+
/* TODO: may also need a pool allocator for term strings, so we dont lose them
in error conditions? */
struct _EMemChunk *term_chunks;
@@ -117,15 +122,20 @@ struct _ESExp {
struct _ESExpClass {
#ifdef E_SEXP_IS_GTK_OBJECT
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
+#else
+ int dummy;
#endif
};
-#ifdef E_SEXP_IS_GTK_OBJECT
-guint e_sexp_get_type (void);
+#ifdef E_SEXP_IS_G_OBJECT
+GType e_sexp_get_type (void);
#endif
ESExp *e_sexp_new (void);
-#ifndef E_SEXP_IS_GTK_OBJECT
+#ifdef E_SEXP_IS_G_OBJECT
+#define e_sexp_ref(f) g_object_ref (f)
+#define e_sexp_unref(f) g_object_unref (f)
+#else
void e_sexp_ref (ESExp *f);
void e_sexp_unref (ESExp *f);
#endif
diff --git a/e-util/e-trie.c b/e-util/e-trie.c
index 307cb3ec95..c0e4f49487 100644
--- a/e-util/e-trie.c
+++ b/e-util/e-trie.c
@@ -57,7 +57,7 @@ struct _ETrie {
};
-static __inline__ gunichar
+static inline gunichar
trie_utf8_getc (const unsigned char **in, size_t inlen)
{
register const unsigned char *inptr = *in;