| 680 | } |
| 681 | |
| 682 | void 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 | |
| 736 | void parse_scripts(const char *filename) |
| 737 | { |