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-2017, 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 "utils/pg_locale.h"
19 #include "mb/pg_wchar.h"
20 
21 /*
22  * towlower() and friends should be in <wctype.h>, but some pre-C99 systems
23  * declare them in <wchar.h>.
24  */
25 #ifdef HAVE_WCHAR_H
26 #include <wchar.h>
27 #endif
28 #ifdef HAVE_WCTYPE_H
29 #include <wctype.h>
30 #endif
31 
32 /* working state for tsearch_readline (should be a local var in caller) */
33 typedef struct
34 {
35  FILE *fp;
36  const char *filename;
37  int lineno;
38  char *curline;
41 
42 #define TOUCHAR(x) (*((const unsigned char *) (x)))
43 
44 /* The second argument of t_iseq() must be a plain ASCII character */
45 #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
46 
47 #define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s))
48 
49 extern int t_isdigit(const char *ptr);
50 extern int t_isspace(const char *ptr);
51 extern int t_isalpha(const char *ptr);
52 extern int t_isprint(const char *ptr);
53 
54 extern char *lowerstr(const char *str);
55 extern char *lowerstr_with_len(const char *str, int len);
56 
58  const char *filename);
59 extern char *tsearch_readline(tsearch_readline_state *stp);
61 
62 extern char *t_readline(FILE *fp);
63 
64 #endif /* __TSLOCALE_H__ */
int t_isdigit(const char *ptr)
Definition: ts_locale.c:25
char * tsearch_readline(tsearch_readline_state *stp)
Definition: ts_locale.c:135
int t_isspace(const char *ptr)
Definition: ts_locale.c:41
char * lowerstr_with_len(const char *str, int len)
Definition: ts_locale.c:241
char * lowerstr(const char *str)
Definition: ts_locale.c:228
char * t_readline(FILE *fp)
Definition: ts_locale.c:194
void tsearch_readline_end(tsearch_readline_state *stp)
Definition: ts_locale.c:150
bool tsearch_readline_begin(tsearch_readline_state *stp, const char *filename)
Definition: ts_locale.c:113
ErrorContextCallback cb
Definition: ts_locale.h:39
const char * filename
Definition: ts_locale.h:36
int t_isalpha(const char *ptr)
Definition: ts_locale.c:57
static char * filename
Definition: pg_dumpall.c:90
int t_isprint(const char *ptr)
Definition: ts_locale.c:73