summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/onigmo/tool/convert-jis-props.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:18 +0000
commit5da14042f70711ea5cf66e034699730335462f66 (patch)
tree0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/fluent-bit/lib/onigmo/tool/convert-jis-props.sh
parentReleasing debian version 1.44.3-2. (diff)
downloadnetdata-5da14042f70711ea5cf66e034699730335462f66.tar.xz
netdata-5da14042f70711ea5cf66e034699730335462f66.zip
Merging upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fluent-bit/lib/onigmo/tool/convert-jis-props.sh')
-rwxr-xr-xsrc/fluent-bit/lib/onigmo/tool/convert-jis-props.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/onigmo/tool/convert-jis-props.sh b/src/fluent-bit/lib/onigmo/tool/convert-jis-props.sh
new file mode 100755
index 000000000..476a5a532
--- /dev/null
+++ b/src/fluent-bit/lib/onigmo/tool/convert-jis-props.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Convert props.kwd to props.h using GNU gperf.
+#
+# Usage:
+# ./tool/convert-jis-props.sh enc/jis/props.kwd enc/jis/props.h
+
+GPERF_VERSION=`gperf -v | head -n1 | sed -e 's/^GNU gperf \([0-9]\+\)\.\([0-9]\+.*\)$/\1 \2/' | xargs printf '%02d%02d'`
+if [ $GPERF_VERSION -ge '0301' ]; then
+ # static const struct enc_property *onig_jis_property(const char *str, unsigned int len);
+ GPERF_REPLACE='s/\(onig_jis_property([^,]\+, \).\+\( len)\)/\1size_t\2/'
+else
+ GPERF_REPLACE='#'
+fi
+
+JIS_PROPS_OPTIONS='-k1,3 -7 -c -j1 -i1 -t -C -P -t --ignore-case -H onig_jis_property_hash -Q onig_jis_property_pool -N onig_jis_property'
+
+gperf $JIS_PROPS_OPTIONS $1 | sed "$GPERF_REPLACE" | \
+ sed 's/(int)(\(long\|size_t\))&((\([a-zA-Z_0-9 ]*[a-zA-Z_0-9]\) *\*)0)->\([a-zA-Z0-9_]*\),/(char)offsetof(\2, \3),/g' > $2