MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / buildSharedCCPPTypesHeader

Function buildSharedCCPPTypesHeader

Source/languagec.go:78–160  ·  view source on GitHub ↗
(component ComponentDefinition, w LanguageWriter, NameSpace string)

Source from the content-addressed store, hash-verified

76
77
78func buildSharedCCPPTypesHeader(component ComponentDefinition, w LanguageWriter, NameSpace string) (error) {
79 w.Writeln("/*************************************************************************************************************************");
80 w.Writeln(" Scalar types definition");
81 w.Writeln("**************************************************************************************************************************/")
82 w.Writeln("")
83 w.Writeln("#ifdef %s_USELEGACYINTEGERTYPES", strings.ToUpper(NameSpace));
84 w.Writeln("")
85 w.Writeln("typedef unsigned char %s_uint8;", NameSpace);
86 w.Writeln("typedef unsigned short %s_uint16 ;", NameSpace);
87 w.Writeln("typedef unsigned int %s_uint32;", NameSpace);
88 w.Writeln("typedef unsigned long long %s_uint64;", NameSpace);
89 w.Writeln("typedef char %s_int8;", NameSpace);
90 w.Writeln("typedef short %s_int16;", NameSpace);
91 w.Writeln("typedef int %s_int32;", NameSpace);
92 w.Writeln("typedef long long %s_int64;", NameSpace);
93 w.Writeln("")
94 w.Writeln("#else // %s_USELEGACYINTEGERTYPES", strings.ToUpper(NameSpace));
95 w.Writeln("")
96 w.Writeln("#include <stdint.h>")
97 w.Writeln("")
98 w.Writeln("typedef uint8_t %s_uint8;", NameSpace);
99 w.Writeln("typedef uint16_t %s_uint16;", NameSpace);
100 w.Writeln("typedef uint32_t %s_uint32;", NameSpace);
101 w.Writeln("typedef uint64_t %s_uint64;", NameSpace);
102 w.Writeln("typedef int8_t %s_int8;", NameSpace);
103 w.Writeln("typedef int16_t %s_int16;", NameSpace);
104 w.Writeln("typedef int32_t %s_int32;", NameSpace);
105 w.Writeln("typedef int64_t %s_int64 ;", NameSpace);
106 w.Writeln("")
107 w.Writeln("#endif // %s_USELEGACYINTEGERTYPES", strings.ToUpper(NameSpace));
108 w.Writeln("")
109 w.Writeln("typedef float %s_single;", NameSpace);
110 w.Writeln("typedef double %s_double;", NameSpace);
111 w.Writeln("")
112
113
114 w.Writeln("/*************************************************************************************************************************");
115 w.Writeln(" General type definitions");
116 w.Writeln("**************************************************************************************************************************/");
117
118 w.Writeln("");
119 w.Writeln("typedef %s_int32 %sResult;", NameSpace, NameSpace);
120 w.Writeln("typedef void * %sHandle;", NameSpace);
121 w.Writeln("typedef void * %s_pvoid;", NameSpace);
122
123 w.Writeln("");
124 w.Writeln("/*************************************************************************************************************************");
125 w.Writeln(" Version for %s", NameSpace);
126 w.Writeln("**************************************************************************************************************************/");
127 w.Writeln("");
128 w.Writeln("#define %s_VERSION_MAJOR %d", strings.ToUpper(NameSpace), majorVersion(component.Version));
129 w.Writeln("#define %s_VERSION_MINOR %d", strings.ToUpper(NameSpace), minorVersion(component.Version));
130 w.Writeln("#define %s_VERSION_MICRO %d", strings.ToUpper(NameSpace), microVersion(component.Version));
131 w.Writeln("#define %s_VERSION_PRERELEASEINFO \"%s\"", strings.ToUpper(NameSpace), preReleaseInfo(component.Version));
132 w.Writeln("#define %s_VERSION_BUILDINFO \"%s\"", strings.ToUpper(NameSpace), buildInfo(component.Version));
133
134 w.Writeln("");
135

Callers 1

buildCCPPTypesHeaderFunction · 0.85

Calls 6

majorVersionFunction · 0.85
minorVersionFunction · 0.85
microVersionFunction · 0.85
preReleaseInfoFunction · 0.85
buildInfoFunction · 0.85
WritelnMethod · 0.80

Tested by

no test coverage detected