[Python-checkins] python/dist/src/Include unicodeobject.h, 2.44, 2.45

perky at users.sourceforge.net perky at users.sourceforge.net
Wed Aug 4 09:38:36 CEST 2004


Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1744/Include

Modified Files:
	unicodeobject.h 
Log Message:
SF #989185: Drop unicode.iswide() and unicode.width() and add
unicodedata.east_asian_width().  You can still implement your own
simple width() function using it like this:
    def width(u):
        w = 0
        for c in unicodedata.normalize('NFC', u):
            cwidth = unicodedata.east_asian_width(c)
            if cwidth in ('W', 'F'): w += 2
            else: w += 1
        return w


Index: unicodeobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v
retrieving revision 2.44
retrieving revision 2.45
diff -C2 -d -r2.44 -r2.45
*** unicodeobject.h	8 Jul 2004 17:57:30 -0000	2.44
--- unicodeobject.h	4 Aug 2004 07:38:33 -0000	2.45
***************
*** 182,186 ****
  # define PyUnicode_GetMax PyUnicodeUCS2_GetMax
  # define PyUnicode_GetSize PyUnicodeUCS2_GetSize
- # define PyUnicode_GetWidth PyUnicodeUCS2_GetWidth
  # define PyUnicode_Join PyUnicodeUCS2_Join
  # define PyUnicode_Replace PyUnicodeUCS2_Replace
--- 182,185 ----
***************
*** 202,206 ****
  # define _PyUnicode_IsLowercase _PyUnicodeUCS2_IsLowercase
  # define _PyUnicode_IsNumeric _PyUnicodeUCS2_IsNumeric
- # define _PyUnicode_IsWide _PyUnicodeUCS2_IsWide
  # define _PyUnicode_IsTitlecase _PyUnicodeUCS2_IsTitlecase
  # define _PyUnicode_IsUppercase _PyUnicodeUCS2_IsUppercase
--- 201,204 ----
***************
*** 257,261 ****
  # define PyUnicode_GetMax PyUnicodeUCS4_GetMax
  # define PyUnicode_GetSize PyUnicodeUCS4_GetSize
- # define PyUnicode_GetWidth PyUnicodeUCS4_GetWidth
  # define PyUnicode_Join PyUnicodeUCS4_Join
  # define PyUnicode_Replace PyUnicodeUCS4_Replace
--- 255,258 ----
***************
*** 276,280 ****
  # define _PyUnicode_IsLowercase _PyUnicodeUCS4_IsLowercase
  # define _PyUnicode_IsNumeric _PyUnicodeUCS4_IsNumeric
- # define _PyUnicode_IsWide _PyUnicodeUCS4_IsWide
  # define _PyUnicode_IsTitlecase _PyUnicodeUCS4_IsTitlecase
  # define _PyUnicode_IsUppercase _PyUnicodeUCS4_IsUppercase
--- 273,276 ----
***************
*** 322,327 ****
  #define Py_UNICODE_ISALPHA(ch) iswalpha(ch)
  
- #define Py_UNICODE_ISWIDE(ch) _PyUnicode_IsWide(ch)
- 
  #else
  
--- 318,321 ----
***************
*** 347,352 ****
  #define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch)
  
- #define Py_UNICODE_ISWIDE(ch) _PyUnicode_IsWide(ch)
- 
  #endif
  
--- 341,344 ----
***************
*** 441,450 ****
      );
  
- /* Get the fixed-width representation length of the Unicode object */
- 
- PyAPI_FUNC(int) PyUnicode_GetWidth(
-     PyObject *unicode	 	/* Unicode object */
-     );
- 
  /* Get the maximum ordinal for a Unicode character. */
  PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void);
--- 433,436 ----
***************
*** 1177,1184 ****
      );
  
- PyAPI_FUNC(int) _PyUnicode_IsWide(
-     Py_UNICODE ch 	/* Unicode character */
-     );
- 
  #ifdef __cplusplus
  }
--- 1163,1166 ----



More information about the Python-checkins mailing list