From 868b541e296dc47748ad03b8f0174c828d996529 Mon Sep 17 00:00:00 2001 From: Ondrej Fabry Date: Thu, 13 Dec 2018 10:21:49 +0100 Subject: Add support for aliases and boolean type - aliases are now generated as new types or arrays (if length > 0) - bool is recognized as a boolean type and generated as Go bool - comment with original JSON is now prepended for each object type - interface Services is now generated at the top of the file to provide overview of what RPC services does the current module consists of - dump services now correctly return slice of the particular details type Change-Id: I788babc1c0f2de33e0febd87e5b200d54065b244 Signed-off-by: Ondrej Fabry --- cmd/binapi-generator/definitions.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'cmd/binapi-generator/definitions.go') diff --git a/cmd/binapi-generator/definitions.go b/cmd/binapi-generator/definitions.go index 3ad782f..0176278 100644 --- a/cmd/binapi-generator/definitions.go +++ b/cmd/binapi-generator/definitions.go @@ -25,6 +25,8 @@ func getBinapiTypeSize(binapiType string) int { b, err := strconv.Atoi(strings.TrimLeft(binapiType, "uif")) if err == nil { return b / 8 + } else { + return 1 } } return -1 @@ -32,15 +34,16 @@ func getBinapiTypeSize(binapiType string) int { // binapiTypes is a set of types used VPP binary API for translation to Go types var binapiTypes = map[string]string{ - "u8": "uint8", - "i8": "int8", - "u16": "uint16", - "i16": "int16", - "u32": "uint32", - "i32": "int32", - "u64": "uint64", - "i64": "int64", - "f64": "float64", + "bool": "bool", + "u8": "uint8", + "i8": "int8", + "u16": "uint16", + "i16": "int16", + "u32": "uint32", + "i32": "int32", + "u64": "uint64", + "i64": "int64", + "f64": "float64", } func usesInitialism(s string) string { -- cgit 1.2.3-korg