| 734 | } |
| 735 | |
| 736 | void parse_scripts(const char *filename) |
| 737 | { |
| 738 | FILE *f; |
| 739 | char line[4096], *p, buf[256], *q; |
| 740 | uint32_t c0, c1, c; |
| 741 | int i; |
| 742 | |
| 743 | f = fopen(filename, "rb"); |
| 744 | if (!f) { |
| 745 | perror(filename); |
| 746 | exit(1); |
| 747 | } |
| 748 | |
| 749 | for(;;) { |
| 750 | if (!get_line(line, sizeof(line), f)) |
| 751 | break; |
| 752 | p = line; |
| 753 | while (isspace(*p)) |
| 754 | p++; |
| 755 | if (*p == '#' || *p == '@' || *p == '\0') |
| 756 | continue; |
| 757 | c0 = strtoul(p, (char **)&p, 16); |
| 758 | if (*p == '.' && p[1] == '.') { |
| 759 | p += 2; |
| 760 | c1 = strtoul(p, (char **)&p, 16); |
| 761 | } else { |
| 762 | c1 = c0; |
| 763 | } |
| 764 | assert(c1 <= CHARCODE_MAX); |
| 765 | p += strspn(p, " \t"); |
| 766 | if (*p == ';') { |
| 767 | p++; |
| 768 | p += strspn(p, " \t"); |
| 769 | q = buf; |
| 770 | while (*p != '\0' && *p != ' ' && *p != '#' && *p != '\t') { |
| 771 | if ((q - buf) < sizeof(buf) - 1) |
| 772 | *q++ = *p; |
| 773 | p++; |
| 774 | } |
| 775 | *q = '\0'; |
| 776 | i = find_name(unicode_script_name, |
| 777 | countof(unicode_script_name), buf); |
| 778 | if (i < 0) { |
| 779 | fprintf(stderr, "Unknown script: '%s'\n", buf); |
| 780 | exit(1); |
| 781 | } |
| 782 | for(c = c0; c <= c1; c++) |
| 783 | unicode_db[c].script = i; |
| 784 | } |
| 785 | } |
| 786 | fclose(f); |
| 787 | } |
| 788 | |
| 789 | void parse_script_extensions(const char *filename) |
| 790 | { |