From 46651ce6fe013220ed397add242004d764fc0153 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:15:05 +0200 Subject: Adding upstream version 14.5. Signed-off-by: Daniel Baumann --- src/include/tsearch/ts_locale.h | 63 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 src/include/tsearch/ts_locale.h (limited to 'src/include/tsearch/ts_locale.h') diff --git a/src/include/tsearch/ts_locale.h b/src/include/tsearch/ts_locale.h new file mode 100644 index 0000000..cfd34b3 --- /dev/null +++ b/src/include/tsearch/ts_locale.h @@ -0,0 +1,63 @@ +/*------------------------------------------------------------------------- + * + * ts_locale.h + * locale compatibility layer for tsearch + * + * Copyright (c) 1998-2021, PostgreSQL Global Development Group + * + * src/include/tsearch/ts_locale.h + * + *------------------------------------------------------------------------- + */ +#ifndef __TSLOCALE_H__ +#define __TSLOCALE_H__ + +#include +#include + +#include "lib/stringinfo.h" +#include "mb/pg_wchar.h" +#include "utils/pg_locale.h" + +/* + * towlower() and friends should be in , but some pre-C99 systems + * declare them in , so include that too. + */ +#include +#ifdef HAVE_WCTYPE_H +#include +#endif + +/* working state for tsearch_readline (should be a local var in caller) */ +typedef struct +{ + FILE *fp; + const char *filename; + int lineno; + StringInfoData buf; /* current input line, in UTF-8 */ + char *curline; /* current input line, in DB's encoding */ + /* curline may be NULL, or equal to buf.data, or a palloc'd string */ + ErrorContextCallback cb; +} tsearch_readline_state; + +#define TOUCHAR(x) (*((const unsigned char *) (x))) + +/* The second argument of t_iseq() must be a plain ASCII character */ +#define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c)) + +#define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s)) + +extern int t_isdigit(const char *ptr); +extern int t_isspace(const char *ptr); +extern int t_isalpha(const char *ptr); +extern int t_isprint(const char *ptr); + +extern char *lowerstr(const char *str); +extern char *lowerstr_with_len(const char *str, int len); + +extern bool tsearch_readline_begin(tsearch_readline_state *stp, + const char *filename); +extern char *tsearch_readline(tsearch_readline_state *stp); +extern void tsearch_readline_end(tsearch_readline_state *stp); + +#endif /* __TSLOCALE_H__ */ -- cgit v1.2.3