Merge pull request #504 from xushiwei/q

c.AllocaCStrs; ssa: AllocaU/ArrayAlloca/Times/AllocaCStrs; cl/_testlibc: allocacstrs; demo: sysexec
This commit is contained in:
xushiwei
2024-07-13 12:51:33 +08:00
committed by GitHub
14 changed files with 304 additions and 71 deletions

View File

@@ -1,19 +0,0 @@
package main
import (
"fmt"
"time"
)
var c chan int
func handle(int) {}
func main() {
select {
case m := <-c:
handle(m)
case <-time.After(10 * time.Second):
fmt.Println("timed out")
}
}

View File

@@ -1,20 +1,11 @@
package main
import (
"runtime"
"unsafe"
"github.com/goplus/llgo/c"
"github.com/goplus/llgo/c/os"
)
func main() {
ls := c.Str("ls")
args := []*c.Char{ls, c.Str("-l"), nil}
if runtime.GOOS == "windows" {
ls = c.Str("dir")
args = []*c.Char{ls, nil}
}
os.Execvp(ls, unsafe.SliceData(args))
os.Execlp(ls, ls, c.Str("-l"), nil)
}

View File

@@ -1,21 +0,0 @@
package main
func main() {
c1 := make(chan string)
c2 := make(chan string, 1)
go func() {
c1 <- "ch1"
}()
go func() {
c2 <- "ch2"
}()
for i := 0; i < 2; i++ {
select {
case msg1 := <-c1:
println(msg1)
case msg2 := <-c2:
println(msg2)
}
}
}

View File

@@ -9,10 +9,10 @@ import (
func main() {
ls := "ls"
args := []string{"ls", "-l"}
args := []string{ls, "-l"}
if runtime.GOOS == "windows" {
ls = "dir"
args = nil
args = []string{ls}
}
lspath, _ := exec.LookPath(ls)
if lspath != "" {