(component ComponentDefinition, implw LanguageWriter)
| 279 | } |
| 280 | |
| 281 | func buildGoImplementationHandle(component ComponentDefinition, implw LanguageWriter) { |
| 282 | NameSpace := component.NameSpace |
| 283 | implw.Writeln("type %sImplementationHandle interface {", NameSpace) |
| 284 | implw.Writeln(" %sHandle", NameSpace) |
| 285 | implw.Writeln("") |
| 286 | implw.Writeln(" GetDLLInHandle() (uintptr)") |
| 287 | implw.Writeln(" GetDLLOutHandle() (uintptr)") |
| 288 | implw.Writeln(" GetWrapper() (*%sImplementation)", NameSpace) |
| 289 | implw.Writeln("}") |
| 290 | implw.Writeln("") |
| 291 | implw.Writeln("type %sImplementationHandleStruct struct {", NameSpace) |
| 292 | implw.Writeln(" Implementation * %sImplementation", NameSpace) |
| 293 | implw.Writeln(" DLLhandle uintptr") |
| 294 | implw.Writeln("}") |
| 295 | implw.Writeln("") |
| 296 | implw.Writeln("func (handle *%sImplementationHandleStruct) Close() (error) {", NameSpace) |
| 297 | implw.Writeln(" if (handle.DLLhandle != 0) {") |
| 298 | implw.Writeln(" if (handle.Implementation == nil) {") |
| 299 | implw.Writeln(" return errors.New(\"Uninitialized DLL Implementation Handle\")") |
| 300 | implw.Writeln(" }") |
| 301 | implw.Writeln(" ") |
| 302 | implw.Writeln(" dllhandle := handle.DLLhandle") |
| 303 | implw.Writeln(" handle.DLLhandle = 0;") |
| 304 | implw.Writeln(" ") |
| 305 | implw.Writeln(" return handle.Implementation.CallFunction(handle.Implementation.%s_%s, dllhandle)", NameSpace, strings.ToLower(component.Global.ReleaseMethod)) |
| 306 | implw.Writeln(" }") |
| 307 | implw.Writeln(" ") |
| 308 | implw.Writeln(" return nil") |
| 309 | implw.Writeln("}") |
| 310 | implw.Writeln("") |
| 311 | implw.Writeln("func (handle *%sImplementationHandleStruct) IsValid() (bool) {", NameSpace) |
| 312 | implw.Writeln(" return (handle.DLLhandle != 0)") |
| 313 | implw.Writeln("}") |
| 314 | implw.Writeln("") |
| 315 | implw.Writeln("func (handle *%sImplementationHandleStruct) GetDLLInHandle() (uintptr) {", NameSpace) |
| 316 | implw.Writeln(" return handle.DLLhandle;") |
| 317 | implw.Writeln("}") |
| 318 | implw.Writeln("") |
| 319 | implw.Writeln("func (handle *%sImplementationHandleStruct) GetDLLOutHandle() (uintptr) {", NameSpace) |
| 320 | implw.Writeln(" return uintptr(unsafe.Pointer(&handle.DLLhandle));") |
| 321 | implw.Writeln("}") |
| 322 | implw.Writeln("") |
| 323 | implw.Writeln("func (handle *%sImplementationHandleStruct) GetWrapper() (*%sImplementation) {", NameSpace, NameSpace) |
| 324 | implw.Writeln(" return handle.Implementation;") |
| 325 | implw.Writeln("}") |
| 326 | implw.Writeln("") |
| 327 | } |
| 328 | |
| 329 | func buildGoHelperFunctions(implw LanguageWriter) { |
| 330 | for _, theIntType := range [2]string{"Int", "UInt"} { |
no test coverage detected