From aa97030d6d3e40d6eeda138face9db92f2fca787 Mon Sep 17 00:00:00 2001 From: tomo Date: Tue, 7 Dec 2010 13:01:43 +0000 Subject: [PATCH] - Include "elconcord.h". - Move EXFUNs for `Fconcord_decode_object', `Fconcord_object_put' and `Fconcord_object_get' to elconcord.h. (Lisp_CONCORD_DS): Moved to elconcord.h. (struct Lisp_CONCORD_DS): Ditto. (XCONCORD_DS): Ditto. (XSET_CONCORD_DS): Ditto. (CONCORD_DS_P): Ditto. (CHECK_CONCORD_DS): Ditto. (CONCHECK_CONCORD_DS): Ditto. (Lisp_CONCORD_Object): Ditto. (struct Lisp_CONCORD_Object): Ditto. (XCONCORD_OBJECT): Ditto. (XSET_CONCORD_OBJECT): Ditto. (CONCORD_OBJECT_P): Ditto. (CHECK_CONCORD_OBJECT): Ditto. (CONCHECK_CONCORD_OBJECT): Ditto. (CONCORD_OBJECT_GENRE): Ditto. (CONCORD_OBJECT_ID): Ditto. (XCONCORD_OBJECT_ID): Ditto. (XCONCORD_OBJECT_GENRE): Ditto. (concord_object_equal): New function. (LRECORD_IMPLEMENTATION of "concord_object"): Use `concord_object_equal'. --- src/concord.c | 55 ++++++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/src/concord.c b/src/concord.c index e68f390..7f06ae3 100644 --- a/src/concord.c +++ b/src/concord.c @@ -27,7 +27,7 @@ Boston, MA 02111-1307, USA. */ #include "sysfile.h" #include "buffer.h" #include -#include +#include "elconcord.h" #ifdef HAVE_LIBCHISE # include #endif @@ -36,10 +36,6 @@ Boston, MA 02111-1307, USA. */ EXFUN (Fread_from_string, 3); -EXFUN (Fconcord_decode_object, 4); -EXFUN (Fconcord_object_put, 3); -EXFUN (Fconcord_object_get, 2); - Lisp_Object Qconcord; Lisp_Object Qconcord_object; Lisp_Object Qgenre, Q_id; @@ -53,23 +49,12 @@ Lisp_Object Vconcord_genre_hash_table; Lisp_Object Vconcord_genre_object_hash_table; -typedef struct Lisp_CONCORD_DS Lisp_CONCORD_DS; -DECLARE_LRECORD (concord_ds, Lisp_CONCORD_DS); +/* + * data source + */ Lisp_Object Qconcord_dsp; -struct Lisp_CONCORD_DS -{ - struct lcrecord_header header; - CONCORD_DS ds; -}; - -#define XCONCORD_DS(x) XRECORD (x, concord_ds, Lisp_CONCORD_DS) -#define XSET_CONCORD_DS(x, p) XSETRECORD (x, p, concord_ds) -#define CONCORD_DS_P(x) RECORDP (x, concord_ds) -#define CHECK_CONCORD_DS(x) CHECK_RECORD (x, concord_ds) -#define CONCHECK_CONCORD_DS(x) CONCHECK_RECORD (x, concord_ds) - static Lisp_CONCORD_DS* allocate_concord_ds (void) { @@ -328,28 +313,12 @@ Return the list of all existing features in GENRE. } -typedef struct Lisp_CONCORD_Object Lisp_CONCORD_Object; -DECLARE_LRECORD (concord_object, Lisp_CONCORD_Object); +/* + * Concord-object + */ Lisp_Object Qconcord_objectp; -struct Lisp_CONCORD_Object -{ - struct lcrecord_header header; - CONCORD_Genre genre; - Lisp_Object id; -}; - -#define XCONCORD_OBJECT(x) XRECORD (x, concord_object, Lisp_CONCORD_Object) -#define XSET_CONCORD_OBJECT(x, p) XSETRECORD (x, p, concord_object) -#define CONCORD_OBJECT_P(x) RECORDP (x, concord_object) -#define CHECK_CONCORD_OBJECT(x) CHECK_RECORD (x, concord_object) -#define CONCHECK_CONCORD_OBJECT(x) CONCHECK_RECORD (x, concord_object) -#define CONCORD_OBJECT_GENRE(x) ((x)->genre) -#define CONCORD_OBJECT_ID(x) ((x)->id) -#define XCONCORD_OBJECT_ID(x) CONCORD_OBJECT_ID (XCONCORD_OBJECT(x)) -#define XCONCORD_OBJECT_GENRE(x) CONCORD_OBJECT_GENRE (XCONCORD_OBJECT(x)) - static Lisp_CONCORD_Object* allocate_concord_object (void) { @@ -417,6 +386,13 @@ finalize_concord_object (void *header, int for_disksave) } } +static int +concord_object_equal (Lisp_Object cobj1, Lisp_Object cobj2, int depth) +{ + return internal_equal ( XCONCORD_OBJECT_ID(cobj1), + XCONCORD_OBJECT_ID(cobj2), depth); +} + static const struct lrecord_description concord_object_description[] = { { XD_LISP_OBJECT, offsetof (Lisp_CONCORD_Object, id) }, { XD_END } @@ -424,7 +400,8 @@ static const struct lrecord_description concord_object_description[] = { DEFINE_LRECORD_IMPLEMENTATION ("concord_object", concord_object, mark_concord_object, print_concord_object, - finalize_concord_object, 0, 0, + finalize_concord_object, + concord_object_equal, 0, concord_object_description, Lisp_CONCORD_Object); -- 1.7.10.4