diff options
author | Akira TAGOH <akira@tagoh.org> | 2010-05-27 22:32:22 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2010-05-27 22:32:22 +0900 |
commit | cd4f049745a1ef75aa1d782407776b69ca8248b8 (patch) | |
tree | 841bdb1d585d5b0f54964336e71362961754e45e | |
parent | 9decaa94b40ec02e24159d1ecaefb0443eca8684 (diff) |
* hieroglyph/hgobject.c (_hg_object_new): add the object type to
the quark.
(hg_object_init): add the name object vtable.
(hg_object_init): initialize the encodings.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | hieroglyph/hgobject.c | 9 | ||||
-rw-r--r-- | hieroglyph/hgtypes.h | 8 | ||||
-rw-r--r-- | hieroglyph/hgversion.h.in | 2 | ||||
-rw-r--r-- | tests/hgbool.c | 1 | ||||
-rw-r--r-- | tests/hgint.c | 1 | ||||
-rw-r--r-- | tests/hgmark.c | 1 | ||||
-rw-r--r-- | tests/hgnull.c | 1 |
8 files changed, 27 insertions, 1 deletions
@@ -1,5 +1,10 @@ 2010-05-27 Akira TAGOH <akira@tagoh.org> + * hieroglyph/hgobject.c (_hg_object_new): add the object type to + the quark. + (hg_object_init): add the name object vtable. + (hg_object_init): initialize the encodings. + * hieroglyph/hgmem.c (hg_mem_free): get rid of the unnecessary bits. (hg_mem_lock_object): likewise. (hg_mem_unlock_object): likewise. diff --git a/hieroglyph/hgobject.c b/hieroglyph/hgobject.c index fa5d296..b850772 100644 --- a/hieroglyph/hgobject.c +++ b/hieroglyph/hgobject.c @@ -27,9 +27,11 @@ #include <string.h> #include "hgerror.h" +#include "hgencoding.h" #include "hgbool.h" #include "hgint.h" #include "hgmark.h" +#include "hgname.h" #include "hgnull.h" #include "hgmem.h" #include "hgobject.h" @@ -65,6 +67,7 @@ _hg_object_new(hg_mem_t *mem, if (ret) *ret = object; } + retval |= hg_quark_mask_set_type(type); return retval; } @@ -89,8 +92,12 @@ hg_object_init(void) vtables[HG_TYPE_INT] = v; v = hg_object_mark_get_vtable(); vtables[HG_TYPE_MARK] = v; + v = hg_object_name_get_vtable(); + vtables[HG_TYPE_NAME] = v; v = hg_object_null_get_vtable(); vtables[HG_TYPE_NULL] = v; + + hg_encoding_init(); } } @@ -102,6 +109,8 @@ hg_object_init(void) void hg_object_fini(void) { + hg_encoding_fini(); + is_initialized = FALSE; } diff --git a/hieroglyph/hgtypes.h b/hieroglyph/hgtypes.h index ac940ad..23659cd 100644 --- a/hieroglyph/hgtypes.h +++ b/hieroglyph/hgtypes.h @@ -30,6 +30,14 @@ G_BEGIN_DECLS #define Qnil (hg_quark_t)-1 +/* hgutils.h */ +#define hg_quark_mask_value(_v_) \ + ((_v_) & 0xffffffff) +#define hg_quark_get_value(_v_) \ + hg_quark_mask_value (_v_) +#define hg_quark_mask_set_value(_v_) \ + hg_quark_mask_value (_v_) + /* hgmem.h */ typedef struct _hg_mem_t hg_mem_t; typedef struct _hg_mem_vtable_t hg_mem_vtable_t; diff --git a/hieroglyph/hgversion.h.in b/hieroglyph/hgversion.h.in index 71d8d4f..15e908b 100644 --- a/hieroglyph/hgversion.h.in +++ b/hieroglyph/hgversion.h.in @@ -30,7 +30,7 @@ G_BEGIN_DECLS #define HIEROGLYPH_VERSION "@VERSION@" -#define HIEROGLYPH_UUID "8fb0e1ed-c241-4721-9184-b506244878a7" +#define HIEROGLYPH_UUID "8c6eee8f-bf19-4289-9428-7bd4c5d443f2" const char *__hg_rcsid G_GNUC_UNUSED = "$Rev$"; diff --git a/tests/hgbool.c b/tests/hgbool.c index c73c511..ad60fb5 100644 --- a/tests/hgbool.c +++ b/tests/hgbool.c @@ -72,6 +72,7 @@ TDEF (initialize) q = hg_object_bool_new(mem, Qnil, (gpointer *)&v); fail_unless(q != Qnil, "Unable to create the boolean object."); + fail_unless(hg_quark_get_type(q) == HG_TYPE_BOOL, "No type information in the quark"); v->value = TRUE; qv = hg_object_bool_to_qbool(v); fail_unless(qv == 0x4000000000000001, "Unexpected result to convert the object to the quark value."); diff --git a/tests/hgint.c b/tests/hgint.c index d1a6793..58c13bc 100644 --- a/tests/hgint.c +++ b/tests/hgint.c @@ -72,6 +72,7 @@ TDEF (initialize) q = hg_object_int_new(mem, Qnil, (gpointer *)&v); fail_unless(q != Qnil, "Unable to create the integer object."); + fail_unless(hg_quark_get_type(q) == HG_TYPE_INT, "No type information in the quark"); v->value = 32768; qv = hg_object_int_to_qint(v); fail_unless(qv == 0x1000000000008000, "Unexpected result to convert the object to the quark value."); diff --git a/tests/hgmark.c b/tests/hgmark.c index 5abc7d9..12c58d0 100644 --- a/tests/hgmark.c +++ b/tests/hgmark.c @@ -72,6 +72,7 @@ TDEF (initialize) q = hg_object_mark_new(mem, (gpointer *)&v); fail_unless(q != Qnil, "Unable to create the mark object."); + fail_unless(hg_quark_get_type(q) == HG_TYPE_MARK, "No type information in the quark"); qv = hg_object_mark_to_qmark(v); fail_unless(qv == 0xa000000000000000, "Unexpected result to convert the object to the quark value."); q2 = hg_qmark_to_object_mark(mem, qv, (gpointer *)&v2); diff --git a/tests/hgnull.c b/tests/hgnull.c index 601642f..5cae911 100644 --- a/tests/hgnull.c +++ b/tests/hgnull.c @@ -72,6 +72,7 @@ TDEF (initialize) q = hg_object_null_new(mem, (gpointer *)&v); fail_unless(q != Qnil, "Unable to create the null object."); + fail_unless(hg_quark_get_type(q) == HG_TYPE_NULL, "No type information in the quark"); qv = hg_object_null_to_qnull(v); fail_unless(qv == 0x0000000000000000, "Unexpected result to convert the object to the quark value."); q2 = hg_qnull_to_object_null(mem, qv, (gpointer *)&v2); |