# $OpenLDAP$
-## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
##
## Makefile.in for LDAP -lldap
/* $OpenLDAP$ */
/*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/*
/* $OpenLDAP$ */
/*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/*
/* $OpenLDAP$ */
/*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/*
}
static int
-cmpcomps(_comp_t *comp1, _comp_t *comp2)
+cmpcomps(const void *v_comp1, const void *v_comp2)
{
+ const _comp_t *comp1 = v_comp1, *comp2 = v_comp2;
long diff = comp1->code1 - comp2->code1;
if (!diff)
cu++;
}
comps_used = cu;
- qsort(comps, comps_used, sizeof(_comp_t),
- (int (*)(const void *, const void *)) cmpcomps);
+ qsort(comps, comps_used, sizeof(_comp_t), cmpcomps);
}
static void
/*
- * Copyright 2000-2002 The OpenLDAP Foundation
+ * Copyright 2000-2003 The OpenLDAP Foundation
* COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
* of this package for details.
*/
/* $OpenLDAP$ */
/*
- * Copyright 2000-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/*
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * 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
+
+#include "portable.h"
+
+/*
+ * $Id: ure.h,v 1.2 1999/09/21 15:47:44 mleisher Exp $
+ */
+
+#include <stdio.h>
+
+LDAP_BEGIN_DECL
+
+/*
+ * 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.
+ *
+ *************************************************************************/
+
+LDAP_LUNICODE_F (ure_buffer_t) ure_buffer_create LDAP_P((void));
+
+LDAP_LUNICODE_F (void) ure_buffer_free LDAP_P((ure_buffer_t buf));
+
+LDAP_LUNICODE_F (ure_dfa_t)
+ure_compile LDAP_P((ucs2_t *re, unsigned long relen,
+ int casefold, ure_buffer_t buf));
+
+LDAP_LUNICODE_F (void) ure_dfa_free LDAP_P((ure_dfa_t dfa));
+
+LDAP_LUNICODE_F (void) ure_write_dfa LDAP_P((ure_dfa_t dfa, FILE *out));
+
+LDAP_LUNICODE_F (int)
+ure_exec LDAP_P((ure_dfa_t dfa, int flags, 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.
+ *
+ *************************************************************************/
+
+LDAP_LUNICODE_F (ucs4_t) _ure_tolower LDAP_P((ucs4_t c));
+
+LDAP_LUNICODE_F (int)
+_ure_matches_properties LDAP_P((unsigned long props, ucs4_t c));
+
+LDAP_END_DECL
+
+#endif /* _h_ure */
--- /dev/null
+/* $OpenLDAP$ */
+/*
+ * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*
+ * 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.
+ */
+/* $Id: urestubs.c,v 1.2 1999/09/21 15:47:44 mleisher Exp $" */
+
+#include "ure.h"
+
+#ifdef _MSC_VER
+# include "../ucdata/ucdata.h"
+#else
+# include "ucdata.h"
+#endif
+
+/*
+ * This file contains stub routines needed by the URE package to test
+ * character properties and other Unicode implementation specific details.
+ */
+
+/*
+ * This routine should return the lower case equivalent for the character or,
+ * if there is no lower case quivalent, the character itself.
+ */
+ucs4_t _ure_tolower(ucs4_t c)
+{
+ return uctoupper(c);
+}
+
+static struct ucmaskmap {
+ unsigned long mask1;
+ unsigned long mask2;
+} masks[32] = {
+ { UC_MN, 0 }, /* _URE_NONSPACING */
+ { UC_MC, 0 }, /* _URE_COMBINING */
+ { UC_ND, 0 }, /* _URE_NUMDIGIT */
+ { UC_NL|UC_NO, 0 }, /* _URE_NUMOTHER */
+ { UC_ZS, 0 }, /* _URE_SPACESEP */
+ { UC_ZL, 0 }, /* _URE_LINESEP */
+ { UC_ZP, 0 }, /* _URE_PARASEP */
+ { UC_CC, 0 }, /* _URE_CNTRL */
+ { UC_CO, 0 }, /* _URE_PUA */
+
+ { UC_LU, 0 }, /* _URE_UPPER */
+ { UC_LL, 0 }, /* _URE_LOWER */
+ { UC_LT, 0 }, /* _URE_TITLE */
+ { UC_LM, 0 }, /* _URE_MODIFIER */
+ { UC_LO, 0 }, /* _URE_OTHERLETTER */
+ { UC_PD, 0 }, /* _URE_DASHPUNCT */
+ { UC_PS, 0 }, /* _URE_OPENPUNCT */
+ { UC_PC, 0 }, /* _URE_CLOSEPUNCT */
+ { UC_PO, 0 }, /* _URE_OTHERPUNCT */
+ { UC_SM, 0 }, /* _URE_MATHSYM */
+ { UC_SC, 0 }, /* _URE_CURRENCYSYM */
+ { UC_SO, 0 }, /* _URE_OTHERSYM */
+
+ { UC_L, 0 }, /* _URE_LTR */
+ { UC_R, 0 }, /* _URE_RTL */
+
+ { 0, UC_EN }, /* _URE_EURONUM */
+ { 0, UC_ES }, /* _URE_EURONUMSEP */
+ { 0, UC_ET }, /* _URE_EURONUMTERM */
+ { 0, UC_AN }, /* _URE_ARABNUM */
+ { 0, UC_CS }, /* _URE_COMMONSEP */
+
+ { 0, UC_B }, /* _URE_BLOCKSEP */
+ { 0, UC_S }, /* _URE_SEGMENTSEP */
+
+ { 0, UC_WS }, /* _URE_WHITESPACE */
+ { 0, UC_ON } /* _URE_OTHERNEUT */
+};
+
+
+/*
+ * This routine takes a set of URE character property flags (see ure.h) along
+ * with a character and tests to see if the character has one or more of those
+ * properties.
+ */
+int
+_ure_matches_properties(unsigned long props, ucs4_t c)
+{
+ int i;
+ unsigned long mask1=0, mask2=0;
+
+ for( i=0; i<32; i++ ) {
+ if( props & (1 << i) ) {
+ mask1 |= masks[i].mask1;
+ mask2 |= masks[i].mask2;
+ }
+ }
+
+ return ucisprop( mask1, mask2, c );
+}