Fix xslt_process() to ensure that it inserts a NULL terminator after the
[PostgreSQL.git] / src / include / tsearch / ts_locale.h
blob3f5f2a82fdedd8c772b2d4eb202f9a248d61b741
1 /*-------------------------------------------------------------------------
3 * ts_locale.h
4 * locale compatibility layer for tsearch
6 * Copyright (c) 1998-2009, PostgreSQL Global Development Group
8 * $PostgreSQL$
10 *-------------------------------------------------------------------------
12 #ifndef __TSLOCALE_H__
13 #define __TSLOCALE_H__
15 #include <ctype.h>
16 #include <limits.h>
18 #include "utils/pg_locale.h"
19 #include "mb/pg_wchar.h"
22 * towlower() and friends should be in <wctype.h>, but some pre-C99 systems
23 * declare them in <wchar.h>.
25 #ifdef HAVE_WCHAR_H
26 #include <wchar.h>
27 #endif
28 #ifdef HAVE_WCTYPE_H
29 #include <wctype.h>
30 #endif
32 /* working state for tsearch_readline (should be a local var in caller) */
33 typedef struct
35 FILE *fp;
36 const char *filename;
37 int lineno;
38 char *curline;
39 ErrorContextCallback cb;
40 } tsearch_readline_state;
42 #define TOUCHAR(x) (*((const unsigned char *) (x)))
44 #ifdef USE_WIDE_UPPER_LOWER
46 extern int t_isdigit(const char *ptr);
47 extern int t_isspace(const char *ptr);
48 extern int t_isalpha(const char *ptr);
49 extern int t_isprint(const char *ptr);
51 /* The second argument of t_iseq() must be a plain ASCII character */
52 #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
54 #define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s))
55 #else /* not USE_WIDE_UPPER_LOWER */
57 #define t_isdigit(x) isdigit(TOUCHAR(x))
58 #define t_isspace(x) isspace(TOUCHAR(x))
59 #define t_isalpha(x) isalpha(TOUCHAR(x))
60 #define t_isprint(x) isprint(TOUCHAR(x))
61 #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
63 #define COPYCHAR(d,s) (*((unsigned char *) (d)) = TOUCHAR(s))
64 #endif /* USE_WIDE_UPPER_LOWER */
66 extern char *lowerstr(const char *str);
67 extern char *lowerstr_with_len(const char *str, int len);
69 extern bool tsearch_readline_begin(tsearch_readline_state *stp,
70 const char *filename);
71 extern char *tsearch_readline(tsearch_readline_state *stp);
72 extern void tsearch_readline_end(tsearch_readline_state *stp);
74 extern char *t_readline(FILE *fp);
76 #endif /* __TSLOCALE_H__ */