reorganize: consolidate demo directories

- Consolidate _demo, _pydemo, _embdemo into single _demo directory structure
- Organize demos by language: _demo/{go,py,c,embed}/
- Categorize demos based on imports:
- Python library demos (py imports) → _demo/py/
- C/C++ library demos (c/cpp imports) → _demo/c/
- Go-specific demos → _demo/go/
- Embedded demos → _demo/embed/
- Move C-related demos (asm*, cabi*, cgo*, linkname, targetsbuild) from go/ to c/
- Update all path references in README.md and GitHub workflows
- Improve demo organization and navigation as requested in #1256

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Li Jie
2025-09-09 15:06:55 +08:00
parent 849b23079b
commit 64df39b3c5
96 changed files with 61 additions and 52 deletions

25
_demo/c/qsort/qsort.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
"unsafe"
"github.com/goplus/lib/c"
)
func main() {
a := [...]int{100, 8, 23, 2, 7}
c.Qsort(c.Pointer(&a), 5, unsafe.Sizeof(0), func(a, b c.Pointer) c.Int {
return c.Int(*(*int)(a) - *(*int)(b))
})
for _, v := range a {
c.Printf(c.Str("%d\n"), v)
}
}
/* Expected output:
2
7
8
23
100
*/