Public header icu.h, private header icu_I18N.h .
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 8 Nov 2007 09:29:38 +0000 (09:29 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 8 Nov 2007 09:29:38 +0000 (09:29 +0000)
include/yaz/Makefile.am
include/yaz/icu.h [new file with mode: 0644]
include/yaz/icu_I18N.h
util/yaz-icu.c

index 5457ff5..24f498e 100644 (file)
@@ -1,4 +1,6 @@
-## $Id: Makefile.am,v 1.48 2007-10-24 13:50:02 adam Exp $
+## $Id: Makefile.am,v 1.49 2007-11-08 09:29:38 adam Exp $
+
+noinst_HEADERS = icu_I18N.h
 
 pkginclude_HEADERS= backend.h ccl.h ccl_xml.h cql.h comstack.h \
  diagbib1.h diagsrw.h diagsru_update.h sortspec.h log.h logrpn.h marcdisp.h \
@@ -9,7 +11,7 @@ pkginclude_HEADERS= backend.h ccl.h ccl_xml.h cql.h comstack.h \
  yaz-ccl.h yaz-iconv.h yaz-util.h yaz-version.h yconfig.h proto.h \
  xmlquery.h libxml2_error.h xmltypes.h snprintf.h query-charset.h \
  mutex.h oid_db.h oid_util.h oid_std.h tokenizer.h copy_types.h \
- icu_I18N.h match_glob.h \
+ icu.h match_glob.h \
  \
  ill.h ill-core.h item-req.h oclc-ill-req-ext.h z-accdes1.h z-accform1.h \
  z-acckrb1.h z-core.h z-date.h z-diag1.h z-espec1.h z-estask.h z-exp.h \
diff --git a/include/yaz/icu.h b/include/yaz/icu.h
new file mode 100644 (file)
index 0000000..19ab4ce
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1995-2007, Index Data
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Index Data nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** \file
+    \brief ICU utilities
+*/
+
+
+#ifndef YAZ_ICU_H
+#define YAZ_ICU_H
+
+#include <yaz/yconfig.h>
+
+#include <libxml/tree.h>
+
+#include <unicode/utypes.h>
+
+YAZ_BEGIN_CDECL
+
+typedef struct icu_chain *yaz_icu_chain_t;
+
+yaz_icu_chain_t icu_chain_create(const char * locale,
+                                 int sort,
+                                 UErrorCode * status);
+
+void icu_chain_destroy(yaz_icu_chain_t chain);
+
+yaz_icu_chain_t icu_chain_xml_config(const xmlNode *xml_node,
+                                     const char *locale,
+                                     int sort,
+                                     UErrorCode * status);
+
+int icu_chain_assign_cstr(yaz_icu_chain_t chain,
+                          const char * src8cstr, 
+                          UErrorCode *status);
+
+int icu_chain_next_token(yaz_icu_chain_t chain,
+                         UErrorCode *status);
+
+int icu_chain_token_number(yaz_icu_chain_t chain);
+
+const char * icu_chain_token_display(yaz_icu_chain_t chain);
+
+const char * icu_chain_token_norm(yaz_icu_chain_t chain);
+
+const char * icu_chain_token_sortkey(yaz_icu_chain_t chain);
+
+YAZ_END_CDECL
+
+#endif /* YAZ_ICU_H */
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
index 44e852c..0b06dbd 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/** \file
+    \brief Internal header for ICU utilities
+*/
+
 #ifndef ICU_I18NL_H
 #define ICU_I18NL_H
 
-#include <yaz/nmem.h>
+#include <yaz/yconfig.h>
 
-#include <libxml/parser.h>
 #include <libxml/tree.h>
 
 #include <unicode/utypes.h>   /* Basic ICU data types */
@@ -40,6 +43,7 @@
 #include <unicode/ubrk.h>
 #include <unicode/utrans.h>
 
+#include <yaz/icu.h>
 
 /* declared structs and functions */
 
@@ -210,7 +214,7 @@ struct icu_chain_step
 
 struct icu_chain;
 
-struct icu_chain_step * icu_chain_step_create(struct icu_chain * chain,
+struct icu_chain_step * icu_chain_step_create(yaz_icu_chain_t chain,
                                               enum icu_chain_step_type type,
                                               const uint8_t * rule,
                                               struct icu_buf_utf16 * buf16,
@@ -244,42 +248,18 @@ struct icu_chain
     struct icu_chain_step * steps;
 };
 
-struct icu_chain * icu_chain_create(const char * locale,
-                                    int sort,
-                                    UErrorCode * status);
-
-void icu_chain_destroy(struct icu_chain * chain);
-
-struct icu_chain * icu_chain_xml_config(const xmlNode *xml_node,
-                                        const char *locale,
-                                        int sort,
-                                        UErrorCode * status);
-
-struct icu_chain_step * icu_chain_insert_step(struct icu_chain * chain,
+struct icu_chain_step * icu_chain_insert_step(yaz_icu_chain_t chain,
                                               enum icu_chain_step_type type,
                                               const uint8_t * rule,
                                               UErrorCode *status);
 
-int icu_chain_step_next_token(struct icu_chain * chain,
+int icu_chain_step_next_token(yaz_icu_chain_t chain,
                               struct icu_chain_step * step,
                               UErrorCode *status);
 
-int icu_chain_assign_cstr(struct icu_chain * chain,
-                          const char * src8cstr, 
-                          UErrorCode *status);
-
-int icu_chain_next_token(struct icu_chain * chain,
-                         UErrorCode *status);
-
-int icu_chain_token_number(struct icu_chain * chain);
-
-const char * icu_chain_token_display(struct icu_chain * chain);
-
-const char * icu_chain_token_norm(struct icu_chain * chain);
-
-const char * icu_chain_token_sortkey(struct icu_chain * chain);
+int icu_chain_token_number(yaz_icu_chain_t chain);
 
-const UCollator * icu_chain_get_coll(struct icu_chain * chain);
+const UCollator * icu_chain_get_coll(yaz_icu_chain_t chain);
 
 #endif /* ICU_I18NL_H */
 
index c6e7a0e..c4fb91f 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2007, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: yaz-icu.c,v 1.9 2007-11-08 08:17:18 adam Exp $
+ * $Id: yaz-icu.c,v 1.10 2007-11-08 09:29:39 adam Exp $
  */
 
 #if HAVE_CONFIG_H
 
 #include <unicode/ucnv.h>
 #include <unicode/ustring.h>
+#include <unicode/ucol.h> 
+#include <unicode/ubrk.h>
+#include <unicode/utrans.h>
 
-#include <yaz/icu_I18N.h>
+#include <yaz/icu.h>
 
 /* commando line and config parameters */
 static struct config_t { 
     char conffile[1024];
     char print[1024];
     int xmloutput;
-    struct icu_chain * chain;
+    yaz_icu_chain_t chain;
     FILE * infile;
     FILE * outfile;
 } config;