]> git.sur5r.net Git - openldap/blobdiff - libraries/liblunicode/ucdata/ucdata.h
Merge remote-tracking branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / libraries / liblunicode / ucdata / ucdata.h
index 8e05933db01606b27ba5b062888b075b583c8287..dcc4b3bf1647f8e5f804d74c41e5c0d6fe87a592 100644 (file)
@@ -1,10 +1,18 @@
 /* $OpenLDAP$ */
-/*
- * Copyright 2000 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2013 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
  */
-/*
- * Copyright 1999 Computing Research Labs, New Mexico State University
+/* Copyright 2001 Computing Research Labs, New Mexico State University
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+/* $Id: ucdata.h,v 1.6 2001/01/02 18:46:20 mleisher Exp $ */
+
 #ifndef _h_ucdata
 #define _h_ucdata
 
-/*
- * $Id: ucdata.h,v 1.5 1999/11/19 15:24:29 mleisher Exp $
- */
-
 LDAP_BEGIN_DECL
 
-#undef __
-#define __(x) x
-
-#define UCDATA_VERSION "2.3"
+#define UCDATA_VERSION "2.4"
 
 /**************************************************************************
  *
@@ -116,8 +119,8 @@ LDAP_BEGIN_DECL
  * of properties.  The macros that test for various character properties all
  * call this function with some set of masks.
  */
-extern int ucisprop __((unsigned long code, unsigned long mask1,
-                        unsigned long mask2));
+LDAP_LUNICODE_F (int)
+ucisprop LDAP_P((ac_uint4 code, ac_uint4 mask1, ac_uint4 mask2));
 
 #define ucisalpha(cc) ucisprop(cc, UC_LU|UC_LL|UC_LM|UC_LO|UC_LT, 0)
 #define ucisdigit(cc) ucisprop(cc, UC_ND, 0)
