commit ccb4e871535950e714946e213adc818795da4706
parent 41eb89eb9f7a4aa4db6f29e6606b0e05c3e089a6
Author: hhvn <dev@hhvn.uk>
Date: Thu, 2 Dec 2021 15:38:30 +0000
m/rpl-conf-gen.awk m/rpl-ui-gen.awk: code generation scripts
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/misc/rpl-conf-gen.awk b/misc/rpl-conf-gen.awk
@@ -0,0 +1,12 @@
+#!/bin/awk -f
+# Parses RFC1459 for config[]
+
+$1 ~ /^[0-9][0-9][0-9]$/ && $2 ~ /RPL_/ {
+ rpl = tolower($2);
+ sub(/_/, ".", rpl);
+ printf("\t{\"format.%s\", 1, Val_string\n", rpl);
+ printf("\t\t.str = \"${2-}\",\n");
+ printf("\t\t.strhandle = config_redraws,\n");
+ printf("\t\t.description = {\n");
+ printf("\t\t\"Format of %s (%03d) numeric\", NULL}},\n", $2, $1)
+}
diff --git a/misc/rpl-ui-gen.awk b/misc/rpl-ui-gen.awk
@@ -0,0 +1,8 @@
+#!/bin/awk -f
+# Parses RFC1459 for formatmap[]
+
+$1 ~ /^[0-9][0-9][0-9]$/ && $2 ~ /RPL_/ {
+ rpl = tolower($2)
+ sub(/_/, ".", rpl)
+ printf("\t{\"%03d\",\t\t\t\"format.%s\"},\n", $1, rpl);
+}