+2005-01-12 Rodrigo Moya <rodrigo@novell.com>
+
+ * libedataserver/e-sexp.[ch]: removed the usage of the
+ E_SEXP_IS_G_OBJECT macro, since it was not being set anywhere.
+ (e_sexp_new): fixed some typoes.
+ (e_sexp_class_init): use g_type_class_peek_parent to get the
+ parent class for our class.
+
2005-01-08 Not Zed <NotZed@Ximian.com>
* libedataserver/e-xml-hash-utils.c (e_xmlhash_write): cast field
static void parse_dump_term(struct _ESExpTerm *t, int depth);
-#ifdef E_SEXP_IS_G_OBJECT
static GObjectClass *parent_class;
-#endif
static GScannerConfig scanner_config =
{
static void e_sexp_finalise(void *);
-#ifdef E_SEXP_IS_G_OBJECT
static void
e_sexp_class_init (ESExpClass *klass)
{
object_class->finalize = e_sexp_finalise;
- parent_class = g_type_class_ref (g_object_get_type ());
+ parent_class = g_type_class_peek_parent (klass);
}
-#endif
/* 'builtin' functions */
static struct {
g_scanner_scope_foreach_symbol(s->scanner, 0, free_symbol, 0);
g_scanner_destroy(s->scanner);
-#ifdef E_SEXP_IS_G_OBJECT
G_OBJECT_CLASS (parent_class)->finalize (o);
-#endif
}
static void
}
}
-#ifndef E_SEXP_IS_G_OBJECT
- s->refcount = 1;
-#endif
}
-#ifdef E_SEXP_IS_G_OBJECT
GType
e_sexp_get_type (void)
{
return type;
}
-#endif
ESExp *
e_sexp_new (void)
{
-#ifdef E_SEXP_IS_G_OBJECT
- ESExp *f = (ESexp *) g_object_new (E_TYPE_SEXP, NULL);
-#else
- ESExp *f = g_malloc0 (sizeof (ESExp));
- e_sexp_init (f);
-#endif
+ ESExp *f = (ESExp *) g_object_new (E_TYPE_SEXP, NULL);
return f;
}
-#ifndef E_SEXP_IS_G_OBJECT
-void
-e_sexp_ref (ESExp *f)
-{
- f->refcount++;
-}
-
-void
-e_sexp_unref (ESExp *f)
-{
- f->refcount--;
- if (f->refcount == 0) {
- e_sexp_finalise(f);
- g_free(f);
- }
-}
-#endif
-
void
e_sexp_add_function(ESExp *f, int scope, char *name, ESExpFunc *func, void *data)
{
#include <time.h>
#include <glib.h>
-#ifdef E_SEXP_IS_G_OBJECT
#include <glib-object.h>
-#endif
G_BEGIN_DECLS
-#ifdef E_SEXP_IS_G_OBJECT
#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_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;
typedef struct _ESExpClass ESExpClass;
struct _ESExp {
-#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 */
};
struct _ESExpClass {
-#ifdef E_SEXP_IS_G_OBJECT
GObjectClass parent_class;
-#else
- int dummy;
-#endif
};
-#ifdef E_SEXP_IS_G_OBJECT
GType e_sexp_get_type (void);
-#endif
ESExp *e_sexp_new (void);
-#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
void e_sexp_add_function (ESExp *f, int scope, char *name, ESExpFunc *func, void *data);
void e_sexp_add_ifunction (ESExp *f, int scope, char *name, ESExpIFunc *func, void *data);
void e_sexp_add_variable (ESExp *f, int scope, char *name, ESExpTerm *value);