logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

disable-unicode.patch (2914B)


  1. SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
  2. SPDX-License-Identifier: PSF-2.0
  3. This is a nearly-equivalent patch to Python 2.0.1, with nearly
  4. identical reasoning.
  5. Python 2.3's unicode regeneration code is a bit too incompatible
  6. with Python 2.0.1.
  7. --- Python-2.3.7/Objects/unicodectype.c 2022-10-05 18:11:21.989603599 +1100
  8. +++ Python-2.3.7/Objects/unicodectype.c 2022-10-05 18:14:57.335843857 +1100
  9. @@ -29,31 +29,12 @@
  10. const unsigned char digit;
  11. } _PyUnicode_TypeRecord;
  12. -#include "unicodetype_db.h"
  13. -
  14. -static const _PyUnicode_TypeRecord *
  15. -gettyperecord(Py_UNICODE code)
  16. -{
  17. - int index;
  18. -
  19. - if (code >= 0x110000)
  20. - index = 0;
  21. - else {
  22. - index = index1[(code>>SHIFT)];
  23. - index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))];
  24. - }
  25. -
  26. - return &_PyUnicode_TypeRecords[index];
  27. -}
  28. -
  29. /* Returns 1 for Unicode characters having the category 'Zl' or type
  30. 'B', 0 otherwise. */
  31. int _PyUnicode_IsLinebreak(Py_UNICODE ch)
  32. {
  33. - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
  34. -
  35. - return (ctype->flags & LINEBREAK_MASK) != 0;
  36. + return 0;
  37. }
  38. /* Returns the titlecase Unicode characters corresponding to ch or just
  39. @@ -61,18 +42,7 @@
  40. Py_UNICODE _PyUnicode_ToTitlecase(register Py_UNICODE ch)
  41. {
  42. - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
  43. - int delta;
  44. -
  45. - if (ctype->title)
  46. - delta = ctype->title;
  47. - else
  48. - delta = ctype->upper;
  49. -
  50. - if (delta >= 32768)
  51. - delta -= 65536;
  52. -
  53. - return ch + delta;
  54. + return ch;
  55. }
  56. /* Returns 1 for Unicode characters having the category 'Lt', 0
  57. @@ -80,9 +50,7 @@
  58. int _PyUnicode_IsTitlecase(Py_UNICODE ch)
  59. {
  60. - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
  61. -
  62. - return (ctype->flags & TITLE_MASK) != 0;
  63. + return 0;
  64. }
  65. /* Returns the integer decimal (0-9) for Unicode characters having
  66. @@ -90,9 +58,7 @@
  67. int _PyUnicode_ToDecimalDigit(Py_UNICODE ch)
  68. {
  69. - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
  70. -
  71. - return (ctype->flags & DECIMAL_MASK) ? ctype->decimal : -1;
  72. + return -1;
  73. }
  74. int _PyUnicode_IsDecimalDigit(Py_UNICODE ch)
  75. @@ -107,9 +73,7 @@
  76. int _PyUnicode_ToDigit(Py_UNICODE ch)
  77. {
  78. - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch);
  79. -
  80. - return (ctype->flags & DIGIT_MASK) ? ctype->digit : -1;
  81. + return -1;
  82. }
  83. int _PyUnicode_IsDigit(Py_UNICODE ch)
  84. --- Python-2.3.7/Makefile.pre.in 2005-01-12 00:49:02.000000000 +1100
  85. +++ Python-2.3.7/Makefile.pre.in 2022-10-05 18:35:05.979846971 +1100
  86. @@ -456,8 +456,7 @@
  87. Python/importdl.o: $(srcdir)/Python/importdl.c
  88. $(CC) -c $(PY_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
  89. -Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c \
  90. - $(srcdir)/Objects/unicodetype_db.h
  91. +Objects/unicodectype.o: $(srcdir)/Objects/unicodectype.c
  92. ############################################################################
  93. # Header files