1 /* search.c - searching subroutines using dfa, kwset and regex for grep. 2 Copyright 1992, 1998, 2000, 2007, 2009-2014 Free Software Foundation, Inc. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 3, or (at your option) 7 any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 17 02110-1301, USA. */ 18 19 #ifndef GREP_SEARCH_H 20 #define GREP_SEARCH_H 1 21 22 #include <config.h> 23 24 #include <sys/types.h> 25 #include <stdint.h> 26 #include <wchar.h> 27 #include <wctype.h> 28 #include <regex.h> 29 30 #include "system.h" 31 #include "error.h" 32 #include "grep.h" 33 #include "dfa.h" 34 #include "kwset.h" 35 #include "xalloc.h" 36 37 /* This must be a signed type. Each value is the difference in the size 38 of a character (in bytes) induced by converting to lower case. 39 The vast majority of values are 0, but a few are 1 or -1, so 40 technically, two bits may be sufficient. */ 41 typedef signed char mb_len_map_t; 42 43 /* searchutils.c */ 44 extern void kwsinit (kwset_t *); 45 46 extern char *mbtoupper (char const *, size_t *, mb_len_map_t **); 47 extern void build_mbclen_cache (void); 48 extern ptrdiff_t mb_goback (char const **, char const *, char const *); 49 extern wint_t mb_prev_wc (char const *, char const *, char const *); 50 extern wint_t mb_next_wc (char const *, char const *); 51 52 /* dfasearch.c */ 53 extern void GEAcompile (char const *, size_t, reg_syntax_t); 54 extern size_t EGexecute (char const *, size_t, size_t *, char const *); 55 56 /* kwsearch.c */ 57 extern void Fcompile (char const *, size_t); 58 extern size_t Fexecute (char const *, size_t, size_t *, char const *); 59 60 /* pcresearch.c */ 61 extern void Pcompile (char const *, size_t); 62 extern size_t Pexecute (char const *, size_t, size_t *, char const *); 63 64 #endif /* GREP_SEARCH_H */ 65