openldap/libraries/liblunicode/ure/ure.h

145 lines
4.4 KiB
C
Raw Normal View History

2000-04-19 21:37:52 +08:00
/* $OpenLDAP$ */
/*
2000-05-22 02:15:00 +08:00
* Copyright 2000 The OpenLDAP Foundation, All Rights Reserved.
2000-04-19 21:37:52 +08:00
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
2000-01-26 06:38:34 +08:00
/*
* Copyright 1997, 1998, 1999 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"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _h_ure
#define _h_ure
2000-01-27 09:00:02 +08:00
#include "portable.h"
2000-01-26 06:38:34 +08:00
/*
* $Id: ure.h,v 1.2 1999/09/21 15:47:44 mleisher Exp $
*/
#include <stdio.h>
2000-01-27 09:00:02 +08:00
LDAP_BEGIN_DECL
2000-01-26 06:38:34 +08:00
/*
* Set of character class flags.
*/
#define _URE_NONSPACING 0x00000001
#define _URE_COMBINING 0x00000002
#define _URE_NUMDIGIT 0x00000004
#define _URE_NUMOTHER 0x00000008
#define _URE_SPACESEP 0x00000010
#define _URE_LINESEP 0x00000020
#define _URE_PARASEP 0x00000040
#define _URE_CNTRL 0x00000080
#define _URE_PUA 0x00000100
#define _URE_UPPER 0x00000200
#define _URE_LOWER 0x00000400
#define _URE_TITLE 0x00000800
#define _URE_MODIFIER 0x00001000
#define _URE_OTHERLETTER 0x00002000
#define _URE_DASHPUNCT 0x00004000
#define _URE_OPENPUNCT 0x00008000
#define _URE_CLOSEPUNCT 0x00010000
#define _URE_OTHERPUNCT 0x00020000
#define _URE_MATHSYM 0x00040000
#define _URE_CURRENCYSYM 0x00080000
#define _URE_OTHERSYM 0x00100000
#define _URE_LTR 0x00200000
#define _URE_RTL 0x00400000
#define _URE_EURONUM 0x00800000
#define _URE_EURONUMSEP 0x01000000
#define _URE_EURONUMTERM 0x02000000
#define _URE_ARABNUM 0x04000000
#define _URE_COMMONSEP 0x08000000
#define _URE_BLOCKSEP 0x10000000
#define _URE_SEGMENTSEP 0x20000000
#define _URE_WHITESPACE 0x40000000
#define _URE_OTHERNEUT 0x80000000
/*
* Error codes.
*/
#define _URE_OK 0
#define _URE_UNEXPECTED_EOS -1
#define _URE_CCLASS_OPEN -2
#define _URE_UNBALANCED_GROUP -3
#define _URE_INVALID_PROPERTY -4
/*
* Options that can be combined for searching.
*/
#define URE_IGNORE_NONSPACING 0x01
#define URE_DOT_MATCHES_SEPARATORS 0x02
typedef unsigned long ucs4_t;
typedef unsigned short ucs2_t;
/*
* Opaque type for memory used when compiling expressions.
*/
typedef struct _ure_buffer_t *ure_buffer_t;
/*
* Opaque type for the minimal DFA used when matching.
*/
typedef struct _ure_dfa_t *ure_dfa_t;
/*************************************************************************
*
* API.
*
*************************************************************************/
2001-06-16 15:37:43 +08:00
extern ure_buffer_t ure_buffer_create LDAP_P((void));
2000-01-26 06:38:34 +08:00
2001-06-16 15:37:43 +08:00
extern void ure_buffer_free LDAP_P((ure_buffer_t buf));
2000-01-26 06:38:34 +08:00
2001-06-16 15:37:43 +08:00
extern ure_dfa_t ure_compile LDAP_P((ucs2_t *re, unsigned long relen,
2000-01-26 06:38:34 +08:00
int casefold, ure_buffer_t buf));
2001-06-16 15:37:43 +08:00
extern void ure_dfa_free LDAP_P((ure_dfa_t dfa));
2000-01-26 06:38:34 +08:00
2001-06-16 15:37:43 +08:00
extern void ure_write_dfa LDAP_P((ure_dfa_t dfa, FILE *out));
2000-01-26 06:38:34 +08:00
2001-06-16 15:37:43 +08:00
extern int ure_exec LDAP_P((ure_dfa_t dfa, int flags,
2000-01-26 06:38:34 +08:00
ucs2_t *text, unsigned long textlen,
unsigned long *match_start, unsigned long *match_end));
/*************************************************************************
*
* Prototypes for stub functions used for URE. These need to be rewritten to
* use the Unicode support available on the system.
*
*************************************************************************/
2001-06-16 15:37:43 +08:00
extern ucs4_t _ure_tolower LDAP_P((ucs4_t c));
2000-01-26 06:38:34 +08:00
2001-06-16 15:37:43 +08:00
extern int _ure_matches_properties LDAP_P((unsigned long props, ucs4_t c));
2000-01-26 06:38:34 +08:00
2000-01-27 09:00:02 +08:00
LDAP_END_DECL
2000-01-26 06:38:34 +08:00
#endif /* _h_ure */