From 0ff02b6b1f0757f5e4c011457757bd18d0a60f01 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Tue, 4 Jun 2019 14:47:19 +0200 Subject: Fix union data size for types with enums - this also fixed proper alphabetical order for struct tags - env var DEBUG_BINAPI_GENERATOR=y can be used to enable debug mode Change-Id: I5b08a696ad2ff2a297872f231f9229cd956ee443 Signed-off-by: Ondrej Fabry --- cmd/binapi-generator/main.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'cmd/binapi-generator/main.go') diff --git a/cmd/binapi-generator/main.go b/cmd/binapi-generator/main.go index b3a131c..faed54f 100644 --- a/cmd/binapi-generator/main.go +++ b/cmd/binapi-generator/main.go @@ -30,15 +30,18 @@ import ( ) var ( - inputFile = flag.String("input-file", "", "Input file with VPP API in JSON format.") - inputDir = flag.String("input-dir", ".", "Input directory with VPP API files in JSON format.") - outputDir = flag.String("output-dir", ".", "Output directory where package folders will be generated.") - includeAPIVer = flag.Bool("include-apiver", false, "Include APIVersion constant for each module.") - includeComments = flag.Bool("include-comments", false, "Include JSON API source in comments for each object.") - continueOnError = flag.Bool("continue-onerror", false, "Continue with next file on error.") - debug = flag.Bool("debug", false, "Enable debug mode.") + inputFile = flag.String("input-file", "", "Input file with VPP API in JSON format.") + inputDir = flag.String("input-dir", ".", "Input directory with VPP API files in JSON format.") + outputDir = flag.String("output-dir", ".", "Output directory where package folders will be generated.") + includeAPIVer = flag.Bool("include-apiver", false, "Include APIVersion constant for each module.") + includeComments = flag.Bool("include-comments", false, "Include JSON API source in comments for each object.") + includeBinapiNames = flag.Bool("include-binapi-names", false, "Include binary API names in struct tag.") + continueOnError = flag.Bool("continue-onerror", false, "Continue with next file on error.") + debug = flag.Bool("debug", debugMode, "Enable debug mode.") ) +var debugMode = os.Getenv("DEBUG_BINAPI_GENERATOR") != "" + var log = logrus.Logger{ Level: logrus.InfoLevel, Formatter: &logrus.TextFormatter{}, @@ -107,6 +110,7 @@ func generateFromFile(inputFile, outputDir string) error { ctx.includeAPIVersionCrc = *includeAPIVer ctx.includeComments = *includeComments + ctx.includeBinapiNames = *includeBinapiNames // read input file contents ctx.inputData, err = readFile(inputFile) -- cgit 1.2.3-korg