@@ -206,9 +209,35 @@ extern int ucisprop __((unsigned long code, unsigned long mask1,
  *
  **************************************************************************/
 
-extern unsigned long uctoupper __((unsigned long code));
-extern unsigned long uctolower __((unsigned long code));
-extern unsigned long uctotitle __((unsigned long code));
+LDAP_LUNICODE_F (ac_uint4) uctoupper LDAP_P((ac_uint4 code));
+LDAP_LUNICODE_F (ac_uint4) uctolower LDAP_P((ac_uint4 code));
+LDAP_LUNICODE_F (ac_uint4) uctotitle LDAP_P((ac_uint4 code));
+
+/**************************************************************************
+ *
+ * Functions for getting compositions.
+ *
+ **************************************************************************/
+
+/*
+ * This routine determines if there exists a composition of node1 and node2.
+ * If it returns 0, there is no composition.  Any other value indicates a
+ * composition was returned in comp.
+ */
+LDAP_LUNICODE_F (int) uccomp LDAP_P((ac_uint4 node1, ac_uint4 node2,
+                     ac_uint4 *comp));
+
+/*
+ * Does Hangul composition on the string str with length len, and returns
+ * the length of the composed string.
+ */
+LDAP_LUNICODE_F (int) uccomp_hangul LDAP_P((ac_uint4 *str, int len));
+
+/*
+ * Does canonical composition on the string str with length len, and returns
+ * the length of the composed string.
+ */
+LDAP_LUNICODE_F (int) uccanoncomp LDAP_P((ac_uint4 *str, int len));
 
 /**************************************************************************
  *
@@ -221,17 +250,44 @@ extern unsigned long uctotitle __((unsigned long code));
  * there is no decomposition.  Any other value indicates a decomposition was
  * returned.
  */
-extern int ucdecomp __((unsigned long code, unsigned long *num,
+LDAP_LUNICODE_F (int)
+ucdecomp LDAP_P((ac_uint4 code, ac_uint4 *num,
+                ac_uint4 **decomp));
 
-                        unsigned long **decomp));
+/*
+ * Equivalent to ucdecomp() except that it includes compatibility
+ * decompositions.
+ */
+LDAP_LUNICODE_F (int)
+uckdecomp LDAP_P((ac_uint4 code, ac_uint4 *num,
+                ac_uint4 **decomp));
 
 /*
  * If the code is a Hangul syllable, this routine decomposes it into the array
  * passed.  The array size should be at least 3.
  */
-extern int ucdecomp_hangul __((unsigned long code, unsigned long *num,
-                               unsigned long decomp[]));
-
+LDAP_LUNICODE_F (int)
+ucdecomp_hangul LDAP_P((ac_uint4 code, ac_uint4 *num,
+                       ac_uint4 decomp[]));
+
+/*  
+ * This routine does canonical decomposition of the string in of length
+ * inlen, and returns the decomposed string in out with length outlen.
+ * The memory for out is allocated by this routine. It returns the length
+ * of the decomposed string if okay, and -1 on error.
+ */
+LDAP_LUNICODE_F (int)
+uccanondecomp LDAP_P((const ac_uint4 *in, int inlen,
+                    ac_uint4 **out, int *outlen, void *ctx));
+  
+/*  
+ * Equivalent to uccanondecomp() except that it includes compatibility
+ * decompositions.
+ */
+LDAP_LUNICODE_F (int)
+uccompatdecomp LDAP_P((const ac_uint4 *in, int inlen,
+                    ac_uint4 **out, int *outlen, void *ctx));
+  
 /**************************************************************************
  *
  * Functions for getting combining classes.
@@ -242,7 +298,7 @@ extern int ucdecomp_hangul __((unsigned long code, unsigned long *num,
  * This will return the combining class for a character to be used with the
  * Canonical Ordering algorithm.
  */
-extern unsigned long uccombining_class __((unsigned long code));
+LDAP_LUNICODE_F (ac_uint4) uccombining_class LDAP_P((ac_uint4 code));
 
 /**************************************************************************
  *
@@ -255,14 +311,17 @@ struct ucnumber {
     int denominator;
 };
 
-extern int ucnumber_lookup __((unsigned long code, struct ucnumber *num));
-extern int ucdigit_lookup __((unsigned long code, int *digit));
+LDAP_LUNICODE_F (int)
+ucnumber_lookup LDAP_P((ac_uint4 code, struct ucnumber *num));
+
+LDAP_LUNICODE_F (int)
+ucdigit_lookup LDAP_P((ac_uint4 code, int *digit));
 
 /*
  * For compatibility with John Cowan's "uctype" package.
  */
-extern struct ucnumber ucgetnumber __((unsigned long code));
-extern int ucgetdigit __((unsigned long code));
+LDAP_LUNICODE_F (struct ucnumber) ucgetnumber LDAP_P((ac_uint4 code));
+LDAP_LUNICODE_F (int) ucgetdigit LDAP_P((ac_uint4 code));
 
 /**************************************************************************
  *
@@ -279,16 +338,18 @@ extern int ucgetdigit __((unsigned long code));
 #define UCDATA_DECOMP 0x04
 #define UCDATA_CMBCL  0x08
 #define UCDATA_NUM    0x10
+#define UCDATA_COMP   0x20
+#define UCDATA_KDECOMP 0x40
 
 #define UCDATA_ALL (UCDATA_CASE|UCDATA_CTYPE|UCDATA_DECOMP|\
-                    UCDATA_CMBCL|UCDATA_NUM)
+                    UCDATA_CMBCL|UCDATA_NUM|UCDATA_COMP|UCDATA_KDECOMP)
 
 /*
  * Functions to load, unload, and reload specific data files.
  */
-extern void ucdata_load __((char *paths, int mask));
-extern void ucdata_unload __((int mask));
-extern void ucdata_reload __((char *paths, int mask));
+LDAP_LUNICODE_F (int) ucdata_load LDAP_P((char *paths, int mask));
+LDAP_LUNICODE_F (void) ucdata_unload LDAP_P((int mask));
+LDAP_LUNICODE_F (int) ucdata_reload LDAP_P((char *paths, int mask));
 
 #ifdef UCDATA_DEPRECATED
 /*
@@ -298,8 +359,6 @@ extern void ucdata_reload __((char *paths, int mask));
 #define ucdata_cleanup() ucdata_unload(UCDATA_ALL)
 #endif
 
-#undef __
-
 LDAP_END_DECL
 
 #endif /* _h_ucdata */