Clean up protocol code generators

This commit is contained in:
2022-09-29 16:39:26 +02:00
parent 941ee2f10c
commit 86278c154c
6 changed files with 67 additions and 43 deletions

View File

@@ -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()