move out c/cpp/py

This commit is contained in:
Li Jie
2025-04-03 15:52:18 +08:00
parent 0a8a4eb6a6
commit ed366568b4
777 changed files with 4608 additions and 139122 deletions

20
cl/_testlibc/sqlite/in.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"github.com/goplus/lib/c"
"github.com/goplus/lib/c/sqlite"
)
func main() {
db, err := sqlite.OpenV2(c.Str(":memory:"), sqlite.OpenReadWrite|sqlite.OpenMemory, nil)
check(err)
db.Close()
}
func check(err sqlite.Errno) {
if err != sqlite.OK {
c.Printf(c.Str("==> Error: (%d) %s\n"), err, err.Errstr())
c.Exit(1)
}
}

View File

@@ -0,0 +1,54 @@
; ModuleID = 'github.com/goplus/llgo/cl/_testlibc/sqlite'
source_filename = "github.com/goplus/llgo/cl/_testlibc/sqlite"
@"github.com/goplus/llgo/cl/_testlibc/sqlite.init$guard" = global i1 false, align 1
@0 = private unnamed_addr constant [20 x i8] c"==> Error: (%d) %s\0A\00", align 1
@1 = private unnamed_addr constant [9 x i8] c":memory:\00", align 1
define void @"github.com/goplus/llgo/cl/_testlibc/sqlite.check"(i32 %0) {
_llgo_0:
%1 = icmp ne i32 %0, 0
br i1 %1, label %_llgo_1, label %_llgo_2
_llgo_1: ; preds = %_llgo_0
%2 = call ptr @sqlite3_errstr(i32 %0)
%3 = call i32 (ptr, ...) @printf(ptr @0, i32 %0, ptr %2)
call void @exit(i32 1)
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
define void @"github.com/goplus/llgo/cl/_testlibc/sqlite.init"() {
_llgo_0:
%0 = load i1, ptr @"github.com/goplus/llgo/cl/_testlibc/sqlite.init$guard", align 1
br i1 %0, label %_llgo_2, label %_llgo_1
_llgo_1: ; preds = %_llgo_0
store i1 true, ptr @"github.com/goplus/llgo/cl/_testlibc/sqlite.init$guard", align 1
br label %_llgo_2
_llgo_2: ; preds = %_llgo_1, %_llgo_0
ret void
}
define void @"github.com/goplus/llgo/cl/_testlibc/sqlite.main"() {
_llgo_0:
%0 = call { ptr, i32 } @"github.com/goplus/lib/c/sqlite.OpenV2"(ptr @1, i32 130, ptr null)
%1 = extractvalue { ptr, i32 } %0, 0
%2 = extractvalue { ptr, i32 } %0, 1
call void @"github.com/goplus/llgo/cl/_testlibc/sqlite.check"(i32 %2)
%3 = call i32 @sqlite3_close(ptr %1)
ret void
}
declare ptr @sqlite3_errstr(i32)
declare i32 @printf(ptr, ...)
declare void @exit(i32)
declare { ptr, i32 } @"github.com/goplus/lib/c/sqlite.OpenV2"(ptr, i32, ptr)
declare i32 @sqlite3_close(ptr)