MCPcopy Create free account
hub / github.com/buke/quickjs-go / parse_special_casing

Function parse_special_casing

deps/quickjs/unicode_gen.c:409–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409void parse_special_casing(CCInfo *tab, const char *filename)
410{
411 FILE *f;
412 char line[1024];
413 const char *p;
414 int code;
415 CCInfo *ci;
416
417 f = fopen(filename, "rb");
418 if (!f) {
419 perror(filename);
420 exit(1);
421 }
422
423 for(;;) {
424 if (!get_line(line, sizeof(line), f))
425 break;
426 p = line;
427 while (isspace(*p))
428 p++;
429 if (*p == '#')
430 continue;
431
432 p = get_field(line, 0);
433 if (!p)
434 continue;
435 code = strtoul(p, NULL, 16);
436 assert(code <= CHARCODE_MAX);
437 ci = &tab[code];
438
439 p = get_field(line, 4);
440 if (p) {
441 /* locale dependent casing */
442 while (isspace(*p))
443 p++;
444 if (*p != '#' && *p != '\0')
445 continue;
446 }
447
448
449 p = get_field(line, 1);
450 if (p && *p != ';') {
451 ci->l_len = 0;
452 for(;;) {
453 while (isspace(*p))
454 p++;
455 if (*p == ';')
456 break;
457 assert(ci->l_len < CC_LEN_MAX);
458 ci->l_data[ci->l_len++] = strtoul(p, (char **)&p, 16);
459 }
460
461 if (ci->l_len == 1 && ci->l_data[0] == code)
462 ci->l_len = 0;
463 }
464
465 p = get_field(line, 3);
466 if (p && *p != ';') {

Callers 1

mainFunction · 0.85

Calls 4

exitFunction · 0.85
get_lineFunction · 0.85
get_fieldFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected