diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-01-27 23:26:42 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-01-27 23:26:42 +0100 |
commit | 679f7928e27a95e559eb3a69febf0c6336e40234 (patch) | |
tree | af9c5bb35253086eb8e3ad3d7774e7349b3beefe /vendor/librune/gen | |
parent | fd502fd87b40ae7f60314d8d9009f739f1c5fcf3 (diff) |
Bump librune
Diffstat (limited to 'vendor/librune/gen')
-rwxr-xr-x | vendor/librune/gen/gbrk | 10 | ||||
-rwxr-xr-x | vendor/librune/gen/rtype | 106 |
2 files changed, 111 insertions, 5 deletions
diff --git a/vendor/librune/gen/gbrk b/vendor/librune/gen/gbrk index 58e47b4..72ee2f7 100755 --- a/vendor/librune/gen/gbrk +++ b/vendor/librune/gen/gbrk @@ -2,17 +2,17 @@ cache() { - name="/tmp/librune/$(basename "$1")" + name="/tmp/librune/gbrk/$(basename "$1")" if test ! -f "$name" then - mkdir -p /tmp/librune + mkdir -p /tmp/librune/gbrk wget -q "$1" -O "$name" fi } set -e cd "${0%/*}/.." -exec >lib/internal/gbrk_lookup.h +exec >include/internal/gbrk_lookup.h readonly URL1='https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakProperty.txt' readonly URL2='https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt' @@ -104,10 +104,10 @@ END { lo = i while (props[lo] == props[i + 1]) i++ - printf "\t{0x%05X, 0x%05X, %s},\n", lo, i, props[lo] + printf "\t{0x%06X, 0x%06X, %s},\n", lo, i, props[lo] } } -' /tmp/librune/* | sort +' /tmp/librune/gbrk/* | sort cat <<C }; diff --git a/vendor/librune/gen/rtype b/vendor/librune/gen/rtype new file mode 100755 index 0000000..21916d3 --- /dev/null +++ b/vendor/librune/gen/rtype @@ -0,0 +1,106 @@ +#!/bin/sh + +cache() +{ + name="/tmp/librune/rtype/$(basename "$1")" + if test ! -f "$name" + then + mkdir -p /tmp/librune/rtype + wget -q "$1" -O "$name" + fi +} + +set -e +cd "${0%/*}/.." +exec >include/internal/rtype_lookup.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt' +cache "$URL" + +cat <<C +/* This file is autogenerated by gen/gbrk; DO NOT EDIT. */ + +/* TODO: Change tables to constexpr from const when Clangd gets better */ + +#ifndef RUNE_INTERNAL_RTYPE_LOOKUP_H +#define RUNE_INTERNAL_RTYPE_LOOKUP_H + +/* IWYU pragma: private */ +/* clang-format off */ + +#include "types.h" +#include "../rtype.h" + +static const unicat rtype_lat1_tbl[] = { +C + +gawk ' +BEGIN { + FS = ";" +} + +{ + s = "UC_" toupper($3) + lo = strtonum("0X" $1) + + if ($2 ~ /First/) { + getline + hi = strtonum("0X" $1) + } else + hi = lo + + for (i = lo; i <= hi; i++) + props[i] = s +} + +END { + for (i = 0; i <= 0xFF; i++) + print props[i] "," +} +' /tmp/librune/rtype/* | paste -d' ' - - - - - - - - | sed 's/^/\t/' + +cat <<C +}; + +static const struct { + rune lo, hi; + unicat cat; +} rtype_cat_tbl[] = { +C + +gawk ' +BEGIN { + FS = ";" +} + +{ + s = "UC_" toupper($3) + lo = strtonum("0X" $1) + + if ($2 ~ /First/) { + getline + hi = strtonum("0X" $1) + } else + hi = lo + + for (i = lo; i <= hi; i++) + props[i] = s +} + +END { + for (i = 0; i <= 0x10FFFF; i++) { + if (!props[i]) + continue + lo = i + while (props[lo] == props[i + 1]) + i++ + printf "\t{0x%06X, 0x%06X, %s},\n", lo, i, props[lo] + } +} +' /tmp/librune/rtype/* | sort + +cat <<C +}; + +#endif /* !RUNE_INTERNAL_RTYPE_LOOKUP_H */ +C |