Bladeren bron

Whitespace cleanup in datatype generator

Sumedha Widyadharma 6 jaren geleden
bovenliggende
commit
e11f3b13ce
1 gewijzigde bestanden met toevoegingen van 8 en 8 verwijderingen
  1. 8 8
      tools/generate_datatypes.py

+ 8 - 8
tools/generate_datatypes.py

@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 #!/usr/bin/env python
 
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this 
+# License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 from __future__ import print_function
 from __future__ import print_function
@@ -55,13 +55,13 @@ builtin_overlayable = {"Boolean": "true",
                        "offsetof(UA_Guid, data3) == (sizeof(UA_UInt16) + sizeof(UA_UInt32)) && " + \
                        "offsetof(UA_Guid, data3) == (sizeof(UA_UInt16) + sizeof(UA_UInt32)) && " + \
                        "offsetof(UA_Guid, data4) == (2*sizeof(UA_UInt32)))"}
                        "offsetof(UA_Guid, data4) == (2*sizeof(UA_UInt32)))"}
 
 
-whitelistFuncAttrWarnUnusedResult = [  ] # for instances [ "String", "ByteString", "LocalizedText" ]
+whitelistFuncAttrWarnUnusedResult = []  # for instances [ "String", "ByteString", "LocalizedText" ]
 
 
 # Type aliases
 # Type aliases
 type_aliases = { "CharArray" : "String" }
 type_aliases = { "CharArray" : "String" }
 def getTypeName(xmlTypeName):
 def getTypeName(xmlTypeName):
-   typeName = xmlTypeName[xmlTypeName.find(":")+1:]
-   return type_aliases.get(typeName, typeName)
+    typeName = xmlTypeName[xmlTypeName.find(":")+1:]
+    return type_aliases.get(typeName, typeName)
 
 
 # Escape C strings:
 # Escape C strings:
 def makeCLiteral(value):
 def makeCLiteral(value):
@@ -186,7 +186,7 @@ class Type(object):
                 if idName == entry:
                 if idName == entry:
                     funcs += "UA_INTERNAL_FUNC_ATTR_WARN_UNUSED_RESULT "
                     funcs += "UA_INTERNAL_FUNC_ATTR_WARN_UNUSED_RESULT "
                     break
                     break
-            
+
             funcs += "static UA_INLINE UA_StatusCode\nUA_%s_copy(const UA_%s *src, UA_%s *dst) {\n    return UA_copy(src, dst, %s);\n}\n\n" % (idName, idName, idName, self.datatype_ptr())
             funcs += "static UA_INLINE UA_StatusCode\nUA_%s_copy(const UA_%s *src, UA_%s *dst) {\n    return UA_copy(src, dst, %s);\n}\n\n" % (idName, idName, idName, self.datatype_ptr())
             funcs += "static UA_INLINE void\nUA_%s_deleteMembers(UA_%s *p) {\n    UA_clear(p, %s);\n}\n\n" % (idName, idName, self.datatype_ptr())
             funcs += "static UA_INLINE void\nUA_%s_deleteMembers(UA_%s *p) {\n    UA_clear(p, %s);\n}\n\n" % (idName, idName, self.datatype_ptr())
             funcs += "static UA_INLINE void\nUA_%s_clear(UA_%s *p) {\n    UA_clear(p, %s);\n}\n\n" % (idName, idName, self.datatype_ptr())
             funcs += "static UA_INLINE void\nUA_%s_clear(UA_%s *p) {\n    UA_clear(p, %s);\n}\n\n" % (idName, idName, self.datatype_ptr())
@@ -500,9 +500,9 @@ if len(selected_types) == 0:
 # Write out the Definitions #
 # Write out the Definitions #
 #############################
 #############################
 
 
-fh = open(args.outfile + "_generated.h",'w')
-ff = open(args.outfile + "_generated_handling.h",'w')
-fe = open(args.outfile + "_generated_encoding_binary.h",'w')
+fh = open(args.outfile + "_generated.h", 'w')
+ff = open(args.outfile + "_generated_handling.h", 'w')
+fe = open(args.outfile + "_generated_encoding_binary.h", 'w')
 fc = open(args.outfile + "_generated.c",'w')
 fc = open(args.outfile + "_generated.c",'w')
 def printh(string):
 def printh(string):
     print(string, end='\n', file=fh)
     print(string, end='\n', file=fh)