From 3812b0b0ab8f001b08c0a050d9dcc6be6f2a3bd8 Mon Sep 17 00:00:00 2001 From: tomo Date: Sat, 16 Aug 2003 08:07:28 +0000 Subject: [PATCH] Sync with b1-r0_2_0-pre1. --- ChangeLog | 37 +++++++++++++++++++++++++++++++++++++ Makefile.in | 5 ++++- chise.c | 32 ++++++++++++++++---------------- chise.h | 11 +++++++---- configure | 24 ++++++++++++------------ configure.in | 2 +- sample.c | 26 +++++++++++++------------- 7 files changed, 90 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index dc37fc6..4a427bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +2003-08-12 MORIOKA Tomohiko + + * configure.in: Update version to 0.2.0. + + * Makefile.in (ABI_VERSION): New variable. + (libchise.la): Specify $(ABI_VERSION) as -version-info of libtool. + +2003-08-12 MORIOKA Tomohiko + + * sample.c (main): Use instead of + to define `dt_daikanwa'; use + instead of to define + `ft_ideographic_structure' and `ft_ascii'. + + * chise.c (chise_open_decoding_table): Use + instead of as the type of the first + argument. + (chise_open_feature_table): Use instead of + as the type of the first argument. + (chise_ft_iterate): Modify for the structure + `CHISE_Feature_Table'. + (chise_open_attribute_table): Use instead + of as the type of the first argument; + modify for the structure . + (chise_close_attribute_table): Modify for the structure + . + (chise_get_attribute_table): Likewise. + (chise_put_attribute_table): Likewise. + + * chise.h (CHISE_Attribute_Table): Define as a structure. + (chise_open_decoding_table): Use instead + of as the type of the first argument. + (chise_open_feature_table): Use instead of + as the type of the first argument. + (chise_open_attribute_table): Use instead + of as the type of the first argument. + 2003-08-11 MORIOKA Tomohiko * chise.h (chise_dt_put_char): New prototype. diff --git a/Makefile.in b/Makefile.in index c18b01e..bc2c952 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,11 +30,14 @@ DB_INSTALLDIR = ${libdir}/chise VERSION = @PACKAGE_VERSION@ +ABI_VERSION = 1:0:0 + all: libchise.la libchise.la: chise.lo - $(LIBTOOL) $(CC) -o libchise.la chise.lo $(LIBS) -rpath ${libdir} + $(LIBTOOL) $(CC) -o libchise.la chise.lo $(LIBS) \ + -rpath ${libdir} -version-info $(ABI_VERSION) chise.lo: chise.c chise.h $(LIBTOOL) $(CC) $(CFLAGS) chise.c diff --git a/chise.c b/chise.c index e76f8e1..5d382c1 100644 --- a/chise.c +++ b/chise.c @@ -237,7 +237,7 @@ chise_close_data_source (CHISE_DS *ds) int -chise_open_decoding_table (CHISE_Decoding_Table **db, +chise_open_decoding_table (CHISE_Decoding_Table *db, CHISE_DS *ds, const char *ccs, DBTYPE real_subtype, u_int32_t accessmask, int modemask) @@ -291,7 +291,7 @@ chise_dt_put_char (CHISE_Decoding_Table *db, int -chise_open_feature_table (CHISE_Feature_Table **db, +chise_open_feature_table (CHISE_Feature_Table *db, CHISE_DS *ds, const char *feature, DBTYPE real_subtype, u_int32_t accessmask, int modemask) @@ -321,8 +321,8 @@ chise_ft_get_value (CHISE_Feature_Table *db, } void -chise_ft_iterate (CHISE_Feature_Table *dbp, - int (*func) (CHISE_Feature_Table *db, +chise_ft_iterate (CHISE_Feature_Table *ft, + int (*func) (CHISE_Feature_Table *ft, CHISE_Char_ID cid, CHISE_Value *valdatum)) { DBT keydatum, valdatum; @@ -332,7 +332,7 @@ chise_ft_iterate (CHISE_Feature_Table *dbp, xzero (keydatum); xzero (valdatum); - status = dbp->cursor (dbp, NULL, &dbcp, 0); + status = ft->dbp->cursor (ft->dbp, NULL, &dbcp, 0); for (status = dbcp->c_get (dbcp, &keydatum, &valdatum, DB_FIRST); status == 0; status = dbcp->c_get (dbcp, &keydatum, &valdatum, DB_NEXT)) @@ -342,14 +342,14 @@ chise_ft_iterate (CHISE_Feature_Table *dbp, CHISE_Char_ID key = chise_char_id_parse_c_string (key_str, key_len); int ret; - if (ret = func (dbp, key, &valdatum)) + if (ret = func (ft, key, &valdatum)) break; } dbcp->c_close (dbcp); } int -chise_open_attribute_table (CHISE_Attribute_Table **db, +chise_open_attribute_table (CHISE_Attribute_Table *ft, const char *db_dir, const char *encoding, const char *feature, DBTYPE real_subtype, @@ -399,23 +399,23 @@ chise_open_attribute_table (CHISE_Attribute_Table **db, dbase->close (dbase, 0); return -1; } - *db = dbase; + ft->dbp = dbase; return 0; } int -chise_close_attribute_table (CHISE_Attribute_Table *db) +chise_close_attribute_table (CHISE_Attribute_Table *ft) { - if (db) + if (ft->dbp) { - db->sync (db, 0); - db->close (db, 0); + ft->dbp->sync (ft->dbp, 0); + ft->dbp->close (ft->dbp, 0); } return 0; } int -chise_get_attribute_table (CHISE_Attribute_Table *db, +chise_get_attribute_table (CHISE_Attribute_Table *ft, char *key, CHISE_Value *valdatum) { DBT keydatum; @@ -428,12 +428,12 @@ chise_get_attribute_table (CHISE_Attribute_Table *db, keydatum.data = key; keydatum.size = strlen (key); - status = db->get (db, NULL, &keydatum, valdatum, 0); + status = ft->dbp->get (ft->dbp, NULL, &keydatum, valdatum, 0); return status; } int -chise_put_attribute_table (CHISE_Attribute_Table *db, +chise_put_attribute_table (CHISE_Attribute_Table *ft, char *key, char *value) { DBT keydatum, valdatum; @@ -449,6 +449,6 @@ chise_put_attribute_table (CHISE_Attribute_Table *db, valdatum.data = value; valdatum.size = strlen (value); - status = db->put (db, NULL, &keydatum, &valdatum, 0); + status = ft->dbp->put (ft->dbp, NULL, &keydatum, &valdatum, 0); return status; } diff --git a/chise.h b/chise.h index 22e7982..29fbcd7 100644 --- a/chise.h +++ b/chise.h @@ -46,12 +46,15 @@ chise_value_to_c_string (const CHISE_Value *s) } -typedef DB CHISE_Attribute_Table; +typedef struct CHISE_Attribute_Table +{ + DB *dbp; +} CHISE_Attribute_Table; typedef CHISE_Attribute_Table CHISE_Decoding_Table; -int chise_open_decoding_table (CHISE_Decoding_Table **db, +int chise_open_decoding_table (CHISE_Decoding_Table *db, CHISE_DS *ds, const char *ccs, DBTYPE real_subtype, u_int32_t accessmask, int modemask); @@ -65,7 +68,7 @@ int chise_dt_put_char (CHISE_Decoding_Table *db, typedef CHISE_Attribute_Table CHISE_Feature_Table; -int chise_open_feature_table (CHISE_Feature_Table **db, +int chise_open_feature_table (CHISE_Feature_Table *db, CHISE_DS *ds, const char *feature, DBTYPE real_subtype, u_int32_t accessmask, int modemask); @@ -87,7 +90,7 @@ int chise_get_feature (CHISE_DS *ds, CHISE_Char_ID cid, char *key, CHISE_Value *valdatum); -int chise_open_attribute_table (CHISE_Attribute_Table **db, +int chise_open_attribute_table (CHISE_Attribute_Table *db, const char *db_dir, const char *encoding, const char *feature, DBTYPE real_subtype, diff --git a/configure b/configure index 90b4493..2c9b09f 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for libchise 0.1.1. +# Generated by GNU Autoconf 2.57 for libchise 0.2.0. # # Report bugs to . # @@ -268,8 +268,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='libchise' PACKAGE_TARNAME='libchise' -PACKAGE_VERSION='0.1.1' -PACKAGE_STRING='libchise 0.1.1' +PACKAGE_VERSION='0.2.0' +PACKAGE_STRING='libchise 0.2.0' PACKAGE_BUGREPORT='chise-en@m17n.org' ac_unique_file="chise.c" @@ -742,7 +742,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libchise 0.1.1 to adapt to many kinds of systems. +\`configure' configures libchise 0.2.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -799,7 +799,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libchise 0.1.1:";; + short | recursive ) echo "Configuration of libchise 0.2.0:";; esac cat <<\_ACEOF @@ -878,7 +878,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -libchise configure 0.1.1 +libchise configure 0.2.0 generated by GNU Autoconf 2.57 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 @@ -893,7 +893,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libchise $as_me 0.1.1, which was +It was created by libchise $as_me 0.2.0, which was generated by GNU Autoconf 2.57. Invocation command line was $ $0 $@ @@ -1070,7 +1070,7 @@ _ASBOX echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -2872,7 +2872,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_stack_direction=-1 fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5 @@ -2944,7 +2944,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_func_strnlen_working=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_strnlen_working" >&5 @@ -3399,7 +3399,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by libchise $as_me 0.1.1, which was +This file was extended by libchise $as_me 0.2.0, which was generated by GNU Autoconf 2.57. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3459,7 +3459,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -libchise config.status 0.1.1 +libchise config.status 0.2.0 configured by $0, generated by GNU Autoconf 2.57, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.in b/configure.in index 5e0adc1..cbf3d40 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT(libchise, 0.1.1, chise-en@m17n.org) +AC_INIT(libchise, 0.2.0, chise-en@m17n.org) AC_CONFIG_SRCDIR(chise.c) AC_CONFIG_HEADER(config.h) diff --git a/sample.c b/sample.c index b6b567f..29e6756 100644 --- a/sample.c +++ b/sample.c @@ -15,9 +15,9 @@ int main (int argc, char* argv[]) { CHISE_DS ds; - CHISE_Decoding_Table *dt_daikanwa; - CHISE_Feature_Table *ft_ideographic_structure; - CHISE_Feature_Table *ft_ascii; + CHISE_Decoding_Table dt_daikanwa; + CHISE_Feature_Table ft_ideographic_structure; + CHISE_Feature_Table ft_ascii; int modemask; int accessmask = 0; DBTYPE real_subtype; @@ -49,16 +49,16 @@ main (int argc, char* argv[]) accessmask, modemask); if (status) { - chise_close_decoding_table (dt_daikanwa); + chise_close_decoding_table (&dt_daikanwa); chise_close_data_source (&ds); return -1; } /* get a character from the decoding-table */ - char_id = chise_dt_get_char (dt_daikanwa, 364); + char_id = chise_dt_get_char (&dt_daikanwa, 364); /* close the decoding-table */ - chise_close_decoding_table (dt_daikanwa); + chise_close_decoding_table (&dt_daikanwa); /* @@ -71,7 +71,7 @@ main (int argc, char* argv[]) real_subtype, accessmask, modemask); if (status) { - chise_close_feature_table (ft_ideographic_structure); + chise_close_feature_table (&ft_ideographic_structure); chise_close_data_source (&ds); return -1; } @@ -82,26 +82,26 @@ main (int argc, char* argv[]) real_subtype, accessmask, modemask); if (status) { - chise_close_feature_table (ft_ascii); + chise_close_feature_table (&ft_ascii); chise_close_data_source (&ds); return -1; } /* get a feature-value of the character */ - status = chise_ft_get_value (ft_ideographic_structure, char_id, &value); + status = chise_ft_get_value (&ft_ideographic_structure, char_id, &value); if (!status) printf ("#x%X => %s\n", char_id, chise_value_to_c_string(&value)); else printf ("#x%X (%d)\n", char_id, status); - chise_ft_iterate (ft_ascii, &test_map_func); - chise_ft_iterate (ft_ideographic_structure, &test_map_func); + chise_ft_iterate (&ft_ascii, &test_map_func); + chise_ft_iterate (&ft_ideographic_structure, &test_map_func); /* close the feature-table */ - chise_close_feature_table (ft_ideographic_structure); + chise_close_feature_table (&ft_ideographic_structure); - chise_close_feature_table (ft_ascii); + chise_close_feature_table (&ft_ascii); /* close the data-source */ -- 1.7.10.4