79 Star 313 Fork 53

不在乎y/govcl

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
stdstr_lcl.go 1.15 KB
一键复制 编辑 原始数据 按行查看 历史
不在乎y 提交于 2020-02-24 23:28 . Add a unified comment header.
//----------------------------------------
//
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package api
import (
"fmt"
"unsafe"
)
// ---------------- liblcl ----------------
func initLCLStdStr() {
fmt.Println("Library Character Encoding: UTF-8")
GoStrToDStr = lcl_GoStrToDStr
DStrToGoStr = lcl_DStrToGoStr
getBuff = lcl_getBuff
getBuffPtr = lcl_getBuffPtr
getTextBuf = lcl_getTextBuf
}
// Go的string转换为Lazarus的string
func lcl_GoStrToDStr(s string) uintptr {
if s == "" {
return 0
}
return uintptr(unsafe.Pointer(StringToUTF8Ptr(s)))
}
// Lazarus的string转换为Go的string
func lcl_DStrToGoStr(ustr uintptr) string {
l := DStrLen(ustr)
if l == 0 {
return ""
}
str := make([]uint8, l)
DMove(ustr, uintptr(unsafe.Pointer(&str[0])), l)
return string(str)
}
func lcl_getBuff(size int32) interface{} {
return make([]uint8, size+1)
}
func lcl_getBuffPtr(buff interface{}) uintptr {
return uintptr(unsafe.Pointer(&(buff.([]uint8))[0]))
}
func lcl_getTextBuf(strBuff interface{}, Buffer *string, slen int) {
*Buffer = string((strBuff.([]uint8))[:slen])
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ying32/govcl.git
git@gitee.com:ying32/govcl.git
ying32
govcl
govcl
v1.2.9

搜索帮助

0d507c66 1850385 C8b1a773 1850385