diff options
Diffstat (limited to 'src/base/utf/vendor/mkrunewidth.c')
-rw-r--r-- | src/base/utf/vendor/mkrunewidth.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/src/base/utf/vendor/mkrunewidth.c b/src/base/utf/vendor/mkrunewidth.c index 14e6973..c911b66 100644 --- a/src/base/utf/vendor/mkrunewidth.c +++ b/src/base/utf/vendor/mkrunewidth.c @@ -30,21 +30,20 @@ static struct Table table; // ----------------------------------------------------------------------- // internal functions -static -void +static void parse_category(char *path) { int sc, c, ec, w; - io·Stream *utf8; - char *prop, *field[NumFields], line[1024]; + static io·Buffer utf8; + char *prop, field[NumFields][FieldLen]; - if(!(utf8 = io·open(path, "r"))) + if(io·open(path, sys·ORead, &utf8)) panicf("can't open %s\n", path); // NOTE: we don't check for comments here ec = -1; - while(parse(utf8, arrlen(field), field, arrlen(line), line)){ - codepointrange(utf8, field, &sc, &ec); + while(parse(&utf8, arrlen(field), field)){ + codepointrange(&utf8, field, &sc, &ec); prop = field[Fcategory]; @@ -86,11 +85,10 @@ parse_category(char *path) table.width[w][c] = 1; } - io·close(utf8); + io·close((io·Header *)&utf8); } -static -void +static void coderange(char *field, int *l, int *r) { char *s; @@ -104,17 +102,18 @@ coderange(char *field, int *l, int *r) } } -static -void +static void parse_eawidths(char *path) { int at, w; int l, c, r; - io·Stream *utf8; - char *field[2], line[1024]; + static io·Buffer utf8; + char field[2][FieldLen]; - utf8 = io·open(path, "r"); - while((at=parse(utf8, arrlen(field), field, arrlen(line), line)) != ParseEOF){ + if(io·open(path, sys·ORead, &utf8)) + panicf("can't open %s\n", path); + + while((at=parse(&utf8, arrlen(field), field)) != ParseEOF){ if(at == ParseSkip) continue; @@ -142,20 +141,21 @@ parse_eawidths(char *path) table.width[(w+2)%3][c] = 0; } } - io·close(utf8); + io·close((io·Header*)&utf8); } -static -void +static void parse_emoji(char *path) { int at, w; int l, c, r; - io·Stream *utf8; - char *s, *field[2], line[1024]; + static io·Buffer utf8; + char *s, field[2][FieldLen]; - utf8 = io·open(path, "r"); - while((at=parse(utf8, arrlen(field), field, arrlen(line), line)) != ParseEOF){ + if(io·open(path, sys·ORead, &utf8)) + panicf("can't open %s\n", path); + + while((at=parse(&utf8, arrlen(field), field)) != ParseEOF){ if(at == ParseSkip) continue; @@ -178,7 +178,7 @@ parse_emoji(char *path) } } - io·close(utf8); + io·close((io·Header*)&utf8); } /* output functions */ @@ -322,4 +322,6 @@ main(int argc, char *argv[]) " return 0;\n" "}" ); + + return 0; } |