mirror of
https://github.com/fltk/fltk.git
synced 2026-05-30 21:25:30 +08:00
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
This commit is contained in:
@@ -30,13 +30,16 @@
|
|||||||
* forward declare the routines as static to avoid name leakage.
|
* forward declare the routines as static to avoid name leakage.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if 0
|
||||||
#include <stdio.h> /* for size_t only */
|
#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_wcwidth(unsigned int ucs);
|
||||||
static int mk_wcswidth(const wchar_t *pwcs, size_t n);
|
#if 0
|
||||||
static int mk_wcwidth_cjk(wchar_t ucs);
|
static int mk_wcswidth(const unsigned int *pwcs, size_t n);
|
||||||
static int mk_wcswidth_cjk(const wchar_t *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"
|
#include "mk_wcwidth.c"
|
||||||
|
|
||||||
|
|||||||
+34
-3
@@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Important!
|
* FLTK: Important!
|
||||||
* This file should remain as close to Markus Kuhn's original source
|
* This file should remain as close to Markus Kuhn's original source
|
||||||
* as possible for easy checking for changes later, however unlikely.
|
* as possible for easy checking for changes later, however unlikely.
|
||||||
* All customisations to work with FLTK shall be annotated!
|
* All customisations to work with FLTK shall be annotated!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is an implementation of wcwidth() and wcswidth() (defined in
|
* This is an implementation of wcwidth() and wcswidth() (defined in
|
||||||
* IEEE Std 1002.1-2001) for Unicode.
|
* IEEE Std 1002.1-2001) for Unicode.
|
||||||
@@ -67,8 +68,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* FLTK - avoid possible problems on systems with 32-bit wchar_t.
|
* FLTK - avoid possible problems on systems with 32-bit wchar_t.
|
||||||
* In the first instance, wchar_t is superceded in calling file
|
* Don't include wchar.h, and change wchar_t to unsigned int.
|
||||||
* to avoid any unnecessary changes in this one.
|
* Can we guarantee sizeof(unsigned int) >= 4 ?
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
@@ -80,7 +81,11 @@ struct interval {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* auxiliary function for binary search in interval table */
|
/* 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(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 min = 0;
|
||||||
int mid;
|
int mid;
|
||||||
|
|
||||||
@@ -132,7 +137,11 @@ static int bisearch(wchar_t ucs, const struct interval *table, int max) {
|
|||||||
* in ISO 10646.
|
* in ISO 10646.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FLTK: was
|
||||||
int mk_wcwidth(wchar_t ucs)
|
int mk_wcwidth(wchar_t ucs)
|
||||||
|
*/
|
||||||
|
int mk_wcwidth(unsigned int ucs)
|
||||||
{
|
{
|
||||||
/* sorted list of non-overlapping intervals of non-spacing characters */
|
/* sorted list of non-overlapping intervals of non-spacing characters */
|
||||||
/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
|
/* 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 wchar_t *pwcs, size_t n)
|
||||||
|
*/
|
||||||
|
int mk_wcswidth(const unsigned int *pwcs, size_t n)
|
||||||
{
|
{
|
||||||
int w, width = 0;
|
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
|
* the traditional terminal character-width behaviour. It is not
|
||||||
* otherwise recommended for general use.
|
* otherwise recommended for general use.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* FLTK: was
|
||||||
int mk_wcwidth_cjk(wchar_t ucs)
|
int mk_wcwidth_cjk(wchar_t ucs)
|
||||||
|
*/
|
||||||
|
int mk_wcwidth_cjk(unsigned int ucs)
|
||||||
{
|
{
|
||||||
/* sorted list of non-overlapping intervals of East Asian Ambiguous
|
/* sorted list of non-overlapping intervals of East Asian Ambiguous
|
||||||
* characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */
|
* 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 wchar_t *pwcs, size_t n)
|
||||||
|
*/
|
||||||
|
int mk_wcswidth_cjk(const unsigned int *pwcs, size_t n)
|
||||||
{
|
{
|
||||||
int w, width = 0;
|
int w, width = 0;
|
||||||
|
|
||||||
@@ -320,3 +346,8 @@ int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
|
|||||||
|
|
||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FLTK: end of commented out functions
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user