about summary refs log tree commit diff
path: root/Src/system.h
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-01-14 13:04:47 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-01-14 13:04:47 +0000
commit88a37cc187c0f6c5b7130a943c7ddd87474a0f69 (patch)
treed1f3fa3261e2f436ef5fc4fd6690b12a448fd11a /Src/system.h
parente38389d83e7962759138763a038ed9f2f8e23ec9 (diff)
downloadzsh-88a37cc187c0f6c5b7130a943c7ddd87474a0f69.tar.gz
zsh-88a37cc187c0f6c5b7130a943c7ddd87474a0f69.tar.xz
zsh-88a37cc187c0f6c5b7130a943c7ddd87474a0f69.zip
c.f. 20675: improve zle as a basis for Unicode.
unposted: update version to 4.2.3-dev-1
Diffstat (limited to 'Src/system.h')
-rw-r--r--Src/system.h49
1 files changed, 43 insertions, 6 deletions
diff --git a/Src/system.h b/Src/system.h
index ccb125088..0fec678d3 100644
--- a/Src/system.h
+++ b/Src/system.h
@@ -635,12 +635,6 @@ extern char PC, *BC, *UP;
 extern short ospeed;
 #endif
 
-/* Rename some global zsh variables to avoid *
- * possible name clashes with libc           */
-
-#define cs zshcs
-#define ll zshll
-
 #ifndef O_NOCTTY
 # define O_NOCTTY 0
 #endif
@@ -687,3 +681,46 @@ extern short ospeed;
 #else
 #define UNUSED(x) x
 #endif
+
+/*
+ * This is a subset of ZLE_UNICODE_SUPPORT.  It is not all that likely
+ * that only the subset is supported, however it's easy to make the
+ * \u and \U escape sequences work with just the following.
+ */
+#if defined(HAVE_WCHAR_H) && defined(HAVE_WCTOMB) && defined (__STDC_ISO_10646__)
+# include <wchar.h>
+
+/*
+ * More stringent requirements to enable complete Unicode conversion
+ * between wide characters and multibyte strings.
+ */
+#if defined(HAVE_MBRTOWC) && defined(HAVE_WCRTOMB)
+/*#define ZLE_UNICODE_SUPPORT	1*/
+#endif
+#else
+# ifdef HAVE_LANGINFO_H
+#   include <langinfo.h>
+#   if defined(HAVE_ICONV) || defined(HAVE_LIBICONV)
+#     include <iconv.h>
+#   endif
+# endif
+#endif
+
+#ifdef ZLE_UNICODE_SUPPORT
+typedef wchar_t ZLE_CHAR_T;
+typedef wchar_t *ZLE_STRING_T;
+
+/*
+ * MB_CUR_MAX is the maximum number of bytes that a single wide
+ * character will convert into.  We use it to keep strings
+ * sufficiently long.  It should always be defined, but if it isn't
+ * just assume we are using Unicode which requires 6 characters.
+ * (Note that it's not necessarily defined to a constant.)
+ */
+#ifndef MB_CUR_MAX
+#define MB_CUR_MAX 6
+#endif
+#else
+typedef int ZLE_CHAR_T;
+typedef unsigned char *ZLE_STRING_T;
+#endif