]> git.sur5r.net Git - openldap/blob - libraries/liblunicode/ure/ure.h
Happy New Year!
[openldap] / libraries / liblunicode / ure / ure.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1998-2016 The OpenLDAP Foundation.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted only as authorized by the OpenLDAP
9  * Public License.
10  *
11  * A copy of this license is available in file LICENSE in the
12  * top-level directory of the distribution or, alternatively, at
13  * <http://www.OpenLDAP.org/license.html>.
14  */
15 /* Copyright 1997, 1998, 1999 Computing Research Labs,
16  * New Mexico State University
17  *
18  * Permission is hereby granted, free of charge, to any person obtaining a
19  * copy of this software and associated documentation files (the "Software"),
20  * to deal in the Software without restriction, including without limitation
21  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
22  * and/or sell copies of the Software, and to permit persons to whom the
23  * Software is furnished to do so, subject to the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be included in
26  * all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
31  * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
32  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
33  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
34  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  */
36 /* $Id: ure.h,v 1.2 1999/09/21 15:47:44 mleisher Exp $ */
37
38 #ifndef _h_ure
39 #define _h_ure
40
41 #include "portable.h"
42
43
44 #include <stdio.h>
45
46 LDAP_BEGIN_DECL
47
48 /*
49  * Set of character class flags.
50  */
51 #define _URE_NONSPACING  0x00000001
52 #define _URE_COMBINING   0x00000002
53 #define _URE_NUMDIGIT    0x00000004
54 #define _URE_NUMOTHER    0x00000008
55 #define _URE_SPACESEP    0x00000010
56 #define _URE_LINESEP     0x00000020
57 #define _URE_PARASEP     0x00000040
58 #define _URE_CNTRL       0x00000080
59 #define _URE_PUA         0x00000100
60
61 #define _URE_UPPER       0x00000200
62 #define _URE_LOWER       0x00000400
63 #define _URE_TITLE       0x00000800
64 #define _URE_MODIFIER    0x00001000
65 #define _URE_OTHERLETTER 0x00002000
66 #define _URE_DASHPUNCT   0x00004000
67 #define _URE_OPENPUNCT   0x00008000
68 #define _URE_CLOSEPUNCT  0x00010000
69 #define _URE_OTHERPUNCT  0x00020000
70 #define _URE_MATHSYM     0x00040000
71 #define _URE_CURRENCYSYM 0x00080000
72 #define _URE_OTHERSYM    0x00100000
73
74 #define _URE_LTR         0x00200000
75 #define _URE_RTL         0x00400000
76
77 #define _URE_EURONUM     0x00800000
78 #define _URE_EURONUMSEP  0x01000000
79 #define _URE_EURONUMTERM 0x02000000
80 #define _URE_ARABNUM     0x04000000
81 #define _URE_COMMONSEP   0x08000000
82
83 #define _URE_BLOCKSEP    0x10000000
84 #define _URE_SEGMENTSEP  0x20000000
85
86 #define _URE_WHITESPACE  0x40000000
87 #define _URE_OTHERNEUT   0x80000000
88
89 /*
90  * Error codes.
91  */
92 #define _URE_OK               0
93 #define _URE_UNEXPECTED_EOS   -1
94 #define _URE_CCLASS_OPEN      -2
95 #define _URE_UNBALANCED_GROUP -3
96 #define _URE_INVALID_PROPERTY -4
97
98 /*
99  * Options that can be combined for searching.
100  */
101 #define URE_IGNORE_NONSPACING      0x01
102 #define URE_DOT_MATCHES_SEPARATORS 0x02
103
104 typedef unsigned long ucs4_t;
105 typedef unsigned short ucs2_t;
106
107 /*
108  * Opaque type for memory used when compiling expressions.
109  */
110 typedef struct _ure_buffer_t *ure_buffer_t;
111
112 /*
113  * Opaque type for the minimal DFA used when matching.
114  */
115 typedef struct _ure_dfa_t *ure_dfa_t;
116
117 /*************************************************************************
118  *
119  * API.
120  *
121  *************************************************************************/
122
123 LDAP_LUNICODE_F (ure_buffer_t) ure_buffer_create LDAP_P((void));
124
125 LDAP_LUNICODE_F (void) ure_buffer_free LDAP_P((ure_buffer_t buf));
126
127 LDAP_LUNICODE_F (ure_dfa_t)
128 ure_compile LDAP_P((ucs2_t *re, unsigned long relen,
129                     int casefold, ure_buffer_t buf));
130
131 LDAP_LUNICODE_F (void) ure_dfa_free LDAP_P((ure_dfa_t dfa));
132
133 LDAP_LUNICODE_F (void) ure_write_dfa LDAP_P((ure_dfa_t dfa, FILE *out));
134
135 LDAP_LUNICODE_F (int)
136 ure_exec LDAP_P((ure_dfa_t dfa, int flags, ucs2_t *text,
137                  unsigned long textlen, unsigned long *match_start,
138                  unsigned long *match_end));
139
140 /*************************************************************************
141  *
142  * Prototypes for stub functions used for URE.  These need to be rewritten to
143  * use the Unicode support available on the system.
144  *
145  *************************************************************************/
146
147 LDAP_LUNICODE_F (ucs4_t) _ure_tolower LDAP_P((ucs4_t c));
148
149 LDAP_LUNICODE_F (int)
150 _ure_matches_properties LDAP_P((unsigned long props, ucs4_t c));
151
152 LDAP_END_DECL
153
154 #endif /* _h_ure */