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

Function parse_prop_list

deps/quickjs/unicode_gen.c:682–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

680}
681
682void parse_prop_list(const char *filename)
683{
684 FILE *f;
685 char line[4096], *p, buf[256], *q;
686 uint32_t c0, c1, c;
687 int i;
688
689 f = fopen(filename, "rb");
690 if (!f) {
691 perror(filename);
692 exit(1);
693 }
694
695 for(;;) {
696 if (!get_line(line, sizeof(line), f))
697 break;
698 p = line;
699 while (isspace(*p))
700 p++;
701 if (*p == '#' || *p == '@' || *p == '\0')
702 continue;
703 c0 = strtoul(p, (char **)&p, 16);
704 if (*p == '.' && p[1] == '.') {
705 p += 2;
706 c1 = strtoul(p, (char **)&p, 16);
707 } else {
708 c1 = c0;
709 }
710 assert(c1 <= CHARCODE_MAX);
711 p += strspn(p, " \t");
712 if (*p == ';') {
713 p++;
714 p += strspn(p, " \t");
715 q = buf;
716 while (*p != '\0' && *p != ' ' && *p != '#' && *p != '\t') {
717 if ((q - buf) < sizeof(buf) - 1)
718 *q++ = *p;
719 p++;
720 }
721 *q = '\0';
722 i = find_name(unicode_prop_name,
723 countof(unicode_prop_name), buf);
724 if (i < 0) {
725 fprintf(stderr, "Property not found: %s\n", buf);
726 exit(1);
727 }
728 for(c = c0; c <= c1; c++) {
729 set_prop(c, i, 1);
730 }
731 }
732 }
733 fclose(f);
734}
735
736void parse_scripts(const char *filename)
737{

Callers 1

mainFunction · 0.85

Calls 5

exitFunction · 0.85
get_lineFunction · 0.85
find_nameFunction · 0.85
set_propFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected