From 8e5b0977192e005e5b1c25f585c76a38befe5455 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 10:10:24 +0900 Subject: [PATCH 01/16] (concord_object_get_feature_value): Use `cos_read_int' to parse integer. --- cos.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cos.c b/cos.c index 9e09502..303b2dd 100644 --- a/cos.c +++ b/cos.c @@ -416,6 +416,7 @@ concord_object_get_feature_value (COS_object object, COS_object feature) size_t end; int val_cid; COS_String val_str; + COS_object val_obj; if (COS_OBJECT_CHAR_P (object)) { @@ -440,6 +441,12 @@ concord_object_get_feature_value (COS_object object, COS_object feature) concord_feature_get_name (fobj), cos_string_data (val_string)); + val_obj = cos_read_int (CONCORD_String_data (&val_st), + CONCORD_String_size (&val_st), + 0, &end); + if ( val_obj != NULL ) + return val_obj; + val_cid = cos_read_char (CONCORD_String_data (&val_st), CONCORD_String_size (&val_st), 0, &end); -- 1.7.10.4 From df5631b2c07aef24f06860530e955075f748206e Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 10:12:03 +0900 Subject: [PATCH 02/16] update. --- ChangeLog | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ChangeLog b/ChangeLog index 99b7c6f..123d0b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-04-15 MORIOKA Tomohiko + + * cos.c (concord_object_get_feature_value): Use `cos_read_int' to + parse integer. + + * read.c: Include . + (cos_read_int): New function. + + * cos-read.h (cos_read_int): New prototype. + 2013-04-14 MORIOKA Tomohiko * cos.c (cos_string_p): New function. -- 1.7.10.4 From f9f2aa38a4147d7ce3e4d31bd74aa5c341194f52 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 12:55:17 +0900 Subject: [PATCH 03/16] (struct COS_Cons_ent): New structure. (COS_Cons): New type. (cos_cons): New prototype. (cos_car): New prototype. (cos_cdr): New prototype. --- cos.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cos.h b/cos.h index 3b157fc..42ff7a2 100644 --- a/cos.h +++ b/cos.h @@ -69,6 +69,14 @@ COS_Symbol cos_intern (COS_object name); COS_String cos_symbol_name (COS_Symbol symbol); +typedef struct COS_Cons_ent COS_Cons_ent; +typedef struct COS_Cons_ent* COS_Cons; + +COS_Cons cos_cons (COS_object car, COS_object cdr); +COS_object cos_car (COS_Cons pair); +COS_object cos_cdr (COS_Cons pair); + + typedef struct COS_Container_ent COS_Container_ent; typedef struct COS_Container_ent* COS_Container; -- 1.7.10.4 From ecedcc1ac0d1986c8a75fdf17e62930636c45b59 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 12:57:10 +0900 Subject: [PATCH 04/16] (enum COS_Object_Type): Add COS_Object_Type_Cons. (COS_OBJECT_CONS_P): New macro. (struct COS_Cons_ent): New structure. (COS_CAR): New macro. (COS_CDR): New macro. (cos_release_cons): New prototype. --- cos-i.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cos-i.h b/cos-i.h index 1468fd8..73450dc 100644 --- a/cos-i.h +++ b/cos-i.h @@ -101,6 +101,7 @@ enum COS_Object_Type { COS_Object_Type_char, COS_Object_Type_String, COS_Object_Type_Symbol, + COS_Object_Type_Cons, COS_Object_Type_Container, COS_Object_Type_Sexp, COS_Object_Type_Binary, @@ -154,6 +155,9 @@ COS_Object cos_allocate_object_0 (enum COS_Object_Type type, #define COS_OBJECT_SYMBOL_P(obj) \ COS_OBJECT_TYPE_P (obj, Symbol) +#define COS_OBJECT_CONS_P(obj) \ + COS_OBJECT_TYPE_P (obj, Cons) + #define COS_OBJECT_DS_P(obj) \ COS_OBJECT_TYPE_P (obj, DS) @@ -212,6 +216,22 @@ COS_Symbol cos_symbol_table_intern (COS_Symbol_Table table, COS_object name); +struct COS_Cons_ent +{ + COS_Object_Header header; + + COS_object car; + COS_object cdr; +}; + +#define COS_CAR(obj) \ + (((COS_Cons)(obj))->car) +#define COS_CDR(obj) \ + (((COS_Cons)(obj))->cdr) + +int cos_release_cons (COS_Object obj); + + struct COS_Container_ent { COS_Object_Header header; -- 1.7.10.4 From e108fbaaff85cfaddae07cfec6e4bfdf73880aca Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 12:59:48 +0900 Subject: [PATCH 05/16] (COS_Object_release_function_table): Add `cos_release_cons'. (cos_retain_object): Use `COS_OBJECT_P' to check `obj' is a fat object. (cos_release_object): Likewise. (cos_cons): New function. (cos_release_cons): New function. (cos_car): New function. (cos_cdr): New function. --- cos.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/cos.c b/cos.c index 303b2dd..299852b 100644 --- a/cos.c +++ b/cos.c @@ -33,6 +33,7 @@ int (*COS_Object_release_function_table (COS_Object) = { cos_release_string, cos_release_symbol, + cos_release_cons, cos_release_container, cos_release_sexp, cos_release_binary, @@ -104,22 +105,24 @@ cos_allocate_object_0 (enum COS_Object_Type type, size_t size) COS_Object cos_retain_object (COS_Object obj) { - obj->header.reference_count++; - + if (COS_OBJECT_P (obj)) + obj->header.reference_count++; return obj; } int cos_release_object (COS_object obj) { - ((COS_Object)obj)->header.reference_count--; + if (COS_OBJECT_P (obj)) + { + ((COS_Object)obj)->header.reference_count--; - if ( ((COS_Object)obj)->header.reference_count <= 0 ) - return (*COS_Object_release_function_table - [((COS_Object)obj)->header.type - - COS_FAT_OBJECT_TYPE_MIN])(obj); - else - return 0; + if ( ((COS_Object)obj)->header.reference_count <= 0 ) + return (*COS_Object_release_function_table + [((COS_Object)obj)->header.type + - COS_FAT_OBJECT_TYPE_MIN])(obj); + } + return 0; } @@ -199,6 +202,53 @@ cos_string_data (COS_String string) } +COS_Cons +cos_cons (COS_object car, COS_object cdr) +{ + COS_Cons obj = COS_ALLOCATE_OBJECT (Cons); + + if (obj == NULL) + return NULL; + + obj->car = car; + obj->cdr = cdr; + cos_retain_object (car); + cos_retain_object (cdr); + + return obj; +} + +int +cos_release_cons (COS_Object obj) +{ + if (obj == NULL) + return 0; + + cos_release_object (COS_CAR (obj)); + cos_release_object (COS_CDR (obj)); + free (obj); + return 0; +} + +COS_object +cos_car (COS_Cons pair) +{ + if (COS_OBJECT_CONS_P (pair)) + return COS_CAR (pair); + else + return NULL; +} + +COS_object +cos_cdr (COS_Cons pair) +{ + if (COS_OBJECT_CONS_P (pair)) + return COS_CDR (pair); + else + return NULL; +} + + int cos_release_container (COS_Object obj) { -- 1.7.10.4 From 94b706f295fe01684a56ef48d1d51b39556be593 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 13:01:16 +0900 Subject: [PATCH 06/16] update. --- ChangeLog | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ChangeLog b/ChangeLog index 123d0b1..518d8e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2013-04-16 MORIOKA Tomohiko + + * cos.c (COS_Object_release_function_table): Add + `cos_release_cons'. + (cos_retain_object): Use `COS_OBJECT_P' to check `obj' is a fat + object. + (cos_release_object): Likewise. + (cos_cons): New function. + (cos_release_cons): New function. + (cos_car): New function. + (cos_cdr): New function. + + * cos-i.h (enum COS_Object_Type): Add COS_Object_Type_Cons. + (COS_OBJECT_CONS_P): New macro. + (struct COS_Cons_ent): New structure. + (COS_CAR): New macro. + (COS_CDR): New macro. + (cos_release_cons): New prototype. + + * cos.h (struct COS_Cons_ent): New structure. + (COS_Cons): New type. + (cos_cons): New prototype. + (cos_car): New prototype. + (cos_cdr): New prototype. + 2013-04-15 MORIOKA Tomohiko * cos.c (concord_object_get_feature_value): Use `cos_read_int' to -- 1.7.10.4 From 2f9217da73c78a820f14a83cf25caf7eac790f3a Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 17:42:53 +0900 Subject: [PATCH 07/16] Include . (cos_Qnil): New variable. (cos_Qt): New variable. (cos_print_object): New prototype. --- cos.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cos.h b/cos.h index 42ff7a2..17f7b34 100644 --- a/cos.h +++ b/cos.h @@ -28,6 +28,9 @@ extern "C" { } #endif +#include + + typedef void* COS_object; typedef struct COS_Object_ent COS_Object_ent; @@ -68,6 +71,9 @@ COS_Symbol cos_intern (COS_object name); COS_String cos_symbol_name (COS_Symbol symbol); +extern COS_Symbol cos_Qnil; +extern COS_Symbol cos_Qt; + typedef struct COS_Cons_ent COS_Cons_ent; typedef struct COS_Cons_ent* COS_Cons; @@ -88,6 +94,9 @@ typedef struct COS_Sexp_ent* COS_Sexp; typedef struct COS_Binary_ent COS_Binary_ent; typedef struct COS_Binary_ent* COS_Binary; + +void cos_print_object (COS_object obj); + #if 0 { #endif -- 1.7.10.4 From df8e1592453edd84ec2a6d23c2853710255ee1e4 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 17:48:17 +0900 Subject: [PATCH 08/16] (cos_string_ent_nil): New variable. (cos_symbol_ent_nil): New variable. (cos_Qnil): New variable. (cos_string_ent_t): New variable. (cos_symbol_ent_t): New variable. (cos_Qt): New variable. (cos_intern): Setup `nil' and `t'. (cos_symbol_table_grow): Release old `table->data'. --- symbol.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/symbol.c b/symbol.c index bf544f7..a01b4ce 100644 --- a/symbol.c +++ b/symbol.c @@ -25,6 +25,37 @@ unsigned long cos_hash_c_string_n (const unsigned char *ptr, size_t size); unsigned long cos_symbol_hash_string (COS_String string); +COS_String_ent cos_string_ent_nil = { {COS_OBJECT_PREFIX_OBJECT, + COS_Object_Type_String, + 1}, + 3, "nil"}; + +COS_Symbol_ent cos_symbol_ent_nil = { {COS_OBJECT_PREFIX_OBJECT, + COS_Object_Type_Symbol, + 1}, + &cos_string_ent_nil, + NULL}; + +COS_Symbol cos_Qnil = &cos_symbol_ent_nil; + + +COS_String_ent cos_string_ent_t = { {COS_OBJECT_PREFIX_OBJECT, + COS_Object_Type_String, + 1}, + 1, "t"}; + +COS_Symbol_ent cos_symbol_ent_t = { {COS_OBJECT_PREFIX_OBJECT, + COS_Object_Type_Symbol, + 1}, + &cos_string_ent_t, + NULL}; + +COS_Symbol cos_Qt = &cos_symbol_ent_t; + + +COS_Symbol_Table cos_default_symbol_table = NULL; + + COS_Symbol cos_make_symbol (COS_String string) { @@ -102,8 +133,6 @@ cos_symbol_name (COS_Symbol symbol) } -COS_Symbol_Table cos_default_symbol_table = NULL; - COS_Symbol_Table cos_make_symbol_table_0 (size_t size); void cos_destroy_symbol_table_0 (COS_Symbol_Table hash); @@ -196,8 +225,11 @@ COS_Symbol cos_intern (COS_object name) { if (cos_default_symbol_table == NULL) - cos_default_symbol_table = cos_make_symbol_table(); - + { + cos_default_symbol_table = cos_make_symbol_table(); + cos_symbol_table_set (cos_default_symbol_table, cos_Qnil); + cos_symbol_table_set (cos_default_symbol_table, cos_Qt); + } return cos_symbol_table_intern (cos_default_symbol_table, name); } @@ -257,6 +289,7 @@ cos_symbol_table_grow (COS_Symbol_Table table) } } } + free (table->data); table->size = new_table->size; table->data = new_table->data; free (new_table); -- 1.7.10.4 From 7011b75694bb02fff7f98defbc11ea7260235685 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 17:48:56 +0900 Subject: [PATCH 09/16] (cos_print_object): New function. --- print.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/print.c b/print.c index 2698189..0a8952b 100644 --- a/print.c +++ b/print.c @@ -234,3 +234,50 @@ cos_utf8_print_char (COS_object character, unsigned char *dest, size_t size) return i; } } + + +void +cos_print_object (COS_object obj) +{ + if ( obj == NULL ) + printf ("#", obj); + else if ( COS_OBJECT_INT_P (obj) ) + printf ("%d", cos_int_value (obj)); + else if ( COS_OBJECT_CHAR_P (obj) ) + { + char id_buf[256]; + + cos_utf8_print_char (obj, id_buf, 256); + printf ("?%s", id_buf); + } + else if ( COS_OBJECT_STRING_P (obj) ) + { + printf ("\"%s\"", cos_string_data (obj)); + } + else if ( COS_OBJECT_SYMBOL_P (obj) ) + { + printf ("%s", cos_string_data (cos_symbol_name (obj))); + } + else if ( COS_OBJECT_CONS_P (obj) ) + { + COS_object rest = COS_CDR (obj); + + printf ("("); + cos_print_object (COS_CAR (obj)); + while ( COS_OBJECT_CONS_P (rest) ) + { + printf (" "); + cos_print_object (COS_CAR (rest)); + rest = COS_CDR (rest); + } + if ( rest != cos_Qnil ) + { + printf (" . "); + cos_print_object (rest); + } + printf (")"); + } + else + printf ("Object[0x%lX] is a fat object.\n", + obj); +} -- 1.7.10.4 From b8cde7b7e18c8016262c552958319dd29a488ab1 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 17:49:30 +0900 Subject: [PATCH 10/16] (concord_name_table_grow): Release old `table->data'. --- name.c | 1 + 1 file changed, 1 insertion(+) diff --git a/name.c b/name.c index 90cde63..da8b7d5 100644 --- a/name.c +++ b/name.c @@ -194,6 +194,7 @@ concord_name_table_grow (CONCORD_NAME_TABLE* table) } } } + free (table->data); table->size = new_table->size; table->data = new_table->data; free (new_table); -- 1.7.10.4 From 60b503a34be005a31bed11acf598b7377c077531 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 17:53:25 +0900 Subject: [PATCH 11/16] update. --- ChangeLog | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 518d8e3..29438b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,25 @@ 2013-04-16 MORIOKA Tomohiko + * name.c (concord_name_table_grow): Release old `table->data'. + + * cos.h: Include . + (cos_Qnil): New variable. + (cos_Qt): New variable. + (cos_print_object): New prototype. + + * symbol.c (cos_string_ent_nil): New variable. + (cos_symbol_ent_nil): New variable. + (cos_Qnil): New variable. + (cos_string_ent_t): New variable. + (cos_symbol_ent_t): New variable. + (cos_Qt): New variable. + (cos_intern): Setup `nil' and `t'. + (cos_symbol_table_grow): Release old `table->data'. + + * print.c (cos_print_object): New function. + +2013-04-16 MORIOKA Tomohiko + * cos.c (COS_Object_release_function_table): Add `cos_release_cons'. (cos_retain_object): Use `COS_OBJECT_P' to check `obj' is a fat -- 1.7.10.4 From 8201539d526e84a03b1739b8e61ddac01fecf343 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 17:55:24 +0900 Subject: [PATCH 12/16] (symbol-test): New target. --- Makefile.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.in b/Makefile.in index 6e83c44..3b30b72 100644 --- a/Makefile.in +++ b/Makefile.in @@ -99,6 +99,9 @@ install.libs: libconcord.la sample: sample.c libconcord.la gcc -Wall -Wmissing-prototypes -o sample sample.c -lconcord +symbol-test: symbol-test.c libconcord.la + gcc -Wall -Wmissing-prototypes -o symbol-test symbol-test.c -lconcord + clean: -$(RM) -r *.o *.lo *.so *.la .libs sample -- 1.7.10.4 From 0d3176d0fb075dde73e08ebf9d918733f0c3ef72 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 18:42:39 +0900 Subject: [PATCH 13/16] (COS_Object_retain_function_table): New variable. (cos_retain_string): New prototype. (cos_retain_symbol): New prototype. (cos_retain_cons): New prototype. (cos_retain_container): New prototype. (cos_retain_sexp): New prototype. (cos_retain_binary): New prototype. (cos_retain_ds): New prototype. (cos_retain_genre): New prototype. (cos_retain_feature): New prototype. (cos_retain_index): New prototype. (cos_retain_db_object): New prototype. --- cos-i.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cos-i.h b/cos-i.h index 73450dc..4ed5540 100644 --- a/cos-i.h +++ b/cos-i.h @@ -115,6 +115,7 @@ enum COS_Object_Type { #define COS_FAT_OBJECT_TYPE_MIN COS_Object_Type_String #define COS_OBJECT_TYPE_MAX COS_Object_Type_DB_Object +extern int (*COS_Object_retain_function_table[]) (COS_Object); extern int (*COS_Object_release_function_table[]) (COS_Object); struct COS_Object_ent @@ -179,6 +180,7 @@ struct COS_String_ent unsigned char* data; }; +int cos_retain_string (COS_Object obj); int cos_release_string (COS_Object obj); @@ -192,6 +194,7 @@ struct COS_Symbol_ent COS_Symbol cos_make_symbol (COS_String string); +int cos_retain_symbol (COS_Object obj); int cos_release_symbol (COS_Object obj); @@ -229,6 +232,7 @@ struct COS_Cons_ent #define COS_CDR(obj) \ (((COS_Cons)(obj))->cdr) +int cos_retain_cons (COS_Object obj); int cos_release_cons (COS_Object obj); @@ -243,6 +247,7 @@ struct COS_Container_ent COS_Object* data; }; +int cos_retain_container (COS_Object obj); int cos_release_container (COS_Object obj); @@ -254,6 +259,7 @@ struct COS_Sexp_ent char* data; }; +int cos_retain_sexp (COS_Object obj); int cos_release_sexp (COS_Object obj); @@ -265,22 +271,27 @@ struct COS_Binary_ent unsigned char* data; }; +int cos_retain_binary (COS_Object obj); int cos_release_binary (COS_Object obj); +int cos_retain_ds (COS_Object obj); int cos_release_ds (COS_Object obj); +int cos_retain_genre (COS_Object obj); int cos_release_genre (COS_Object obj); int concord_close_genre (COS_Genre genre); +int cos_retain_feature (COS_Object obj); int cos_release_feature (COS_Object obj); int concord_close_feature (COS_Feature feature); +int cos_retain_index (COS_Object obj); int cos_release_index (COS_Object obj); int concord_close_index (COS_Feature_INDEX table); @@ -294,6 +305,7 @@ struct COS_DB_Object_ent COS_Object id; }; +int cos_retain_db_object (COS_Object obj); int cos_release_db_object (COS_Object obj); #if 0 -- 1.7.10.4 From 73a70ba1eb49f0a0d15089e2abc45d09a49452c6 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 18:45:30 +0900 Subject: [PATCH 14/16] (COS_Object_retain_function_table): New variable. (cos_retain_object): Call a retain-function in `COS_Object_retain_function_table'. (cos_retain_string): New function. (cos_retain_cons): New function. (cos_retain_container): New function. (cos_retain_sexp): New function. (cos_retain_binary): New function. (cos_retain_ds): New function. (cos_retain_genre): New function. (cos_retain_feature): New function. (cos_retain_index): New function. (cos_retain_db_object): New function. --- cos.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/cos.c b/cos.c index 299852b..4a842b8 100644 --- a/cos.c +++ b/cos.c @@ -28,6 +28,22 @@ const char concord_system_db_dir[] = CONCORD_SI_DB_DIR; CONCORD_DS concord_current_env = NULL; +int (*COS_Object_retain_function_table + [COS_OBJECT_TYPE_MAX - COS_Object_Type_char]) + (COS_Object) + = { cos_retain_string, + cos_retain_symbol, + cos_retain_cons, + cos_retain_container, + cos_retain_sexp, + cos_retain_binary, + cos_retain_ds, + cos_retain_genre, + cos_retain_feature, + cos_retain_index, + cos_retain_db_object +}; + int (*COS_Object_release_function_table [COS_OBJECT_TYPE_MAX - COS_Object_Type_char]) (COS_Object) @@ -106,7 +122,12 @@ COS_Object cos_retain_object (COS_Object obj) { if (COS_OBJECT_P (obj)) - obj->header.reference_count++; + { + obj->header.reference_count++; + (*COS_Object_retain_function_table + [((COS_Object)obj)->header.type + - COS_FAT_OBJECT_TYPE_MIN])(obj); + } return obj; } @@ -173,6 +194,12 @@ cos_build_string (char* str) } int +cos_retain_string (COS_Object obj) +{ + return 0; +} + +int cos_release_string (COS_Object obj) { if (obj == NULL) @@ -219,6 +246,14 @@ cos_cons (COS_object car, COS_object cdr) } int +cos_retain_cons (COS_Object obj) +{ + cos_retain_object (COS_CAR (obj)); + cos_retain_object (COS_CDR (obj)); + return 0; +} + +int cos_release_cons (COS_Object obj) { if (obj == NULL) @@ -250,6 +285,12 @@ cos_cdr (COS_Cons pair) int +cos_retain_container (COS_Object obj) +{ + return 0; +} + +int cos_release_container (COS_Object obj) { return 0; @@ -257,6 +298,12 @@ cos_release_container (COS_Object obj) int +cos_retain_sexp (COS_Object obj) +{ + return 0; +} + +int cos_release_sexp (COS_Object obj) { return 0; @@ -264,6 +311,12 @@ cos_release_sexp (COS_Object obj) int +cos_retain_binary (COS_Object obj) +{ + return 0; +} + +int cos_release_binary (COS_Object obj) { return 0; @@ -293,6 +346,12 @@ concord_open_env (COS_object ds) } int +cos_retain_ds (COS_Object obj) +{ + return 0; +} + +int cos_release_ds (COS_Object obj) { return concord_close_ds ((COS_DS)obj); @@ -312,6 +371,12 @@ concord_get_genre (COS_object ds, COS_object genre) } int +cos_retain_genre (COS_Object obj) +{ + return 0; +} + +int cos_release_genre (COS_Object obj) { return concord_close_genre ((COS_Genre)obj); @@ -343,6 +408,12 @@ concord_get_feature (COS_object ds, } int +cos_retain_feature (COS_Object obj) +{ + return 0; +} + +int cos_release_feature (COS_Object obj) { return concord_close_feature ((COS_Feature)obj); @@ -371,6 +442,12 @@ concord_get_feature_index (COS_object ds, } int +cos_retain_index (COS_Object obj) +{ + return concord_close_index ((COS_Feature_INDEX)obj); +} + +int cos_release_index (COS_Object obj) { return concord_close_index ((COS_Feature_INDEX)obj); @@ -378,6 +455,12 @@ cos_release_index (COS_Object obj) int +cos_retain_db_object (COS_Object obj) +{ + return 0; +} + +int cos_release_db_object (COS_Object obj) { return 0; -- 1.7.10.4 From a966e055800566f26ae5b08778d457760a61bae5 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 18:47:04 +0900 Subject: [PATCH 15/16] (cos_make_symbol): Use `cos_retain_object' for `obj->name'. (cos_retain_symbol): New function. --- symbol.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/symbol.c b/symbol.c index a01b4ce..94cf020 100644 --- a/symbol.c +++ b/symbol.c @@ -66,10 +66,19 @@ cos_make_symbol (COS_String string) obj->name = string; obj->value = NULL; + cos_retain_object (string); return obj; } int +cos_retain_symbol (COS_Object obj) +{ + cos_retain_object (((COS_Symbol)obj)->value); + cos_retain_object (((COS_Symbol)obj)->name); + return 0; +} + +int cos_release_symbol (COS_Object obj) { if (obj == NULL) -- 1.7.10.4 From 5ec4a964f1dd628a493661d72b6f5960dfec57a2 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Tue, 16 Apr 2013 18:48:57 +0900 Subject: [PATCH 16/16] update. --- ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/ChangeLog b/ChangeLog index 29438b3..24ded0b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,42 @@ 2013-04-16 MORIOKA Tomohiko + * symbol.c (cos_make_symbol): Use `cos_retain_object' for + `obj->name'. + (cos_retain_symbol): New function. + + * cos.c (COS_Object_retain_function_table): New variable. + (cos_retain_object): Call a retain-function in + `COS_Object_retain_function_table'. + (cos_retain_string): New function. + (cos_retain_cons): New function. + (cos_retain_container): New function. + (cos_retain_sexp): New function. + (cos_retain_binary): New function. + (cos_retain_ds): New function. + (cos_retain_genre): New function. + (cos_retain_feature): New function. + (cos_retain_index): New function. + (cos_retain_db_object): New function. + + * cos-i.h (COS_Object_retain_function_table): New variable. + (cos_retain_string): New prototype. + (cos_retain_symbol): New prototype. + (cos_retain_cons): New prototype. + (cos_retain_container): New prototype. + (cos_retain_sexp): New prototype. + (cos_retain_binary): New prototype. + (cos_retain_ds): New prototype. + (cos_retain_genre): New prototype. + (cos_retain_feature): New prototype. + (cos_retain_index): New prototype. + (cos_retain_db_object): New prototype. + +2013-04-16 MORIOKA Tomohiko + + * Makefile.in (symbol-test): New target. + +2013-04-16 MORIOKA Tomohiko + * name.c (concord_name_table_grow): Release old `table->data'. * cos.h: Include . -- 1.7.10.4