aboutsummaryrefslogtreecommitdiff
path: root/src/lutf8libext.patch
blob: ab8819283aa609bab6245a0872433a506ece0154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
--- lutf8libext.c	2016-03-26 09:39:32.469103890 -0400
+++ lib/lutf8libext.c	2016-03-26 13:29:06.770738807 -0400
@@ -199,8 +199,10 @@
 define_category(space)
 define_converter(tolower)
 define_converter(toupper)
+#if 0
 define_converter(totitle)
 define_converter(tofold)
+#endif
 
 #undef define_category
 #undef define_converter
@@ -223,6 +225,7 @@
   return 0;
 }
 
+#if 0
 static int utf8_width(unsigned ch, int ambi_is_single) {
   if (find_in_range(doublewidth_table, table_size(doublewidth_table), ch))
     return 2;
@@ -234,6 +237,7 @@
     return 0;
   return 1;
 }
+#endif
 
 
 /* string module compatible interface */
@@ -258,11 +262,13 @@
   luaL_addlstring(b, buff, n);
 }
 
+#if 0
 static lua_Integer byterelat(lua_Integer pos, size_t len) {
   if (pos >= 0) return pos;
   else if (0u - (size_t)pos > len) return 0;
   else return (lua_Integer)len + pos + 1;
 }
+#endif
 
 static int u_posrange(const char **ps, const char **pe,
     lua_Integer posi, lua_Integer posj) {
@@ -281,6 +287,7 @@
   return *ps < *pe;
 }
 
+#if 0
 static int Lutf8_len(lua_State *L) {
   size_t len;
   const char *s = luaL_checklstring(L, 1, &len);
@@ -292,6 +299,7 @@
   lua_pushinteger(L, (lua_Integer)utf8_length(s+posi, s+posj+1));
   return 1;
 }
+#endif
 
 static int Lutf8_sub(lua_State *L) {
   const char *e, *s = check_utf8(L, 1, &e);
@@ -344,11 +352,13 @@
 static int Lutf8_upper(lua_State *L)
 { return convert(L, utf8_toupper); }
 
+#if 0
 static int Lutf8_title(lua_State *L)
 { return convert(L, utf8_totitle); }
 
 static int Lutf8_fold(lua_State *L)
 { return convert(L, utf8_tofold); }
+#endif
 
 static int Lutf8_byte(lua_State *L) {
   size_t n = 0;
@@ -367,6 +377,7 @@
   return n;
 }
 
+#if 0
 static int Lutf8_codepoint(lua_State *L) {
   const char *e, *s = check_utf8(L, 1, &e);
   size_t len = e-s;
@@ -643,6 +654,7 @@
   lua_pushinteger(L, 0);
   return 1;
 }
+#endif
 
 
 /* utf8 pattern matching implement */
@@ -1265,21 +1277,26 @@
 
 #define UTF8PATT	"[\0-\x7F\xC2-\xF4][\x80-\xBF]*"
 
-LUALIB_API int luaopen_utf8(lua_State *L) {
+LUALIB_API int luaopen_utf8_ext(lua_State *L) {
   luaL_Reg libs[] = {
 #define ENTRY(name) { #name, Lutf8_##name }
+#if 0
     ENTRY(offset),
     ENTRY(codes),
     ENTRY(codepoint),
 
     ENTRY(len),
+#endif
     ENTRY(sub),
     ENTRY(reverse),
     ENTRY(lower),
     ENTRY(upper),
+#if 0
     ENTRY(title),
     ENTRY(fold),
+#endif
     ENTRY(byte),
+#if 0
     ENTRY(char),
     ENTRY(escape),
     ENTRY(insert),
@@ -1289,6 +1306,7 @@
     ENTRY(width),
     ENTRY(widthindex),
     ENTRY(ncasecmp),
+#endif
     ENTRY(find),
     ENTRY(gmatch),
     ENTRY(gsub),
@@ -1301,11 +1319,13 @@
   luaL_newlib(L, libs);
 #else
   lua_createtable(L, 0, sizeof(libs)/sizeof(libs[0]));
-  luaL_register(L, NULL, libs);
+  luaL_register(L, "utf8_ext", libs);
 #endif
 
+#if 0
   lua_pushliteral(L, UTF8PATT);
   lua_setfield(L, -2, "charpattern");
+#endif
 
   return 1;
 }
--- unidata.h	2015-05-31 04:48:35.000000000 -0400
+++ lib/unidata.h	2016-03-26 13:01:16.951664669 -0400
@@ -904,6 +904,7 @@
     { 0x3000, 0x3000, 1 },
 };
 
+#if 0
 static struct range_table unprintable_table[] = {
     { 0xAD, 0x34F, 674 },
     { 0x61C, 0x115F, 2883 },
@@ -921,6 +922,7 @@
     { 0x1D173, 0x1D17A, 1 },
     { 0xE0000, 0xE0FFF, 1 },
 };
+#endif
 
 static struct range_table graph_table[] = {
     { 0x20, 0x7E, 1 },
@@ -2547,6 +2549,7 @@
     { 0x118C0, 0x118DF, 1, -32 },
 };
 
+#if 0
 static struct conv_table totitle_table[] = {
     { 0x61, 0x7A, 1, -32 },
     { 0xB5, 0xB5, 1, 743 },
@@ -3060,5 +3063,6 @@
     { 0xF0000, 0xFFFFD, 1 },
     { 0x100000, 0x10FFFD, 1 },
 };
+#endif
 
 #endif /* unidata_h */