]> granicus.if.org Git - postgresql/blob - src/include/regex/pg_wchar.h
Version 06-30-0248
[postgresql] / src / include / regex / pg_wchar.h
1 /* $Id: pg_wchar.h,v 1.4 1998/07/18 18:34:24 momjian Exp $ */
2
3 #ifndef PG_WCHAR_H
4 #define PG_WCHAR_H
5
6 #include <sys/types.h>
7
8 #define EUC_JP 0        /* EUC for Japanese */
9 #define EUC_CN 1        /* EUC for Chinese */
10 #define EUC_KR 2        /* EUC for Korean */
11 #define EUC_TW 3        /* EUC for Taiwan */
12 #define UNICODE 4       /* Unicode UTF-8 */
13 #define MULE_INTERNAL 5 /* Mule internal code */
14 #define LATIN1 6        /* ISO-8859 Latin 1 */
15 #define LATIN2 7        /* ISO-8859 Latin 2 */
16 #define LATIN3 8        /* ISO-8859 Latin 3 */
17 #define LATIN4 9        /* ISO-8859 Latin 4 */
18 #define LATIN5 10       /* ISO-8859 Latin 5 */
19 /* followings are for client encoding only */
20 #define SJIS 16         /* Shift JIS */
21
22 #ifdef MULTIBYTE
23 # if LATIN1 <= MULTIBYTE && MULTIBYTE <= LATIN5
24 typedef unsigned char pg_wchar;
25 # else
26 typedef unsigned int pg_wchar;
27 # endif
28 #else
29 #define pg_wchar char
30 #endif
31
32 /*
33  * various definitions for EUC
34  */
35 #define SS2 0x8e        /* single shift 2 */
36 #define SS3 0x8f        /* single shift 3 */
37
38 /*
39  * various definitions for mule internal code
40  */
41 #define IS_LC1(c)       ((unsigned char)(c) >= 0x81 && (unsigned char)(c) <= 0x8f)
42 #define IS_LCPRV1(c)    ((unsigned char)(c) == 0x9a || (unsigned char)(c) == 0x9b)
43 #define IS_LC2(c)       ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99)
44 #define IS_LCPRV2(c)    ((unsigned char)(c) == 0x9c || (unsigned char)(c) == 0x9d)
45
46 /*
47  * leading characters
48  */
49 #define LC_ISO8859_1    0x81    /* ISO8859 Latin 1 */
50 #define LC_ISO8859_2    0x82    /* ISO8859 Latin 2 */
51 #define LC_ISO8859_3    0x83    /* ISO8859 Latin 3 */
52 #define LC_ISO8859_4    0x84    /* ISO8859 Latin 4 */
53 #define LC_ISO8859_5    0x8d    /* ISO8859 Latin 5 */
54 #define LC_JISX0201K    0x89    /* Japanese 1 byte kana */
55 #define LC_JISX0201R    0x90    /* Japanese 1 byte Roman */
56 #define LC_GB2312_80    0x91    /* Chinese */
57 #define LC_JISX0208     0x92    /* Japanese Kanji */
58 #define LC_KS5601       0x93    /* Korean */
59 #define LC_JISX0212     0x94    /* Japanese Kanji (JISX0212) */
60 #define LC_CNS11643_1   0x95    /* CNS 11643-1992 Plane 1 */
61 #define LC_CNS11643_2   0x96    /* CNS 11643-1992 Plane 2 */
62 #define LC_CNS11643_3   0xf6    /* CNS 11643-1992 Plane 3 */
63 #define LC_CNS11643_4   0xf7    /* CNS 11643-1992 Plane 4 */
64 #define LC_CNS11643_5   0xf8    /* CNS 11643-1992 Plane 5 */
65 #define LC_CNS11643_6   0xf9    /* CNS 11643-1992 Plane 6 */
66 #define LC_CNS11643_7   0xfa    /* CNS 11643-1992 Plane 7 */
67
68 #ifdef MULTIBYTE
69 extern void pg_mb2wchar(const unsigned char *, pg_wchar *);
70 extern void pg_mb2wchar_with_len(const unsigned char *, pg_wchar *, int);
71 extern int pg_char_and_wchar_strcmp(const char *, const pg_wchar *);
72 extern int pg_wchar_strncmp(const pg_wchar *, const pg_wchar *, size_t);
73 extern int pg_char_and_wchar_strncmp(const char *, const pg_wchar *, size_t);
74 extern size_t pg_wchar_strlen(const pg_wchar *);
75 extern int pg_mblen(const unsigned char *);
76 extern int pg_encoding_mblen(int, const unsigned char *);
77 extern int pg_mic_mblen(const unsigned char *);
78 extern int pg_mbstrlen(const unsigned char *);
79 extern int pg_mbstrlen_with_len(const unsigned char *, int);
80 #endif
81
82 #endif