PostgreSQL Source Code  git master
ts_locale.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * ts_locale.h
4  * locale compatibility layer for tsearch
5  *
6  * Copyright (c) 1998-2021, PostgreSQL Global Development Group
7  *
8  * src/include/tsearch/ts_locale.h
9  *
10  *-------------------------------------------------------------------------
11  */
12 #ifndef __TSLOCALE_H__
13 #define __TSLOCALE_H__
14 
15 #include <ctype.h>
16 #include <limits.h>
17 
18 #include "lib/stringinfo.h"
19 #include "mb/pg_wchar.h"
20 #include "utils/pg_locale.h"
21 
22 /*
23  * towlower() and friends should be in <wctype.h>, but some pre-C99 systems
24  * declare them in <wchar.h>, so include that too.
25  */
26 #include <wchar.h>
27 #ifdef HAVE_WCTYPE_H
28 #include <wctype.h>
29 #endif
30 
31 /* working state for tsearch_readline (should be a local var in caller) */
32 typedef struct
33 {
34  FILE *fp;
35  const char *filename;
36  int lineno;
37  StringInfoData buf; /* current input line, in UTF-8 */
38  char *curline; /* current input line, in DB's encoding */
39  /* curline may be NULL, or equal to buf.data, or a palloc'd string */
42 
43 #define TOUCHAR(x) (*((const unsigned char *) (x)))
44 
45 /* The second argument of t_iseq() must be a plain ASCII character */
46 #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
47 
48 #define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s))
49 
50 extern int t_isdigit(const char *ptr);
51 extern int t_isspace(const char *ptr);
52 extern int t_isalpha(const char *ptr);
53 extern int t_isprint(const char *ptr);
54 
55 extern char *lowerstr(const char *str);
56 extern char *lowerstr_with_len(const char *str, int len);
57 
59  const char *filename);
60 extern char *tsearch_readline(tsearch_readline_state *stp);
62 
63 #endif /* __TSLOCALE_H__ */
int t_isdigit(const char *ptr)
Definition: ts_locale.c:37
char * tsearch_readline(tsearch_readline_state *stp)
Definition: ts_locale.c:148
int t_isspace(const char *ptr)
Definition: ts_locale.c:53
char * lowerstr_with_len(const char *str, int len)
Definition: ts_locale.c:257
char * lowerstr(const char *str)
Definition: ts_locale.c:244
void tsearch_readline_end(tsearch_readline_state *stp)
Definition: ts_locale.c:193
bool tsearch_readline_begin(tsearch_readline_state *stp, const char *filename)
Definition: ts_locale.c:125
ErrorContextCallback cb
Definition: ts_locale.h:40
StringInfoData buf
Definition: ts_locale.h:37
const char * filename
Definition: ts_locale.h:35
int t_isalpha(const char *ptr)
Definition: ts_locale.c:69
static char * filename
Definition: pg_dumpall.c:92
int t_isprint(const char *ptr)
Definition: ts_locale.c:85