Home | History | Annotate | only in /src/external/bsd/openldap/dist/libraries/liblunicode/utbm
Up to higher level directory
NameDateSize
README14-Aug-20214K
utbm.c05-Sep-202513K
utbm.h05-Sep-20253.8K
utbmstub.c05-Sep-20252.9K

README

      1 #
      2 # Id: README,v 1.1 1999/09/21 15:45:17 mleisher Exp 
      3 #
      4 # Copyright 1997, 1998, 1999 Computing Research Labs,
      5 # New Mexico State University
      6 #
      7 # Permission is hereby granted, free of charge, to any person obtaining a
      8 # copy of this software and associated documentation files (the "Software"),
      9 # to deal in the Software without restriction, including without limitation
     10 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
     11 # and/or sell copies of the Software, and to permit persons to whom the
     12 # Software is furnished to do so, subject to the following conditions:
     13 #
     14 # The above copyright notice and this permission notice shall be included in
     15 # all copies or substantial portions of the Software.
     16 #
     17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     20 # THE COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY BE LIABLE FOR ANY
     21 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
     22 # OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
     23 # THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     24 #
     25 
     26                        Unicode and Boyer-Moore Searching
     27                                  Version 0.2
     28 
     29 UTBM (Unicode Tuned Boyer-Moore) is a simple package that provides tuned
     30 Boyer-Moore searches on Unicode UCS2 text (handles high and low surrogates).
     31 
     32 ---------------------------------------------------------------------------
     33 
     34 Assumptions:
     35 
     36   o  Search pattern and text already normalized in some fashion.
     37 
     38   o  Upper, lower, and title case conversions are one-to-one.
     39 
     40   o  For conversions between upper, lower, and title case, UCS2 characters
     41      always convert to other UCS2 characters, and UTF-16 characters always
     42      convert to other UTF-16 characters.
     43 
     44 Flags:
     45 
     46   UTBM provides three processing flags:
     47 
     48   o  UTBM_CASEFOLD          - search in a case-insensitive manner.
     49 
     50   o  UTBM_IGNORE_NONSPACING - ignore non-spacing characters in the pattern and
     51                               the text.
     52 
     53   o  UTBM_SPACE_COMPRESS    - view as a *single space*, sequential groups of
     54                               U+2028, U+2029, '\n', '\r', '\t', and any
     55                               character identified as a space by the Unicode
     56                               support on the platform.
     57 
     58                               This flag also causes all characters identified
     59                               as control by the Unicode support on the
     60                               platform to be ignored (except for '\n', '\r',
     61                               and '\t').
     62 
     63 ---------------------------------------------------------------------------
     64 
     65 Before using UTBM
     66 -----------------
     67 Before UTBM is used, some functions need to be created.  The "utbmstub.c" file
     68 contains stubs that need to be rewritten so they work with the Unicode support
     69 on the platform on which this package is being used.
     70 
     71 Using UTBM
     72 ----------
     73 
     74 Sample pseudo-code fragment.
     75 
     76   utbm_pattern_t pat;
     77   ucs2_t *pattern, *text;
     78   unsigned long patternlen, textlen;
     79   unsigned long flags, match_start, match_end;
     80 
     81   /*
     82    * Allocate the dynamic storage needed for a search pattern.
     83    */
     84   pat = utbm_create_pattern();
     85 
     86   /*
     87    * Set the search flags desired.
     88    */
     89   flags = UTBM_CASEFOLD|UTBM_IGNORE_NONSPACING;
     90 
     91   /*
     92    * Compile the search pattern.
     93    */
     94   utbm_compile(pattern, patternlen, flags, pat);
     95 
     96   /*
     97    * Find the first occurrence of the search pattern in the text.
     98    */
     99   if (utbm_exec(pat, text, textlen, &match_start, &match_end))
    100     printf("MATCH: %ld %ld\n", match_start, match_end);
    101 
    102   /*
    103    * Free the dynamic storage used for the search pattern.
    104    */
    105   ure_free_pattern(pat);
    106 
    107 ---------------------------------------------------------------------------
    108 
    109 Mark Leisher <mleisher@crl.nmsu.edu>
    110 2 May 1997
    111 
    112 ===========================================================================
    113 
    114 CHANGES
    115 -------
    116 
    117 Version: 0.2
    118 Date   : 21 September 1999
    119 ==========================
    120   1. Added copyright stuff and put in CVS.
    121 
    122