| 1 |
// SPDX-License-Identifier: Apache-2.0 |
| 2 |
// SPDX-FileCopyrightText: 2026 The Ebitengine Authors |
| 3 |
|
| 4 |
package purego |
| 5 |
|
| 6 |
import "unsafe" |
| 7 |
|
| 8 |
// callbackArgs is the argument block passed from the assembly trampoline |
| 9 |
// to callbackWrap when C code calls a Go callback registered with NewCallback. |
| 10 |
type callbackArgs struct { |
| 11 |
index uintptr |
| 12 |
// args points to the argument block. |
| 13 |
// |
| 14 |
// The structure of the arguments goes |
| 15 |
// float registers followed by the |
| 16 |
// integer registers. |
| 17 |
args unsafe.Pointer |
| 18 |
// Below are out-args from callbackWrap. |
| 19 |
result [1]uintptr |
| 20 |
// stackArgs points to stack-passed arguments. |
| 21 |
stackArgs unsafe.Pointer |
| 22 |
} |
| 23 |
|
| 24 |
func (c *callbackArgs) stackFrame() unsafe.Pointer { |
| 25 |
return c.stackArgs |
| 26 |
} |
| 27 |
|
| 28 |
func (c *callbackArgs) intFrame() unsafe.Pointer { |
| 29 |
return nil |
| 30 |
} |
| 31 |
|
| 32 |
func (c *callbackArgs) setInt64Result(result int64) { |
| 33 |
c.result[0] = uintptr(result) |
| 34 |
} |
| 35 |
|
| 36 |
func (c *callbackArgs) setUint64Result(result uint64) { |
| 37 |
c.result[0] = uintptr(result) |
| 38 |
} |