detached 81d8c41

purego: clean up files for callbackArgs definitions (#435)

commit
81d8c41541b87236c0cdd602d09f073d3969f6d2
author
Hajime Hoshi · · 2026-03-08 12:50 UTC
committer
GitHub · · 2026-03-08 12:50 UTC
parent
90bb24e
signature
GPG UnverifiedB5690EEEBB952194 The key is unknown
4 files · +48 -30
A syscall_notstackargs.go +37 -0
@@ -0,0 +1,37 @@
1+// SPDX-License-Identifier: Apache-2.0
2+// SPDX-FileCopyrightText: 2026 The Ebitengine Authors
3+
4+//go:build !(ppc64le || s390x)
5+
6+package purego
7+
8+import "unsafe"
9+
10+// callbackArgs is the argument block passed from the assembly trampoline
11+// to callbackWrap when C code calls a Go callback registered with NewCallback.
12+// The assembly fills in the fields before calling callbackWrap, which uses
13+// them to determine which Go function to invoke and where to read its
14+// arguments from, and writes the return value back into result.
15+//
16+// callbackArgs is only used on Unix. On Windows, callbacks are handled by
17+// the runtime's own callback mechanism, so this type is compiled but unused,
18+// serving only as a stub to satisfy cross-platform compilation.
19+type callbackArgs struct {
20+ index uintptr
21+ // args points to the argument block.
22+ //
23+ // The structure of the arguments goes
24+ // float registers followed by the
25+ // integer registers followed by the stack.
26+ //
27+ // This variable is treated as a contiguous
28+ // block of memory containing all of the arguments
29+ // for this callback.
30+ args unsafe.Pointer
31+ // Below are out-args from callbackWrap
32+ result uintptr
33+}
34+
35+func (c *callbackArgs) stackFrame() unsafe.Pointer {
36+ return nil
37+}
@@ -0,0 +1,37 @@
1+// SPDX-License-Identifier: Apache-2.0
2+// SPDX-FileCopyrightText: 2026 The Ebitengine Authors
3+
4+//go:build !(ppc64le || s390x)
5+
6+package purego
7+
8+import "unsafe"
9+
10+// callbackArgs is the argument block passed from the assembly trampoline
11+// to callbackWrap when C code calls a Go callback registered with NewCallback.
12+// The assembly fills in the fields before calling callbackWrap, which uses
13+// them to determine which Go function to invoke and where to read its
14+// arguments from, and writes the return value back into result.
15+//
16+// callbackArgs is only used on Unix. On Windows, callbacks are handled by
17+// the runtime's own callback mechanism, so this type is compiled but unused,
18+// serving only as a stub to satisfy cross-platform compilation.
19+type callbackArgs struct {
20+ index uintptr
21+ // args points to the argument block.
22+ //
23+ // The structure of the arguments goes
24+ // float registers followed by the
25+ // integer registers followed by the stack.
26+ //
27+ // This variable is treated as a contiguous
28+ // block of memory containing all of the arguments
29+ // for this callback.
30+ args unsafe.Pointer
31+ // Below are out-args from callbackWrap
32+ result uintptr
33+}
34+
35+func (c *callbackArgs) stackFrame() unsafe.Pointer {
36+ return nil
37+}
R syscall_sysv_stackargs.go → syscall_stackargs.go +11 -2 renamed, 55% similar
@@ -1,12 +1,21 @@
11 // SPDX-License-Identifier: Apache-2.0
22 // SPDX-FileCopyrightText: 2026 The Ebitengine Authors
33
4-//go:build linux && (ppc64le || s390x)
4+//go:build ppc64le || s390x
55
66 package purego
77
88 import "unsafe"
99
10+// callbackArgs is the argument block passed from the assembly trampoline
11+// to callbackWrap when C code calls a Go callback registered with NewCallback.
12+// The assembly fills in the fields before calling callbackWrap, which uses
13+// them to determine which Go function to invoke and where to read its
14+// arguments from, and writes the return value back into result.
15+//
16+// callbackArgs is only used on Unix. On Windows, callbacks are handled by
17+// the runtime's own callback mechanism, so this type is compiled but unused,
18+// serving only as a stub to satisfy cross-platform compilation.
1019 type callbackArgs struct {
1120 index uintptr
1221 // args points to the argument block.
@@ -15,7 +24,7 @@ type callbackArgs struct {
1524 // float registers followed by the
1625 // integer registers followed by the stack.
1726 //
18- // This variable is treated as a continuous
27+ // This variable is treated as a contiguous
1928 // block of memory containing all of the arguments
2029 // for this callback.
2130 args unsafe.Pointer
@@ -1,12 +1,21 @@
1 // SPDX-License-Identifier: Apache-2.01 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: 2026 The Ebitengine Authors2 // SPDX-FileCopyrightText: 2026 The Ebitengine Authors
3 3
4-//go:build linux && (ppc64le || s390x)4+//go:build ppc64le || s390x
5 5
6 package purego6 package purego
7 7
8 import "unsafe"8 import "unsafe"
9 9
10+// callbackArgs is the argument block passed from the assembly trampoline
11+// to callbackWrap when C code calls a Go callback registered with NewCallback.
12+// The assembly fills in the fields before calling callbackWrap, which uses
13+// them to determine which Go function to invoke and where to read its
14+// arguments from, and writes the return value back into result.
15+//
16+// callbackArgs is only used on Unix. On Windows, callbacks are handled by
17+// the runtime's own callback mechanism, so this type is compiled but unused,
18+// serving only as a stub to satisfy cross-platform compilation.
10 type callbackArgs struct {19 type callbackArgs struct {
11 index uintptr20 index uintptr
12 // args points to the argument block.21 // args points to the argument block.
@@ -15,7 +24,7 @@ type callbackArgs struct {
15 // float registers followed by the24 // float registers followed by the
16 // integer registers followed by the stack.25 // integer registers followed by the stack.
17 //26 //
18- // This variable is treated as a continuous27+ // This variable is treated as a contiguous
19 // block of memory containing all of the arguments28 // block of memory containing all of the arguments
20 // for this callback.29 // for this callback.
21 args unsafe.Pointer30 args unsafe.Pointer
D syscall_sysv_others.go +0 -28
@@ -1,28 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2026 The Ebitengine Authors
3-
4-//go:build darwin || freebsd || (linux && (386 || amd64 || arm || arm64 || loong64 || riscv64)) || netbsd
5-
6-package purego
7-
8-import "unsafe"
9-
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 followed by the stack.
17- //
18- // This variable is treated as a continuous
19- // block of memory containing all of the arguments
20- // for this callback.
21- args unsafe.Pointer
22- // Below are out-args from callbackWrap
23- result uintptr
24-}
25-
26-func (c *callbackArgs) stackFrame() unsafe.Pointer {
27- return nil
28-}
@@ -1,28 +0,0 @@
1-// SPDX-License-Identifier: Apache-2.0
2-// SPDX-FileCopyrightText: 2026 The Ebitengine Authors
3-
4-//go:build darwin || freebsd || (linux && (386 || amd64 || arm || arm64 || loong64 || riscv64)) || netbsd
5-
6-package purego
7-
8-import "unsafe"
9-
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 followed by the stack.
17- //
18- // This variable is treated as a continuous
19- // block of memory containing all of the arguments
20- // for this callback.
21- args unsafe.Pointer
22- // Below are out-args from callbackWrap
23- result uintptr
24-}
25-
26-func (c *callbackArgs) stackFrame() unsafe.Pointer {
27- return nil
28-}
R syscall_sysv.go → syscall_unix.go +0 -0 renamed, 100% similar

renamed, 100% similar

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close