Documentation ¶
Index ¶
- Constants
- Variables
- func AddrAsFunc(addr uintptr, typ interface{}) interface{}
- func ArgCopy(dst, src *ArgList)
- func AsFunc(p interface{}, typ interface{}) interface{}
- func AsPtr(v interface{}) (unsafe.Pointer, error)
- func AscTime(tm *TimeInfo) *byte
- func Assert(cond bool)
- func Atof(s string) float64
- func Atoi(s string) int
- func BoolToInt(v bool) int32
- func BytesN(p *byte, sz int) []bytedeprecated
- func CBytes(b []byte) *byte
- func CString(s string) *byte
- func CStringSlice(arr []string) **byte
- func Calloc(num, sz int) unsafe.Pointer
- func ClockGetRes(c Clock, ts *TimeSpec) int32
- func ClockGetTime(c Clock, ts *TimeSpec) int32
- func ClockSetTime(c Clock, ts *TimeSpec) int32
- func ErrCode(err error) int
- func Error() error
- func Free(p unsafe.Pointer)
- func FuncAddr(v interface{}) uintptr
- func FuncAddrUnsafe(v interface{}) unsafe.Pointer
- func FuncName() string
- func GoBytes(ptr *byte) []byte
- func GoBytesS(s []byte) []byte
- func GoString(s *byte) string
- func GoStringS(s []byte) string
- func GoWString(s *WChar) string
- func IndexBytePtr(p *byte, i int) *bytedeprecated
- func IndexUnsafePtr(p unsafe.Pointer, i int) unsafe.Pointerdeprecated
- func IsAlnum(c rune) bool
- func IsAlpha(c rune) bool
- func LoadAddInt32(p *int32, v int32) int32
- func LoadAndInt32(p *int32, v int32) int32
- func LoadNandInt32(p *int32, v int32) int32
- func LoadOrInt32(p *int32, v int32) int32
- func LoadSubInt32(p *int32, v int32) int32
- func LoadXorInt32(p *int32, v int32) int32
- func Malloc(sz int) unsafe.Pointer
- func Mbstowcs(a1 *WChar, a2 *byte, a3 uint32) uint32
- func MemChr(ptr *byte, ch byte, sz int) *byte
- func MemCmp(lhs, rhs unsafe.Pointer, sz int) int
- func MemCpy(dst, src unsafe.Pointer, sz int) unsafe.Pointer
- func MemMove(dst, src unsafe.Pointer, sz int) unsafe.Pointer
- func MemSet(p unsafe.Pointer, ch byte, sz int) unsafe.Pointer
- func PointerDiff(a, b unsafe.Pointer) int
- func Rand() int32
- func Realloc(buf unsafe.Pointer, sz int) unsafe.Pointer
- func Search(key, base unsafe.Pointer, num, size uint32, ...) unsafe.Pointer
- func SeedRand(seed uint32)
- func SetErr(err error)
- func Sort(base unsafe.Pointer, num, size uint32, compar func(a, b unsafe.Pointer) int32)
- func StrCSpn(a, b *byte) int
- func StrCaseCmp(a, b *byte) int
- func StrCat(dst, src *byte) *byte
- func StrChr(str *byte, ch byte) *byte
- func StrCmp(a, b *byte) int
- func StrCpy(dst, src *byte) *byte
- func StrCpyGo(dst *byte, src []byte)
- func StrCpyGoZero(dst *byte, src []byte)
- func StrDup(s *byte) *byte
- func StrError(e int) *byte
- func StrLen(str *byte) int
- func StrLenS(s []byte) int
- func StrNCaseCmp(a, b *byte, sz int) int
- func StrNCat(dst, src *byte, sz int) *byte
- func StrNCmp(a, b *byte, sz int) int
- func StrNCpy(dst, src *byte, sz int) *byte
- func StrNDup(s *byte, n int) *byte
- func StrRChr(str *byte, ch byte) *byte
- func StrSpn(str, chars *byte) int
- func StrStr(str, substr *byte) *byte
- func StrTok(src, delim *byte) *byte
- func ToPointer(p uintptr) unsafe.Pointer
- func ToUintptr(p unsafe.Pointer) uintptr
- func Uint16N(p *uint16, sz int) []uint16deprecated
- func Uint32N(p *uint32, sz int) []uint32deprecated
- func UnsafeBytesN(ptr unsafe.Pointer, sz int) []bytedeprecated
- func UnsafeUint16N(ptr unsafe.Pointer, sz int) []uint16deprecated
- func UnsafeUint32N(ptr unsafe.Pointer, sz int) []uint32deprecated
- func WStrCaseCmp(a, b *WChar) int
- func WStrCmp(a, b *WChar) int
- func WStrLen(str *WChar) uint64
- func WStrtol(s *WChar, end **WChar, base int) int
- func Wctob(wc WChar) int64
- type ArgList
- type Clock
- type ClockID
- type JumpBuf
- type Time
- type TimeInfo
- type TimeSpec
- type TimeVal
- type Timer
- type WChar
- func CWString(s string) *WChar
- func GoWSlice(ptr *WChar) []WChar
- func IndexWCharPtr(p *WChar, i int) *WChardeprecated
- func UnsafeWCharN(ptr unsafe.Pointer, sz uint64) []WChardeprecated
- func WCharN(p *WChar, sz uint64) []WChardeprecated
- func WStrCat(dst, src *WChar) *WChar
- func WStrChr(str *WChar, ch int64) *WChar
- func WStrCpy(dst, src *WChar) *WChar
- func WStrNCpy(dst, src *WChar, sz uint32) *WChar
- func WStrTok(src, delim *WChar) *WChar
Constants ¶
const CLOCKS_PER_SEC = 1000000 // us
const CLOCK_MONOTONIC = 1
const CLOCK_REALTIME = 0
const RandMax = math.MaxInt32
const V1Defined = true
const WCharSize = int(unsafe.Sizeof(WChar(0)))
Variables ¶
var (
Errno int
)
Functions ¶
func AddrAsFunc ¶
func AddrAsFunc(addr uintptr, typ interface{}) interface{}
AddrAsFunc converts a function address to a function value. The caller must type-assert to an expected function type. The function type can be specified as (*func())(nil).
func AsFunc ¶
func AsFunc(p interface{}, typ interface{}) interface{}
AsFunc is a less restrictive version of AddrAsFunc. It accepts a pointer value that may be one of: uintptr, unsafe.Pointer, *T, int, uint.
func CStringSlice ¶
CStringSlice convers a Go string slice to a zero-terminated array of C string pointers.
func ClockGetRes ¶
func ClockGetTime ¶
func ClockSetTime ¶
func Error ¶
func Error() error
Error returns a Go error value that corresponds to the current Errno.
func FuncAddr ¶
func FuncAddr(v interface{}) uintptr
FuncAddr converts a function value to a uintptr.
func FuncAddrUnsafe ¶
FuncAddrUnsafe converts a function value to a unsafe.Pointer.
func GoBytes ¶
GoBytes makes a Go byte slice from a pointer to a zero-terminated byte array. The slice will point to the same memory as ptr.
func IndexBytePtr
deprecated
func LoadAddInt32 ¶
func LoadAndInt32 ¶
func LoadNandInt32 ¶
func LoadOrInt32 ¶
func LoadSubInt32 ¶
func LoadXorInt32 ¶
func MemChr ¶
MemChr finds the first occurrence of ch (after conversion to byte as if by byte(ch)) in the initial count characters (each interpreted as byte) of the object pointed to by ptr.
The behavior is undefined if access occurs beyond the end of the array searched. The behavior is undefined if ptr is a null pointer.
func MemCmp ¶
MemCmp compares the first count characters of the objects pointed to by lhs and rhs. The comparison is done lexicographically.
The sign of the result is the sign of the difference between the values of the first pair of bytes (both interpreted as byte) that differ in the objects being compared.
The behavior is undefined if access occurs beyond the end of either object pointed to by lhs and rhs. The behavior is undefined if either lhs or rhs is a null pointer.
func MemCpy ¶
MemCpy copies count characters from the object pointed to by src to the object pointed to by dest. Both objects are interpreted as arrays of byte.
The behavior is undefined if access occurs beyond the end of the dest array. If the objects overlap (which is a violation of the restrict contract), the behavior is undefined. The behavior is undefined if either dest or src is a null pointer.
func MemMove ¶
MemMove copies count characters from the object pointed to by src to the object pointed to by dest. Both objects are interpreted as arrays of byte. The objects may overlap: copying takes place as if the characters were copied to a temporary character array and then the characters were copied from the array to dest.
The behavior is undefined if access occurs beyond the end of the dest array. The behavior is undefined if either dest or src is a null pointer.
func MemSet ¶
MemSet copies the value ch (after conversion to byte as if by byte(ch)) into each of the first count characters of the object pointed to by dest.
The behavior is undefined if access occurs beyond the end of the dest array. The behavior is undefined if dest is a null pointer.
func SetErr ¶
func SetErr(err error)
SetErr sets the Errno value to a specified Go error equivalent.
func StrCaseCmp ¶
func StrCat ¶
StrCat appends a copy of the source string to the destination string. The terminating null character in destination is overwritten by the first character of source, and a null-character is included at the end of the new string formed by the concatenation of both in destination.
Destination and source shall not overlap.
func StrChr ¶
StrChr finds the first occurrence of ch (after conversion to byte as if by byte(ch)) in the null-terminated byte string pointed to by str (each character interpreted as unsigned char). The terminating null character is considered to be a part of the string and can be found when searching for '\x00'.
The behavior is undefined if str is not a pointer to a null-terminated byte string.
The return value is a pointer to the found character in str, or null pointer if no such character is found.
func StrCpy ¶
StrCpy copies the C string pointed by source into the array pointed by destination, including the terminating null character (and stopping at that point).
To avoid overflows, the size of the array pointed by destination shall be long enough to contain the same C string as source (including the terminating null character), and should not overlap in memory with source.
func StrCpyGo ¶
StrCpyGo copies a Go slice into a C string pointed by dst. It won't add the null terminator.
func StrCpyGoZero ¶
StrCpyGoZero is the same as StrCpyGo, but adds a null terminator.
func StrLen ¶
StrLen returns the length of the given null-terminated byte string, that is, the number of characters in a character array whose first element is pointed to by str up to and not including the first null character.
The behavior is undefined if str is not a pointer to a null-terminated byte string.
func StrNCaseCmp ¶
func StrNCat ¶
StrNCat appends the first num characters of source to destination, plus a terminating null-character.
If the length of the C string in source is less than num, only the content up to the terminating null-character is copied.
func StrNCpy ¶
StrNCpy copies the first num characters of source to destination. If the end of the source C string (which is signaled by a null-character) is found before num characters have been copied, destination is padded with zeros until a total of num characters have been written to it.
No null-character is implicitly appended at the end of destination if source is longer than num. Thus, in this case, destination shall not be considered a null terminated C string (reading it as such would overflow).
Destination and source shall not overlap (see MemMove for a safer alternative when overlapping).
func StrNDup ¶ added in v0.3.7
StrNDup copies a null-terminated C string up to N bytes. Null terminator is added if the string is larger than N.
func StrRChr ¶
StrRChr finds the last occurrence of ch (after conversion to byte as if by byte(ch)) in the null-terminated byte string pointed to by str (each character interpreted as unsigned char). The terminating null character is considered to be a part of the string and can be found when searching for '\x00'.
The behavior is undefined if str is not a pointer to a null-terminated byte string.
The return value is a pointer to the found character in str, or null pointer if no such character is found.
func StrSpn ¶
StrSpn returns the length of the initial portion of str1 which consists only of characters that are part of str2.
The search does not include the terminating null-characters of either strings, but ends there.
func StrStr ¶
StrStr finds the first occurrence of the null-terminated byte string pointed to by substr in the null-terminated byte string pointed to by str. The terminating null characters are not compared.
The behavior is undefined if either str or substr is not a pointer to a null-terminated byte string.
The return value is a pointer to the first character of the found substring in str, or NULL if such substring is not found. If substr points to an empty string, str is returned.
func StrTok ¶
StrTok is used in a sequence of calls to split str into tokens, which are sequences of contiguous characters separated by any of the characters that are part of delimiters.
On a first call, the function expects a C string as argument for str, whose first character is used as the starting location to scan for tokens. In subsequent calls, the function expects a null pointer and uses the position right after the end of the last token as the new starting location for scanning.
To determine the beginning and the end of a token, the function first scans from the starting location for the first character not contained in delimiters (which becomes the beginning of the token). And then scans starting from this beginning of the token for the first character contained in delimiters, which becomes the end of the token. The scan also stops if the terminating null character is found.
This end of the token is automatically replaced by a null-character, and the beginning of the token is returned by the function.
Once the terminating null character of str is found in a call to strtok, all subsequent calls to this function (with a null pointer as the first argument) return a null pointer.
The point where the last token was found is kept internally by the function to be used on the next call (particular library implementations are not required to avoid data races).
func UnsafeBytesN
deprecated
func UnsafeUint16N
deprecated
func UnsafeUint32N
deprecated
func WStrCaseCmp ¶
Types ¶
type ArgList ¶
type ArgList struct {
// contains filtered or unexported fields
}
func (*ArgList) ArgUintptr ¶
type TimeInfo ¶
type WChar ¶
type WChar = uint16