From 8344b09c4f9989370691c71b1145b09348e0a6d3 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Mon, 26 Sep 2022 12:23:58 +0200 Subject: hid: rename to xS before merge into xK --- xS/xS-gen-replies.awk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 xS/xS-gen-replies.awk (limited to 'xS/xS-gen-replies.awk') diff --git a/xS/xS-gen-replies.awk b/xS/xS-gen-replies.awk new file mode 100755 index 0000000..fce7b50 --- /dev/null +++ b/xS/xS-gen-replies.awk @@ -0,0 +1,16 @@ +#!/usr/bin/awk -f +/^[0-9]+ *(ERR|RPL)_[A-Z]+ *".*"$/ { + match($0, /".*"/); + ids[$1] = $2; + texts[$2] = substr($0, RSTART, RLENGTH); +} + +END { + print "package " ENVIRON["GOPACKAGE"] "\n\nconst (" + for (i in ids) + printf("\t%s = %s\n", ids[i], i) + print ")\n\nvar defaultReplies = map[int]string{" + for (i in ids) + print "\t" ids[i] ": " texts[ids[i]] "," + print "}" +} -- cgit v1.2.3-70-g09d2