From d3ad2e8a6bd2a7b010077f475e52244352ecaa0c Mon Sep 17 00:00:00 2001 From: tomo Date: Tue, 12 Aug 2003 02:28:59 +0000 Subject: [PATCH] (chise_dt_put_char): New function. (chise_put_attribute_table): New function. --- chise.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/chise.c b/chise.c index fdb73b1..e76f8e1 100644 --- a/chise.c +++ b/chise.c @@ -276,6 +276,18 @@ chise_dt_get_char (CHISE_Decoding_Table *db, int code_point) return -1; } +int +chise_dt_put_char (CHISE_Decoding_Table *db, + int code_point, CHISE_Char_ID cid) +{ + CHISE_Value valdatum; + char key_buf[16], val_buf[8]; + + sprintf(key_buf, "%d", code_point); + chise_format_char_id (cid, val_buf, 8); + return chise_put_attribute_table (db, key_buf, val_buf); +} + int @@ -419,3 +431,24 @@ chise_get_attribute_table (CHISE_Attribute_Table *db, status = db->get (db, NULL, &keydatum, valdatum, 0); return status; } + +int +chise_put_attribute_table (CHISE_Attribute_Table *db, + char *key, char *value) +{ + DBT keydatum, valdatum; + int status = 0; + + /* DB Version 2 requires DBT's to be zeroed before use. */ + xzero (keydatum); + xzero (valdatum); + + keydatum.data = key; + keydatum.size = strlen (key); + + valdatum.data = value; + valdatum.size = strlen (value); + + status = db->put (db, NULL, &keydatum, &valdatum, 0); + return status; +} -- 1.7.10.4