diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2022-09-29 16:39:26 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2022-09-30 03:24:13 +0200 |
commit | 86278c154c0e8f88f3df91298b4fcd40f8c7571b (patch) | |
tree | da2aa0f4786337b7245dc931e56f72b144008839 /xC-gen-proto.awk | |
parent | 941ee2f10c0c6d273d4d7bf591a48068141e2c56 (diff) | |
download | xK-86278c154c0e8f88f3df91298b4fcd40f8c7571b.tar.gz xK-86278c154c0e8f88f3df91298b4fcd40f8c7571b.tar.xz xK-86278c154c0e8f88f3df91298b4fcd40f8c7571b.zip |
Clean up protocol code generators
Diffstat (limited to 'xC-gen-proto.awk')
-rw-r--r-- | xC-gen-proto.awk | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/xC-gen-proto.awk b/xC-gen-proto.awk index 9b65a74..1a9ab1f 100644 --- a/xC-gen-proto.awk +++ b/xC-gen-proto.awk @@ -22,7 +22,7 @@ # unless this role is already filled by, e.g., WebSocket. # # Usage: env LC_ALL=C awk -f xC-gen-proto.awk -f xC-gen-proto-{c,go,js}.awk \ -# xC-proto > xC-proto.{c,go,js} | {clang-format,gofmt,...} +# -v PrefixCamel=Relay xC-proto > xC-proto.{c,go,js} | {clang-format,gofmt,...} # --- Utilities ---------------------------------------------------------------- @@ -289,12 +289,14 @@ function deftype() { return 0 } -BEGIN { - PrefixLower = "relay_" - PrefixUpper = "RELAY_" - PrefixCamel = "Relay" +{ + if (PrefixCamel) { + PrefixLower = tolower(cameltosnake(PrefixCamel)) "_" + PrefixUpper = toupper(cameltosnake(PrefixCamel)) "_" + } - print "// Generated by xC-gen-proto.awk. DO NOT MODIFY." + # This is not in a BEGIN clause (even though it consumes all input), + # so that the code generator can insert the first FILENAME. codegen_begin() nexttoken() |