diff options
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() |