Back to index

openldap  2.4.31
ure.h
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  *
00004  * Copyright 1998-2012 The OpenLDAP Foundation.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted only as authorized by the OpenLDAP
00009  * Public License.
00010  *
00011  * A copy of this license is available in file LICENSE in the
00012  * top-level directory of the distribution or, alternatively, at
00013  * <http://www.OpenLDAP.org/license.html>.
00014  */
00015 /* Copyright 1997, 1998, 1999 Computing Research Labs,
00016  * New Mexico State University
00017  *
00018  * Permission is hereby granted, free of charge, to any person obtaining a
00019  * copy of this software and associated documentation files (the "Software"),
00020  * to deal in the Software without restriction, including without limitation
00021  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00022  * and/or sell copies of the Software, and to permit persons to whom the
00023  * Software is furnished to do so, subject to the following conditions:
00024  *
00025  * The above copyright notice and this permission notice shall be included in
00026  * all copies or substantial portions of the Software.
00027  *
00028  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00029  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00030  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00031  * THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
00032  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
00033  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
00034  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00035  */
00036 /* $Id: ure.h,v 1.2 1999/09/21 15:47:44 mleisher Exp $ */
00037 
00038 #ifndef _h_ure
00039 #define _h_ure
00040 
00041 #include "portable.h"
00042 
00043 
00044 #include <stdio.h>
00045 
00046 LDAP_BEGIN_DECL
00047 
00048 /*
00049  * Set of character class flags.
00050  */
00051 #define _URE_NONSPACING  0x00000001
00052 #define _URE_COMBINING   0x00000002
00053 #define _URE_NUMDIGIT    0x00000004
00054 #define _URE_NUMOTHER    0x00000008
00055 #define _URE_SPACESEP    0x00000010
00056 #define _URE_LINESEP     0x00000020
00057 #define _URE_PARASEP     0x00000040
00058 #define _URE_CNTRL       0x00000080
00059 #define _URE_PUA         0x00000100
00060 
00061 #define _URE_UPPER       0x00000200
00062 #define _URE_LOWER       0x00000400
00063 #define _URE_TITLE       0x00000800
00064 #define _URE_MODIFIER    0x00001000
00065 #define _URE_OTHERLETTER 0x00002000
00066 #define _URE_DASHPUNCT   0x00004000
00067 #define _URE_OPENPUNCT   0x00008000
00068 #define _URE_CLOSEPUNCT  0x00010000
00069 #define _URE_OTHERPUNCT  0x00020000
00070 #define _URE_MATHSYM     0x00040000
00071 #define _URE_CURRENCYSYM 0x00080000
00072 #define _URE_OTHERSYM    0x00100000
00073 
00074 #define _URE_LTR         0x00200000
00075 #define _URE_RTL         0x00400000
00076 
00077 #define _URE_EURONUM     0x00800000
00078 #define _URE_EURONUMSEP  0x01000000
00079 #define _URE_EURONUMTERM 0x02000000
00080 #define _URE_ARABNUM     0x04000000
00081 #define _URE_COMMONSEP   0x08000000
00082 
00083 #define _URE_BLOCKSEP    0x10000000
00084 #define _URE_SEGMENTSEP  0x20000000
00085 
00086 #define _URE_WHITESPACE  0x40000000
00087 #define _URE_OTHERNEUT   0x80000000
00088 
00089 /*
00090  * Error codes.
00091  */
00092 #define _URE_OK               0
00093 #define _URE_UNEXPECTED_EOS   -1
00094 #define _URE_CCLASS_OPEN      -2
00095 #define _URE_UNBALANCED_GROUP -3
00096 #define _URE_INVALID_PROPERTY -4
00097 
00098 /*
00099  * Options that can be combined for searching.
00100  */
00101 #define URE_IGNORE_NONSPACING      0x01
00102 #define URE_DOT_MATCHES_SEPARATORS 0x02
00103 
00104 typedef unsigned long ucs4_t;
00105 typedef unsigned short ucs2_t;
00106 
00107 /*
00108  * Opaque type for memory used when compiling expressions.
00109  */
00110 typedef struct _ure_buffer_t *ure_buffer_t;
00111 
00112 /*
00113  * Opaque type for the minimal DFA used when matching.
00114  */
00115 typedef struct _ure_dfa_t *ure_dfa_t;
00116 
00117 /*************************************************************************
00118  *
00119  * API.
00120  *
00121  *************************************************************************/
00122 
00123 LDAP_LUNICODE_F (ure_buffer_t) ure_buffer_create LDAP_P((void));
00124 
00125 LDAP_LUNICODE_F (void) ure_buffer_free LDAP_P((ure_buffer_t buf));
00126 
00127 LDAP_LUNICODE_F (ure_dfa_t)
00128 ure_compile LDAP_P((ucs2_t *re, unsigned long relen,
00129                   int casefold, ure_buffer_t buf));
00130 
00131 LDAP_LUNICODE_F (void) ure_dfa_free LDAP_P((ure_dfa_t dfa));
00132 
00133 LDAP_LUNICODE_F (void) ure_write_dfa LDAP_P((ure_dfa_t dfa, FILE *out));
00134 
00135 LDAP_LUNICODE_F (int)
00136 ure_exec LDAP_P((ure_dfa_t dfa, int flags, ucs2_t *text,
00137                unsigned long textlen, unsigned long *match_start,
00138                unsigned long *match_end));
00139 
00140 /*************************************************************************
00141  *
00142  * Prototypes for stub functions used for URE.  These need to be rewritten to
00143  * use the Unicode support available on the system.
00144  *
00145  *************************************************************************/
00146 
00147 LDAP_LUNICODE_F (ucs4_t) _ure_tolower LDAP_P((ucs4_t c));
00148 
00149 LDAP_LUNICODE_F (int)
00150 _ure_matches_properties LDAP_P((unsigned long props, ucs4_t c));
00151 
00152 LDAP_END_DECL
00153 
00154 #endif /* _h_ure */