darwin

package
v0.16.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package darwin contains low-level functions for the Darwin (macOS) operating system.

Index

Constants

View Source
const (
	CtypeA   = 0x00000100 // Alpha
	CtypeC   = 0x00000200 // Control
	CtypeD   = 0x00000400 // Digit
	CtypeG   = 0x00000800 // Graph
	CtypeL   = 0x00001000 // Lower
	CtypeP   = 0x00002000 // Punct
	CtypeS   = 0x00004000 // Space
	CtypeU   = 0x00008000 // Upper
	CtypeX   = 0x00010000 // X digit
	CtypeB   = 0x00020000 // Blank
	CtypeR   = 0x00040000 // Print
	CtypeI   = 0x00080000 // Ideogram
	CtypeT   = 0x00100000 // Special
	CtypeQ   = 0x00200000 // Phonogram
	CtypeSW0 = 0x20000000 // 0 width character
	CtypeSW1 = 0x40000000 // 1 width character
	CtypeSW2 = 0x80000000 // 2 width character
	CtypeSW3 = 0xc0000000 // 3 width character
)

Apple defines a bunch of magic values for the type of character, see https://opensource.apple.com/source/Libc/Libc-320/include/ctype.h.auto.html

These are provided as values for method that take _f parameter.

Variables

This section is empty.

Functions

func AssertRtn

func AssertRtn(
	functionName, filePath []byte,
	lineNumber int,
	expression []byte,
) bool

AssertRtn handles __assert_rtn().

func BSwap32 added in v0.9.0

func BSwap32(a uint32) uint32

BSwap32 handles __builtin_bswap32(). It is not supported and if used with panic. The original documentation says:

Returns x with the order of the bytes reversed; for example, 0xaabb becomes 0xbbaa. Byte here always means exactly 8 bits.

func BSwap64 added in v0.9.0

func BSwap64(a uint64) uint64

BSwap64 handles __builtin_bswap64(). It is not supported, see BSwap32().

func BuiltinExpect

func BuiltinExpect(a, b int) int

BuiltinExpect handles __builtin_expect().

func Fabs

func Fabs(x float64) float64

Fabs handles __builtin_fabs().

func Fabsf

func Fabsf(x float32) float32

Fabsf handles __builtin_fabsf().

func Fabsl

func Fabsl(x float64) float64

Fabsl handles __builtin_fabsl().

func Inf

func Inf() float64

Inf handles __builtin_inf().

func Inff

func Inff() float32

Inff handles __builtin_inff().

func Infl

func Infl() float64

Infl handles __builtin_infl().

func IsType added in v0.9.0

func IsType(_c CtRuneT, _f uint32) uint32

IsType replaces __istype(). It should not be strictly necessary but the real __istype() refers to internal darwin state (_DefaultRuneLocale) that is difficult to translate. So for now we will replace it but this could be removed in the future.

There may be multiple bit masks. And yes, I'm sure there is a much better way to handle this, so if you know one please consider putting in a PR :)

func NaN added in v0.13.0

func NaN(s []byte) float64

Types

type CtRuneT added in v0.13.7

type CtRuneT int

CtRuneT represents __darwin_ct_rune_t.

func IsCType added in v0.9.0

func IsCType(_c CtRuneT, _f uint32) CtRuneT

IsCType handles __isctype.

func MaskRune added in v0.9.0

func MaskRune(_c CtRuneT, _f uint32) CtRuneT

MaskRune handles __maskrune(). I have no idea what MaskRune is supposed to do. It is provided internally by darwin.

func ToLower added in v0.9.0

func ToLower(_c CtRuneT) CtRuneT

ToLower handles __tolower().

func ToUpper added in v0.9.0

func ToUpper(_c CtRuneT) CtRuneT

ToUpper handles __toupper().

type Double2

type Double2 struct {
	Sinval float64
	Cosval float64
}

Double2 is used by the functions that end with "Stret". It replaces the internal macOS type of __double2.

func SincosStret

func SincosStret(x float64) Double2

SincosStret handles __sincos_stret().

func SincospiStret

func SincospiStret(x float64) Double2

SincospiStret handles __sincospi_stret().

type Float2

type Float2 struct {
	Sinval float32
	Cosval float32
}

Float2 is used by the functions that end with "Stret". It replaces the internal macOS type of __float2.

func SincosfStret

func SincosfStret(x float32) Float2

SincosfStret handles __sincosf_stret().

func SincospifStret

func SincospifStret(x float32) Float2

SincospifStret handles __sincospif_stret().

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL