From b8f4479a17e1add06e1532a00ae913cc0f4e9567 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 29 Jan 2024 00:42:05 +0100 Subject: Bump librune --- vendor/librune/gen/gbrk | 2 - vendor/librune/gen/rtype | 106 ---------------------------------- vendor/librune/gen/rtype-cat | 104 ++++++++++++++++++++++++++++++++++ vendor/librune/gen/rtype-prop | 116 ++++++++++++++++++++++++++++++++++++++ vendor/librune/gen/rtype-prop.awk | 61 ++++++++++++++++++++ 5 files changed, 281 insertions(+), 108 deletions(-) delete mode 100755 vendor/librune/gen/rtype create mode 100755 vendor/librune/gen/rtype-cat create mode 100755 vendor/librune/gen/rtype-prop create mode 100644 vendor/librune/gen/rtype-prop.awk (limited to 'vendor/librune/gen') diff --git a/vendor/librune/gen/gbrk b/vendor/librune/gen/gbrk index 72ee2f7..1146327 100755 --- a/vendor/librune/gen/gbrk +++ b/vendor/librune/gen/gbrk @@ -26,8 +26,6 @@ wait cat <include/internal/rtype_lookup.h - -readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt' -cache "$URL" - -cat <include/internal/rtype/cat.h + +readonly URL='https://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt' +cache "$URL" + +cat <&2 + + gawk -M -v prop=$prop -f gen/rtype-prop.awk \ + /tmp/librune/rtype/PropList.txt \ + >lib/rtype/rune_has_prop_$lprop.c + + echo "[[unsequenced]] bool rune_has_prop_$lprop(rune);" + echo ' DONE' >&2 + done + + for prop in $props2 + do + lprop=$(echo $prop | tr A-Z a-z) + + printf 'rune_has_prop_%s…' $lprop >&2 + + gawk -M -v prop=$prop -f gen/rtype-prop.awk \ + /tmp/librune/rtype/DerivedCoreProperties.txt \ + >lib/rtype/rune_has_prop_$lprop.c + + echo "[[unsequenced]] bool rune_has_prop_$lprop(rune);" + echo ' DONE' >&2 + done +} | 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 diff --git a/vendor/librune/gen/rtype-prop.awk b/vendor/librune/gen/rtype-prop.awk new file mode 100644 index 0000000..59b4a99 --- /dev/null +++ b/vendor/librune/gen/rtype-prop.awk @@ -0,0 +1,61 @@ +BEGIN { + FS = "( *#.*| +; +)" + + print "/* This file is autogenerated by gen/rtype-prop; DO NOT EDIT. */" + print "" + print "#include \"rtype.h\"" + print "" + print "#include \"internal/common.h\"" + 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 { + for (i = 0; i <= 0xFF; i++) { + if (xs[i]) + mask = or(mask, lshift(1, i)) + } + print "#if BIT_LOOKUP" + printf "static const unsigned _BitInt(LATIN1_MAX + 1) mask = 0x%Xuwb;\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{0x%06X, 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 "rune_has_prop_%s(rune ch)\n", tolower(prop) + print "{" + print "\treturn" + print "#if BIT_LOOKUP" + print "\t\tch <= LATIN1_MAX ? (mask & ch) :" + print "#endif" + print "\t\tlookup(ch);" + print "}" +} -- cgit v1.2.3