1/* Pattern Matchers - Common Utilities. 2 Copyright (C) 1992, 1998, 2000, 2005 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 of the License, or 7 (at your option) 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, see <http://www.gnu.org/licenses/>. */ 16 17#include <stdbool.h> 18#include <stddef.h> 19#include <limits.h> 20#include "kwset.h" 21 22#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC 23/* We can handle multibyte string. */ 24# define MBS_SUPPORT 25# include <wchar.h> 26# include <wctype.h> 27#endif 28 29#define NCHAR (UCHAR_MAX + 1) 30 31struct compiled_kwset { 32 kwset_t kwset; 33 char *trans; 34 bool match_words; 35 bool match_lines; 36 char eolbyte; 37}; 38 39extern void 40 kwsinit (struct compiled_kwset *ckwset, 41 bool match_icase, bool match_words, bool match_lines, 42 char eolbyte); 43 44#ifdef MBS_SUPPORT 45extern char* 46 check_multibyte_string (const char *buf, size_t buf_size); 47#endif 48 49#define IS_WORD_CONSTITUENT(C) (ISALNUM(C) || (C) == '_') 50