[Python-checkins] CVS: python/dist/src/Modules unicodedata.c,2.1,2.2 unicodedatabase.c,2.1,2.2 unicodedatabase.h,2.1,2.2

Guido van Rossum python-dev@python.org
Fri, 31 Mar 2000 12:26:16 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Modules
In directory eric:/home/guido/hp/mal/py-patched/Modules

Modified Files:
	unicodedata.c unicodedatabase.c unicodedatabase.h 
Log Message:
Marc-Andre Lemburg: The large unicode database table is broken in
pages of 4k entries each. This should fix compiler problems on some
platforms.


Index: unicodedata.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/unicodedata.c,v
retrieving revision 2.1
retrieving revision 2.2
diff -C2 -r2.1 -r2.2
*** unicodedata.c	2000/03/10 23:10:21	2.1
--- unicodedata.c	2000/03/31 17:26:09	2.2
***************
*** 14,17 ****
--- 14,29 ----
  #include "unicodedatabase.h"
  
+ /* --- Helpers ------------------------------------------------------------ */
+ 
+ static 
+ const _PyUnicode_DatabaseRecord *unicode_db(register int i)
+ {
+     register int page = i >> 12;
+     
+     if (page < sizeof(_PyUnicode_Database))
+ 	return &_PyUnicode_Database[page][i & 0x0fff];
+     return &_PyUnicode_Database[0][0];
+ }
+ 
  /* --- Module API --------------------------------------------------------- */
  
***************
*** 133,137 ****
  	goto onError;
      }
!     index = (int)_PyUnicode_Database[(int)*PyUnicode_AS_UNICODE(v)].category;
      if (index < 0 || 
  	index > sizeof(_PyUnicode_CategoryNames) / 
--- 145,149 ----
  	goto onError;
      }
!     index = (int)unicode_db((int)*PyUnicode_AS_UNICODE(v))->category;
      if (index < 0 || 
  	index > sizeof(_PyUnicode_CategoryNames) / 
***************
*** 163,168 ****
  	goto onError;
      }
!     index = (int)_PyUnicode_Database[
! 			  (int)*PyUnicode_AS_UNICODE(v)].bidirectional;
      if (index < 0 || 
  	index > sizeof(_PyUnicode_CategoryNames) / 
--- 175,179 ----
  	goto onError;
      }
!     index = (int)unicode_db((int)*PyUnicode_AS_UNICODE(v))->bidirectional;
      if (index < 0 || 
  	index > sizeof(_PyUnicode_CategoryNames) / 
***************
*** 194,199 ****
  	goto onError;
      }
!     value = (int)_PyUnicode_Database[
!                           (int)*PyUnicode_AS_UNICODE(v)].combining;
      return PyInt_FromLong(value);
      
--- 205,209 ----
  	goto onError;
      }
!     value = (int)unicode_db((int)*PyUnicode_AS_UNICODE(v))->combining;
      return PyInt_FromLong(value);
      
***************
*** 217,221 ****
  	goto onError;
      }
!     value = (int)_PyUnicode_Database[(int)*PyUnicode_AS_UNICODE(v)].mirrored;
      return PyInt_FromLong(value);
      
--- 227,231 ----
  	goto onError;
      }
!     value = (int)unicode_db((int)*PyUnicode_AS_UNICODE(v))->mirrored;
      return PyInt_FromLong(value);
      
***************
*** 239,243 ****
  	goto onError;
      }
!     value = _PyUnicode_Database[(int)*PyUnicode_AS_UNICODE(v)].decomposition;
      if (value == NULL)
  	return PyString_FromString("");
--- 249,253 ----
  	goto onError;
      }
!     value = unicode_db((int)*PyUnicode_AS_UNICODE(v))->decomposition;
      if (value == NULL)
  	return PyString_FromString("");

Index: unicodedatabase.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/unicodedatabase.c,v
retrieving revision 2.1
retrieving revision 2.2
diff -C2 -r2.1 -r2.2
*** unicodedatabase.c	2000/03/10 23:08:02	2.1
--- unicodedatabase.c	2000/03/31 17:26:09	2.2
***************
*** 88,94 ****
  };
  
! /* --- Unicode Database --------------------------------------------------- */
  
! const _PyUnicode_DatabaseRecord _PyUnicode_Database[65536] = {
      
  /* U+0000 */ { 13, 0, 15, 0, 0 },
--- 88,94 ----
  };
  
! /* --- Unicode Database Pages --------------------------------------------- */
  
