summaryrefslogtreecommitdiff
path: root/src/xutf8/mk_wcwidth.c
diff options
context:
space:
mode:
authorengelsman <engelsman>2010-04-19 21:15:30 +0000
committerengelsman <engelsman>2010-04-19 21:15:30 +0000
commitd50ca53788aa062b84fa7fddeb691d735eeb3d3b (patch)
tree247655477bb74e1bf492b958cb1ea6b595ec5b5e /src/xutf8/mk_wcwidth.c
parenta7a81061be488c34b75c02ee24c08973e2b11fb1 (diff)
tweaked fl_wcwidth.c and mk_wcwidth.c to remove system wchar_t
commented out, or replaced, wchar_t with unsigned int. commented out unused functions from mk_wcwidth.c. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7536 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/xutf8/mk_wcwidth.c')
-rw-r--r--src/xutf8/mk_wcwidth.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/xutf8/mk_wcwidth.c b/src/xutf8/mk_wcwidth.c
index c0bebaecc..0c4eb2cc9 100644
--- a/src/xutf8/mk_wcwidth.c
+++ b/src/xutf8/mk_wcwidth.c
@@ -1,9 +1,10 @@
/*
- * Important!
+ * FLTK: Important!
* This file should remain as close to Markus Kuhn's original source
* as possible for easy checking for changes later, however unlikely.
* All customisations to work with FLTK shall be annotated!
*/
+
/*
* This is an implementation of wcwidth() and wcswidth() (defined in
* IEEE Std 1002.1-2001) for Unicode.
@@ -67,8 +68,8 @@
/*
* FLTK - avoid possible problems on systems with 32-bit wchar_t.
- * In the first instance, wchar_t is superceded in calling file
- * to avoid any unnecessary changes in this one.
+ * Don't include wchar.h, and change wchar_t to unsigned int.
+ * Can we guarantee sizeof(unsigned int) >= 4 ?
*/
#if 0
#include <wchar.h>
@@ -80,7 +81,11 @@ struct interval {
};
/* auxiliary function for binary search in interval table */
+/*
+ * FLTK: was
static int bisearch(wchar_t ucs, const struct interval *table, int max) {
+ */
+static int bisearch(unsigned int ucs, const struct interval *table, int max) {
int min = 0;
int mid;
@@ -132,7 +137,11 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) {
* in ISO 10646.
*/
+/*
+ * FLTK: was
int mk_wcwidth(wchar_t ucs)
+ */
+int mk_wcwidth(unsigned int ucs)
{
/* sorted list of non-overlapping intervals of non-spacing characters */
/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
@@ -217,7 +226,16 @@ int mk_wcwidth(wchar_t ucs)
}
+/*
+ * FLTK: comment out the remaining functions, as we don't need themm.
+ */
+#if 0
+
+/*
+ * FLTK: was
int mk_wcswidth(const wchar_t *pwcs, size_t n)
+ */
+int mk_wcswidth(const unsigned int *pwcs, size_t n)
{
int w, width = 0;
@@ -240,7 +258,11 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n)
* the traditional terminal character-width behaviour. It is not
* otherwise recommended for general use.
*/
+/*
+ * FLTK: was
int mk_wcwidth_cjk(wchar_t ucs)
+ */
+int mk_wcwidth_cjk(unsigned int ucs)
{
/* sorted list of non-overlapping intervals of East Asian Ambiguous
* characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
@@ -308,7 +330,11 @@ int mk_wcwidth_cjk(wchar_t ucs)
}
+/*
+ * FLTK: was
int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
+ */
+int mk_wcswidth_cjk(const unsigned int *pwcs, size_t n)
{
int w, width = 0;
@@ -320,3 +346,8 @@ int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
return width;
}
+
+/*
+ * FLTK: end of commented out functions
+ */
+#endif