X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/c2e01e0ac91c61de69158113d2ab59f6831b2941..caecd4f412422d8130d616da33325e03557218e7:/scripts/make-unidata?ds=sidebyside diff --git a/scripts/make-unidata b/scripts/make-unidata index 9fa0dec..4339fee 100755 --- a/scripts/make-unidata +++ b/scripts/make-unidata @@ -371,6 +371,11 @@ out("struct unidata {\n", out("extern const struct unidata *const unidata[];\n"); +out("extern const struct unicode_utf8_row {\n", + " uint8_t count;\n", + " uint8_t min2, max2;\n", + "} unicode_utf8_valid[];\n"); + out("#define UNICODE_NCHARS ", ($max + 1), "\n"); out("#define UNICODE_MODULUS $modulus\n"); out("#define UNICODE_BREAK_START $break_start\n"); @@ -527,6 +532,42 @@ for(my $base = 0; $base <= $max; $base += $modulus) { } out("};\n"); +out("const struct unicode_utf8_row unicode_utf8_valid[] = {\n"); +for(my $c = 0; $c <= 0x7F; ++$c) { + out(" { 1, 0, 0 }, /* $c */\n"); +} +for(my $c = 0x80; $c < 0xC2; ++$c) { + out(" { 0, 0, 0 }, /* $c */\n"); +} +for(my $c = 0xC2; $c <= 0xDF; ++$c) { + out(" { 2, 0x80, 0xBF }, /* $c */\n"); +} +for(my $c = 0xE0; $c <= 0xE0; ++$c) { + out(" { 3, 0xA0, 0xBF }, /* $c */\n"); +} +for(my $c = 0xE1; $c <= 0xEC; ++$c) { + out(" { 3, 0x80, 0xBF }, /* $c */\n"); +} +for(my $c = 0xED; $c <= 0xED; ++$c) { + out(" { 3, 0x80, 0x9F }, /* $c */\n"); +} +for(my $c = 0xEE; $c <= 0xEF; ++$c) { + out(" { 3, 0x80, 0xBF }, /* $c */\n"); +} +for(my $c = 0xF0; $c <= 0xF0; ++$c) { + out(" { 4, 0x90, 0xBF }, /* $c */\n"); +} +for(my $c = 0xF1; $c <= 0xF3; ++$c) { + out(" { 4, 0x80, 0xBF }, /* $c */\n"); +} +for(my $c = 0xF4; $c <= 0xF4; ++$c) { + out(" { 4, 0x80, 0x8F }, /* $c */\n"); +} +for(my $c = 0xF5; $c <= 0xFF; ++$c) { + out(" { 0, 0, 0 }, /* $c */\n"); +} +out("};\n"); + close STDOUT or die "unidata.c: $!\n"; printf STDERR "modulus=%d\n", $modulus;