Prechádzať zdrojové kódy

fixed compile errors

FlorianPalm 11 rokov pred
rodič
commit
d842807355

+ 1 - 1
src/opcua_builtInDatatypes.h

@@ -135,7 +135,7 @@ typedef int16_t Int16;
 
 typedef uint16_t UInt16;
 
-typedef int32_t UA_Int32;
+typedef int32_t Int32;
 
 typedef uint32_t UInt32;
 

+ 4 - 4
tool/generate_builtin.py

@@ -108,7 +108,7 @@ def createStructured(element):
         elif child.tag == "{http://opcfoundation.org/BinarySchema/}Field":
             if child.get("Name") in lengthfields:
                 continue
-            childname = child.get("Name")
+            childname = camlCase2CCase(child.get("Name"))
             #if childname in printed_types:
             #    childname = childname + "_Value" # attributes may not have the name of a type
             typename = stripTypename(child.get("TypeName"))
@@ -131,7 +131,7 @@ def createStructured(element):
     if len(valuemap) > 0:
         for n,t in valuemap.iteritems():
             if t.find("**") != -1:
-	        print("\t" + "UA_UInt32 " + n + "_size;", end='\n', file=fh)
+	        print("\t" + "UA_UInt32 " + n + "Size;", end='\n', file=fh)
             print("\t" + "UA_" + t + " " + n + ";", end='\n', file=fh)
     else:
         print("\t/* null record */", end='\n', file=fh)
@@ -162,8 +162,8 @@ def createStructured(element):
             if t in enum_types:
                 print('\n\t + 4 //' + n, end='', file=fc) # enums are all 32 bit
             elif t.find("**") != -1:
-		print("\n\t + 4 //" + n + "_size", end='', file=fc),
-		print("\n\t + UA_Array_calcSize(ptr->" + n + "_size, UA_" + t[0:t.find("*")].upper() + ", (void const**) ptr->" + n +")", end='', file=fc)
+		print("\n\t + 4 //" + n + "Size", end='', file=fc),
+		print("\n\t + UA_Array_calcSize(ptr->" + n + "Size, UA_" + t[0:t.find("*")].upper() + ", (void const**) ptr->" + n +")", end='', file=fc)
             elif t.find("*") != -1:
                 print('\n\t + ' + "UA_" + t[0:t.find("*")] + "_calcSize(ptr->" + n + ')', end='', file=fc)
             else:

+ 1 - 0
tool/opcua_basictypes.c

@@ -8,6 +8,7 @@
 #include <stdio.h>	// printf
 #include <stdlib.h>	// alloc, free
 #include <string.h>
+#include "opcua_basictypes.h"
 
 
 UA_Int32 UA_encode(void* const data, UA_Int32 *pos, UA_Int32 type, char* dst) {

+ 14 - 22
tool/opcua_basictypes.h

@@ -23,6 +23,19 @@ typedef uint64_t UInt64;
 typedef float Float;
 typedef double Double;
 
+/* Basic types */
+typedef _Bool UA_Boolean;
+typedef int8_t UA_Byte;
+typedef uint8_t UA_SByte;
+typedef int16_t UA_Int16;
+typedef uint16_t UA_UInt16;
+typedef int32_t UA_Int32;
+typedef uint32_t UA_UInt32;
+typedef int64_t UA_Int64;
+typedef uint64_t UA_UInt64;
+typedef float UA_Float;
+typedef double UA_Double;
+
 /* Function return values */
 #define UA_SUCCESS 0
 #define UA_NO_ERROR UA_SUCCESS
@@ -93,38 +106,17 @@ UA_Int32 TYPE##_encode(TYPE const * src, UA_Int32* pos, char *dst) { \
 	return TYPE_AS##_encode((TYPE_AS*) src,pos,dst); \
 }
 
-/* Prototypes for basic types */
-typedef _Bool UA_Boolean;
+/*** Prototypes for basic types **/
 UA_TYPE_METHOD_PROTOTYPES (UA_Boolean)
-
-typedef int8_t UA_Byte;
 UA_TYPE_METHOD_PROTOTYPES (UA_Byte)
-
-typedef uint8_t UA_SByte;
 UA_TYPE_METHOD_PROTOTYPES (UA_SByte)
-
-typedef int16_t UA_Int16;
 UA_TYPE_METHOD_PROTOTYPES (UA_Int16)
-
-typedef uint16_t UA_UInt16;
 UA_TYPE_METHOD_PROTOTYPES (UA_UInt16)
-
-typedef int32_t UA_Int32;
 UA_TYPE_METHOD_PROTOTYPES (UA_Int32)
-
-typedef uint32_t UA_UInt32;
 UA_TYPE_METHOD_PROTOTYPES (UA_UInt32)
-
-typedef int64_t UA_Int64;
 UA_TYPE_METHOD_PROTOTYPES (UA_Int64)
-
-typedef uint64_t UA_UInt64;
 UA_TYPE_METHOD_PROTOTYPES (UA_UInt64)
-
-typedef float UA_Float;
 UA_TYPE_METHOD_PROTOTYPES (UA_Float)
-
-typedef double UA_Double;
 UA_TYPE_METHOD_PROTOTYPES (UA_Double)
 
 /**