Refactored binapi generator with message encoding
[govpp.git] / binapigen / definitions.go
similarity index 78%
rename from cmd/binapi-generator/definitions.go
rename to binapigen/definitions.go
index 9bf9e53..3c8a874 100644 (file)
@@ -1,18 +1,18 @@
-// Copyright (c) 2018 Cisco and/or its affiliates.
+//  Copyright (c) 2020 Cisco and/or its affiliates.
 //
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at:
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at:
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+//      http://www.apache.org/licenses/LICENSE-2.0
 //
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
 
-package main
+package binapigen
 
 import (
        "strings"
@@ -23,7 +23,10 @@ import (
 var commonInitialisms = map[string]bool{
        "ACL": true,
        "API": true,
-       //"ASCII": true, // there are only two use cases for ASCII which already have initialism before and after
+       // NOTE: There are only two occurences of the word 'ascii' and
+       // these already have initialism before and after ASCII part,
+       // thus disabling initialism for this case.
+       "ASCII": false,
        "CPU":   true,
        "CSS":   true,
        "DNS":   true,
@@ -68,8 +71,6 @@ var commonInitialisms = map[string]bool{
 // specialInitialisms is a set of special initialisms that need part to stay in upper case.
 var specialInitialisms = map[string]string{
        "IPV": "IPv",
-       //"IPV4": "IPv4",
-       //"IPV6": "IPv6",
 }
 
 func usesInitialism(s string) string {