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