[Python-checkins] CVS: python/dist/src/Include unicodeobject.h,2.21,2.22

Fredrik Lundh effbot@users.sourceforge.net
Tue, 26 Jun 2001 10:17:09 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv28886/Include

Modified Files:
	unicodeobject.h 
Log Message:


experimental UCS-4 support: added USE_UCS4_STORAGE define to
unicodeobject.h, which forces sizeof(Py_UNICODE) == sizeof(Py_UCS4).
(this may be good enough for platforms that doesn't have a 16-bit
type.  the UTF-16 codecs don't work, though)


Index: unicodeobject.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v
retrieving revision 2.21
retrieving revision 2.22
diff -C2 -r2.21 -r2.22
*** unicodeobject.h	2001/05/21 20:30:15	2.21
--- unicodeobject.h	2001/06/26 17:17:07	2.22
***************
*** 59,62 ****
--- 59,75 ----
  /* --- Internal Unicode Format -------------------------------------------- */
  
+ /* experimental UCS-4 support.  enable at your own risk! */
+ #undef USE_UCS4_STORAGE
+ 
+ /*
+  * Use this typedef when you need to represent a UTF-16 surrogate pair
+  * as single unsigned integer.
+  */
+ #if SIZEOF_INT >= 4 
+ typedef unsigned int Py_UCS4; 
+ #elif SIZEOF_LONG >= 4
+ typedef unsigned long Py_UCS4; 
+ #endif 
+ 
  /* Set these flags if the platform has "wchar.h", "wctype.h" and the
     wchar_t type is a 16-bit unsigned type */
***************
*** 67,72 ****
  #ifndef HAVE_USABLE_WCHAR_T
  
! /* Windows has a usable wchar_t type */
! # if defined(MS_WIN32)
  #  define HAVE_USABLE_WCHAR_T
  # endif
--- 80,85 ----
  #ifndef HAVE_USABLE_WCHAR_T
  
! /* Windows has a usable wchar_t type (unless we're using UCS-4) */
! # if defined(MS_WIN32) && !defined(USE_UCS4_STORAGE)
  #  define HAVE_USABLE_WCHAR_T
  # endif
***************
*** 106,122 ****
     typedef below, or the module initialization code will complain. */
  
  typedef unsigned short Py_UNICODE;
- 
  #endif
  
! /*
!  * Use this typedef when you need to represent a UTF-16 surrogate pair
!  * as single unsigned integer.
!  */
! #if SIZEOF_INT >= 4 
! typedef unsigned int Py_UCS4; 
! #elif SIZEOF_LONG >= 4
! typedef unsigned long Py_UCS4; 
! #endif 
  
  
--- 119,129 ----
     typedef below, or the module initialization code will complain. */
  
+ #ifdef USE_UCS4_STORAGE
+ typedef Py_UCS4 Py_UNICODE;
+ #else
  typedef unsigned short Py_UNICODE;
  #endif
  
! #endif