asar coverage - build #159


src/asar/
File: src/asar/libstr.cpp
Date: 2024-01-26 20:21:51
Lines:
204/261
78.2%
Functions:
14/17
82.4%
Branches:
155/258
60.1%

Line Branch Exec Source
1 #include "asar.h"
2 #include "virtualfile.h"
3 #include "unicode.h"
4
5 #include "platform/file-helpers.h"
6
7 #define typed_malloc(type, count) (type*)malloc(sizeof(type)*(count))
8 #define typed_realloc(type, ptr, count) (type*)realloc(ptr, sizeof(type)*(count))
9
10
11 // Detects if str starts with a UTF-8 byte order mark.
12 // If so, throws a warning, then returns the number of bytes we should skip ahead in the string.
13 1785 size_t check_bom(const char* str)
14 {
15 // RPG Hacker: We could also check for BoMs of incompatible encodings here (like UTF-16)
16 // and throw errors, but not sure if that's worth adding. Asar never supported any wide
17 // encodings to begin with, so it's unreasonable to assume that any UTF-16 patches currently
18 // exist for it. As for future patches, those should be caught by the "must be UTF-8" checks
19 // I have already implemented further below.
20 // I think UTF-8 + BoM is the only case that could lead to confusion if we didn't handle it,
21 // so that's why I have added this.
22
4/6
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1779 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
1785 if (str[0u] == '\xEF' && str[1u] == '\xBB' && str[2u] == '\xBF')
23 {
24 6 asar_throw_warning(0, warning_id_byte_order_mark_utf8);
25 6 return 3u;
26 }
27
28 904 return 0u;
29 }
30
31
32 863 char * readfile(const char * fname, const char * basepath)
33 {
34 863 virtual_file_handle myfile = filesystem->open_file(fname, basepath);
35
2/2
✓ Branch 0 taken 418 times.
✓ Branch 1 taken 445 times.
863 if (myfile == INVALID_VIRTUAL_FILE_HANDLE) return nullptr;
36 845 size_t datalen = filesystem->get_file_size(myfile);
37 845 char * data= typed_malloc(char, datalen+1);
38 845 data[filesystem->read_file(myfile, data, 0u, datalen)] = 0;
39 845 filesystem->close_file(myfile);
40
41
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 839 times.
845 if (!is_valid_utf8(data))
42 {
43 6 free(data);
44 6 asar_throw_error(0, error_type_block, error_id_invalid_utf8);
45 }
46
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 833 times.
839 if(check_bom(data)){
47 6 data[0] = ' ';
48 6 data[1] = ' ';
49 6 data[2] = ' ';
50 }
51 433 return data;
52 }
53
54 // RPG Hacker: like readfile(), but doesn't use virtual file system
55 // and instead read our file directly.
56 946 char * readfilenative(const char * fname)
57 {
58 946 FileHandleType myfile = open_file(fname, FileOpenMode_Read);
59
2/2
✓ Branch 0 taken 472 times.
✓ Branch 1 taken 474 times.
946 if (myfile == InvalidFileHandle) return nullptr;
60 946 size_t datalen = (size_t)get_file_size(myfile);
61 946 char * data = typed_malloc(char, datalen + 1);
62 946 data[read_file(myfile, data, datalen)] = 0;
63 946 close_file(myfile);
64
65
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 946 times.
946 if (!is_valid_utf8(data)) asar_throw_error(0, error_type_block, error_id_invalid_utf8);
66
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 946 times.
946 if(check_bom(data)){
67 data[0] = ' ';
68 data[1] = ' ';
69 data[2] = ' ';
70 }
71 474 return data;
72 }
73
74 714 bool readfile(const char * fname, const char * basepath, char ** data, int * len)
75 {
76 714 virtual_file_handle myfile = filesystem->open_file(fname, basepath);
77
2/2
✓ Branch 0 taken 351 times.
✓ Branch 1 taken 363 times.
714 if (!myfile) return false;
78 678 size_t datalen = filesystem->get_file_size(myfile);
79 678 *data= typed_malloc(char, datalen);
80 678 *len = (int)filesystem->read_file(myfile, *data, 0, datalen);
81 678 filesystem->close_file(myfile);
82 678 return true;
83 }
84
85 #define isq(n) (((0x2227 ^ (0x0101 * (n))) - 0x0101UL) & ~(0x2227 ^ (0x0101 * (n))) & 0x8080UL)
86 #define isqp(n) (((0x22272829 ^ (0x01010101 * (n))) - 0x01010101UL) & ~(0x22272829 ^ (0x01010101 * (n))) & 0x80808080UL)
87
88 // RPG Hacker: Only index this with ASCII characters.
89 // Anything else doesn't make sense, anyways.
90 const bool qparlut[128] = {
91 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
92 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
93 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
94 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
95 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
96 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
97 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
99 };
100
101 //this will leave the last char found as the one pointed at
102 294225 inline bool skip_quote(char *&str)
103 {
104
105
2/2
✓ Branch 0 taken 31479 times.
✓ Branch 1 taken 262746 times.
294225 if(*str == '"') str = strchr(str + 1, '"');
106
2/2
✓ Branch 0 taken 2502 times.
✓ Branch 1 taken 260244 times.
262746 else if(*str == '\'')
107 {
108 int codepoint;
109
1/2
✓ Branch 0 taken 1251 times.
✗ Branch 1 not taken.
2502 str += utf8_val(&codepoint, str + 1) + 1;
110
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2502 times.
2502 if(*str != '\'') return false;
111 }
112 294225 return str;
113 }
114
115 //eat 1 char or quote/par
116 33882 inline bool skip_par(char *&str)
117 {
118 16962 int par = 0;
119
7/8
✓ Branch 0 taken 16641 times.
✓ Branch 1 taken 17241 times.
✓ Branch 2 taken 13866 times.
✓ Branch 3 taken 19737 times.
✓ Branch 4 taken 16650 times.
✓ Branch 5 taken 13608 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 13608 times.
33882 if(*str != '\'' && *str != '"' && *str != '(' && *str != ')')
120 {
121 27189 str++;
122 27189 return true;
123 }
124 while(true)
125 {
126 40509 char *t = str;
127
2/2
✓ Branch 0 taken 1032 times.
✓ Branch 1 taken 39477 times.
40509 if(*str == '"') t = strchr(t + 1, '"');
128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 39477 times.
39477 else if(*str == '\'')
129 {
130 int codepoint;
131 t += utf8_val(&codepoint, t + 1) + 1;
132 if(*t != '\'') return false;
133 }
134
2/2
✓ Branch 0 taken 6129 times.
✓ Branch 1 taken 33348 times.
39477 else if(*t == '(')
135 {
136 6129 par++;
137 }
138
2/2
✓ Branch 0 taken 6129 times.
✓ Branch 1 taken 27219 times.
33348 else if(*t == ')')
139 {
140 6129 par--;
141
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 6129 times.
6129 if(par < 0) return false;
142 }
143
144 40509 str = t + 1;
145
4/4
✓ Branch 0 taken 35751 times.
✓ Branch 1 taken 4758 times.
✓ Branch 2 taken 17856 times.
✓ Branch 3 taken 17895 times.
40509 if(!*str || !par) return par == 0 ? true : false;
146 16932 }
147 }
148
149 //instr should not be duplicate chars. Instr should also not be 1 char
150 string& string::qreplace(const char * instr, const char * outstr)
151 {
152 string& thisstring =*this;
153 if (!strstr(thisstring, instr)) return thisstring;
154 int inlen = strlen(instr);
155 string out;
156 for (int i=0;thisstring[i];)
157 {
158 if (!strncmp((const char*)thisstring +i, instr, inlen))
159 {
160 out+=outstr;
161 i+=inlen;
162 }
163 // randomdude999: prevent appending the null terminator to the output
164 else if(!isq(thisstring[i])) out+= thisstring[i++];
165 else
166 {
167 char *start = raw() + i;
168 char *end = start;
169 if(!skip_quote(end)) return thisstring;
170 out.append(raw(), i, end - start + i + 1);
171 i += end - start + 1;
172
173 }
174 }
175 thisstring =out;
176 return thisstring;
177 }
178
179 164991 string& string::qnormalize()
180 {
181 79482 string& thisstring =*this;
182 79482 string out;
183 79482 char *startstr = thisstring.raw();
184 79482 char *str = startstr;
185
2/2
✓ Branch 0 taken 194613 times.
✓ Branch 1 taken 164883 times.
359496 while((str = strpbrk(str, "'\" \t,\r")))
186 {
187
2/2
✓ Branch 0 taken 142554 times.
✓ Branch 1 taken 52059 times.
194613 if(is_space(*str))
188 {
189
6/6
✓ Branch 0 taken 142518 times.
✓ Branch 1 taken 36 times.
✓ Branch 2 taken 142374 times.
✓ Branch 3 taken 144 times.
✓ Branch 4 taken 68211 times.
✓ Branch 5 taken 90 times.
142554 if(str[0] == ' ' && !is_space(str[1]))
190 {
191 142374 str++;
192 142374 continue;
193 }
194
1/2
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
180 out.append(startstr, 0, str - startstr);
195
1/2
✓ Branch 0 taken 90 times.
✗ Branch 1 not taken.
180 out += ' ';
196
2/2
✓ Branch 0 taken 576 times.
✓ Branch 1 taken 180 times.
756 while(is_space(*str)) str++;
197 90 startstr = str;
198
2/2
✓ Branch 0 taken 18456 times.
✓ Branch 1 taken 33603 times.
52059 }else if(*str == ',')
199 {
200 18456 str++;
201
2/2
✓ Branch 0 taken 5169 times.
✓ Branch 1 taken 13287 times.
18456 if(is_space(*str))
202 {
203
1/2
✓ Branch 0 taken 2586 times.
✗ Branch 1 not taken.
5169 out.append(startstr, 0, str - startstr);
204
2/2
✓ Branch 0 taken 5277 times.
✓ Branch 1 taken 5169 times.
10446 while(is_space(*str)) str++;
205 2586 startstr = str;
206 }
207 }
208 else
209 {
210 33603 str = strchr(str + 1, *str); //confirm quotes has already been run, so this should be okay
211
2/2
✓ Branch 0 taken 19896 times.
✓ Branch 1 taken 13707 times.
33603 if(!str) return thisstring;
212 33495 str++;
213 }
214 }
215
2/2
✓ Branch 0 taken 4215 times.
✓ Branch 1 taken 160668 times.
164883 if(startstr != thisstring.raw())
216 {
217
1/2
✓ Branch 0 taken 2109 times.
✗ Branch 1 not taken.
4215 out.append(startstr, 0, strlen(startstr)); //the remaining
218
219
1/2
✓ Branch 0 taken 2109 times.
✗ Branch 1 not taken.
2109 thisstring = out;
220 }
221 79428 return thisstring;
222 164991 }
223
224 64622 bool confirmquotes(const char * str)
225 {
226
2/2
✓ Branch 0 taken 45893 times.
✓ Branch 1 taken 21755 times.
67648 while(*str)
227 {
228 45893 char *dquote = strchr((char *)str, '"');
229 45893 char *squote = strchr((char *)str, '\'');
230
4/4
✓ Branch 0 taken 23266 times.
✓ Branch 1 taken 22627 times.
✓ Branch 2 taken 300 times.
✓ Branch 3 taken 21447 times.
45893 if(dquote || squote)
231 {
232
6/6
✓ Branch 0 taken 2456 times.
✓ Branch 1 taken 600 times.
✓ Branch 2 taken 2399 times.
✓ Branch 3 taken 57 times.
✓ Branch 4 taken 1180 times.
✓ Branch 5 taken 3 times.
3056 if(dquote && (dquote < squote || !squote))
233 {
234 2450 dquote = strchr(dquote+1, '"');
235
2/2
✓ Branch 0 taken 2426 times.
✓ Branch 1 taken 24 times.
2450 if(dquote) str = dquote+1;
236 12 else return false;
237 }
238 else
239 {
240 int codepoint;
241
1/2
✓ Branch 0 taken 303 times.
✗ Branch 1 not taken.
606 squote += utf8_val(&codepoint, squote + 1) + 1;
242
2/2
✓ Branch 0 taken 600 times.
✓ Branch 1 taken 6 times.
606 if(*squote == '\'') str = squote+1;
243 6 else return false;
244 }
245 1522 }
246 else
247 {
248 21447 return true;
249 }
250 }
251 10890 return true;
252 }
253
254 2202 bool confirmqpar(const char * str)
255 {
256 //todo fully optimize
257 1101 int par = 0;
258
3/4
✗ Branch 0 not taken.
✓ Branch 1 taken 29418 times.
✓ Branch 2 taken 27216 times.
✓ Branch 3 taken 2202 times.
29418 while((unsigned char)*str >= 128 || !qparlut[(unsigned char)*str]) str++;
259
2/2
✓ Branch 0 taken 5394 times.
✓ Branch 1 taken 2202 times.
7596 while(*str)
260 {
261
2/2
✓ Branch 0 taken 1098 times.
✓ Branch 1 taken 4296 times.
5394 if(*str == '"')
262 {
263 1098 str = strchr(str + 1, '"');
264
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1098 times.
1098 if(!str++) return false;
265 }
266
2/2
✓ Branch 0 taken 72 times.
✓ Branch 1 taken 4224 times.
4296 else if(*str == '\'')
267 {
268 int codepoint;
269
1/2
✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
72 str += utf8_val(&codepoint, str + 1) + 1;
270
1/2
✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
72 if(*str == '\'') str++;
271 else return false;
272 }
273 else
274 {
275 4224 par += 1 - ((*str++ - '(') << 1);
276
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4224 times.
4224 if(par < 0) return false;
277 }
278
3/4
✗ Branch 0 not taken.
✓ Branch 1 taken 13650 times.
✓ Branch 2 taken 8256 times.
✓ Branch 3 taken 5394 times.
13650 while((unsigned char)*str >= 128 || !qparlut[(unsigned char)*str]) str++;
279 }
280 2202 return !par;
281 }
282
283 162218 char ** split(char * str, char key, int * len)
284 {
285 162218 char *thisentry=strchr(str, key);
286
2/2
✓ Branch 0 taken 87411 times.
✓ Branch 1 taken 74807 times.
162218 if (!thisentry)
287 {
288 87411 char ** out= typed_malloc(char*, 2);
289 87411 out[0]=str;
290 87411 out[1]=nullptr;
291
2/2
✓ Branch 0 taken 77853 times.
✓ Branch 1 taken 9558 times.
87411 if (len) *len=1;
292 87411 return out;
293 }
294 37479 int count=15; //makes the default alloc 8 elements, sounds fair.
295 74807 char ** outdata= typed_malloc(char*, (size_t)count+1);
296
297 37479 int newcount=0;
298 74807 outdata[newcount++]=str;
299 do{
300 128044 *thisentry = 0;
301 128044 thisentry++;
302 128044 outdata[newcount++]=thisentry;
303
2/2
✓ Branch 0 taken 834 times.
✓ Branch 1 taken 127210 times.
128044 if(newcount >= count)
304 {
305 834 count *= 2;
306 834 outdata = typed_realloc(char *, outdata, count);
307 }
308
2/2
✓ Branch 0 taken 53237 times.
✓ Branch 1 taken 74807 times.
128044 }while((thisentry = strchr(thisentry, key)));
309
310 74807 outdata[newcount]= nullptr;
311
2/2
✓ Branch 0 taken 68175 times.
✓ Branch 1 taken 6632 times.
74807 if (len) *len=newcount;
312 37479 return outdata;
313 }
314
315 187998 char ** qsplit(char * str, char key, int * len)
316 {
317
5/6
✓ Branch 0 taken 158253 times.
✓ Branch 1 taken 29745 times.
✓ Branch 2 taken 156381 times.
✓ Branch 3 taken 1872 times.
✓ Branch 4 taken 52233 times.
✗ Branch 5 not taken.
187998 if (!strchr(str, '"') && !strchr(str, '\'')) return split(str, key, len);
318
319 12717 int count=15;
320 31617 char ** outdata= typed_malloc(char*, (size_t)count+1);
321 12717 int newcount=0;
322 31617 char * thisentry=str;
323 31617 outdata[newcount++]=thisentry;
324
2/2
✓ Branch 0 taken 266055 times.
✓ Branch 1 taken 31617 times.
297672 while (*thisentry) /*todo fix*/
325 {
326
2/2
✓ Branch 0 taken 32328 times.
✓ Branch 1 taken 233727 times.
266055 if (*thisentry == key)
327 {
328 32328 *thisentry=0;
329 32328 thisentry++;
330 32328 outdata[newcount++]=thisentry;
331
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 32328 times.
32328 if(newcount >= count)
332 {
333 count *= 2;
334 outdata = typed_realloc(char *, outdata, count);
335 }
336 }
337
2/4
✓ Branch 0 taken 233727 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 95229 times.
✗ Branch 3 not taken.
233727 else if(skip_quote(thisentry)) thisentry++;
338 else return nullptr;
339 }
340 31617 outdata[newcount]= nullptr;
341
2/2
✓ Branch 0 taken 30114 times.
✓ Branch 1 taken 1503 times.
31617 if (len) *len=newcount;
342 12717 return outdata;
343 }
344
345 154143 char ** qsplitstr(char * str, const char * key, int * len)
346 {
347 //check if the str is found first
348
2/2
✓ Branch 0 taken 152781 times.
✓ Branch 1 taken 1362 times.
154143 if (!strstr(str, key))
349 {
350 152781 char ** out= typed_malloc(char*, 2);
351 152781 out[0]=str;
352 152781 out[1]=nullptr;
353
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 152781 times.
152781 if (len) *len=1;
354 152781 return out;
355 }
356
357 1362 int keylen=(int)strlen(key);
358 705 int count=15;
359 1362 char ** outdata= typed_malloc(char*, (size_t)count+1);
360 705 int newcount=0;
361 1362 char * thisentry=str;
362 1362 outdata[newcount++]=thisentry;
363
2/2
✓ Branch 0 taken 65949 times.
✓ Branch 1 taken 1362 times.
67311 while (*thisentry) /*todo fix*/
364 {
365
2/2
✓ Branch 0 taken 5451 times.
✓ Branch 1 taken 60498 times.
65949 if (!strncmp(thisentry, key, (size_t)keylen))
366 {
367 5451 *thisentry=0;
368 5451 thisentry+=keylen;
369 5451 outdata[newcount++]=thisentry;
370
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 5451 times.
5451 if(newcount >= count)
371 {
372 count *= 2;
373 outdata = typed_realloc(char *, outdata, count);
374 }
375 }
376
2/4
✓ Branch 0 taken 60498 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 30672 times.
✗ Branch 3 not taken.
60498 else if(skip_quote(thisentry)) thisentry++;
377 else return nullptr;
378 }
379 1362 outdata[newcount]= nullptr;
380
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1362 times.
1362 if (len) *len=newcount;
381 705 return outdata;
382 }
383
384 //this function is most commonly called in cases where additional chars are very likely
385 34188 char ** qpsplit(char * str, char key, int * len)
386 {
387
4/6
✓ Branch 0 taken 28404 times.
✓ Branch 1 taken 5784 times.
✓ Branch 2 taken 28404 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14235 times.
✗ Branch 5 not taken.
34188 if (!strchr(str, '(') && !strchr(str, ')')) return qsplit(str, key, len);
388 2895 int count=7;
389 5784 char ** outdata= typed_malloc(char*, (size_t)count+1);
390
391 2895 int newcount=0;
392 5784 char * thisentry=str;
393 5784 outdata[newcount++]=thisentry;
394
2/2
✓ Branch 0 taken 35133 times.
✓ Branch 1 taken 5784 times.
40917 while (*thisentry)
395 {
396 //skippar(*thisentry, thisentry++, return nullptr;)
397
2/2
✓ Branch 0 taken 2691 times.
✓ Branch 1 taken 32442 times.
35133 if (*thisentry == key)
398 {
399 2691 *thisentry=0;
400 2691 thisentry++;
401 2691 outdata[newcount++]=thisentry;
402
2/2
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 2655 times.
2691 if(newcount >= count)
403 {
404 36 count *= 2;
405 36 outdata = typed_realloc(char *, outdata, count);
406 }
407 }
408
2/4
✓ Branch 0 taken 32442 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 16242 times.
32442 else if(!skip_par(thisentry)) return nullptr;
409 }
410 5784 outdata[newcount]= nullptr;
411
2/2
✓ Branch 0 taken 2718 times.
✓ Branch 1 taken 3066 times.
5784 if (len) *len=newcount;
412 2895 return outdata;
413 }
414
415 string &itrim(string &input, const char * left, const char * right)
416 {
417 bool nukeright=true;
418 int totallen=input.length();
419 int rightlen=(int)strlen(right);
420 if (rightlen && rightlen<=totallen)
421 {
422 const char * rightend=right+rightlen;
423 const char * strend=input.data()+totallen;
424 while (right!=rightend)
425 {
426 rightend--;
427 strend--;
428 if (to_lower(*strend)!=to_lower(*rightend)) nukeright=false;
429 }
430 if (nukeright)
431 {
432 totallen-=rightlen;
433 input.truncate(totallen);
434 }
435 }
436 bool nukeleft=true;
437 int leftlen = strlen(left);
438 if(leftlen == 1 && input.data()[0] == left[0])
439 {
440 return input = string(input.data()+1, (input.length()-1));
441 }
442 else
443 {
444 for (int i = 0; i < leftlen; i++)
445 {
446 if (to_lower(input.data()[i])!=to_lower(left[i])) nukeleft=false;
447 }
448 if (nukeleft) input = string(input.data()+leftlen, (input.length()-leftlen));
449 }
450 return input;
451 }
452
453 char* strqpchr(char* str, char key)
454 {
455 while (*str)
456 {
457 if (*str == key) return str;
458 else if(!skip_par(str)) return nullptr;
459 }
460 return nullptr;
461 }
462
463 378 char* strqpstr(char* str, const char* key)
464 {
465 378 size_t keylen = strlen(key);
466
2/2
✓ Branch 0 taken 1800 times.
✓ Branch 1 taken 18 times.
1818 while (*str)
467 {
468
2/2
✓ Branch 0 taken 360 times.
✓ Branch 1 taken 1440 times.
1800 if (!strncmp(str, key, keylen)) return str;
469
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1440 times.
1440 else if(!skip_par(str)) return nullptr;
470 }
471 9 return nullptr;
472 }
473
474 extern const uint8_t char_props[256] = {
475 //x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
476 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x80,0x00,0x00, // 0x
477 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 1x
478 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 2x !"#$%&'()*+,-./
479 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x00,0x00,0x00,0x00,0x00,0x00, // 3x 0123456789:;<=>?
480 0x00,0x23,0x23,0x23,0x23,0x23,0x23,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, // 4x @ABCDEFGHIJKLMNO
481 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x00,0x00,0x00,0x00,0x08, // 5x PQRSTUVWXYZ[\]^_
482 0x00,0x25,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24, // 6x `abcdefghijklmno
483 0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x00,0x00,0x00,0x00,0x00, // 7x pqrstuvwxyz{|}~
484 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 8x
485 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 9x
486 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Ax
487 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Bx
488 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Cx
489 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Dx
490 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Ex
491 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // Fx
492 };
493