From 79e6af86ca526d5fb56af6f6ca3da713e3a5e9f9 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 13 Feb 2024 13:02:28 +0100 Subject: Genesis commit --- vendor/librune/gen/gbrk | 114 ++++++++++++++++++++++++++++ vendor/librune/gen/mkfile | 37 +++++++++ vendor/librune/gen/rtype-dt | 98 ++++++++++++++++++++++++ vendor/librune/gen/rtype-equideo | 64 ++++++++++++++++ vendor/librune/gen/rtype-gc | 107 ++++++++++++++++++++++++++ vendor/librune/gen/rtype-jg | 69 +++++++++++++++++ vendor/librune/gen/rtype-jt | 97 ++++++++++++++++++++++++ vendor/librune/gen/rtype-nt | 97 ++++++++++++++++++++++++ vendor/librune/gen/rtype-nv | 68 +++++++++++++++++ vendor/librune/gen/rtype-prop | 155 ++++++++++++++++++++++++++++++++++++++ vendor/librune/gen/rtype-prop.awk | 72 ++++++++++++++++++ vendor/librune/gen/rtype-vo | 100 ++++++++++++++++++++++++ 12 files changed, 1078 insertions(+) create mode 100755 vendor/librune/gen/gbrk create mode 100755 vendor/librune/gen/mkfile create mode 100755 vendor/librune/gen/rtype-dt create mode 100755 vendor/librune/gen/rtype-equideo create mode 100755 vendor/librune/gen/rtype-gc create mode 100755 vendor/librune/gen/rtype-jg create mode 100755 vendor/librune/gen/rtype-jt create mode 100755 vendor/librune/gen/rtype-nt create mode 100755 vendor/librune/gen/rtype-nv create mode 100755 vendor/librune/gen/rtype-prop create mode 100644 vendor/librune/gen/rtype-prop.awk create mode 100755 vendor/librune/gen/rtype-vo (limited to 'vendor/librune/gen') diff --git a/vendor/librune/gen/gbrk b/vendor/librune/gen/gbrk new file mode 100755 index 0000000..577c2c9 --- /dev/null +++ b/vendor/librune/gen/gbrk @@ -0,0 +1,114 @@ +#!/bin/sh + +cache() +{ + name="/tmp/librune/gbrk/$(basename "$1")" + if test ! -f "$name" + then + mkdir -p /tmp/librune/gbrk + wget -q "$1" -O "$name" + fi +} + +set -e +cd "${0%/*}/.." +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' +readonly URL3='https://www.unicode.org/Public/UCD/latest/ucd/DerivedCoreProperties.txt' + +cache "$URL1" & +cache "$URL2" & +cache "$URL3" & +wait + +cat <Makefile + +cat <&2 +make diff --git a/vendor/librune/gen/rtype-dt b/vendor/librune/gen/rtype-dt new file mode 100755 index 0000000..927b54f --- /dev/null +++ b/vendor/librune/gen/rtype-dt @@ -0,0 +1,98 @@ +#!/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/dt.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedDecompositionType.txt' +cache "$URL" + +cat <include/internal/rtype/equideo.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/EquivalentUnifiedIdeograph.txt' +cache "$URL" + +cat <include/internal/rtype/gc.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt' +cache "$URL" + +cat <include/internal/rtype/jg.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedJoiningGroup.txt' +cache "$URL" + +cat <include/internal/rtype/jt.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedJoiningType.txt' +cache "$URL" + +cat <include/internal/rtype/nt.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedNumericType.txt' +cache "$URL" + +cat <include/internal/rtype/nv.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedNumericValues.txt' +cache "$URL" + +cat <lib/rtype/rprop_${2}_${p}.c + printf 'DONE rprop_%s_%s()\n' $2 $p >&2 +} + +for prop in $props1 +do + gen $prop is PropList.txt & +done + +for prop in $props2 +do + gen $prop is DerivedCoreProperties.txt & +done + +for prop in $props3 +do + gen $prop is emoji-data.txt & +done + +for prop in $props4 +do + gen $prop is DerivedNormalizationProps.txt & +done + +for prop in $props5 +do + gen $prop is DerivedBinaryProperties.txt & +done + +printf '[[unsequenced]] bool rprop_is_%s(rune);\n' \ + $(printf '%s\n' $props1 $props2 $props3 $props4 $props5 | cut -d= -f1) \ +| gawk ' + /PROP PREDICATES END/ { no = 0 } + FILENAME != "-" && !no { print } + FILENAME == "-" { funcs[++i] = $0 } + + /PROP PREDICATES START/ { + no = 1 + asort(funcs) + for (i = 1; i <= length(funcs); i++) + print funcs[i] + } +' - include/rtype.h | sponge include/rtype.h + +wait +for prop in $manual +do + shrt=${prop%%=*} + printf 'Function rprop_is_%s() implemented manually\n' $shrt >&2 +done diff --git a/vendor/librune/gen/rtype-prop.awk b/vendor/librune/gen/rtype-prop.awk new file mode 100644 index 0000000..138b3ab --- /dev/null +++ b/vendor/librune/gen/rtype-prop.awk @@ -0,0 +1,72 @@ +BEGIN { + FS = "( *#.*| +; +)" + + print "/* This file is autogenerated by gen/rtype-prop; DO NOT EDIT. */" + print "" + print "#include \"rtype.h\"" + print "#include \"rune.h\"" + print "" + print "#include \"internal/common.h\"" + print "" + print "/* clang-format off */" + print "" +} + +$2 == prop || (prop == "Indic_Conjunct_Break" && $2 ~ /InCB;/) { + n = split($1, a, /\.\./) + lo = strtonum("0x" a[1]) + hi = strtonum("0x" a[n]) + + for (i = lo; i <= hi; i++) + xs[i] = 1 +} + +END { + if (word == "is") { + for (i = 0; i <= 0xFF; i++) { + if (xs[i]) + mask = or(mask, lshift(1, i)) + } + } + if (mask > 0) { + print "#if BIT_LOOKUP" + print "static const unsigned _BitInt(LATIN1_MAX + 1) mask =" + printf "\t0x%064Xuwb;\n", mask + print "#endif" + print "" + } + + print "static const struct {" + print "\trune lo, hi;" + print "} lookup_tbl[] = {" + + for (i = 0; i <= 0x10FFFF; i++) { + if (!xs[i]) + continue + lo = i + while (xs[i + 1]) + i++ + printf "\t{RUNE_C(0x%06X), RUNE_C(0x%06X)},\n", lo, i + } + + print "};" + print "" + print "#define TYPE bool" + print "#define TABLE lookup_tbl" + print "#define DEFAULT false" + print "#define HAS_VALUE 0" + print "#include \"internal/rtype/lookup-func.h\"" + print "" + print "bool" + printf "rprop_%s_%s(rune ch)\n", word, short + print "{" + if (mask > 0) { + print "\treturn" + print "#if BIT_LOOKUP" + print "\t\tch <= LATIN1_MAX ? (mask & (1 << ch)) :" + print "#endif" + print "\t\tlookup(ch);" + } else + print "\treturn lookup(ch);" + print "}" +} diff --git a/vendor/librune/gen/rtype-vo b/vendor/librune/gen/rtype-vo new file mode 100755 index 0000000..7c2f65f --- /dev/null +++ b/vendor/librune/gen/rtype-vo @@ -0,0 +1,100 @@ +#!/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/vo.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/VerticalOrientation.txt' +cache "$URL" + +cat <