Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __TSLOCALE_H__
00013 #define __TSLOCALE_H__
00014
00015 #include <ctype.h>
00016 #include <limits.h>
00017
00018 #include "utils/pg_locale.h"
00019 #include "mb/pg_wchar.h"
00020
00021
00022
00023
00024
00025 #ifdef HAVE_WCHAR_H
00026 #include <wchar.h>
00027 #endif
00028 #ifdef HAVE_WCTYPE_H
00029 #include <wctype.h>
00030 #endif
00031
00032
00033 typedef struct
00034 {
00035 FILE *fp;
00036 const char *filename;
00037 int lineno;
00038 char *curline;
00039 ErrorContextCallback cb;
00040 } tsearch_readline_state;
00041
00042 #define TOUCHAR(x) (*((const unsigned char *) (x)))
00043
00044 #ifdef USE_WIDE_UPPER_LOWER
00045
00046 extern int t_isdigit(const char *ptr);
00047 extern int t_isspace(const char *ptr);
00048 extern int t_isalpha(const char *ptr);
00049 extern int t_isprint(const char *ptr);
00050
00051
00052 #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
00053
00054 #define COPYCHAR(d,s) memcpy(d, s, pg_mblen(s))
00055 #else
00056
00057 #define t_isdigit(x) isdigit(TOUCHAR(x))
00058 #define t_isspace(x) isspace(TOUCHAR(x))
00059 #define t_isalpha(x) isalpha(TOUCHAR(x))
00060 #define t_isprint(x) isprint(TOUCHAR(x))
00061 #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c))
00062
00063 #define COPYCHAR(d,s) (*((unsigned char *) (d)) = TOUCHAR(s))
00064 #endif
00065
00066 extern char *lowerstr(const char *str);
00067 extern char *lowerstr_with_len(const char *str, int len);
00068
00069 extern bool tsearch_readline_begin(tsearch_readline_state *stp,
00070 const char *filename);
00071 extern char *tsearch_readline(tsearch_readline_state *stp);
00072 extern void tsearch_readline_end(tsearch_readline_state *stp);
00073
00074 extern char *t_readline(FILE *fp);
00075
00076 #endif