(implw LanguageWriter)
| 327 | } |
| 328 | |
| 329 | func buildGoHelperFunctions(implw LanguageWriter) { |
| 330 | for _, theIntType := range [2]string{"Int", "UInt"} { |
| 331 | for _, theWidth := range [4]string{"8", "16", "32", "64"} { |
| 332 | implw.Writeln("func %s%sOutValue(reference * %s%s) uintptr {", theIntType, theWidth, strings.ToLower(theIntType), theWidth) |
| 333 | implw.Writeln(" return uintptr(unsafe.Pointer(reference))") |
| 334 | implw.Writeln("}") |
| 335 | |
| 336 | implw.Writeln("func %s%sInValue(value %s%s) uintptr {", theIntType, theWidth, strings.ToLower(theIntType), theWidth) |
| 337 | implw.Writeln(" return uintptr(value)") |
| 338 | implw.Writeln("}") |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | for _, theFloatType := range [1]string{"Float"} { |
| 343 | for _, theWidth := range [2]string{"32", "64"} { |
| 344 | implw.Writeln("func %s%sOutValue(reference * %s%s) uintptr {", theFloatType, theWidth, strings.ToLower(theFloatType), theWidth) |
| 345 | implw.Writeln(" return uintptr(unsafe.Pointer(reference))") |
| 346 | implw.Writeln("}") |
| 347 | |
| 348 | implw.Writeln("func %s%sInValue(value %s%s) uintptr {", theFloatType, theWidth, strings.ToLower(theFloatType), theWidth) |
| 349 | implw.Writeln(" return uintptr(value)") |
| 350 | implw.Writeln("}") |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | implw.Writeln("func StringInValue (value string) uintptr {") |
| 355 | implw.Writeln(" bytePtr, err := syscall.BytePtrFromString(value)") |
| 356 | implw.Writeln(" if err != nil {") |
| 357 | implw.Writeln(" return 0") |
| 358 | implw.Writeln(" }") |
| 359 | implw.Writeln(" return uintptr(unsafe.Pointer(bytePtr))") |
| 360 | implw.Writeln("}") |
| 361 | implw.Writeln("") |
| 362 | implw.Writeln("func PtrOutValue(ptr * uintptr) uintptr {") |
| 363 | implw.Writeln(" return uintptr(unsafe.Pointer(ptr))") |
| 364 | implw.Writeln("}") |
| 365 | implw.Writeln("") |
| 366 | implw.Writeln("func BytesOutValue(bytePtr * []byte) uintptr {") |
| 367 | implw.Writeln(" return uintptr(unsafe.Pointer(bytePtr))") |
| 368 | implw.Writeln("}") |
| 369 | implw.Writeln("") |
| 370 | } |
| 371 | |
| 372 | func buildGoErrorHandling(component ComponentDefinition, implw LanguageWriter) { |
| 373 | implw.Writeln("") |
no test coverage detected