[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.211,2.212

Martin v. L?wis loewis@users.sourceforge.net
Tue, 26 Jun 2001 15:22:39 -0700


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

Modified Files:
	bltinmodule.c 
Log Message:
Support using UCS-4 as the Py_UNICODE type:
Add configure option --enable-unicode.
Add config.h macros Py_USING_UNICODE, PY_UNICODE_TYPE, Py_UNICODE_SIZE,
                    SIZEOF_WCHAR_T.
Define Py_UCS2.
Encode and decode large UTF-8 characters into single Py_UNICODE values
for wide Unicode types; likewise for UTF-16.
Remove test whether sizeof Py_UNICODE is two.


Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.211
retrieving revision 2.212
diff -C2 -r2.211 -r2.212
*** bltinmodule.c	2001/06/26 20:01:56	2.211
--- bltinmodule.c	2001/06/26 22:22:37	2.212
***************
*** 325,328 ****
--- 325,329 ----
  		return PyUnicode_FromUnicode(s, 1);
  	} else {
+ #if Py_UNICODE_SIZE == 2
  		/* UCS-4 character.  store as two surrogate characters */
  		x -= 0x10000L;
***************
*** 330,334 ****
--- 331,338 ----
  		s[1] = 0xDC00 + (Py_UNICODE) (x & 0x03FF);
  		return PyUnicode_FromUnicode(s, 2);
+ #endif
  	}
+ 	s[0] = (Py_UNICODE)x;
+ 	return PyUnicode_FromUnicode(s, 1);
  }