summaryrefslogtreecommitdiff
path: root/src/include/regex/pg_wchar.h
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-03-15 07:39:04 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-03-15 07:39:04 +0000
commit661ecf3c48e16a9add216287eb969d7615e47968 (patch)
tree91b54d5905aa2e22bd0ae9ea8c6b0f3cab75d3f4 /src/include/regex/pg_wchar.h
parent31a925c4d07675bc098a742ee9ca642ec79a40ee (diff)
From: t-ishii@sra.co.jp
Included are patches intended for allowing PostgreSQL to handle multi-byte charachter sets such as EUC(Extende Unix Code), Unicode and Mule internal code. With the MB patch you can use multi-byte character sets in regexp and LIKE. The encoding system chosen is determined at the compile time. To enable the MB extension, you need to define a variable "MB" in Makefile.global or in Makefile.custom. For further information please take a look at README.mb under doc directory. (Note that unlike "jp patch" I do not use modified GNU regexp any more. I changed Henry Spencer's regexp coming with PostgreSQL.)
Diffstat (limited to 'src/include/regex/pg_wchar.h')
-rw-r--r--src/include/regex/pg_wchar.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/include/regex/pg_wchar.h b/src/include/regex/pg_wchar.h
new file mode 100644
index 00000000000..616f76cfec5
--- /dev/null
+++ b/src/include/regex/pg_wchar.h
@@ -0,0 +1,44 @@
+/* $Id: pg_wchar.h,v 1.1 1998/03/15 07:38:47 scrappy Exp $ */
+
+#ifndef PG_WCHAR_H
+#define PG_WCHAR_H
+
+#include <sys/types.h>
+
+#define EUC_JP 0 /* EUC for Japanese */
+#define EUC_CN 1 /* EUC for Chinese */
+#define EUC_KR 2 /* EUC for Korean */
+#define EUC_TW 3 /* EUC for Taiwan */
+#define UNICODE 4 /* Unicode UTF-8 */
+#define MULE_INTERNAL 5 /* Mule internal code */
+
+#ifdef MB
+typedef unsigned int pg_wchar;
+#else
+#define pg_wchar char
+#endif
+
+/*
+ * various definitions for EUC
+ */
+#define SS2 0x8e /* single shift 2 */
+#define SS3 0x8f /* single shift 3 */
+
+/*
+ * various definitions for mule internal code
+ */
+#define IS_LC1(c) ((unsigned char)(c) >= 0x81 && (unsigned char)(c) <= 0x8f)
+#define IS_LCPRV1(c) ((unsigned char)(c) == 0x9a || (unsigned char)(c) == 0x9b)
+#define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99)
+#define IS_LCPRV2(c) ((unsigned char)(c) == 0x9c || (unsigned char)(c) == 0x9d)
+
+#ifdef MB
+extern void pg_mb2wchar(const unsigned char *, pg_wchar *);
+extern void pg_mb2wchar_with_len(const unsigned char *, pg_wchar *, int);
+extern int pg_char_and_wchar_strcmp(const char *, const pg_wchar *);
+extern int pg_wchar_strncmp(const pg_wchar *, const pg_wchar *, size_t);
+extern int pg_char_and_wchar_strncmp(const char *, const pg_wchar *, size_t);
+extern size_t pg_wchar_strlen(const pg_wchar *);
+#endif
+
+#endif