xref: /netbsd-src/external/bsd/openldap/dist/libraries/liblunicode/utbm/utbm.h (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: utbm.h,v 1.3 2021/08/14 16:14:57 christos Exp $	*/
2 
3 /* $OpenLDAP$ */
4 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5  *
6  * Copyright 1998-2021 The OpenLDAP Foundation.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted only as authorized by the OpenLDAP
11  * Public License.
12  *
13  * A copy of this license is available in file LICENSE in the
14  * top-level directory of the distribution or, alternatively, at
15  * <http://www.OpenLDAP.org/license.html>.
16  */
17 /* Copyright 1997, 1998, 1999 Computing Research Labs,
18  * New Mexico State University
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining a
21  * copy of this software and associated documentation files (the "Software"),
22  * to deal in the Software without restriction, including without limitation
23  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
24  * and/or sell copies of the Software, and to permit persons to whom the
25  * Software is furnished to do so, subject to the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be included in
28  * all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
33  * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
34  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
35  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
36  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  */
38 /* Id: utbm.h,v 1.1 1999/09/21 15:45:18 mleisher Exp  */
39 
40 #ifndef _h_utbm
41 #define _h_utbm
42 
43 #include <sys/cdefs.h>
44 __RCSID("$NetBSD: utbm.h,v 1.3 2021/08/14 16:14:57 christos Exp $");
45 
46 #include "portable.h"
47 
48 LDAP_BEGIN_DECL
49 
50 /*************************************************************************
51  *
52  * Types.
53  *
54  *************************************************************************/
55 
56 /*
57  * Fundamental character types.
58  */
59 typedef unsigned long ucs4_t;
60 typedef unsigned short ucs2_t;
61 
62 /*
63  * An opaque type used for the search pattern.
64  */
65 typedef struct _utbm_pattern_t *utbm_pattern_t;
66 
67 /*************************************************************************
68  *
69  * Flags.
70  *
71  *************************************************************************/
72 
73 #define UTBM_CASEFOLD          0x01
74 #define UTBM_IGNORE_NONSPACING 0x02
75 #define UTBM_SPACE_COMPRESS    0x04
76 
77 /*************************************************************************
78  *
79  * API.
80  *
81  *************************************************************************/
82 
83 LDAP_LUNICODE_F (utbm_pattern_t) utbm_create_pattern LDAP_P((void));
84 
85 LDAP_LUNICODE_F (void) utbm_free_pattern LDAP_P((utbm_pattern_t pattern));
86 
87 LDAP_LUNICODE_F (void)
88 utbm_compile LDAP_P((ucs2_t *pat, unsigned long patlen,
89 		     unsigned long flags, utbm_pattern_t pattern));
90 
91 LDAP_LUNICODE_F (int)
92 utbm_exec LDAP_P((utbm_pattern_t pat, ucs2_t *text,
93 		  unsigned long textlen, unsigned long *match_start,
94 		  unsigned long *match_end));
95 
96 /*************************************************************************
97  *
98  * Prototypes for the stub functions needed.
99  *
100  *************************************************************************/
101 
102 LDAP_LUNICODE_F (int) _utbm_isspace LDAP_P((ucs4_t c, int compress));
103 
104 LDAP_LUNICODE_F (int) _utbm_iscntrl LDAP_P((ucs4_t c));
105 
106 LDAP_LUNICODE_F (int) _utbm_nonspacing LDAP_P((ucs4_t c));
107 
108 LDAP_LUNICODE_F (ucs4_t) _utbm_tolower LDAP_P((ucs4_t c));
109 
110 LDAP_LUNICODE_F (ucs4_t) _utbm_toupper LDAP_P((ucs4_t c));
111 
112 LDAP_LUNICODE_F (ucs4_t) _utbm_totitle LDAP_P((ucs4_t c));
113 
114 LDAP_END_DECL
115 
116 #endif
117 
118 
119 #endif /* _h_utbm */
120