! const _PyUnicode_DatabaseRecord _PyUnicode_Database_0[4096] = {
      
  /* U+0000 */ { 13, 0, 15, 0, 0 },
***************
*** 4188,4191 ****
--- 4188,4196 ----
  /* U+0ffe */ { 0, 0, 0, 0, 0 },
  /* U+0fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_1[4096] = {
+     
  /* U+1000 */ { 19, 0, 1, 0, 0 },
  /* U+1001 */ { 19, 0, 1, 0, 0 },
***************
*** 8284,8287 ****
--- 8289,8297 ----
  /* U+1ffe */ { 29, 0, 19, 0, "<compat> 0020 0314" },
  /* U+1fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_2[4096] = {
+     
  /* U+2000 */ { 10, 0, 18, 0, "2002" },
  /* U+2001 */ { 10, 0, 18, 0, "2003" },
***************
*** 12380,12383 ****
--- 12390,12398 ----
  /* U+2ffe */ { 0, 0, 0, 0, 0 },
  /* U+2fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_3[4096] = {
+     
  /* U+3000 */ { 10, 0, 18, 0, "<wide> 0020" },
  /* U+3001 */ { 26, 0, 19, 0, 0 },
***************
*** 16476,16479 ****
--- 16491,16499 ----
  /* U+3ffe */ { 0, 0, 0, 0, 0 },
  /* U+3fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_4[4096] = {
+     
  /* U+4000 */ { 0, 0, 0, 0, 0 },
  /* U+4001 */ { 0, 0, 0, 0, 0 },
***************
*** 20572,20575 ****
--- 20592,20600 ----
  /* U+4ffe */ { 0, 0, 0, 0, 0 },
  /* U+4fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_5[4096] = {
+     
  /* U+5000 */ { 0, 0, 0, 0, 0 },
  /* U+5001 */ { 0, 0, 0, 0, 0 },
***************
*** 24668,24671 ****
--- 24693,24701 ----
  /* U+5ffe */ { 0, 0, 0, 0, 0 },
  /* U+5fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_6[4096] = {
+     
  /* U+6000 */ { 0, 0, 0, 0, 0 },
  /* U+6001 */ { 0, 0, 0, 0, 0 },
***************
*** 28764,28767 ****
--- 28794,28802 ----
  /* U+6ffe */ { 0, 0, 0, 0, 0 },
  /* U+6fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_7[4096] = {
+     
  /* U+7000 */ { 0, 0, 0, 0, 0 },
  /* U+7001 */ { 0, 0, 0, 0, 0 },
***************
*** 32860,32863 ****
--- 32895,32903 ----
  /* U+7ffe */ { 0, 0, 0, 0, 0 },
  /* U+7fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_8[4096] = {
+     
  /* U+8000 */ { 0, 0, 0, 0, 0 },
  /* U+8001 */ { 0, 0, 0, 0, 0 },
***************
*** 36956,36959 ****
--- 36996,37004 ----
  /* U+8ffe */ { 0, 0, 0, 0, 0 },
  /* U+8fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_9[4096] = {
+     
  /* U+9000 */ { 0, 0, 0, 0, 0 },
  /* U+9001 */ { 0, 0, 0, 0, 0 },
***************
*** 41052,41055 ****
--- 41097,41105 ----
  /* U+9ffe */ { 0, 0, 0, 0, 0 },
  /* U+9fff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_10[4096] = {
+     
  /* U+a000 */ { 19, 0, 1, 0, 0 },
  /* U+a001 */ { 19, 0, 1, 0, 0 },
***************
*** 45148,45151 ****
--- 45198,45206 ----
  /* U+affe */ { 0, 0, 0, 0, 0 },
  /* U+afff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_11[4096] = {
+     
  /* U+b000 */ { 0, 0, 0, 0, 0 },
  /* U+b001 */ { 0, 0, 0, 0, 0 },
***************
*** 49244,49247 ****
--- 49299,49307 ----
  /* U+bffe */ { 0, 0, 0, 0, 0 },
  /* U+bfff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_12[4096] = {
+     
  /* U+c000 */ { 0, 0, 0, 0, 0 },
  /* U+c001 */ { 0, 0, 0, 0, 0 },
***************
*** 53340,53343 ****
--- 53400,53408 ----
  /* U+cffe */ { 0, 0, 0, 0, 0 },
  /* U+cfff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_13[4096] = {
+     
  /* U+d000 */ { 0, 0, 0, 0, 0 },
  /* U+d001 */ { 0, 0, 0, 0, 0 },
***************
*** 57436,57439 ****
--- 57501,57509 ----
  /* U+dffe */ { 0, 0, 0, 0, 0 },
  /* U+dfff */ { 15, 0, 1, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_14[4096] = {
+     
  /* U+e000 */ { 16, 0, 1, 0, 0 },
  /* U+e001 */ { 0, 0, 0, 0, 0 },
***************
*** 61532,61535 ****
--- 61602,61610 ----
  /* U+effe */ { 0, 0, 0, 0, 0 },
  /* U+efff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ const _PyUnicode_DatabaseRecord _PyUnicode_Database_15[4096] = {
+     
  /* U+f000 */ { 0, 0, 0, 0, 0 },
  /* U+f001 */ { 0, 0, 0, 0, 0 },
***************
*** 65628,65630 ****
--- 65703,65728 ----
  /* U+fffe */ { 0, 0, 0, 0, 0 },
  /* U+ffff */ { 0, 0, 0, 0, 0 },
+ 
+ };
+ 
+ /* --- Unicode Database --------------------------------------------------- */
+ 
+ const _PyUnicode_DatabaseRecord *_PyUnicode_Database[16] = {
+     _PyUnicode_Database_0,
+     _PyUnicode_Database_1,
+     _PyUnicode_Database_2,
+     _PyUnicode_Database_3,
+     _PyUnicode_Database_4,
+     _PyUnicode_Database_5,
+     _PyUnicode_Database_6,
+     _PyUnicode_Database_7,
+     _PyUnicode_Database_8,
+     _PyUnicode_Database_9,
+     _PyUnicode_Database_10,
+     _PyUnicode_Database_11,
+     _PyUnicode_Database_12,
+     _PyUnicode_Database_13,
+     _PyUnicode_Database_14,
+     _PyUnicode_Database_15,
  };
+ 

Index: unicodedatabase.h
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/unicodedatabase.h,v
retrieving revision 2.1
retrieving revision 2.2
diff -C2 -r2.1 -r2.2
*** unicodedatabase.h	2000/03/10 23:08:04	2.1
--- unicodedatabase.h	2000/03/31 17:26:12	2.2
***************
*** 31,33 ****
  /* --- Unicode Database --------------------------------------------------- */
  
! extern const _PyUnicode_DatabaseRecord _PyUnicode_Database[65536];
--- 31,33 ----
  /* --- Unicode Database --------------------------------------------------- */
  
! extern const _PyUnicode_DatabaseRecord *_PyUnicode_Database[16];