Author: engelsman Date: 2010-04-19 14:15:30 -0700 (Mon, 19 Apr 2010) New Revision: 7536 Log: 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. Modified: branches/branch-1.3/src/xutf8/fl_wcwidth.c branches/branch-1.3/src/xutf8/mk_wcwidth.c Modified: branches/branch-1.3/src/xutf8/fl_wcwidth.c =================================================================== --- branches/branch-1.3/src/xutf8/fl_wcwidth.c 2010-04-19 20:35:25 UTC (rev 7535) +++ branches/branch-1.3/src/xutf8/fl_wcwidth.c 2010-04-19 21:15:30 UTC (rev 7536) @@ -30,13 +30,16 @@ * forward declare the routines as static to avoid name leakage. */ +#if 0 #include <stdio.h> /* for size_t only */ -typedef unsigned int wchar_t; /* supercede system wchar_t */ +#endif -static int mk_wcwidth(wchar_t ucs); -static int mk_wcswidth(const wchar_t *pwcs, size_t n); -static int mk_wcwidth_cjk(wchar_t ucs); -static int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n); +static int mk_wcwidth(unsigned int ucs); +#if 0 +static int mk_wcswidth(const unsigned int *pwcs, size_t n); +static int mk_wcwidth_cjk(unsigned int ucs); +static int mk_wcswidth_cjk(const unsigned int *pwcs, size_t n); +#endif #include "mk_wcwidth.c" Modified: branches/branch-1.3/src/xutf8/mk_wcwidth.c =================================================================== --- branches/branch-1.3/src/xutf8/mk_wcwidth.c 2010-04-19 20:35:25 UTC (rev 7535) +++ branches/branch-1.3/src/xutf8/mk_wcwidth.c 2010-04-19 21:15:30 UTC (rev 7536) @@ -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 @@ }; /* 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 @@ * 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 @@ } +/* + * 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 @@ * 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 @@ } +/* + * 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 @@ return width; } + +/* + * FLTK: end of commented out functions + */ +#endif _______________________________________________ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit