SWAG

Table of Contents

Namespaces

Structs

collections

compress

crypto

diagnostics

filesystem

globalization

input

math

rand

serialization

serialization/read

serialization/write

system

text

thread

time

Interfaces

crypto

diagnostics

serialization

serialization/read

serialization/write

text

Enums

compress

crypto

diagnostics

filesystem

input

rand

serialization/read

serialization/write

system

text

thread

time

Constants

filesystem

rand

serialization/write

system

text

time

Type Aliases

filesystem

input

math

serialization/read

system

thread

time

Attributes

serialization

system

Functions

algorithms

collections

compress

crypto

diagnostics

filesystem

globalization

input

math

memory

rand

reflection

serialization

serialization/read

serialization/write

slice

system

text

thread

time

Swag Std.Core

The Std.core module contains basic types and algorithms. It is the base of all other modules of the standard Std workspace.

You will find collections like Array or HashTable, a dynamic String and so on.

Content

const Core.Constants [src]

ASSERT bool
BIG_ENDIAN bool
EndLine string
CharProperties const [256] Latin1.CharAttribute
AltDirectorySeparatorChar u8 Alternate directory separator character.
DirectorySeparatorChar u8 Default directory separator character.
VolumeSeparatorChar u8 Volume separator character (e.g., C:).
NN s32
TagBinVersion u32
StringSmallSize u64
DayOfWeekNames const [7] string
DaysPer100Years s32
DaysPer400Years s32
DaysPer4Years s32
DaysPerYear s32
DaysTo10000 u64 Number of days from 1/1/0001 to 12/31/9999.
DaysTo1601 u64 Number of days from 1/1/0001 to 12/31/1600.
DaysTo1899 u64 Number of days from 1/1/0001 to 12/30/1899.
DaysTo1970 u64 Number of days from 1/1/0001 to 12/31/1969.
DaysToMonth365 const [13] u16
DaysToMonth366 const [13] u16
MaxMilliSeconds u64
MaxMillis u64
MaxTicks u64
MillisPerDay u64
MillisPerHour u64
MillisPerMinute u64
MillisPerSecond u64
MonthNames const [12] string
TicksPerDay u64
TicksPerHour u64
TicksPerMilliSecond u64
TicksPerMinute u64
TicksPerSecond u64
RuneError rune
Surr1 u32
Surr2 u32
Surr3 u32
SurrSelf u32
MaxRunes rune
RuneError rune
SurrogateMax rune
SurrogateMin rune
WINDOWS bool

type alias Env.Type Aliases [src]

ProcessHandle Env.ProcessHandle
FileHandle File.FileHandle
VirtualKey Input.VirtualKey
ConstF32 Math.ConstF32
ConstF64 Math.ConstF64
Buffer Serialization.Read.Buffer
ThreadHandle Threading.ThreadHandle
Ticks Time.Ticks
TimerHandle Time.TimerHandle

struct Core.Array [src]

A generic, dynamic array that can hold elements of any type.

struct Array(T)
allocator Swag.IAllocator The allocator used for memory operations.
buffer [*] Array.T Pointer to the contiguous memory block holding the elements.
count u64 The number of valid elements currently in the array.
capacity u64 The total number of elements that can be stored in the allocated me.buffer.

It automatically manages memory and grows as needed.

Functions

add(me, &&T) Moves an element to the end of the array.
add(me, T) Adds a copy of an element to the end of the array.
add(me, const [..] T) Appends all elements from a slice to the end of the array.
addOnce Adds an element to the end of the array, but only if it's not already present.
back Returns a copy of the last element of the array.
backPtr Returns a pointer to the last element of the array.
clear Removes all elements from the array, setting its me.count to 0.
contains Returns true if the array contains the given value.
createBuffer Creates a new byte array of a given size.
createTemp Creates a new array that uses the temporary allocator.
emplaceAddress Reserves space for num elements at the end of the array and returns a pointer to the start of the new space.
emplaceAt Moves elements from a slice at a specific index, shifting existing elements to the right.
emplaceInitAddress Reserves space for num elements at the end of the array and returns a pointer to the start of the new space.
fill Fills the entire array with the given value.
free Frees the array's memory and resets its state.
front Returns a copy of the first element of the array.
frontPtr Returns a pointer to the first element of the array.
grow Ensures the array has enough capacity to store at least newCount elements.
growResize Ensures the array contains at least newCount elements.
insertAt(me, u64, &&T) Inserts a moved value at a specific index, shifting existing elements to the right.
insertAt(me, u64, T) Inserts a copy of a value at a specific index, shifting existing elements to the right.
insertAt(me, u64, const [..] T) Inserts elements from a slice at a specific index, shifting existing elements to the right.
isEmpty Returns true if the array contains no elements.
popBack Removes the last element from the array and returns it.
realloc Reallocates the internal me.buffer to a new capacity.
ref1 Returns a mutable reference to an element using a single coordinate.
ref2 Returns a mutable reference to an element using 2D coordinates and a width.
remove(me, V) Removes the first occurrence of a given value from the array.
remove(me, u64, u64) Removes a specified number of elements starting from a given index.
removeAt Removes the element at a given index by swapping it with the last element.
removeAtOrdered Removes one or more elements at a given index, shifting subsequent elements to the left.
removeBack Removes the last element from the array.
removeOrdered Removes the first occurrence of a given value, preserving the order of remaining elements.
reserve Sets the array's capacity to at least newCapacity.
resize Changes the number of elements in the array to newCount.
sort(me) Sorts the array in ascending order using the default comparison operator.
sort(me, func(*void, T, T)->s32) Sorts the array using a custom comparison function.
sortReverse Sorts the array in descending order.
swap Swaps two elements in the array by their indices.
toSlice(me) Returns a mutable slice containing all elements of the array.
toSlice(me) Returns an immutable slice containing all elements of the array.

Special Functions

opAffect Replaces the content of the array with elements copied from a slice.
opCast(me) Allows the array to be implicitly cast to a mutable slice.
opCast(me) Allows the array to be implicitly cast to an immutable slice.
opCount Returns the number of elements in the array.
opData Returns a raw, constant pointer to the array's me.buffer.
opDrop Ensures the allocated memory is freed when the array goes out of scope.
opIndex(me, u64) Returns a mutable reference to the element at the specified index.
opIndex(me, u64) Returns a constant reference to the element at the specified index.
opIndexAffect Assigns a new value to the element at the specified index.
opIndexAssign Handles compound assignment operators (e.g., +=, -=) for elements.
opPostCopy Handles the deep copy of the array when it is copied.
opSlice Creates a slice from a sub-part of the array.
opVisit Provides a way to iterate over each element in the array.

func IConvert.convert [src]

func convert(me, buf: *ConcatBuffer, convFmt: StrConv.ConvertFormat, strFormat: string)

func Array.add [src]

Adds a copy of an element to the end of the array.

func add(me, value: T)

Moves an element to the end of the array.

func add(me, value: &&T)

Appends all elements from a slice to the end of the array.

func add(me, values: #null const [..] T)

func Array.addOnce [src]

Adds an element to the end of the array, but only if it's not already present.

func addOnce(me, value: T)

This is slower than add due to the containment check.

func Array.back [src]

Returns a copy of the last element of the array.

func back(const me)->Array.T

Asserts if the array is empty.

func Array.backPtr [src]

Returns a pointer to the last element of the array.

func backPtr(me)->*Array.T

Asserts if the array is empty.

func Array.clear [src]

Removes all elements from the array, setting its me.count to 0.

func clear(me)

This calls the destructor for each element if one exists, but does not deallocate memory.

func Array.contains [src]

Returns true if the array contains the given value.

func(V) contains(me, value: V)->bool

func Array.createBuffer [src]

Creates a new byte array of a given size.

func createBuffer(size: u64)->Array'(u8)

Often used for raw memory me.buffers.

func Array.createTemp [src]

Creates a new array that uses the temporary allocator.

func(TA) createTemp()->Array'(TA)

Useful for short-lived arrays to avoid heap fragmentation.

func Array.emplaceAddress [src]

Reserves space for num elements at the end of the array and returns a pointer to the start of the new space.

func emplaceAddress(me, num: u32 = 1)->[*] Array.T

The new memory is not initialized.

func Array.emplaceAt [src]

Moves elements from a slice at a specific index, shifting existing elements to the right.

func emplaceAt(me, index: u64, values: [..] T)

Order is preserved.

func Array.emplaceInitAddress [src]

Reserves space for num elements at the end of the array and returns a pointer to the start of the new space.

func emplaceInitAddress(me, num: u32 = 1)->[*] Array.T

The new memory is default-initialized.

func Array.fill [src]

Fills the entire array with the given value.

func fill(me, value: T)

All existing elements are overwritten.

func Array.free [src]

Frees the array's memory and resets its state.

func free(me)

If elements have destructors, they are called.

func Array.front [src]

Returns a copy of the first element of the array.

func front(const me)->Array.T

Asserts if the array is empty.

func Array.frontPtr [src]

Returns a pointer to the first element of the array.

func frontPtr(me)->*Array.T

Asserts if the array is empty.

func Array.grow [src]

Ensures the array has enough capacity to store at least newCount elements.

func grow(me, newCount: u64)

If the current capacity is insufficient, it will be increased. The element me.count remains unchanged. See also [[reserve]].

func Array.growResize [src]

Ensures the array contains at least newCount elements.

func growResize(me, newCount: u64)

If the current me.count is less than newCount, new elements are added and default-initialized.

func Array.insertAt [src]

Inserts a copy of a value at a specific index, shifting existing elements to the right.

func insertAt(me, index: u64, value: T)

Order is preserved.

Inserts a moved value at a specific index, shifting existing elements to the right.

func insertAt(me, index: u64, value: &&T)

Order is preserved.

Inserts elements from a slice at a specific index, shifting existing elements to the right.

func insertAt(me, index: u64, values: const [..] T)

Order is preserved.

func Array.isEmpty [src]

Returns true if the array contains no elements.

func isEmpty(const me)

func Array.opAffect [src]

Replaces the content of the array with elements copied from a slice.

func opAffect(me, arr: const [..] T)

func Array.opCast [src]

Allows the array to be implicitly cast to a mutable slice.

func opCast(me)->[..] Array.T

Allows the array to be implicitly cast to an immutable slice.

func opCast(const me)->const [..] Array.T

func Array.opCount [src]

Returns the number of elements in the array.

func opCount(me)->u64

func Array.opData [src]

Returns a raw, constant pointer to the array's me.buffer.

func opData(me)->const *Array.T

func Array.opDrop [src]

Ensures the allocated memory is freed when the array goes out of scope.

func opDrop(me)

func Array.opIndex [src]

Returns a constant reference to the element at the specified index.

func opIndex(const me, index: u64)->const &Array.T

Returns a mutable reference to the element at the specified index.

func opIndex(me, index: u64)->&Array.T

func Array.opIndexAffect [src]

Assigns a new value to the element at the specified index.

func opIndexAffect(me, index: u64, value: T)

func Array.opIndexAssign [src]

Handles compound assignment operators (e.g., +=, -=) for elements.

func(op: string) opIndexAssign(me, index: u64, value: T)

func Array.opPostCopy [src]

Handles the deep copy of the array when it is copied.

func opPostCopy(me)

A new me.buffer is allocated and the content is copied over.

func Array.opSlice [src]

Creates a slice from a sub-part of the array.

func opSlice(me, lower, upper: u64)->[..] Array.T

func Array.opVisit [src]

Provides a way to iterate over each element in the array.

#[Swag.Macro] func(ptr: bool, back: bool) opVisit(const me, stmt: #code void)

This is a macro that accepts a code block to execute for each element. Visiting by address and in reverse order is supported via parameters. Aliases: #alias0 for the element or a pointer to it, #alias1 for the index.

func Array.popBack [src]

Removes the last element from the array and returns it.

func popBack(me)->Array.T

Asserts if the array is empty.

func Array.realloc [src]

Reallocates the internal me.buffer to a new capacity.

func realloc(me, newCapacity: u64)

This is a low-level memory operation that handles moving existing elements.

func Array.ref1 [src]

Returns a mutable reference to an element using a single coordinate.

func ref1(me, x: u64)->&Array.T

This can be used to treat the array as a 1D grid.

func Array.ref2 [src]

Returns a mutable reference to an element using 2D coordinates and a width.

func ref2(me, x, y, w: u64)->&Array.T

This can be used to treat the array as a 2D grid.

func Array.remove [src]

Removes a specified number of elements starting from a given index.

func remove(me, index, num: u64)

This is an unstable remove; the order of remaining elements is not preserved.

Removes the first occurrence of a given value from the array.

func(V) remove(me, value: V)

This is an unstable remove; order is not preserved. Does nothing if the value is not found.

func Array.removeAt [src]

Removes the element at a given index by swapping it with the last element.

func removeAt(me, index: u64)

This is very fast, but the order of elements is not preserved.

func Array.removeAtOrdered [src]

Removes one or more elements at a given index, shifting subsequent elements to the left.

func removeAtOrdered(me, index: u64, numValues: u64 = 1)

This is slower than removeAt, but preserves the order of the remaining elements.

func Array.removeBack [src]

Removes the last element from the array.

func removeBack(me)

Asserts if the array is empty.

func Array.removeOrdered [src]

Removes the first occurrence of a given value, preserving the order of remaining elements.

func(V) removeOrdered(me, value: V)

Does nothing if the value is not found.

func Array.reserve [src]

Sets the array's capacity to at least newCapacity.

func reserve(me, newCapacity: u64)

This does not change the number of elements in the array.

func Array.resize [src]

Changes the number of elements in the array to newCount.

func resize(me, newCount: u64)

If newCount is greater than the current me.count, new elements are default-initialized. If newCount is smaller, excess elements are dropped.

func Array.sort [src]

Sorts the array in ascending order using the default comparison operator.

func sort(me)

Sorts the array using a custom comparison function.

func sort(me, cb: func||(T, T)->s32)

func Array.sortReverse [src]

Sorts the array in descending order.

func sortReverse(me)

func Array.swap [src]

Swaps two elements in the array by their indices.

func swap(me, idx0, idx1: u64)

func Array.toSlice [src]

Returns a mutable slice containing all elements of the array.

func toSlice(me)->[..] Array.T

Returns an immutable slice containing all elements of the array.

func toSlice(const me)->const [..] Array.T

struct Core.ArrayPtr [src]

A specialized dynamic array for holding and owning pointers.

struct ArrayPtr(T)
using base Array'(*ArrayPtr.T)

This struct extends the base Array to correctly manage the lifecycle (allocation and deallocation) of the pointed-to objects.

Functions

addNewPtr Allocates a new object, adds its pointer to the end of the array, and returns the pointer.
clear Deallocates all objects pointed to by the elements in the array and clears the array.
deletePtr Deallocates the memory for a single given pointer.
newPtr Allocates memory for a new object of type T using the array's allocator.

Special Functions

opDrop Ensures that all pointed-to objects are deallocated when the array goes out of scope.
opPostCopy Handles the deep copy of the array and the objects it points to.

func ArrayPtr.addNewPtr [src]

Allocates a new object, adds its pointer to the end of the array, and returns the pointer.

func addNewPtr(me)->*ArrayPtr.T

func ArrayPtr.clear [src]

Deallocates all objects pointed to by the elements in the array and clears the array.

func clear(me)

The array's count is set to 0, but the capacity is not changed.

func ArrayPtr.deletePtr [src]

Deallocates the memory for a single given pointer.

func deletePtr(me, item: *T)

The pointer is expected to have been allocated using this array's allocator.

func ArrayPtr.newPtr [src]

Allocates memory for a new object of type T using the array's allocator.

func newPtr(me)->*ArrayPtr.T

Returns a pointer to the newly allocated memory.

func ArrayPtr.opDrop [src]

Ensures that all pointed-to objects are deallocated when the array goes out of scope.

func opDrop(me)

func ArrayPtr.opPostCopy [src]

Handles the deep copy of the array and the objects it points to.

func opPostCopy(me)

When the array is copied, new memory is allocated for each element, and the content is copied over, ensuring the new array owns its own set of objects.

namespace Core.Atomic

Functions

add(*s16, s16)
add(*s32, s32)
add(*s64, s64)
add(*s8, s8)
add(*u16, u16)
add(*u32, u32)
add(*u64, u64)
add(*u8, u8)
compareExchange(*s16, s16, s16)
compareExchange(*s32, s32, s32)
compareExchange(*s64, s64, s64)
compareExchange(*s8, s8, s8)
compareExchange(*u16, u16, u16)
compareExchange(*u32, u32, u32)
compareExchange(*u64, u64, u64)
compareExchange(*u8, u8, u8)
exchange(*s16, s16)
exchange(*s32, s32)
exchange(*s64, s64)
exchange(*s8, s8)
exchange(*u16, u16)
exchange(*u32, u32)
exchange(*u64, u64)
exchange(*u8, u8)
get(*s16)
get(*s32)
get(*s64)
get(*s8)
get(*u16)
get(*u32)
get(*u64)
get(*u8)
logicAnd(*s16, s16)
logicAnd(*s32, s32)
logicAnd(*s64, s64)
logicAnd(*s8, s8)
logicAnd(*u16, u16)
logicAnd(*u32, u32)
logicAnd(*u64, u64)
logicAnd(*u8, u8)
logicOr(*s16, s16)
logicOr(*s32, s32)
logicOr(*s64, s64)
logicOr(*s8, s8)
logicOr(*u16, u16)
logicOr(*u32, u32)
logicOr(*u64, u64)
logicOr(*u8, u8)
logicXor(*s16, s16)
logicXor(*s32, s32)
logicXor(*s64, s64)
logicXor(*s8, s8)
logicXor(*u16, u16)
logicXor(*u32, u32)
logicXor(*u64, u64)
logicXor(*u8, u8)

func Atomic.add [src]

func add(addr: *s8, value: s8)->s8 func add(addr: *s16, value: s16)->s16 func add(addr: *s32, value: s32)->s32 func add(addr: *s64, value: s64)->s64 func add(addr: *u8, value: u8)->u8 func add(addr: *u16, value: u16)->u16 func add(addr: *u32, value: u32)->u32 func add(addr: *u64, value: u64)->u64

func Atomic.compareExchange [src]

func compareExchange(addr: *s8, compareTo, exchangeWith: s8)->s8 func compareExchange(addr: *s16, compareTo, exchangeWith: s16)->s16 func compareExchange(addr: *s32, compareTo, exchangeWith: s32)->s32 func compareExchange(addr: *s64, compareTo, exchangeWith: s64)->s64 func compareExchange(addr: *u8, compareTo, exchangeWith: u8)->u8 func compareExchange(addr: *u16, compareTo, exchangeWith: u16)->u16 func compareExchange(addr: *u32, compareTo, exchangeWith: u32)->u32 func compareExchange(addr: *u64, compareTo, exchangeWith: u64)->u64

func Atomic.exchange [src]

func exchange(addr: *s8, exchangeWith: s8)->s8 func exchange(addr: *s16, exchangeWith: s16)->s16 func exchange(addr: *s32, exchangeWith: s32)->s32 func exchange(addr: *s64, exchangeWith: s64)->s64 func exchange(addr: *u8, exchangeWith: u8)->u8 func exchange(addr: *u16, exchangeWith: u16)->u16 func exchange(addr: *u32, exchangeWith: u32)->u32 func exchange(addr: *u64, exchangeWith: u64)->u64

func Atomic.get [src]

func get(addr: *s8)->s8 func get(addr: *s16)->s16 func get(addr: *s32)->s32 func get(addr: *s64)->s64 func get(addr: *u8)->u8 func get(addr: *u16)->u16 func get(addr: *u32)->u32 func get(addr: *u64)->u64

func Atomic.logicAnd [src]

func logicAnd(addr: *s8, value: s8)->s8 func logicAnd(addr: *s16, value: s16)->s16 func logicAnd(addr: *s32, value: s32)->s32 func logicAnd(addr: *s64, value: s64)->s64 func logicAnd(addr: *u8, value: u8)->u8 func logicAnd(addr: *u16, value: u16)->u16 func logicAnd(addr: *u32, value: u32)->u32 func logicAnd(addr: *u64, value: u64)->u64

func Atomic.logicOr [src]

func logicOr(addr: *s8, value: s8)->s8 func logicOr(addr: *s16, value: s16)->s16 func logicOr(addr: *s32, value: s32)->s32 func logicOr(addr: *s64, value: s64)->s64 func logicOr(addr: *u8, value: u8)->u8 func logicOr(addr: *u16, value: u16)->u16 func logicOr(addr: *u32, value: u32)->u32 func logicOr(addr: *u64, value: u64)->u64

func Atomic.logicXor [src]

func logicXor(addr: *s8, value: s8)->s8 func logicXor(addr: *s16, value: s16)->s16 func logicXor(addr: *s32, value: s32)->s32 func logicXor(addr: *s64, value: s64)->s64 func logicXor(addr: *u8, value: u8)->u8 func logicXor(addr: *u16, value: u16)->u16 func logicXor(addr: *u32, value: u32)->u32 func logicXor(addr: *u64, value: u64)->u64

struct Core.BitArray [src]

Manages a compact array of bit values.

buffer [*] u32 Internal buffer storing the bits packed into 32-bit integers.
allocator Swag.IAllocator The allocator used for memory operations.
count u64 The number of bits in the array.
capacity u64 The total allocated capacity in bytes.

Bits are represented as booleans, where true indicates the bit is on (1) and false indicates the bit is off (0). This structure is memory-efficient for storing a large number of boolean flags.

Functions

andWith Performs a bitwise AND operation between this array and another.
get Returns the boolean value of the bit at a specific position.
invert(me) Inverts all bit values in the array.
invert(me, u64) Inverts the value of the bit at a specific position.
orWith Performs a bitwise OR operation between this array and another.
reserve(me, u64) Reserves capacity for a given number of bits.
reserve(me, u64, bool) Reserves capacity for a given number of bits and initializes them to a specific value.
set Sets the bit at a specific position to the specified value.
setAll Sets all bits in the array to the specified boolean value.
xorWith Performs a bitwise XOR operation between this array and another.

Special Functions

opAffect Replaces the content of the bit array with values from a slice of booleans.
opCount Returns the number of bits in the array.
opDrop Ensures the allocated memory is freed when the array goes out of scope.
opEquals Compares this bit array with another one for equality.
opIndex Returns the boolean value of the bit at a specific position.
opIndexAffect Sets the value of the bit at a specific position.
opPostCopy Handles the deep copy of the array when it is copied.
opVisit Provides a way to iterate over each bit in the array.

func BitArray.andWith [src]

Performs a bitwise AND operation between this array and another.

func andWith(me, other: BitArray)

The current array is modified to store the result. Asserts that arrays are of the same size.

func BitArray.get [src]

Returns the boolean value of the bit at a specific position.

func get(const me, index: u64)->bool

func BitArray.invert [src]

Inverts the value of the bit at a specific position.

func invert(me, index: u64)

Changes a true bit to false and a false bit to true.

Inverts all bit values in the array.

func invert(me)

Bits set to true are changed to false, and vice versa.

func BitArray.opAffect [src]

Replaces the content of the bit array with values from a slice of booleans.

func opAffect(me, what: const [..] bool)

func BitArray.opCount [src]

Returns the number of bits in the array.

func opCount(const me)->u64

func BitArray.opDrop [src]

Ensures the allocated memory is freed when the array goes out of scope.

func opDrop(me)

func BitArray.opEquals [src]

Compares this bit array with another one for equality.

func opEquals(me, other: BitArray)->bool

Returns true if both arrays have the same bit count and all bits are identical.

func BitArray.opIndex [src]

Returns the boolean value of the bit at a specific position.

func opIndex(me, index: u64)->bool

func BitArray.opIndexAffect [src]

Sets the value of the bit at a specific position.

func opIndexAffect(me, index: u64, value: bool)

func BitArray.opPostCopy [src]

Handles the deep copy of the array when it is copied.

func opPostCopy(me)

A new buffer is allocated and the content is copied over.

func BitArray.opVisit [src]

Provides a way to iterate over each bit in the array.

#[Swag.Macro] func(ptr: bool, back: bool) opVisit(me, stmt: #code void)

This is a macro that accepts a code block to execute for each bit. Aliases: #alias0 for the boolean value, #alias1 for the index.

func BitArray.orWith [src]

Performs a bitwise OR operation between this array and another.

func orWith(me, other: BitArray)

The current array is modified to store the result. Asserts that arrays are of the same size.

func BitArray.reserve [src]

Reserves capacity for a given number of bits.

func reserve(me, maxBits: u64)

The allocated memory is not initialized.

Reserves capacity for a given number of bits and initializes them to a specific value.

func reserve(me, maxBits: u64, initialValue: bool)

func BitArray.set [src]

Sets the bit at a specific position to the specified value.

func set(me, index: u64, value: bool)

func BitArray.setAll [src]

Sets all bits in the array to the specified boolean value.

func setAll(me, value: bool)

func BitArray.xorWith [src]

Performs a bitwise XOR operation between this array and another.

func xorWith(me, other: BitArray)

The current array is modified to store the result. Asserts that arrays are of the same size.

struct Core.ByteStream [src]

A stream for reading from or writing to a byte buffer.

readBuffer const [..] u8 Buffer used for reading.
writeBuffer *Array'(u8) Buffer used for writing.
seek u64 Current read/write position.
eof bool End-of-file flag for reads.

Functions

getSeek Returns the current seek position.
isEof Returns true if the end of the buffer was reached during reading.
length Returns the total length of the buffer (read or write).
moveSeek Advances the seek by a specified offset (default is 1).
openRead Creates a byte stream for reading from a buffer.
openWrite Creates a byte stream for writing to a buffer.
peekU8 Peeks at a single byte without consuming it.
readBytes Reads count bytes from the stream into dest.
readData Returns a pointer to the underlying read or write buffer.
readNative Reads a native value of type T from the stream.
readU8 Reads and consumes a single byte.
remainReadToSlice Returns a slice of unread bytes from the current seek to the end.
remainReadToString Returns a string of unread bytes from the current seek to the end.
setSeek Sets the seek to a specific offset.
writeBytes Writes a slice of bytes to the stream.
writeNative Writes a native value of type T to the stream.

func ByteStream.getSeek [src]

Returns the current seek position.

func getSeek(const me)->u64

func ByteStream.isEof [src]

Returns true if the end of the buffer was reached during reading.

func isEof(const me)->bool

func ByteStream.length [src]

Returns the total length of the buffer (read or write).

func length(const me)->u64

func ByteStream.moveSeek [src]

Advances the seek by a specified offset (default is 1).

func moveSeek(me, offset: u64 = 1)

func ByteStream.openRead [src]

Creates a byte stream for reading from a buffer.

func openRead(readBuffer: const [..] u8)->ByteStream

func ByteStream.openWrite [src]

Creates a byte stream for writing to a buffer.

func openWrite(writeBuffer: *Array'u8)->ByteStream

func ByteStream.peekU8 [src]

Peeks at a single byte without consuming it.

func peekU8(me)->u8

func ByteStream.readBytes [src]

Reads count bytes from the stream into dest.

func readBytes(me, dest: *u8, count: u64) throw

func ByteStream.readData [src]

Returns a pointer to the underlying read or write buffer.

func readData(me)->const [*] u8

func ByteStream.readNative [src]

Reads a native value of type T from the stream.

func(T) readNative(me)->T throw

func ByteStream.readU8 [src]

Reads and consumes a single byte.

func readU8(me)->u8

func ByteStream.remainReadToSlice [src]

Returns a slice of unread bytes from the current seek to the end.

func remainReadToSlice(me)->const [..] u8

func ByteStream.remainReadToString [src]

Returns a string of unread bytes from the current seek to the end.

func remainReadToString(me)->string

func ByteStream.setSeek [src]

Sets the seek to a specific offset.

func setSeek(me, offset: u64)

func ByteStream.writeBytes [src]

Writes a slice of bytes to the stream.

func writeBytes(me, slice: const [..] u8)

func ByteStream.writeNative [src]

Writes a native value of type T to the stream.

func(T) writeNative(me, val: T)

enum Core.CharacterSet [src]

Latin1
Unicode

namespace Core.CommandLine

Structs

IsSet The IsSet generic struct is a mirror of the user input struct.
ParseOptions
Result Result of the [parse] function.

Functions

getField
isOption Returns true if oneArg is a valid option (starting with a delimiter).
parse Parse all the arguments and fill the result.
splitArguments Clean and split a list of arguments -option:value or -option=value => -option value.

Attributes

ArgParams

attr CommandLine.ArgParams [src]

Usage: all
attr ArgParams(nameAlias: string = null)

struct CommandLine.IsSet [src]

The IsSet generic struct is a mirror of the user input struct.

struct IsSet(T)

Each field has the same name as the original one, but with a bool type.

It will indicate, after the command line parsing, that the corresponding argument has been specified or not by the user.

struct CommandLine.ParseOptions [src]

struct CommandLine.Result [src]

Result of the [parse] function.

struct Result(T)
isSet CommandLine.IsSet'(CommandLine.IsSet.T)

func CommandLine.getField [src]

func getField(typeStruct: const *Swag.TypeInfoStruct, name: string)->const *Swag.TypeValue

func CommandLine.isOption [src]

Returns true if oneArg is a valid option (starting with a delimiter).

func isOption(oneArg: string, _options: ParseOptions)->bool

func CommandLine.parse [src]

Parse all the arguments and fill the result.

func(T) parse(st: *T, args: const [..] string, options = CommandLine.ParseOptions{})->CommandLine.Result'(CommandLine.Result.T) throw

func parse.checkNext [src]

func checkNext() throw

func CommandLine.splitArguments [src]

Clean and split a list of arguments -option:value or -option=value => -option value.

func splitArguments(args: const [..] string, options: ParseOptions)->Array'(string)

namespace Core.Compress

Structs

BitStream A structure for reading a bit stream, useful for decompressors or parsers.
Deflate Main structure representing a Deflate compression context.
Inflate
ZLib

struct Compress.BitStream [src]

A structure for reading a bit stream, useful for decompressors or parsers.

stream const [..] u8 Input byte stream.
curByte u64 Index of current byte being processed.
codeBuffer u32 Bit buffer holding bits to be consumed.
numBits u8 Number of bits currently in the buffer.
eof bool Flag to signal end-of-stream.

Functions

consumeBits Consumes width bits from the buffer (advances the bit position).
curPtr Returns a pointer to the current byte in the stream.
discardToNextByte Discards bits to align to the next byte boundary.
init Initializes the bit stream with an input buffer.
peek32 Peeks 4 bytes (little-endian) into dest.
peek32Be Peeks 4 bytes (big-endian) into dest, auto-switches based on platform.
peekBits Returns next width bits without consuming them (refills if needed).
peekBitsNoRefill Like peekBits, but assumes enough bits are already available.
peekBytes Peeks width bytes into dest, consuming bits after each byte.
readBits Reads and consumes width bits from the buffer.
readBitsNoRefill Reads and consumes width bits without checking buffer availability.
refill Refills the bit buffer until at least width bits are available.
revert Reverts stream to last byte-aligned state (undo partial read).
size Returns the total size of the stream.
startPtr Returns a pointer to the beginning of the stream.

func BitStream.consumeBits [src]

Consumes width bits from the buffer (advances the bit position).

func consumeBits(me, width: u8)

func BitStream.curPtr [src]

Returns a pointer to the current byte in the stream.

func curPtr(me)->const [*] u8

func BitStream.discardToNextByte [src]

Discards bits to align to the next byte boundary.

func discardToNextByte(me)

func BitStream.init [src]

Initializes the bit stream with an input buffer.

func init(me, buf: const [..] u8)

func BitStream.peek32 [src]

Peeks 4 bytes (little-endian) into dest.

func peek32(me, dest: [*] u8)

func BitStream.peek32Be [src]

Peeks 4 bytes (big-endian) into dest, auto-switches based on platform.

func peek32Be(me, dest: [*] u8)

func BitStream.peekBits [src]

Returns next width bits without consuming them (refills if needed).

func peekBits(me, width: u8)->u32

func BitStream.peekBitsNoRefill [src]

Like peekBits, but assumes enough bits are already available.

func peekBitsNoRefill(me, width: u8)->u32

func BitStream.peekBytes [src]

Peeks width bytes into dest, consuming bits after each byte.

func peekBytes(me, width: u8, dest: [*] u8)

func BitStream.readBits [src]

Reads and consumes width bits from the buffer.

func readBits(me, width: u8)->u32

func BitStream.readBitsNoRefill [src]

Reads and consumes width bits without checking buffer availability.

func readBitsNoRefill(me, width: u8)->u32

func BitStream.refill [src]

Refills the bit buffer until at least width bits are available.

func refill(me, width = 24'u8)

func BitStream.revert [src]

Reverts stream to last byte-aligned state (undo partial read).

func revert(me)

func BitStream.size [src]

Returns the total size of the stream.

func size(me)->u64

func BitStream.startPtr [src]

Returns a pointer to the beginning of the stream.

func startPtr(me)->const [*] u8

struct Compress.Deflate [src]

Main structure representing a Deflate compression context.

Functions

compress Compress the source buffer.
init Initialize the compressor Can be called multiple times.

Special Functions

opDrop

enum Deflate.CompressionFlags [src]

Flags controlling compression behavior.

Zero No compression flags.
ComputeAdler32 Compute Adler-32 checksum after compression.
Default Default flag: computes Adler-32.

enum Deflate.CompressionLevel [src]

Compression level to use (mapped to number of probes and strategies).

NoCompression Disables compression (raw storage).
BestSpeed Fastest compression, less effective.
Default Balanced default compression.
BestCompression High compression ratio, slower.
UberCompression Maximum compression effort.

enum Deflate.CompressionStrategy [src]

Strategy for compression to influence algorithm behavior.

Default Default compression strategy.
Filtered Filter out potentially poor matches.
HuffmanOnly Use only Huffman coding, no match search.
Rle Run-length encoding.
Fixed Use fixed Huffman codes.

func Deflate.compress [src]

Compress the source buffer.

func compress(me, result: *Array'u8, src: const [..] u8) throw

func Deflate.init [src]

Initialize the compressor Can be called multiple times.

func init(me, level = CompressionLevel.Default, strategy = CompressionStrategy.Default, flags = CompressionFlags.Default)

func Deflate.opDrop [src]

func opDrop(me)

struct Compress.Inflate [src]

Functions

decompress Decompress the associated stream.

func Inflate.decompress [src]

Decompress the associated stream.

func decompress(me, result: *Array'u8, buf: const [..] u8, winSize: u32 = InflateMaxDistance) throw

struct Compress.ZLib [src]

Functions

compress Decompress stream.
decompress Decompress stream.

func ZLib.compress [src]

Decompress stream.

func compress(me, buffer: const [..] u8, level = Deflate.CompressionLevel.Default)->Array'(u8) throw

func ZLib.decompress [src]

Decompress stream.

func decompress(me, buffer: const [..] u8)->Array'(u8) throw

struct Core.ConcatBuffer [src]

Represents a growable buffer that is divided into buckets (chunks of memory).

allocator Swag.IAllocator The allocator to use for all memory operations.
firstBucket *ConcatBufferBucket The first bucket in the chain.
curBucket *ConcatBufferBucket The bucket where the current seek pointer is located.
lastBucket *ConcatBufferBucket The last bucket in the chain.
currentSP [*] u8 The current read/write pointer in the curBucket.
granularity u64 The default size for newly allocated buckets.
isAtEnd bool true if the seek pointer is at the very end of the buffer.
viewFirstBucket ConcatBufferBucket A pre-allocated bucket used for views, to avoid a separate allocation.

This structure avoids large reallocations and copies when the buffer needs to grow, making it efficient for building data piece by piece.

Functions

addBytes Appends a slice of bytes to the buffer.
addNative Appends a native type (like u8, s32, f64) to the buffer.
addStruct Appends the raw byte content of a struct to the buffer.
clear Clears the buffer's content without deallocating memory.
count Returns the total number of bytes currently stored in the buffer.
getOffset Calculates the absolute byte offset of a given seek position.
getSeek Returns a ConcatBufferSeek representing the current position in the buffer.
grow Ensures that there is enough room to store at least numBytes more bytes.
makeLinear Merges all buckets into a single, contiguous memory block.
moveSeek Moves the current seek pointer forward by num bytes.
moveToString Moves the buffer's content into a new String, invalidating the buffer.
release Frees all memory associated with the buffer, including all buckets.
setAllocator Associates a specific allocator with the buffer.
setBucketSize Sets the minimum size for new buckets allocated by the buffer.
setEndSeek Sets the end of the buffer to a given seek position, effectively truncating it.
setFirstBucket Initializes the buffer to use an external, existing slice of data as its first bucket.
setSeek Sets the current read/write position to a given seek.
toSlice Returns the buffer's content as a slice, but only if the buffer is linear.
toString Converts the buffer to a String by copying all its content.

Special Functions

opCount Returns the total number of bytes in the buffer.
opDrop Ensures all allocated memory is freed when the buffer goes out of scope.
opVisit Provides a way to iterate over each bucket in the buffer.

func ConcatBuffer.addBytes [src]

Appends a slice of bytes to the buffer.

func addBytes(me, bytes: #null const [..] u8, contiguous = true)

If contiguous is false, the slice can be split across multiple buckets if necessary.

func ConcatBuffer.addNative [src]

Appends a native type (like u8, s32, f64) to the buffer.

func(T) addNative(me, val: T)

func ConcatBuffer.addStruct [src]

Appends the raw byte content of a struct to the buffer.

func(T) addStruct(me, val: T)

func ConcatBuffer.clear [src]

Clears the buffer's content without deallocating memory.

func clear(me)

This resets the buffer to be empty, allowing its allocated buckets to be reused.

func ConcatBuffer.count [src]

Returns the total number of bytes currently stored in the buffer.

func count(const me)->u64

func ConcatBuffer.getOffset [src]

Calculates the absolute byte offset of a given seek position.

func getOffset(seek: ConcatBufferSeek)->u64

func ConcatBuffer.getSeek [src]

Returns a ConcatBufferSeek representing the current position in the buffer.

func getSeek(me)->ConcatBufferSeek

func ConcatBuffer.grow [src]

Ensures that there is enough room to store at least numBytes more bytes.

func grow(me, numBytes: u64)

If the current bucket is full, a new one is allocated.

func ConcatBuffer.makeLinear [src]

Merges all buckets into a single, contiguous memory block.

func makeLinear(me)

After this call, the buffer is guaranteed to be linear.

func ConcatBuffer.moveSeek [src]

Moves the current seek pointer forward by num bytes.

func moveSeek(me, num: u64)

func ConcatBuffer.moveToString [src]

Moves the buffer's content into a new String, invalidating the buffer.

func moveToString(me)->String

If the buffer is linear (one bucket), this is a fast operation that avoids copying. Otherwise, it falls back to copying the data.

func ConcatBuffer.opCount [src]

Returns the total number of bytes in the buffer.

func opCount(me)->u64

func ConcatBuffer.opDrop [src]

Ensures all allocated memory is freed when the buffer goes out of scope.

func opDrop(me)

func ConcatBuffer.opVisit [src]

Provides a way to iterate over each bucket in the buffer.

#[Swag.Macro] func(ptr: bool, back: bool) opVisit(const me, stmt: #code void)

This is a macro that accepts a code block to execute for each bucket. Alias: #alias0 for the bucket pointer.

func ConcatBuffer.release [src]

Frees all memory associated with the buffer, including all buckets.

func release(me)

func ConcatBuffer.setAllocator [src]

Associates a specific allocator with the buffer.

func setAllocator(me, alloc: Swag.IAllocator)

This can only be called when the buffer is empty.

func ConcatBuffer.setBucketSize [src]

Sets the minimum size for new buckets allocated by the buffer.

func setBucketSize(me, size: u64)

func ConcatBuffer.setEndSeek [src]

Sets the end of the buffer to a given seek position, effectively truncating it.

func setEndSeek(me, seek: ConcatBufferSeek)

func ConcatBuffer.setFirstBucket [src]

Initializes the buffer to use an external, existing slice of data as its first bucket.

func setFirstBucket(me, data: [..] u8)

This is a "view" mode; the buffer does not own or free this data.

func ConcatBuffer.setSeek [src]

Sets the current read/write position to a given seek.

func setSeek(me, seek: ConcatBufferSeek)

func ConcatBuffer.toSlice [src]

Returns the buffer's content as a slice, but only if the buffer is linear.

func toSlice(me)->[..] u8

A buffer is linear if it consists of a single bucket. Returns null otherwise. See [[makeLinear]].

func ConcatBuffer.toString [src]

Converts the buffer to a String by copying all its content.

func toString(const me, alloc: Swag.IAllocator = null)->String

The buffer remains valid after this call. See [[moveToString]] for a more efficient version that avoids copying when possible.

struct Core.ConcatBufferBucket [src]

Represents a single memory block (a bucket) within a ConcatBuffer.

datas [*] u8 Pointer to the raw memory of the bucket.
next *ConcatBufferBucket Pointer to the next bucket in the chain.
count u64 Number of bytes used in this bucket.
size u64 Total allocated size of this bucket in bytes.
countBefore u64 Total number of bytes in all preceding buckets.

struct Core.ConcatBufferSeek [src]

Represents a position (seek) within a ConcatBuffer.

bucket *ConcatBufferBucket The bucket where the position is located.
sp [*] u8 The exact memory address of the position.

It holds both the bucket and the specific pointer within that bucket.

namespace Core.Console

Enums

Color

Functions

fatal Fatal error Exit the process with code -1.
lock Use to access console with multiple threads.
print Write a bunch of parameters to the console.
printf Write a formatted message to the console.
println Write a line to the console.
prompt Wait for using input, and returns the corresponding string.
resetColor Restore the console colors to their default values.
setBackColor Set the console background color.
setTextColor Set the console foreground color.
silent Disable console output. This is a counter, so can be called multiple times with the same value Like any other console functions, this is not thread-safe => call lock before if necessary, and unlock after.
unlock

enum Console.Color [src]

Black
White
Gray
Red
Blue
Green
Cyan
Yellow
Magenta
DarkRed
DarkBlue
DarkGreen
DarkCyan
DarkYellow
DarkMagenta

func Console.fatal [src]

Fatal error Exit the process with code -1.

func fatal(msg: string, args: ...)

func Console.lock [src]

Use to access console with multiple threads.

func lock()

No console function is thread safe, so it is the user responsability to lock the console when necessary

func Console.print [src]

Write a bunch of parameters to the console.

func print(params: ...)

func Console.printf [src]

Write a formatted message to the console.

func printf(message: string, params: ...)

func Console.println [src]

Write a line to the console.

func println(params: ...)

func Console.prompt [src]

Wait for using input, and returns the corresponding string.

func prompt()->String

func Console.resetColor [src]

Restore the console colors to their default values.

func resetColor()

func Console.setBackColor [src]

Set the console background color.

func setBackColor(color: Color)

func Console.setTextColor [src]

Set the console foreground color.

func setTextColor(color: Color)

func Console.silent [src]

Disable console output. This is a counter, so can be called multiple times with the same value Like any other console functions, this is not thread-safe => call lock before if necessary, and unlock after.

func silent(value: bool)

func Console.unlock [src]

func unlock()

namespace Core.Debug

Functions

assert
safety
safetyBoundCheck

func Debug.assert [src]

#[Swag.Macro] func assert(expr: #code bool, message: string = null, loc = #callerlocation)

func Debug.safety [src]

#[Swag.Macro] func(what: string) safety(expr: #code bool, message: string = null, loc = #callerlocation)

func Debug.safetyBoundCheck [src]

#[Swag.Macro] func safetyBoundCheck(expr50: #code bool, message: string = null, loc = #callerlocation)

namespace Core.Debugger

Functions

attach Try to attach to a debugger by calling "vsjitdebugger.exe" If it works, it will open a dialog box to pickup a visual studio instance.
debugBreak Trigger a breakpoint.
isAttached Returns true if a debugger is attached to the current process.
log Debug log.

func Debugger.attach [src]

Try to attach to a debugger by calling "vsjitdebugger.exe" If it works, it will open a dialog box to pickup a visual studio instance.

func attach() throw

func Debugger.debugBreak [src]

Trigger a breakpoint.

func debugBreak()

func Debugger.isAttached [src]

Returns true if a debugger is attached to the current process.

func isAttached()->bool

func Debugger.log [src]

Debug log.

func log(msg: string)

namespace Core.Directory

Structs

EnumerationOptions Options for customizing file and directory enumeration.

Functions

create
enumerate Enumerate a directory.
enumerateDirectories Gets all directories in the specified directory.
enumerateFiles Gets all files in the specified directory.
exists Returns true if the given directory exists.
getCurrent Returns the current directory.
getDrives Get the list of logical drives.
getVolumes Get the list of volumes.
setCurrent Set the current directory.

struct Directory.EnumerationOptions [src]

Options for customizing file and directory enumeration.

matchExtension string Optional extension to match (e.g. ".txt").
matchFileName string Optional file name pattern to match.
skipAttributes File.FileAttributes Attributes to skip during enumeration.
recurse bool Whether to recurse into subdirectories.
wantFiles bool Whether to include files in the results.
wantDirectories bool Whether to include directories in the results.
wantSpecialDirectories bool Whether to include "." and ".." in the results.
filterLambda func(File.FileInfo)->bool Optional lambda to filter results.

func Directory.create [src]

func create(dirname: string) throw

func Directory.enumerate [src]

Enumerate a directory.

func enumerate(dirName: string, options: EnumerationOptions)->Array'(File.FileInfo) throw

func Directory.enumerateDirectories [src]

Gets all directories in the specified directory.

func enumerateDirectories(dirName: string, matchExtension: string = null, recurse = false)->Array'(File.FileInfo) throw

func Directory.enumerateFiles [src]

Gets all files in the specified directory.

func enumerateFiles(dirName: string, matchExtension: string = null, recurse = false)->Array'(File.FileInfo) throw

func Directory.exists [src]

Returns true if the given directory exists.

func exists(dirName: string)->bool

func Directory.getCurrent [src]

Returns the current directory.

func getCurrent()->String throw

func Directory.getDrives [src]

Get the list of logical drives.

func getDrives()->Array'(String) throw

func Directory.getVolumes [src]

Get the list of volumes.

func getVolumes()->Array'(String) throw

func Directory.setCurrent [src]

Set the current directory.

func setCurrent(dirName: string) throw

namespace Core.Env

Structs

Monitor Describes a physical monitor.
Process
StartInfo

Enums

Metrics
SpecialDirectory

Functions

associateFileExtension Associate an extension to an executable.
doSyncProcess Starts a new process with arguments, and wait for it to be done.
exit Exit the current process.
getArg Get a given argument, or null.
getArgs Get the program command line arguments as a [..] string.
getDPIScale Returns the DPI scale.
getExe Get current executable.
getMetric Return system metrics.
getMonitorForPoint Returns the monitor that contains pt Returns the nearest one if none contain it.
getMonitorForRect Returns the monitor corresponding to the surface position.
getMonitors Get the list of all monitors.
getSpecialDirectory The system font directory.
hasArg Get a given argument, or null.
locateInExplorer Locate file in the file explorer.
locateUrl Locate file in the internet explorer.
registerApplication Register an application in the system.
startProcess(const &StartInfo) Starts a new process with arguments.
startProcess(string, string) Starts a new process with arguments.

enum Env.Metrics [src]

DesktopX Left position of the full desktop.
DesktopY Top position of the full desktop.
DesktopWidth With of the full desktop.
DesktopHeight Height of the full desktop.

struct Env.Monitor [src]

Describes a physical monitor.

rect Math.Rectangle
work Math.Rectangle
scale f32 Scale factor of this monitor.
rectReal Math.Rectangle The real monitor rect, without scaling.
workReal Math.Rectangle The real monitor work rect, without scaling.

struct Env.Process [src]

handle Env.ProcessHandle

Functions

getProcessId Get current process ID.
getThreadId Get current thread ID.
waitForExit Wait for the process to be done.

func Process.getProcessId [src]

Get current process ID.

func getProcessId()->u64

func Process.getThreadId [src]

Get current thread ID.

func getThreadId()->u64

func Process.waitForExit [src]

Wait for the process to be done.

func waitForExit(me)

enum Env.SpecialDirectory [src]

Font
UserAppData
UserDocuments
CommonAppData
Desktop
UserPictures
UserVideos
UserMusic
CommonPictures
CommonVideos
CommonMusic

struct Env.StartInfo [src]

fileName string
arguments string

func Env.associateFileExtension [src]

Associate an extension to an executable.

func associateFileExtension(extension, appName, appPath: string)->bool

func Env.doSyncProcess [src]

Starts a new process with arguments, and wait for it to be done.

func doSyncProcess(fileName: string, arguments: string = null) throw

func Env.exit [src]

Exit the current process.

func exit(exitCode: u32)

func Env.getArg [src]

Get a given argument, or null.

func getArg(idx: u32)->string

func Env.getArgs [src]

Get the program command line arguments as a [..] string.

func getArgs()->const [..] string

func Env.getDPIScale [src]

Returns the DPI scale.

func getDPIScale()->f32

func Env.getExe [src]

Get current executable.

func getExe()->string

func Env.getMetric [src]

Return system metrics.

func getMetric(what: Metrics)->s32

func Env.getMonitorForPoint [src]

Returns the monitor that contains pt Returns the nearest one if none contain it.

func getMonitorForPoint(pt: Math.Point)->Env.Monitor

func Env.getMonitorForRect [src]

Returns the monitor corresponding to the surface position.

func getMonitorForRect(rect: Math.Rectangle)->Env.Monitor

func Env.getMonitors [src]

Get the list of all monitors.

func getMonitors()->Array'(Env.Monitor)

func Env.getSpecialDirectory [src]

The system font directory.

func getSpecialDirectory(what: SpecialDirectory)->String

func Env.hasArg [src]

Get a given argument, or null.

func hasArg(arg: string)->bool

func Env.locateInExplorer [src]

Locate file in the file explorer.

func locateInExplorer(name: string)

func Env.locateUrl [src]

Locate file in the internet explorer.

func locateUrl(name: string)

func Env.registerApplication [src]

Register an application in the system.

func registerApplication(appName, appFriendly: string)

func Env.startProcess [src]

Starts a new process with arguments.

func startProcess(info: StartInfo)->Env.Process throw func startProcess(fileName: string, arguments: string = null)->Env.Process throw

namespace Core.Errors

Structs

BadParameterError
FileNotFoundError
InvalidFileNameError
InvalidFormatError
InvalidVersion
OverflowError
ParseIncompleteError
SerializationError
SyntaxError
UnsupportedFormatError

Functions

mkString Make a string persistent for errors.

struct Errors.BadParameterError [src]

using base Swag.BaseError

struct Errors.FileNotFoundError [src]

using base Swag.BaseError
fileName string

struct Errors.InvalidFileNameError [src]

using base Swag.BaseError
fileName string

struct Errors.InvalidFormatError [src]

using base Swag.BaseError

struct Errors.InvalidVersion [src]

wantedVersion u32
foundVersion u32

struct Errors.OverflowError [src]

using base Swag.BaseError

struct Errors.ParseIncompleteError [src]

using base Swag.BaseError

struct Errors.SerializationError [src]

using base Swag.BaseError
field Swag.TypeValue Can contain the bad field.

struct Errors.SyntaxError [src]

using base Swag.BaseError
line u64
col u64
seek u64

struct Errors.UnsupportedFormatError [src]

using base Swag.BaseError

func Errors.mkString [src]

Make a string persistent for errors.

func mkString(str: #null string)->string

That kind of string can be stored in an error struct.

namespace Core.File

Structs

FileInfo Represents metadata and properties of a file or directory.
FileStream Represents an open file stream for reading, writing, or seeking.
Folder Represents a folder mapping to a specific structure type with its data.
TextReader TextReader reads a text file from a FileStream with buffering and encoding support.
TweakFile Represents a tweak file parser that can load configuration into registered folders.

Enums

FileAccess File access permissions.
FileAttributes Attributes that define file or directory characteristics.
FileMode File creation and opening behaviors.
FileShare File sharing options.
SeekOrigin Origin from which to calculate seek offset in a file stream.
TextEncoding Text encoding formats supported for reading text files.

Functions

delete Delete the specified file.
duplicate Creates a duplicate of an existing file.
exists Returns true if the given file exists.
getAttributes Returns attributes associated to the given filename.
getFileInfo Retrieves information about a specific file.
getInfo Returns various file informations.
open Open a new file stream.
openRead Creates a new file stream for reading.
openWrite Creates a new file stream for writing.
readAllBytes Reads the entire content of a file into an array of bytes.
readAllLines Reads all lines from a file into an array of strings.
readAllText Reads the entire content of a file into a UTF-8 string.
readEachLines Executes user code for each line read from a file.
touch Change the file write date/time.
writeAllBytes(string, const &ConcatBuffer) Writes the content of a ConcatBuffer to a file.
writeAllBytes(string, const [..] u8) Writes the content of a byte slice to a file.
writeAllLines Writes an array of strings to a file, one string per line.

enum File.FileAccess [src]

File access permissions.

Read Read access.
Write Write access.
ReadWrite Read and write access.

enum File.FileAttributes [src]

Attributes that define file or directory characteristics.

Zero No attributes set.
ReadOnly File is read-only.
Hidden File is hidden.
System File is part of the operating system.
Directory Entry is a directory.
Archive File is marked for backup or removal.
Device Reserved for system use (rarely used).
Normal File has no other attributes set.
Temporary File is used for temporary storage.
SparseFile File is a sparse file.
ReparsePoint File contains a reparse point (e.g., symbolic link).
Compressed File is compressed.
Offline File data is not available immediately (e.g., archived).
NotContentIndexed File is excluded from content indexing.
Encrypted File is encrypted.

struct File.FileInfo [src]

Represents metadata and properties of a file or directory.

fullname String Full path of the file or directory.
attributes File.FileAttributes Attributes describing the file (e.g., read-only, hidden).
creationTime Time.DateTime Time the file or directory was created.
lastAccessTime Time.DateTime Time the file or directory was last accessed.
lastWriteTime Time.DateTime Time the file or directory was last modified.
size u64 Size of the file in bytes (0 for directories).

Functions

isDirectory Returns true if the file info represents a directory.

func FileInfo.isDirectory [src]

Returns true if the file info represents a directory.

func isDirectory(const me)->bool

enum File.FileMode [src]

File creation and opening behaviors.

Append Opens the file if it exists and moves the seek to the end, or creates a new file.
Create Creates a new file, overwriting if it already exists.
CreateNew Creates a new file, throws if the file already exists.
Open Opens an existing file.
OpenOrCreate Opens the file if it exists, otherwise creates a new one.
Truncate Opens an existing file and truncates its content to zero length.

enum File.FileShare [src]

File sharing options.

Zero No sharing.
Delete Allows the file to be deleted by others.
Inheritable File handle is inheritable.
Read Allows shared read access.
Write Allows shared write access.
ReadWrite Allows shared read and write access.

struct File.FileStream [src]

Represents an open file stream for reading, writing, or seeking.

name String File name associated with the stream.
handle File.FileHandle Platform-specific file handle.
canRead bool True if the stream supports reading.
canSeek bool True if the stream supports seeking.
canWrite bool True if the stream supports writing.

Functions

close Close the given file stream.
getPosition Returns the current seek position of the given file stream.
getSize Returns the given file stream length on disk.
isOpen Returns true if the stream is currently open and valid.
read Read from the given file stream, and returns the number of bytes.
readValue Reads a value of type T from the stream into buffer; returns true if read was successful.
setPosition Set the current seek position of the given file stream.
skipPosition Skip bytes from current position.
write Write to the given file stream, and returns the number of written bytes.

Special Functions

opDrop

func FileStream.close [src]

Close the given file stream.

func close(me)

func FileStream.getPosition [src]

Returns the current seek position of the given file stream.

func getPosition(me)->u64 throw

func FileStream.getSize [src]

Returns the given file stream length on disk.

func getSize(me)->u64 throw

func FileStream.isOpen [src]

Returns true if the stream is currently open and valid.

func isOpen(const me)->bool

func FileStream.opDrop [src]

func opDrop(me)

func FileStream.read [src]

Read from the given file stream, and returns the number of bytes.

func read(me, buffer: *void, length: u64)->u64

func FileStream.readValue [src]

Reads a value of type T from the stream into buffer; returns true if read was successful.

func(T) readValue(me, buffer: *T)->bool

func FileStream.setPosition [src]

Set the current seek position of the given file stream.

func setPosition(me, origin: SeekOrigin, seek: u64) throw

func FileStream.skipPosition [src]

Skip bytes from current position.

func skipPosition(me, bytes: u64) throw

func FileStream.write [src]

Write to the given file stream, and returns the number of written bytes.

func write(me, buffer: const *void, length: u64)->u64 throw

struct File.Folder [src]

Represents a folder mapping to a specific structure type with its data.

type const *Swag.TypeInfo Type information of the structure.
data [*] void Pointer to the actual structure instance.

enum File.SeekOrigin [src]

Origin from which to calculate seek offset in a file stream.

Begin Seek from the beginning of the file.
Current Seek from the current position.
End Seek from the end of the file.

enum File.TextEncoding [src]

Text encoding formats supported for reading text files.

Ascii ASCII encoding.
Utf8 UTF-8 encoding.

struct File.TextReader [src]

TextReader reads a text file from a FileStream with buffering and encoding support.

stream File.FileStream File stream used to read from disk.
buffer Array'(u8) Internal byte buffer used for reading data.
encodingType File.TextEncoding Text encoding type (default is UTF-8).
byteSeek u64 Current byte offset in the buffer.
bufferSize u64 Size of the buffer.
checkPreamble bool Indicates whether to check for a UTF-8 BOM on first read.

Functions

close Closes the reader and the associated stream.
open Opens the reader with the specified text encoding (default is UTF-8).
readLine Reads one line of text into the result string Returns false if the end of the stream has been reached.
readToEnd Reads from the current position to the end of the stream and returns the content as a UTF-8 string.

func TextReader.close [src]

Closes the reader and the associated stream.

func close(me)

func TextReader.open [src]

Opens the reader with the specified text encoding (default is UTF-8).

func open(me, fullname: string, encoding = TextEncoding.Utf8) throw

func TextReader.readLine [src]

Reads one line of text into the result string Returns false if the end of the stream has been reached.

func readLine(me, result: &String)->bool

func TextReader.readToEnd [src]

Reads from the current position to the end of the stream and returns the content as a UTF-8 string.

func readToEnd(me)->String

struct File.TweakFile [src]

Represents a tweak file parser that can load configuration into registered folders.

folders Array'(File.Folder) List of registered folders (structure instances) to fill.

Functions

parse(me, const &Array'(string)) Parses tweak content from an array of lines.
parse(me, string) Parses tweak content from a string.
parseFile Reads and parses a tweak file from disk.
registerFolder Registers a new structure to be parsed as a folder.

func TweakFile.parse [src]

Parses tweak content from a string.

func parse(me, content: string) throw

Parses tweak content from an array of lines.

func parse(me, lines: Array'string) throw

func TweakFile.parseFile [src]

Reads and parses a tweak file from disk.

func parseFile(me, fileName: string) throw

func TweakFile.registerFolder [src]

Registers a new structure to be parsed as a folder.

func(T) registerFolder(me, folder: *T)

func File.delete [src]

Delete the specified file.

func delete(fullName: string) throw

func File.duplicate [src]

Creates a duplicate of an existing file.

func duplicate(newName, oldName: string) throw

func File.exists [src]

Returns true if the given file exists.

func exists(fullName: string)->bool

func File.getAttributes [src]

Returns attributes associated to the given filename.

func getAttributes(fullName: string)->File.FileAttributes throw

func File.getFileInfo [src]

Retrieves information about a specific file.

func getFileInfo(fullName: string)->File.FileInfo throw

func File.getInfo [src]

Returns various file informations.

func getInfo(fullname: string)->File.FileInfo throw

func File.open [src]

Open a new file stream.

func open(fullName: string, mode: FileMode, access: FileAccess, share: FileShare)->File.FileStream throw

func File.openRead [src]

Creates a new file stream for reading.

func openRead(fullName: string)->File.FileStream throw

func File.openWrite [src]

Creates a new file stream for writing.

func openWrite(fullName: string)->File.FileStream throw

func File.readAllBytes [src]

Reads the entire content of a file into an array of bytes.

func readAllBytes(fullname: string)->Array'(u8) throw

func File.readAllLines [src]

Reads all lines from a file into an array of strings.

func readAllLines(fullname: string, encoding = TextEncoding.Utf8)->Array'(String) throw

func File.readAllText [src]

Reads the entire content of a file into a UTF-8 string.

func readAllText(fullname: string, encoding = TextEncoding.Utf8, normalizeEol = false)->String throw

func File.readEachLines [src]

Executes user code for each line read from a file.

#[Swag.Macro] func readEachLines(fullname: string, encoding = TextEncoding.Utf8, stmt: #code void) throw

func File.touch [src]

Change the file write date/time.

func touch(fullName: string) throw

func File.writeAllBytes [src]

Writes the content of a byte slice to a file.

func writeAllBytes(fullname: string, buffer: const [..] u8)->u64 throw

Writes the content of a ConcatBuffer to a file.

func writeAllBytes(fullname: string, buffer: ConcatBuffer)->u64 throw

func File.writeAllLines [src]

Writes an array of strings to a file, one string per line.

func writeAllLines(fullname: string, lines: Array'string)->u64 throw

namespace Core.Format

Functions

append Format a string and put the result in a ConcatBuffer.
checkFormat Check if this is a valid fmt/values pair, coherent with format specification.
countPercent Count the number of valid % placeholders in the string format.
replaceString Format a string in dest.
toInterp(*ConcatBuffer, string) String interpolation.
toInterp(string) String interpolation.
toString Format a string and returns the result as a String.
toStringTemp Returns a formatted string stored in the temporary allocator.

func Format.append [src]

Format a string and put the result in a ConcatBuffer.

func append(buf: *ConcatBuffer, fmt: string, values: ...)

func Format.checkFormat [src]

Check if this is a valid fmt/values pair, coherent with format specification.

func checkFormat(fct: string, fmt: string, values: ...)

func Format.countPercent [src]

Count the number of valid % placeholders in the string format.

func countPercent(fmt: string)->u32

Note that %% will not be counted, as this represents the % character

func Format.replaceString [src]

Format a string in dest.

func replaceString(dest: *String, fmt: string, values: ...)

Can be a lot faster than the convenient version which returns a String.

func Format.toInterp [src]

String interpolation.

#[Swag.Macro] func toInterp(buf: *ConcatBuffer, exp: string)

Format is {<value to interpolate>:format}

String interpolation.

#[Swag.Macro] func toInterp(exp: string)->String

func Format.toString [src]

Format a string and returns the result as a String.

func toString(fmt: string, values: ...)->String

Use % as a place holder for a value.

let x = Format.toString("my life is %", myLife)

% can be followed by a format option between {}.

let x = Format.toString("my life in hexadecimal is %{X}", myLife)

func Format.toStringTemp [src]

Returns a formatted string stored in the temporary allocator.

func toStringTemp(fmt: string, values: ...)->string

struct Core.GUID128 [src]

A 128-bit Globally Unique Identifier structure.

using guid {val8:[16] u8,val64:[2] u64}

Provides RFC 4122 compliant UUID generation and manipulation.

Functions

clear Clear id.
getRandom Get a version 4 GUID128 (random).
getString Convert guid to a string.
toString Convert guid to a string of the form xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx.

Special Functions

opEquals Compare two GUID128 instances for equality.

func IConvert.convert [src]

Convert the GUID to its string representation for display.

func convert(me, buf: *ConcatBuffer, convFmt: StrConv.ConvertFormat, strFormat: string)

Uses the standard UUID format with hyphens.

func IHash32.compute [src]

Compute a 32-bit hash value for the GUID.

func compute(const me)->u32

Uses CRC32 algorithm on the entire 16-byte GUID data.

func GUID128.clear [src]

Clear id.

func clear(me)

func GUID128.getRandom [src]

Get a version 4 GUID128 (random).

func getRandom()->GUID128

func GUID128.getString [src]

Convert guid to a string.

func getString(me)->String

func GUID128.opEquals [src]

Compare two GUID128 instances for equality.

func opEquals(me, other: GUID128)->bool

Returns true if both GUIDs have identical values.

func GUID128.toString [src]

Convert guid to a string of the form xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx.

func toString(me, result: [..] u8)

struct Core.GUID64 [src]

A 64-bit Globally Unique Identifier structure.

guid u64 64-bit unique identifier value.

Provides compact GUID generation with multiple entropy strategies for different use cases.

Functions

clear Clear GUID.
getHighEntropy Get a high-entropy GUID64 using multiple entropy sources.
getRandom Get a fully random GUID64 using MT64.
getString Convert guid to a string.
getTimestamp Get a timestamp-based GUID64 with minimal collision risk Structure: 32-bit timestamp + 16-bit microseconds + 12-bit counter + 4-bit random.
isNull Check if GUID is null/empty.
parse Parse GUID64 from hex string (with or without 0x prefix).
toString Convert GUID64 to hexadecimal string.

Special Functions

opEquals Compare two GUID64 instances for equality.

func IConvert.convert [src]

Convert the GUID to its hexadecimal string representation.

func convert(me, buf: *ConcatBuffer, convFmt: StrConv.ConvertFormat, strFormat: string)

Produces a 16-character uppercase hex string without separators.

func IHash32.compute [src]

Compute a 32-bit hash value for the GUID.

func compute(const me)->u32

Uses CRC32 algorithm on the 8-byte GUID data for consistent hashing.

func GUID64.clear [src]

Clear GUID.

func clear(me)

func GUID64.getHighEntropy [src]

Get a high-entropy GUID64 using multiple entropy sources.

func getHighEntropy()->GUID64

func GUID64.getRandom [src]

Get a fully random GUID64 using MT64.

func getRandom()->GUID64

func GUID64.getString [src]

Convert guid to a string.

func getString(me)->String

func GUID64.getTimestamp [src]

Get a timestamp-based GUID64 with minimal collision risk Structure: 32-bit timestamp + 16-bit microseconds + 12-bit counter + 4-bit random.

func getTimestamp()->GUID64

func GUID64.isNull [src]

Check if GUID is null/empty.

func isNull(me)->bool

func GUID64.opEquals [src]

Compare two GUID64 instances for equality.

func opEquals(me, other: GUID64)->bool

Returns true if both GUIDs have identical values.

func GUID64.parse [src]

Parse GUID64 from hex string (with or without 0x prefix).

func parse(str: string)->GUID64

func GUID64.toString [src]

Convert GUID64 to hexadecimal string.

func toString(me, result: [..] u8)

namespace Core.Globalization

Structs

CultureInfo
NumberFormatInfo Provides culture-specific information for formatting and parsing numeric values.

Functions

getCultureInfo Returns the global culture info structure.

struct Globalization.CultureInfo [src]

numberFormat Globalization.NumberFormatInfo

struct Globalization.NumberFormatInfo [src]

Provides culture-specific information for formatting and parsing numeric values.

negativeSign u8
positiveSign u8
decimalSeparator u8

func Globalization.getCultureInfo [src]

Returns the global culture info structure.

func getCultureInfo()->*Globalization.CultureInfo

namespace Core.Hardware

Functions

getMacAddress Max address.
getProcessorCount Number of processors.

func Hardware.getMacAddress [src]

Max address.

func getMacAddress()->u64

func Hardware.getProcessorCount [src]

Number of processors.

func getProcessorCount()->u32

namespace Core.Hash

Structs

Adler32
City32
Crc32
Crc64 CRC-64 implementation as described in ECMA-182, Annex B.
Md5
Sha1 A SHA-1 cryptographic hash function implementation.
Sha256

Enums

Crc64Kind

Functions

hash32 Hash the given value and returns the corresponding u32.
hash64 Hash the given value and returns the corresponding u64.
jenkins(u32)
jenkins(u64)
murmur3(const [*] u8, u64, u64)
murmur3(u32)
murmur3(u32, u32)
murmur3(u64)
murmur3(u64, u64)

struct Hash.Adler32 [src]

adler u32

Functions

compute Returns the adler32 hash value for the given buffer.
init Initialize the hashing sequence.
update Update the hash value with buffer content.

func Adler32.compute [src]

Returns the adler32 hash value for the given buffer.

func compute(buffer: const [..] u8)->u32

func Adler32.init [src]

Initialize the hashing sequence.

func init(me)

func Adler32.update [src]

Update the hash value with buffer content.

func update(me, buffer: const [..] u8)

struct Hash.City32 [src]

crc u32

Functions

compute Returns the hash value for the given buffer.
init Initialize the hashing sequence.
update Update the hash value with buffer content.

func City32.compute [src]

Returns the hash value for the given buffer.

func compute(buffer: const [..] u8)->u32

func City32.init [src]

Initialize the hashing sequence.

func init(me)

func City32.update [src]

Update the hash value with buffer content.

func update(me, data: const [..] u8)

struct Hash.Crc32 [src]

crc u32

Functions

compute Returns the hash value for the given buffer.
init Initialize the hashing sequence.
update Update the hash value with buffer content.

func Crc32.compute [src]

Returns the hash value for the given buffer.

func compute(buffer: const [..] u8)->u32

func Crc32.init [src]

Initialize the hashing sequence.

func init(me, seed: u32 = 0)

func Crc32.update [src]

Update the hash value with buffer content.

func update(me, data: #null const [..] u8)

struct Hash.Crc64 [src]

CRC-64 implementation as described in ECMA-182, Annex B.

crc u64

Functions

compute Returns the hash value for the given buffer.
update Computes the CRC-64 hash of the provided data.

func Crc64.compute [src]

Returns the hash value for the given buffer.

func compute(buffer: const [..] u8, kind = Crc64Kind.ECMA182)->u64

func Crc64.update [src]

Computes the CRC-64 hash of the provided data.

func update(me, data: #null const [..] u8, kind: Crc64Kind)

enum Hash.Crc64Kind [src]

ECMA182
ISO
ISOXZ

interface Hash.IHash32 [src]

compute func(const *Hash.IHash32)->u32

interface Hash.IHash64 [src]

compute func(const *Hash.IHash64)->u64

struct Hash.Md5 [src]

padding [64] u8
state [4] u32
count [2] u32
buffer [64] u8

Functions

compute Returns the md5 value for the given buffer.
final Finalize the computation.
init Initialize the hashing sequence.
toString Convert a MD5 result to a string.
update Update the hash value with buffer content.

func Md5.compute [src]

Returns the md5 value for the given buffer.

func compute(buffer: const [..] u8)->Hash.Md5.Digest

func Md5.final [src]

Finalize the computation.

func final(me, digest: Digest)

func Md5.init [src]

Initialize the hashing sequence.

func init(me)

func Md5.toString [src]

Convert a MD5 result to a string.

func toString(digest: Digest)->String

func Md5.update [src]

Update the hash value with buffer content.

func update(me, data: const [..] u8)

struct Hash.Sha1 [src]

A SHA-1 cryptographic hash function implementation.

data [64] u8 Internal data buffer for processing 512-bit blocks.
state [5] u32 Five 32-bit hash state values (A, B, C, D, E).
datalen u32 Current number of bytes in the data buffer.
bitlen u64 Total number of bits processed so far.

Provides methods to compute 160-bit SHA-1 hash values from arbitrary data streams. Supports incremental hashing through init, update, and final operations.

Functions

compute Returns the SHA-1 hash value for the given buffer.
final Finalize the computation and produce the final hash digest.
init Initialize the hashing sequence with standard SHA-1 constants.
update Update the hash value with buffer content.

func Sha1.compute [src]

Returns the SHA-1 hash value for the given buffer.

func compute(buffer: const [..] u8)->Hash.Sha1.Digest

Convenience function that performs the complete hash operation in a single call.

func Sha1.final [src]

Finalize the computation and produce the final hash digest.

func final(me, result: Digest)

Applies padding and length encoding, then stores the result in result.

func Sha1.init [src]

Initialize the hashing sequence with standard SHA-1 constants.

func init(me)

Sets up the initial state values and resets all counters to zero.

func Sha1.update [src]

Update the hash value with buffer content.

func update(me, buffer: const [..] u8)

Processes the input data in 512-bit blocks, buffering incomplete blocks for later processing.

struct Hash.Sha256 [src]

data [64] u8
state [8] u32
datalen u32
bitlen u64

Functions

compute Returns the sha256 value for the given buffer.
final Finalize the computation.
init Initialize the hashing sequence.
update Update the hash value with buffer content.

func Sha256.compute [src]

Returns the sha256 value for the given buffer.

func compute(buffer: const [..] u8)->Hash.Sha256.Digest

func Sha256.final [src]

Finalize the computation.

func final(me, result: Digest)

func Sha256.init [src]

Initialize the hashing sequence.

func init(me)

func Sha256.update [src]

Update the hash value with buffer content.

func update(me, buffer: const [..] u8)

func Hash.hash32 [src]

Hash the given value and returns the corresponding u32.

func(T) hash32(value: T)->u32

func Hash.hash64 [src]

Hash the given value and returns the corresponding u64.

func(T) hash64(value: T)->u64

func Hash.jenkins [src]

func jenkins(h: u64)->u64 func jenkins(h: u32)->u32

func Hash.murmur3 [src]

func murmur3(h: u32)->u32 func murmur3(h: u64)->u64 func murmur3(a, b: u32)->u32 func murmur3(a, b: u64)->u64 func murmur3(key: const [*] u8, len: u64, seed: u64)->u64

struct Core.HashSet [src]

A hash set implemented with an open-addressing hash me.table.

struct HashSet(K)
HASH_FREE s32 The slot is empty and has never been used.
HASH_DELETED s32 The slot was previously occupied but has been me.deleted.
HASH_FIRST s32 The first possible valid hash value.
HASH_MASK s32 A mask to ensure that valid hashes are >= HASH_FIRST.
allocator Swag.IAllocator The me.allocator used for memory operations.
table [*] HashSetEntry'(HashSetEntry.K) Pointer to the contiguous memory block for the hash me.table.
count u64 The number of valid elements currently in the set.
capacity u64 The total number of slots in the hash me.table.
deleted u64 The number of slots marked as deleted.

It stores a collection of unique keys, providing fast lookups, additions, and removals.

Functions

add(me, &&K) Adds a new key to the set by moving it.
add(me, K) Adds a new key to the set by copying it.
clear Removes all elements from the set without deallocating the me.table memory.
contains Returns true if the set contains the given key.
emplaceInternal Internal helper to add a new element with a pre-computed hash.
free Frees the hash set's memory and resets its state.
getNewIndex Finds the correct index for a new key, handling collisions and me.deleted slots.
grow Checks if the me.table needs to be resized and triggers it if necessary.
hashKey Computes the hash for a given key.
remove Removes a key from the set.
reserve Resizes the hash me.table to a new me.capacity, rehashing all existing elements.

Special Functions

opAffect Replaces the content of the set with elements from a slice.
opCount Returns the number of elements in the set.
opDrop Ensures the allocated memory is freed when the set goes out of scope.
opPostCopy Handles the deep copy of the set when it is copied.
opVisit Provides a way to iterate over each key in the set.

func IConvert.convert [src]

func convert(me, buf: *ConcatBuffer, convFormat: StrConv.ConvertFormat, strFormat: string)

func HashSet.add [src]

Adds a new key to the set by copying it.

func add(me, key: K)->*HashSetEntry'(HashSetEntry.K)

If the key already exists, does nothing. Returns a pointer to the entry.

Adds a new key to the set by moving it.

func add(me, key: &&K)->*HashSetEntry'(HashSetEntry.K)

If the key already exists, does nothing. Returns a pointer to the entry.

func HashSet.clear [src]

Removes all elements from the set without deallocating the me.table memory.

func clear(me)

All slots are marked as FREE.

func HashSet.contains [src]

Returns true if the set contains the given key.

func contains(const me, key: K)->bool

func HashSet.emplaceInternal [src]

Internal helper to add a new element with a pre-computed hash.

func emplaceInternal(me, hashVal: u32, key: &K)->*HashSetEntry'(HashSetEntry.K)

func HashSet.free [src]

Frees the hash set's memory and resets its state.

func free(me)

If keys have destructors, they are called.

func HashSet.getNewIndex [src]

Finds the correct index for a new key, handling collisions and me.deleted slots.

func getNewIndex(me, key: K, idx: u64, hashVal: u64)->u64

Uses linear probing to find the next available slot.

func HashSet.grow [src]

Checks if the me.table needs to be resized and triggers it if necessary.

func grow(me)

Growth happens when the load factor (including me.deleted slots) exceeds 75%.

func HashSet.hashKey [src]

Computes the hash for a given key.

func hashKey(key: K)->u32

Ensures the resulting hash is not one of the reserved values (FREE, me.deleted).

func HashSet.opAffect [src]

Replaces the content of the set with elements from a slice.

func opAffect(me, slice: const [..] K)

func HashSet.opCount [src]

Returns the number of elements in the set.

func opCount(me)->u64

func HashSet.opDrop [src]

Ensures the allocated memory is freed when the set goes out of scope.

func opDrop(me)

func HashSet.opPostCopy [src]

Handles the deep copy of the set when it is copied.

func opPostCopy(me)

A new me.table is allocated and all entries are copied over.

func HashSet.opVisit [src]

Provides a way to iterate over each key in the set.

#[Swag.Macro] func(ptr: bool, back: bool) opVisit(const me, stmt: #code void)

This is a macro that accepts a code block to execute for each key. Alias: #alias0 for the key or a pointer to it.

func HashSet.remove [src]

Removes a key from the set.

func remove(me, key: K)

If the key exists, its slot is marked as DELETED. Does nothing if the key is not found.

func HashSet.reserve [src]

Resizes the hash me.table to a new me.capacity, rehashing all existing elements.

func reserve(me, newCapacity: u64)

struct Core.HashSetEntry [src]

Represents a single entry within a HashSet.

struct HashSetEntry(K)
hash u32 The cached hash of the key.
key HashSetEntry.K The key itself.

struct Core.HashTable [src]

A hash me.table implemented with open-addressing that maps keys to values.

struct HashTable(K, V)
HASH_FREE s32 The slot is empty and has never been used.
HASH_DELETED s32 The slot was previously occupied but has been me.deleted.
HASH_FIRST s32 The first possible valid hash value.
HASH_MASK s32 A mask to ensure that valid hashes are >= HASH_FIRST.
allocator Swag.IAllocator The me.allocator used for memory operations.
table [*] HashTableEntry'(HashTableEntry.K, HashTableEntry.V) Pointer to the contiguous memory block for the hash me.table.
count u64 The number of valid key-value pairs currently in the me.table.
capacity u64 The total number of slots in the hash me.table.
deleted u64 The number of slots marked as me.deleted.

It provides fast lookups, additions, and removals of key-value pairs.

Functions

add(me, K, &&V, bool) Adds a new key-value pair to the me.table, moving the value.
add(me, K, V, bool) Adds a new key-value pair to the me.table by copying them.
clear Removes all elements from the me.table without deallocating the me.table memory.
contains Returns true if the me.table contains the given key.
emplaceInternal Internal helper to add a new element with a pre-computed hash. Use with care.
find Finds the entry for a given key.
findOrAdd Finds the entry for a key, or adds a new entry with a default-initialized value if not found.
free Frees the hash me.table's memory and resets its state.
get Gets the value associated with a key.
getNewIndex Finds the correct index for a new key, handling collisions and me.deleted slots.
grow Checks if the me.table needs to be resized and triggers it if necessary.
hashKey Computes the hash for a given key.
remove Removes a key-value pair from the me.table by key.
reserve Resizes the hash me.table to a new me.capacity, rehashing all existing elements.
tryFind Tries to find the entry for a given key.

Special Functions

opAffect Replaces the content of the me.table with key-value pairs from a slice.
opCount Returns the number of key-value pairs in the me.table.
opDrop Ensures the allocated memory is freed when the me.table goes out of scope.
opIndex(me, K) Provides mutable access to the value associated with a key.
opIndex(me, K) Provides read-only access to the value associated with a key.
opIndexAffect Assigns a value to a key, updating it if it exists or adding it if it doesn't.
opPostCopy Handles the deep copy of the me.table when it is copied.
opVisit Provides a way to iterate over each key-value pair in the me.table.

func IConvert.convert [src]

func convert(me, buf: *ConcatBuffer, convFmt: StrConv.ConvertFormat, strFormat: string)

func HashTable.add [src]

Adds a new key-value pair to the me.table by copying them.

func add(me, key: K, value: V, updateValue = true)->*HashTableEntry'(HashTableEntry.K, HashTableEntry.V)

If the key already exists, the value is updated if updateValue is true.

Adds a new key-value pair to the me.table, moving the value.

func add(me, key: K, value: &&V, updateValue = true)->*HashTableEntry'(HashTableEntry.K, HashTableEntry.V)

If the key already exists, the value is updated if updateValue is true.

func HashTable.clear [src]

Removes all elements from the me.table without deallocating the me.table memory.

func clear(me)

All slots are marked as FREE.

func HashTable.contains [src]

Returns true if the me.table contains the given key.

func contains(const me, key: K)->bool

func HashTable.emplaceInternal [src]

Internal helper to add a new element with a pre-computed hash. Use with care.

func emplaceInternal(me, hashVal: u32, key: &K, value: &V)->*HashTableEntry'(HashTableEntry.K, HashTableEntry.V)

func HashTable.find [src]

Finds the entry for a given key.

func find(const me, key: K)->*HashTableEntry'(HashTableEntry.K, HashTableEntry.V)

Asserts and will likely crash if the key is not found. Use [[tryFind]] for safe searching.

func HashTable.findOrAdd [src]

Finds the entry for a key, or adds a new entry with a default-initialized value if not found.

func findOrAdd(me, key: K)->*HashTableEntry'(HashTableEntry.K, HashTableEntry.V)

Returns a pointer to the existing or new entry.

func HashTable.free [src]

Frees the hash me.table's memory and resets its state.

func free(me)

If keys or values have destructors, they are called.

func HashTable.get [src]

Gets the value associated with a key.

func get(const me, key: K, val: V)->HashTable.V

If the key does not exist, returns the provided default value val instead.

func HashTable.getNewIndex [src]

Finds the correct index for a new key, handling collisions and me.deleted slots.

func getNewIndex(me, key: K, idx: u64, hashVal: u64)->u64

Uses linear probing to find the next available slot.

func HashTable.grow [src]

Checks if the me.table needs to be resized and triggers it if necessary.

func grow(me)

Growth happens when the load factor (including me.deleted slots) exceeds 75%.

func HashTable.hashKey [src]

Computes the hash for a given key.

func hashKey(key: K)->u32

Ensures the resulting hash is not one of the reserved values (FREE, me.deleted).

func HashTable.opAffect [src]

Replaces the content of the me.table with key-value pairs from a slice.

func opAffect(me, slice: const [..] { k: K v: V } )

func HashTable.opCount [src]

Returns the number of key-value pairs in the me.table.

func opCount(me)->u64

func HashTable.opDrop [src]

Ensures the allocated memory is freed when the me.table goes out of scope.

func opDrop(me)

func HashTable.opIndex [src]

Provides read-only access to the value associated with a key.

func opIndex(const me, key: K)->const &HashTable.V

Asserts if the key is not found.

Provides mutable access to the value associated with a key.

func opIndex(me, key: K)->&HashTable.V

If the key does not exist, this will exhibit undefined behavior. Use with caution. See [[opIndexAffect]] for safe insertion/update.

func HashTable.opIndexAffect [src]

Assigns a value to a key, updating it if it exists or adding it if it doesn't.

func opIndexAffect(me, key: K, val: V)

func HashTable.opPostCopy [src]

Handles the deep copy of the me.table when it is copied.

func opPostCopy(me)

A new me.table is allocated and all entries are copied over.

func HashTable.opVisit [src]

Provides a way to iterate over each key-value pair in the me.table.

#[Swag.Macro] func(ptr: bool, back: bool) opVisit(const me, stmt: #code void)

This is a macro that accepts a code block to execute for each pair. Aliases: #alias0 for the key, #alias1 for the value.

func HashTable.remove [src]

Removes a key-value pair from the me.table by key.

func remove(me, key: K)

If the key exists, its slot is marked as DELETED. Does nothing if the key is not found.

func HashTable.reserve [src]

Resizes the hash me.table to a new me.capacity, rehashing all existing elements.

func reserve(me, newCapacity: u64)

func HashTable.tryFind [src]

Tries to find the entry for a given key.

func tryFind(const me, key: K)->*HashTableEntry'(HashTableEntry.K, HashTableEntry.V)

Returns a pointer to the HashTableEntry if found, otherwise returns null.

struct Core.HashTableEntry [src]

Represents a single key-value pair entry within a HashTable.

struct HashTableEntry(K, V)
hash u32 The cached hash of the key.
key HashTableEntry.K The key.
value HashTableEntry.V The value associated with the key.

interface Core.ILogWriter [src]

Interface for writing log output.

print func(*ILogWriter, string)

namespace Core.Input

Structs

GamePad Represents a gamepad.
GamePadState Represents specific information about the state of the controller, including the current state of buttons and sticks.
Keyboard Allows getting keystrokes from keyboard.
KeyboardState Represents one keyboard state.
KeyboardStateNative
Mouse Allows reading position and button click information from mouse.
MouseState Represents one mouse state.

Enums

GamePadButton Enumerates gamepad buttons.
Key Defines the keys on a keyboard.
KeyModifiers
MouseButton

Functions

getKeyName Returns a "shortcut" display name.
getMousePos Returns the current mouse position.
setMousePos Set the current mouse position.
showMouseCursor Shoud or hide the mouse cursor.

struct Input.GamePad [src]

Represents a gamepad.

previousState Input.GamePadState
currentState Input.GamePadState
padIndex u32
connected bool

Functions

clear Reset the previous and current state.
getPosition Get the analog position of the given button.
isButtonJustPressed Determines whether specified input device button has just been pressed.
isButtonJustReleased Determines whether specified input device button has just been released.
isButtonPressed Determines whether specified input device button is pressed.
isButtonReleased Determines whether specified input device button is released (not pressed).
isConnected Returns true if the corresponding padIndex is connected.
setVibration(me, f32, f32) Set the vibration motor speeds.
setVibration(u32, f32, f32) Set the left and right vibration of the given padIndex.
update Update the GamePad current state.

func GamePad.clear [src]

Reset the previous and current state.

func clear(me)

func GamePad.getPosition [src]

Get the analog position of the given button.

func getPosition(me, button: GamePadButton)->Math.Point

func GamePad.isButtonJustPressed [src]

Determines whether specified input device button has just been pressed.

func isButtonJustPressed(me, button: GamePadButton)->bool

func GamePad.isButtonJustReleased [src]

Determines whether specified input device button has just been released.

func isButtonJustReleased(me, button: GamePadButton)->bool

func GamePad.isButtonPressed [src]

Determines whether specified input device button is pressed.

func isButtonPressed(me, button: GamePadButton)->bool

func GamePad.isButtonReleased [src]

Determines whether specified input device button is released (not pressed).

func isButtonReleased(me, button: GamePadButton)->bool

func GamePad.isConnected [src]

Returns true if the corresponding padIndex is connected.

func isConnected(padIndex: u32)->bool

func GamePad.setVibration [src]

Set the left and right vibration of the given padIndex.

func setVibration(padIndex: u32, left, right: f32) throw

Set the vibration motor speeds.

func setVibration(me, left, right: f32) throw

func GamePad.update [src]

Update the GamePad current state.

func update(me) throw

enum Input.GamePadButton [src]

Enumerates gamepad buttons.

A
B
Back
BigButton
DPadDown
DPadLeft
DPadRight
DPadUp
LeftShoulder
LeftStick
LeftThumbstickDown
LeftThumbstickLeft
LeftThumbstickRight
LeftThumbstickUp
LeftTrigger
RightShoulder
RightStick
RightThumbstickDown
RightThumbstickLeft
RightThumbstickRight
RightThumbstickUp
RightTrigger
Start
X
Y

struct Input.GamePadState [src]

Represents specific information about the state of the controller, including the current state of buttons and sticks.

pressed [25] bool
position [25] Math.Point

Functions

clear Reset state to its default value.
update Compute the current state of the given pad index.

func GamePadState.clear [src]

Reset state to its default value.

func clear(me)

func GamePadState.update [src]

Compute the current state of the given pad index.

func update(me, padIndex: u32) throw

enum Input.Key [src]

Defines the keys on a keyboard.

None
A
Add
Apps
Attn
B
Back
BrowserBack
BrowserFavorites
BrowserForward
BrowserHome
BrowserRefresh
BrowserSearch
BrowserStop
C
Cancel
Capital
CapsLock
Clear
Control
Crsel
D
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
Decimal
Delete
Divide
Down
E
End
Enter
EraseEof
Escape
Execute
Exsel
F
F1
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F2
F20
F21
F22
F23
F24
F3
F4
F5
F6
F7
F8
F9
FinalMode
G
H
HanguelMode
HangulMode
HanjaMode
Help
Home
I
IMEAccept
IMEAceept
IMEConvert
IMEModeChange
IMENonConvert
Insert
J
JunjaMode
K
KanaMode
KanjiMode
L
LButton
LControl
LMenu
LShift
LWin
LaunchApplication1
LaunchApplication2
LaunchMail
Left
LineFeed
M
MButton
MediaNextTrack
MediaPlayPause
MediaPreviousTrack
MediaStop
MenuCtrl
Multiply
N
Next
NoName
NumLock
NumPad0
NumPad1
NumPad2
NumPad3
NumPad4
NumPad5
NumPad6
NumPad7
NumPad8
NumPad9
O
Oem1
Oem102
Oem2
Oem3
Oem4
Oem5
Oem6
Oem7
Oem8
OemBackslash
OemClear
OemCloseBrackets
OemComma
OemMinus
OemOpenBrackets
OemPeriod
OemPipe
OemPlus
OemQuestion
OemQuotes
OemSemicolon
OemTilde
P
Pa1
Packet
PageDown
PageUp
Pause
Play
Print
PrintScreen
Prior
Process
Q
R
RButton
RControl
RMenu
RShift
RWin
Return
Right
S
Scroll
Select
SelectMedia
Separator
Shift
Sleep
Space
Subtract
T
Tab
U
Up
V
VolumeDown
VolumeMute
VolumeUp
W
X
XButton1
XButton2
Y
Z
Zoom

enum Input.KeyModifiers [src]

Zero
Shift
Control
Alt
CtrlShift
CtrlAlt

struct Input.Keyboard [src]

Allows getting keystrokes from keyboard.

previousState Input.KeyboardState
currentState Input.KeyboardState
pressedRepeat [188] bool
pressedTime [188] u32
pressedRepeatStartTimeMs u32
pressedRepeatTimeMs u32
canRepeat bool

Functions

clear Reset the keyboard state.
getPressedModifiers Returns the currently pressed key modifiers.
isKeyJustPressed Determines whether given key has just been pressed.
isKeyJustReleased Determines whether given key has just been released.
isKeyPressed(me, Key) Determines whether given key is currently being pressed.
isKeyPressed(Key) Returns true if the given key is pressed.
isKeyReleased Determines whether given key is currently being released.
keyToRune Try to transform the given key to the corresponding rune.
keyToVirtualKey
update Compute current state of the keyboard (all keys).
virtualKeyToKey

func Keyboard.clear [src]

Reset the keyboard state.

func clear(me)

func Keyboard.getPressedModifiers [src]

Returns the currently pressed key modifiers.

func getPressedModifiers(me)->Input.KeyModifiers

func Keyboard.isKeyJustPressed [src]

Determines whether given key has just been pressed.

func isKeyJustPressed(me, key: Key)->bool

func Keyboard.isKeyJustReleased [src]

Determines whether given key has just been released.

func isKeyJustReleased(me, key: Key)->bool

func Keyboard.isKeyPressed [src]

Determines whether given key is currently being pressed.

func isKeyPressed(me, key: Key)->bool

Returns true if the given key is pressed.

func isKeyPressed(key: Key)->bool

func Keyboard.isKeyReleased [src]

Determines whether given key is currently being released.

func isKeyReleased(me, key: Key)->bool

func Keyboard.keyToRune [src]

Try to transform the given key to the corresponding rune.

func keyToRune(me, key: Key)->rune

func Keyboard.keyToVirtualKey [src]

func keyToVirtualKey(key: Key)->Input.VirtualKey

func Keyboard.update [src]

Compute current state of the keyboard (all keys).

func update(me)

func Keyboard.virtualKeyToKey [src]

func virtualKeyToKey(vkey: VirtualKey)->Input.Key

struct Input.KeyboardState [src]

Represents one keyboard state.

using native Input.KeyboardStateNative
pressed [188] bool

Functions

clear Reset keyboard state.
update Compute current keyboard state.

func KeyboardState.clear [src]

Reset keyboard state.

func clear(me)

func KeyboardState.update [src]

Compute current keyboard state.

func update(me)

struct Input.KeyboardStateNative [src]

nativeState [256] Win32.BYTE

struct Input.Mouse [src]

Allows reading position and button click information from mouse.

previousState Input.MouseState
currentState Input.MouseState
dblClk [5] bool
dblClkTimeMs u32

Functions

clear Reset the mouse state to its default value.
getMove Returns the move between the current position and the previous one.
getPosition Returns the mouse position.
getPreviousPos Returns the previous mouse position, before the last update.
isButtonDoubleClick
isButtonJustPressed Determines whether the specified mouse button has just been pressed.
isButtonJustReleased Determines whether the specified mouse button has just been released.
isButtonPressed(me, MouseButton) Determines whether the specified mouse button is pressed.
isButtonPressed(MouseButton) Determins if one given mouse button is pressed or not.
isButtonReleased Determines whether the specified mouse button is released.
update Compute the current state of the mouse.

func Mouse.clear [src]

Reset the mouse state to its default value.

func clear(me)

func Mouse.getMove [src]

Returns the move between the current position and the previous one.

func getMove(me)->Math.Point

func Mouse.getPosition [src]

Returns the mouse position.

func getPosition(me)->Math.Point

func Mouse.getPreviousPos [src]

Returns the previous mouse position, before the last update.

func getPreviousPos(me)->Math.Point

func Mouse.isButtonDoubleClick [src]

func isButtonDoubleClick(me, button: MouseButton)->bool

func Mouse.isButtonJustPressed [src]

Determines whether the specified mouse button has just been pressed.

func isButtonJustPressed(me, button: MouseButton)->bool

func Mouse.isButtonJustReleased [src]

Determines whether the specified mouse button has just been released.

func isButtonJustReleased(me, button: MouseButton)->bool

func Mouse.isButtonPressed [src]

Determins if one given mouse button is pressed or not.

func isButtonPressed(button: MouseButton)->bool

Determines whether the specified mouse button is pressed.

func isButtonPressed(me, button: MouseButton)->bool

func Mouse.isButtonReleased [src]

Determines whether the specified mouse button is released.

func isButtonReleased(me, button: MouseButton)->bool

func Mouse.update [src]

Compute the current state of the mouse.

func update(me)

enum Input.MouseButton [src]

Left
Middle
Right
XButton1
XButton2

struct Input.MouseState [src]

Represents one mouse state.

pressed [5] bool
pressedTime [5] u32
pressedPos [5] Math.Point
position Math.Point

Functions

clear Reset the state to its default value.
update Compute the actual state of the mouse.

func MouseState.clear [src]

Reset the state to its default value.

func clear(me)

func MouseState.update [src]

Compute the actual state of the mouse.

func update(me)

func Input.getKeyName [src]

Returns a "shortcut" display name.

func getKeyName(mdf: KeyModifiers, key: Key)->String

func Input.getMousePos [src]

Returns the current mouse position.

func getMousePos()->Math.Point

func Input.setMousePos [src]

Set the current mouse position.

func setMousePos(x, y: s32)

func Input.showMouseCursor [src]

Shoud or hide the mouse cursor.

func showMouseCursor(show: bool)

namespace Core.Jobs

Structs

ForJob
Job
SliceJob

Enums

JobState

Functions

getNumWorkers Returns number of threads in the job system.
isSynchrone Returns true is the job system has been initialized.
parallelFor Do a for for in parallel chunks.
parallelVisit Operate on a range in parallel chunks.
scheduleJob Schedule a job to execute.
setNumWorkers Set the number of worker threads. Must be done once.
waitDone Wait for all registered jobs to be finished.
waitJob Wait for a given job to be finished.

struct Jobs.ForJob [src]

using base Jobs.Job
startIndex u32
endIndex u32
userData *void

struct Jobs.Job [src]

lambda func(*void)
data *void
state Jobs.JobState
pendingIndex u32

enum Jobs.JobState [src]

Zero
InPending
Done

struct Jobs.SliceJob [src]

struct SliceJob(T)
using base Jobs.Job
buffer [..] Jobs.SliceJob.T
offset u32
userData *void

func Jobs.getNumWorkers [src]

Returns number of threads in the job system.

func getNumWorkers()->u32

func Jobs.isSynchrone [src]

Returns true is the job system has been initialized.

func isSynchrone()->bool

func Jobs.parallelFor [src]

Do a for for in parallel chunks.

#[Swag.Macro] func parallelFor(count: u32, userData: *void = null, stmt: #code void)

Exposed variables: - #alias0: current for index - #alias1: userData as passed to the macro

func Jobs.parallelVisit [src]

Operate on a range in parallel chunks.

#[Swag.Macro] func(T) parallelVisit(range: [..] T, offset: u32 = 1, userData: *void = null, stmt: #code void)

Exposed variables: - buffer: address of the element of the range to process - data: userData as passed to the macro

func Jobs.scheduleJob [src]

Schedule a job to execute.

func scheduleJob(job: *Job)

func Jobs.setNumWorkers [src]

Set the number of worker threads. Must be done once.

func setNumWorkers(numWorkers: u32 = 0) throw

func Jobs.waitDone [src]

Wait for all registered jobs to be finished.

func waitDone()

func Jobs.waitJob [src]

Wait for a given job to be finished.

func waitJob(job: *Job)

namespace Core.Latin1

Enums

CharAttribute

Functions

compare Compare two utf8 strings, dealing only with latin1 table Returns -1, 0 or 1.
compareNatural Compare two utf8 strings in a natural way, dealing only with latin1 table Returns -1, 0 or 1.
isAscii
isBinDigit
isControl
isDigit
isHexDigit
isLetter
isLetterOrDigit
isLower
isNumber
isPunctuation
isSpace
isSymbol
isUpper
isWord
makeLower Make an utf8 buffer lower case, dealing only with latin1 table.
makeUpper Make an utf8 buffer upper case, dealing only with latin1 table.
toLower
toUpper
trim Trim the string.

enum Latin1.CharAttribute [src]

Zero
Control
Punctuation
BinDigit
HexDigit
Digit
Symbol
Spacing
Upper
Lower
Printable
LowerUtf8
UpperUtf8
Graphical
Letter

func Latin1.compare [src]

Compare two utf8 strings, dealing only with latin1 table Returns -1, 0 or 1.

func compare(src, dst: const [..] u8, ignoreCase = false)->s32

func Latin1.compareNatural [src]

Compare two utf8 strings in a natural way, dealing only with latin1 table Returns -1, 0 or 1.

func compareNatural(src, dst: const [..] u8, ignoreCase = false)->s32

:LICENCE This code is based on natsort by Martin Pool (https://github.com/sourcefrog/natsort) The original code has been modified for Swag See LICENCE.md for the corresponding licence.

func Latin1.isAscii [src]

func isAscii(c: u8)->bool

func Latin1.isBinDigit [src]

func isBinDigit(c: u8)->bool

func Latin1.isControl [src]

func isControl(c: u8)->bool

func Latin1.isDigit [src]

func isDigit(c: u8)->bool

func Latin1.isHexDigit [src]

func isHexDigit(c: u8)->bool

func Latin1.isLetter [src]

func isLetter(c: u8)->bool

func Latin1.isLetterOrDigit [src]

func isLetterOrDigit(c: u8)->bool

func Latin1.isLower [src]

func isLower(c: u8)->bool

func Latin1.isNumber [src]

func isNumber(c: u8)->bool

func Latin1.isPunctuation [src]

func isPunctuation(c: u8)->bool

func Latin1.isSpace [src]

func isSpace(c: u8)->bool

func Latin1.isSymbol [src]

func isSymbol(c: u8)->bool

func Latin1.isUpper [src]

func isUpper(c: u8)->bool

func Latin1.isWord [src]

func isWord(c: u8)->bool

func Latin1.makeLower [src]

Make an utf8 buffer lower case, dealing only with latin1 table.

func makeLower(buffer: [..] u8)

func Latin1.makeUpper [src]

Make an utf8 buffer upper case, dealing only with latin1 table.

func makeUpper(buffer: [..] u8)

func Latin1.toLower [src]

func toLower(c: u8)->u8

func Latin1.toUpper [src]

func toUpper(c: u8)->u8

func Latin1.trim [src]

Trim the string.

func trim(str: string)->string

struct Core.List [src]

A generic, doubly-linked list.

struct List(T)
head *ListEntry'(ListEntry.T) Pointer to the first node in the list.
tail *ListEntry'(ListEntry.T) Pointer to the last node in the list.
count u64 The total number of elements in the list.

Provides efficient insertion and deletion of elements.

Functions

addBack(me, &&T) Adds a new element to the back of the list by moving the value.
addBack(me, T) Adds a new element to the back of the list by copying the value.
addFront(me, &&T) Adds a new element to the front of the list by moving the value.
addFront(me, T) Adds a new element to the front of the list by copying the value.
clear Removes and deallocates all elements from the list.
insertAfter(me, *ListEntry'(T), &&T) Inserts a new element after a specified node by moving the value.
insertAfter(me, *ListEntry'(T), T) Inserts a new element after a specified node by copying the value.
insertBefore(me, *ListEntry'(T), &&T) Inserts a new element before a specified node by moving the value.
insertBefore(me, *ListEntry'(T), T) Inserts a new element before a specified node by copying the value.

Special Functions

opDrop Ensures all nodes are deallocated when the list goes out of scope.
opVisit Provides a way to iterate over each element in the list.

func List.addBack [src]

Adds a new element to the back of the list by copying the value.

func addBack(me, value: T)->*ListEntry'(ListEntry.T)

Returns a pointer to the newly created list node.

Adds a new element to the back of the list by moving the value.

func addBack(me, value: &&T)->*ListEntry'(ListEntry.T)

Returns a pointer to the newly created list node.

func List.addFront [src]

Adds a new element to the front of the list by copying the value.

func addFront(me, value: T)->*ListEntry'(ListEntry.T)

Returns a pointer to the newly created list node.

Adds a new element to the front of the list by moving the value.

func addFront(me, value: &&T)->*ListEntry'(ListEntry.T)

Returns a pointer to the newly created list node.

func List.clear [src]

Removes and deallocates all elements from the list.

func clear(me)

func List.insertAfter [src]

Inserts a new element after a specified node by copying the value.

func insertAfter(me, node: *ListEntry, value: T)->*ListEntry'(ListEntry.T)

Returns a pointer to the newly created list node.

Inserts a new element after a specified node by moving the value.

func insertAfter(me, node: *ListEntry, value: &&T)->*ListEntry'(ListEntry.T)

Returns a pointer to the newly created list node.

func List.insertBefore [src]

Inserts a new element before a specified node by copying the value.

func insertBefore(me, node: *ListEntry, value: T)->*ListEntry'(ListEntry.T)

Returns a pointer to the newly created list node.

Inserts a new element before a specified node by moving the value.

func insertBefore(me, node: *ListEntry, value: &&T)->*ListEntry'(ListEntry.T)

Returns a pointer to the newly created list node.

func List.opDrop [src]

Ensures all nodes are deallocated when the list goes out of scope.

func opDrop(me)

func List.opVisit [src]

Provides a way to iterate over each element in the list.

#[Swag.Macro] func(ptr: bool, back: bool) opVisit(me, stmt: #code void)

This is a macro that accepts a code block to execute for each element. Visiting by pointer and in reverse order is supported. Aliases: - #alias0: The value of the element. - #alias1: A pointer to the list node (ListEntry). - #alias2: The index of the element.

struct Core.ListEntry [src]

Represents a single node in a doubly-linked List.

struct ListEntry(T)
prev *ListEntry'(ListEntry.T) Pointer to the previous node in the list.
next *ListEntry'(ListEntry.T) Pointer to the next node in the list.
value ListEntry.T The value stored in the node.

struct Core.Log [src]

A thread-safe logger that supports multiple output writers and customizable formatting.

lock Sync.Mutex Lock for thread-safe access.
buf StrConv.StringBuilder Internal buffer for building log messages.
dt Time.DateTime Cached date/time at the moment of log call.
writers Array'(ILogWriter) Registered writer interfaces.
prefix string Optional prefix added to each log line.
flags LogFlags Bitwise flags controlling output format.

Functions

addWriter Register a new writer interface.
clearWriters Remove all registered writers.
create Create a new log instance.
getFlags Get the logger flags.
getPrefix Get the logger prefix.
print Print a message to the log with an optional source location.
setFlags Set the logger flags.
setPrefix Set the logger prefix.

func Log.addWriter [src]

Register a new writer interface.

func addWriter(me, writer: ILogWriter)

func Log.clearWriters [src]

Remove all registered writers.

func clearWriters(me)

func Log.create [src]

Create a new log instance.

func create()->Log

func Log.getFlags [src]

Get the logger flags.

func getFlags(me)->LogFlags

func Log.getPrefix [src]

Get the logger prefix.

func getPrefix(me)->string

func Log.print [src]

Print a message to the log with an optional source location.

func print(me, text: string, loc = #callerlocation)

func Log.setFlags [src]

Set the logger flags.

func setFlags(me, flags: LogFlags)

func Log.setPrefix [src]

Set the logger prefix.

func setPrefix(me, prefix: string)

enum Core.LogFlags [src]

Flags to control the format of log output.

Zero No flags set.
Prefix Include custom prefix in log output.
Date Include date (YYYY/MM/DD).
Time Include time (HH:MM:SS:ms).
ShortFileName Include only the file name (exclusive with LongFileName).
LongFileName Include full file path (exclusive with ShortFileName).
Line Include only the start line number (exclusive with FullLoc).
FullLoc Include full location (line/col start and end).
Default Default logging configuration.

namespace Core.Math

Structs

Angle An angle representation struct that stores angles in radians.
Const Structure containing mathematical constants of type T.
Int128
Matrix3x3
Matrix4x4
NumericArray
Point A simple 2D point struct with X and Y coordinates.
Rectangle A simple rectangle struct with position and dimensions.
Transform2 2D transformation matrix structure.
Vector2 A 2D vector struct representing a point or direction in 2D space.
Vector3 A 3D vector struct representing a point or direction in 3D space.
Vector4 A 4D vector struct representing a point or direction in 4D space.

Functions

abs(f32)
abs(f64)
abs(s16)
abs(s32)
abs(s64)
abs(s8)
acos(f32)
acos(f64)
asin(f32)
asin(f64)
atan(f32)
atan(f64)
atan2(f32, f32)
atan2(f64, f64)
bigEndianToNative Convert a big-endian integer to the current architecture's native format.
byteswap(u16) Reverse the byte order of the value.
byteswap(u32)
byteswap(u64)
ceil(f32)
ceil(f64)
ceilS32
ceilS64
clamp Clamp a value between a lower and upper bound.
cos(f32)
cos(f64)
cosh(f32)
cosh(f64)
countOnes(u16)
countOnes(u32)
countOnes(u64)
countOnes(u8) Returns the total number of bits set to 1 in the value.
cubicLerp(f32, f32, f32, f32, f32) Cubic interpolation between a, b, c, and d based on t.
cubicLerp(f64, f64, f64, f64, f64)
exp(f32)
exp(f64)
exp2(f32)
exp2(f64)
floor(f32)
floor(f64)
floorS32
floorS64
fract(f32) Get the fractional part.
fract(f64)
gcd Find the gcd between a and b.
hasByte(u16, u8) Determin if an integer has a given byte.
hasByte(u32, u8)
hasByte(u64, u8)
hasZeroByte(u16) Determin if any of the bytes is zero.
hasZeroByte(u32)
hasZeroByte(u64)
interpHermite(f32) Hermite interpolation function.
interpHermite(f64)
interpQuintic(f32) Quintic interpolation function.
interpQuintic(f64)
isEqualEpsilon(f32, f32, f32) Check if x and y are approximately equal within an epsilon threshold.
isEqualEpsilon(f64, f64, f64)
isFinite(f32) Returns true if the value is finite (not infinite and not NaN).
isFinite(f64) Returns true if the value is finite (not infinite and not NaN).
isNaN(f32) Check if x is NaN (not a number).
isNaN(f64)
isPowerOf2(u16)
isPowerOf2(u32)
isPowerOf2(u64)
isPowerOf2(u8)
isZeroEpsilon(f32, f32) Check if x is approximately zero within an epsilon threshold.
isZeroEpsilon(f64, f64)
lcm Find the Least Common Multiple between a and b.
leadingZeros(u16)
leadingZeros(u32)
leadingZeros(u64)
leadingZeros(u8) Returns the number of leading zero bits from the most significant bit.
lerp(f32, f32, f32) Linear interpolation between x and y based on factor.
lerp(f64, f64, f64)
littleEndianToNative Convert a little-endian integer to the current architecture's native format.
log(f32)
log(f64)
log10(f32)
log10(f64)
log2(f32)
log2(f64)
make64 Make a 64 bits with two 32 bits.
makeRepeat16 Make a 16 bits by repeating a given byte 0x20 => 0x2020.
makeRepeat32 Make a 32 bits by repeating a given byte 0x20 => 0x20202020.
makeRepeat64 Make a 64 bits by repeating a given byte 0x20 => 0x20202020_20202020.
map(f32, f32, f32, f32, f32) Maps val from the range [minSrc, maxSrc] to [minDst, maxDst].
map(f64, f64, f64, f64, f64)
max(T, T) Return the larger of two values.
max(T, T, T) Return the largest of three values.
max(T, T, T, T) Return the largest of four values.
max(f32, f32)
max(f64, f64)
max(s16, s16)
max(s32, s32)
max(s64, s64)
max(s8, s8)
max(u16, u16)
max(u32, u32)
max(u64, u64)
max(u8, u8)
min(T, T) Return the smaller of two values.
min(T, T, T) Return the smallest of three values.
min(T, T, T, T) Return the smallest of four values.
min(f32, f32)
min(f64, f64)
min(s16, s16)
min(s32, s32)
min(s64, s64)
min(s8, s8)
min(u16, u16)
min(u32, u32)
min(u64, u64)
min(u8, u8)
moveTowards(f32, f32, f32) Interpolation at constant speed - moves a fixed distance per step.
moveTowards(f64, f64, f64)
mulAdd(f32, f32, f32)
mulAdd(f64, f64, f64)
mulU64
nativeToBigEndian Convert a native architecture integer to big-endian format.
pow(f32, f32)
pow(f64, f64)
powerOf10(f32) Calculates the smallest power of 10 greater than or equal to the given number val.
powerOf10(f64)
reverse(u16) Reverse all bits in a 16-bit value.
reverse(u32) Reverse all bits in a 32-bit value using bit manipulation.
reverse(u64) Reverse all bits in a 64-bit value using bit manipulation.
reverse(u8) Reverse all bits in an 8-bit value using lookup table.
rol(u16, u8)
rol(u32, u8)
rol(u64, u8)
rol(u8, u8) Rotate bits left by y positions.
ror(u16, u8)
ror(u32, u8)
ror(u64, u8)
ror(u8, u8) Rotate bits right by y positions.
round(f32)
round(f64)
roundDownToPowerOf2(u32)
roundDownToPowerOf2(u64)
roundS32
roundS64
roundUpToPowerOf2(u32)
roundUpToPowerOf2(u64)
saturate(f32) Clamps x between 0 and 1.
saturate(f64)
sign(f32) Returns the sign of x (-1 for negative, 1 for positive).
sign(f64)
sign(s16)
sign(s32)
sign(s64)
sign(s8)
sin(f32)
sin(f64)
sinh(f32)
sinh(f64)
smoothDamp Perform smooth damping interpolation towards target.
smoothstep(f32, f32, f32) Smoothstep interpolation between edge0 and edge1.
smoothstep(f64, f64, f64)
sqrt(f32)
sqrt(f64)
tan(f32)
tan(f64)
tanh(f32)
tanh(f64)
toDegrees(f32) Convert radians to degrees.
toDegrees(f64)
toRadians(f32)
toRadians(f64)
trailingZeros(u16)
trailingZeros(u32)
trailingZeros(u64)
trailingZeros(u8) Returns the number of trailing zero bits from the least significant bit.
trunc(f32)
trunc(f64)
truncS32
truncS64

struct Math.Angle [src]

An angle representation struct that stores angles in radians.

rad f32 The angle value stored in radians.

Provides convenient conversion between radians and degrees with literal suffix support.

Functions

toDegrees Convert the angle from radians to degrees.

Special Functions

opAffect Assign a radian value directly to the angle.
opAffectLiteral Assign angle values with unit suffixes (rad or deg).

func Angle.opAffect [src]

Assign a radian value directly to the angle.

func opAffect(me, valueRad: f32)

Allows implicit conversion from floating-point values representing radians.

func Angle.opAffectLiteral [src]

Assign angle values with unit suffixes (rad or deg).

func(suffix: string) opAffectLiteral(me, value: f32)

Supports literal syntax like 90deg' or 1.57rad' for convenient angle creation.

func Angle.toDegrees [src]

Convert the angle from radians to degrees.

func toDegrees(const me)->f32

Returns the angle value in degrees as a floating-point number.

struct Math.Const [src]

Structure containing mathematical constants of type T.

struct Const(T)
Pi Math.Const.T Pi constant.
E Math.Const.T Euler's number.
TwoPi Math.Const.T 2 times Pi.
PiBy2 Math.Const.T Pi divided by 2.
PiBy3 Math.Const.T Pi divided by 3.
PiBy4 Math.Const.T Pi divided by 4.
PiBy6 Math.Const.T Pi divided by 6.
PiBy8 Math.Const.T Pi divided by 8.
ThreePiBy4 Math.Const.T 3 times Pi divided by 4.
OneByPi Math.Const.T Reciprocal of Pi.
TwoByPi Math.Const.T 2 divided by Pi.
Sqrt2 Math.Const.T Square root of 2.
OneBySqrt2 Math.Const.T Reciprocal of square root of 2.
Ln2 Math.Const.T Natural logarithm of 2.
Ln10 Math.Const.T Natural logarithm of 10.
Log2E Math.Const.T Log base 2 of Euler's number.
Log10E Math.Const.T Log base 10 of Euler's number.
Epsilon Math.Const.T Smallest value for floating-point precision comparisons.

namespace Core.Math.Curve

Functions

evaluateBezier(const &Vector2, const &Vector2, const &Vector2, const &Vector2, f32) Evaluate a cubic Bézier curve at parameter t.
evaluateBezier(const &Vector2, const &Vector2, const &Vector2, f32) Evaluate a quadratic Bézier curve at parameter t.
evaluatePolynomial Evaluate a cubic polynomial at parameter t.
getBezierBoundingBox(const &Vector2, const &Vector2, const &Vector2) Calculate the axis-aligned bounding box of a quadratic Bézier curve.
getBezierBoundingBox(const &Vector2, const &Vector2, const &Vector2, const &Vector2) Calculate the axis-aligned bounding box of a cubic Bézier curve.

func Curve.evaluateBezier [src]

Evaluate a quadratic Bézier curve at parameter t.

func evaluateBezier(start, end, ctrl: Vector2, t: f32)->Math.Vector2

Formula: (1-t)²start + 2t(1-t)ctrl + t²end where t ranges from 0.0 to 1.0.

Evaluate a cubic Bézier curve at parameter t.

func evaluateBezier(start, end, ctrl1, ctrl2: Vector2, t: f32)->Math.Vector2

Formula: (1-t)³start + 3t(1-t)²ctrl1 + 3t²(1-t)ctrl2 + t³end where t ranges from 0.0 to 1.0.

func Curve.evaluatePolynomial [src]

Evaluate a cubic polynomial at parameter t.

func evaluatePolynomial(p0, p1, p2, p3: Vector2, t: f32)->Math.Vector2

Uses Horner's method for efficient computation: P(t) = ((p0t + p1)t + p2)t + p3.

func Curve.getBezierBoundingBox [src]

Calculate the axis-aligned bounding box of a cubic Bézier curve.

func getBezierBoundingBox(start, end, ctrl0, ctrl1: Vector2)->Math.Rectangle

Finds extrema by solving the derivative equation and evaluating the curve at critical points.

Calculate the axis-aligned bounding box of a quadratic Bézier curve.

func getBezierBoundingBox(start, end, ctrl: Vector2)->Math.Rectangle

Finds extrema by solving the linear derivative equation for critical points.

namespace Core.Math.Geometry

Functions

distanceToLine Calculate the perpendicular distance from a point to an infinite line.
distanceToSegment Calculate the shortest distance from a point to a line segment.
isInEllipse Test if a point is inside an ellipse.
isInTriangle Test if a point is inside a triangle using cross product method.
lineLineIntersect Find the intersection point of two infinite lines.
nearestPointsSegSeg Find the closest points between two line segments and their distance.
polyContains Test if a point is inside a polygon using ray casting algorithm.
segSegIntersect Find the intersection point of two line segments.

func Geometry.distanceToLine [src]

Calculate the perpendicular distance from a point to an infinite line.

func distanceToLine(self, a, b: Vector2)->f32

Projects the point onto the line and returns the distance to the projection.

func Geometry.distanceToSegment [src]

Calculate the shortest distance from a point to a line segment.

func distanceToSegment(self, a, b: Vector2)->f32

Handles endpoints by clamping the projection to the segment bounds.

func Geometry.isInEllipse [src]

Test if a point is inside an ellipse.

func isInEllipse(self, center: Vector2, radiusX, radiusY: f32)->bool

Uses the standard ellipse equation: (x-cx)²/rx² + (y-cy)²/ry² ≤ 1.

func Geometry.isInTriangle [src]

Test if a point is inside a triangle using cross product method.

func isInTriangle(self, a, b, c: Vector2)->bool

Uses barycentric coordinates by checking if all cross products have the same sign.

func Geometry.lineLineIntersect [src]

Find the intersection point of two infinite lines.

func lineLineIntersect(start0, end0, start1, end1: Vector2, epsilon: f32 = ConstF32.Epsilon)->{yes:bool,pos:Math.Vector2}

Returns the intersection point if lines are not parallel, otherwise returns failure.

func Geometry.nearestPointsSegSeg [src]

Find the closest points between two line segments and their distance.

func nearestPointsSegSeg(p0, p1, q0, q1: Math.Vector2)->{a:Math.Vector2,b:Math.Vector2,dist:f32}

Implementation based on David Eberly's Geometric Tools library algorithm.


David Eberly, Geometric Tools, Redmond WA 98052 Copyright (c) 1998-2022 Distributed under the Boost Software License, Version 1.0. https://www.boost.org/LICENSE_1_0.txt https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt https://www.geometrictools.com/Documentation/DistanceSegments3D.pdf https://www.geometrictools.com/GTE/Mathematics/DistSegmentSegment.h


func Geometry.polyContains [src]

Test if a point is inside a polygon using ray casting algorithm.

func polyContains(poly: Array'Math.Vector2, pt: Math.Vector2)->bool

Implementation of the PNPoly algorithm by W. Randolph Franklin.

func Geometry.segSegIntersect [src]

Find the intersection point of two line segments.

func segSegIntersect(start0, end0, start1, end1: Vector2, epsilon: f32 = ConstF32.Epsilon)->{yes:bool,pos:Math.Vector2}

Returns the intersection point only if it lies within both segment bounds.

struct Math.Int128 [src]

lo u64
hi s64

Functions

mul

Special Functions

opCast
opCmp

func Int128.mul [src]

func mul(x, y: s64)->Math.Int128

func Int128.opCast [src]

func opCast(const me)->f64

func Int128.opCmp [src]

func opCmp(const me, other: Int128)->s32

struct Math.Matrix3x3 [src]

m [3,3] f32

Functions

setIdentity

func Matrix3x3.setIdentity [src]

func setIdentity(me)

struct Math.Matrix4x4 [src]

m [4,4] f32

Functions

setIdentity

func Matrix4x4.setIdentity [src]

func setIdentity(me)

struct Math.NumericArray [src]

struct NumericArray(T, N: u32)
buf [?] Math.NumericArray.T

Functions

from
mulAdd(me, T, T) Multiply & add.
mulAdd(me, const &NumericArray'(T, N), const &NumericArray'(T, N)) Multiply & Add.
set Set all values.

Special Functions

opAffect(me, T)
opAffect(me, const [..] T)
opAssign(me, T)
opAssign(me, const &NumericArray'(T, N))
opBinary
opEquals
opIndex

func NumericArray.from [src]

func from(values: T...)->Math.NumericArray'(Math.NumericArray.T, N)

func NumericArray.mulAdd [src]

Multiply & add.

func mulAdd(me, value1, value2: T)

Multiply & Add.

func mulAdd(me, value1, value2: NumericArray)

func NumericArray.opAffect [src]

func opAffect(me, what: T) func opAffect(me, what: const [..] T)

func NumericArray.opAssign [src]

func(op: string) opAssign(me, value: T) func(op: string) opAssign(me, value: NumericArray)

func NumericArray.opBinary [src]

func(op: string) opBinary(const me, other: NumericArray)->Math.NumericArray'(Math.NumericArray.T, N)

func NumericArray.opEquals [src]

func opEquals(const me, other: NumericArray)->bool

func NumericArray.opIndex [src]

func opIndex(const me, idx: u64)->Math.NumericArray.T

func NumericArray.set [src]

Set all values.

func set(me, values: T...)

struct Math.Point [src]

A simple 2D point struct with X and Y coordinates.

x f32 X coordinate of the point.
y f32 Y coordinate of the point.

Contains x and y components as 32-bit floating point values for representing positions in 2D space.

Functions

ceil Round both coordinates up to the next integer values.
clear Set both coordinates to zero.
isEqualEpsilon Returns true if this point is equal to other within an epsilon tolerance.
isZero Returns true if this point is exactly at the origin.
isZeroEpsilon Returns true if this point is at the origin within an epsilon tolerance.
offset(me, f32) Offset both coordinates by the same scalar value.
offset(me, f32, f32) Offset this point by separate x and y values.
round Round both coordinates to the nearest integer values.
trunc Truncate both coordinates to integer values.

Special Functions

opAffect Set both coordinates to the same scalar value.
opAssign(me, const &Point) Compound assignment operators for point-point operations (+=, -=, =, /=).
opAssign(me, f32) Compound assignment operators for point-scalar operations (+=, -=, =, /=).
opBinary(me, const &Point) Binary operators for point-point operations (+, -, , /).
opBinary(me, f32) Binary operators for point-scalar operations (+, -, , /).
opUnary Apply unary operations to the point.

func Point.ceil [src]

Round both coordinates up to the next integer values.

func ceil(me)

Applies Math.ceil function to both x and y coordinates in-place.

func Point.clear [src]

Set both coordinates to zero.

func clear(me)

Equivalent to assigning the Zero constant but modifies the current instance.

func Point.isEqualEpsilon [src]

Returns true if this point is equal to other within an epsilon tolerance.

func isEqualEpsilon(const me, other: Point, eps = ConstF32.Epsilon)->bool

Compares each coordinate separately using the specified eps tolerance.

func Point.isZero [src]

Returns true if this point is exactly at the origin.

func isZero(const me)->bool

Performs exact floating-point comparison, which may not work well with computed values.

func Point.isZeroEpsilon [src]

Returns true if this point is at the origin within an epsilon tolerance.

func isZeroEpsilon(const me, eps = ConstF32.Epsilon)->bool

Uses eps parameter to handle floating-point precision issues.

func Point.offset [src]

Offset both coordinates by the same scalar value.

func offset(me, value: f32)

Adds value to both x and y coordinates of this point.

Offset this point by separate x and y values.

func offset(me, x, y: f32)

Adds the specified x and y offsets to the corresponding coordinates.

func Point.opAffect [src]

Set both coordinates to the same scalar value.

func opAffect(me, value: f32)

This allows assignment like 'point = 5.0' to set both coordinates to 5.0.

func Point.opAssign [src]

Compound assignment operators for point-point operations (+=, -=, =, /=).

func(op: string) opAssign(me, other: Point)

Performs component-wise operations with another point.

Compound assignment operators for point-scalar operations (+=, -=, =, /=).

func(op: string) opAssign(me, value: f32)

Applies the scalar value to both coordinates of the point.

func Point.opBinary [src]

Binary operators for point-point operations (+, -, , /).

func(op: string) opBinary(const me, other: Point)->Math.Point

Performs component-wise operations between two points and returns the result.

Binary operators for point-scalar operations (+, -, , /).

func(op: string) opBinary(const me, value: f32)->Math.Point

Applies the scalar value to both coordinates and returns the result.

func Point.opUnary [src]

Apply unary operations to the point.

func(op: string) opUnary(const me)->Math.Point

Currently supports negation (-) to return a point with both coordinates negated.

func Point.round [src]

Round both coordinates to the nearest integer values.

func round(me)

Applies Math.round function to both x and y coordinates in-place.

func Point.trunc [src]

Truncate both coordinates to integer values.

func trunc(me)

Applies Math.trunc function to both x and y coordinates, removing fractional parts.

struct Math.Rectangle [src]

A simple rectangle struct with position and dimensions.

x f32 Left position.
y f32 Top position.
width f32 Rectangle width.
height f32 Rectangle height.

Represents an axis-aligned rectangle using top-left position and width/height dimensions.

Functions

applyPadding Apply padding to all sides of the rectangle.
area Get the area of the rectangle.
aspectRatio Get the aspect ratio of the rectangle.
bottom Get the bottom edge coordinate.
bottomLeft Get the bottom-left corner point.
bottomRight Get the bottom-right corner point.
ceil Round all rectangle components up to the next integer values.
center Get the center point of the rectangle.
clampPoint Clamp a point to be within the rectangle bounds.
clear Set all rectangle components to zero.
contains(me, const &Point) Test if the specified point is contained within the rectangle.
contains(me, const &Rectangle) Test if the specified rectangle is entirely contained within this rectangle.
contains(me, f32, f32) Test if the specified coordinates are contained within the rectangle.
createFittedWithin Create a rectangle that fits within bounds while maintaining aspect ratio.
distanceToPoint Get the distance from a point to the rectangle.
expandToInclude(me, const &Point) Expand the rectangle to include a point.
expandToInclude(me, const &Rectangle) Expand the rectangle to include another rectangle.
fitWithin Fit this rectangle within bounds while maintaining aspect ratio.
getUnion Create a rectangle representing the union of two rectangles.
horzCenter Get the horizontal center coordinate.
inflate(me, f32) Inflate the rectangle uniformly in all directions.
inflate(me, f32, f32) Inflate the rectangle by different amounts horizontally and vertically.
intersect(me, const &Rectangle) Intersect this rectangle with another rectangle in-place.
intersect(const &Rectangle, const &Rectangle) Create a rectangle representing the intersection of two rectangles.
intersectWith Test if this rectangle intersects with another rectangle.
isEmpty Returns true if the rectangle has zero area.
isEmptyEpsilon Returns true if the rectangle has zero area within epsilon tolerance.
isEqualEpsilon Returns true if this rectangle equals other within epsilon tolerance.
isNormalized Returns true if the rectangle has non-negative dimensions.
isZero Returns true if all rectangle components are exactly zero.
isZeroEpsilon Returns true if all rectangle components are zero within epsilon tolerance.
moveBottom Extend the bottom edge downward by the specified amount.
moveLeft Move the left edge inward by the specified amount.
moveRight Extend the right edge outward by the specified amount.
moveTop Move the top edge downward by the specified amount.
normalize Normalize the rectangle to ensure positive width and height.
offset(me, const &Point) Offset the rectangle position by a point vector.
offset(me, f32) Offset the rectangle position by the same amount in both directions.
offset(me, f32, f32) Offset the rectangle position by separate x and y amounts.
perimeter Get the perimeter of the rectangle.
right Get the right edge coordinate.
round Round all rectangle components to the nearest integer values.
scale(me, f32) Scale the rectangle dimensions uniformly.
scale(me, f32, f32) Scale the rectangle dimensions independently.
set Initialize the rectangle using two corner points.
setBottom Set the bottom edge coordinate by adjusting the height.
setRight Set the right edge coordinate by adjusting the width.
setSize Set the size of the rectangle.
setUnion Set this rectangle to the union with another rectangle.
size Get the size of the rectangle as a point.
toNormalized Get a normalized copy of the rectangle.
topLeft Get the top-left corner point.
topRight Get the top-right corner point.
trunc Truncate all rectangle components to integer values.
vertCenter Get the vertical center coordinate.

Special Functions

opBinary Scale the rectangle by a scalar value.
opEquals Check if this rectangle is exactly equal to another rectangle.

func Rectangle.applyPadding [src]

Apply padding to all sides of the rectangle.

func applyPadding(me, padding: Math.Vector4)

Uses Vector4 components as left, top, right, bottom padding values respectively.

func Rectangle.area [src]

Get the area of the rectangle.

func area(const me)->f32

Calculated as width × height, may be negative for non-normalized rectangles.

func Rectangle.aspectRatio [src]

Get the aspect ratio of the rectangle.

func aspectRatio(const me)->f32

Returns width / height, or 0 if height is zero.

func Rectangle.bottom [src]

Get the bottom edge coordinate.

func bottom(const me)->f32

Calculated as y + height.

func Rectangle.bottomLeft [src]

Get the bottom-left corner point.

func bottomLeft(const me)->Math.Point

Returns a Point at (x, y + height).

func Rectangle.bottomRight [src]

Get the bottom-right corner point.

func bottomRight(const me)->Math.Point

Returns a Point at (x + width, y + height).

func Rectangle.ceil [src]

Round all rectangle components up to the next integer values.

func ceil(me)

Applies Math.ceil function to all components in-place.

func Rectangle.center [src]

Get the center point of the rectangle.

func center(const me)->Math.Point

Returns a Point containing the horizontal and vertical center coordinates.

func Rectangle.clampPoint [src]

Clamp a point to be within the rectangle bounds.

func clampPoint(const me, pt: Point)->Math.Point

Returns the closest point inside or on the rectangle boundary.

func Rectangle.clear [src]

Set all rectangle components to zero.

func clear(me)

Equivalent to assigning the Zero constant but modifies the current instance.

func Rectangle.contains [src]

Test if the specified coordinates are contained within the rectangle.

func contains(const me, x, y: f32)->bool

Uses half-open interval [x, x+width) × [y, y+height) for containment test.

Test if the specified point is contained within the rectangle.

func contains(const me, pt: Point)->bool

Delegates to the coordinate-based contains method.

Test if the specified rectangle is entirely contained within this rectangle.

func contains(const me, rect: Rectangle)->bool

Returns true only if rect is completely inside the bounds of this rectangle.

func Rectangle.createFittedWithin [src]

Create a rectangle that fits within bounds while maintaining aspect ratio.

func createFittedWithin(rect: Rectangle, bounds: Rectangle)->Math.Rectangle

Returns a new rectangle scaled to fit inside bounds without distortion.

func Rectangle.distanceToPoint [src]

Get the distance from a point to the rectangle.

func distanceToPoint(const me, pt: Point)->f32

Returns 0 if the point is inside the rectangle, otherwise returns the shortest distance to the boundary.

func Rectangle.expandToInclude [src]

Expand the rectangle to include a point.

func expandToInclude(me, pt: Point)

Grows the rectangle if necessary to contain the specified point.

Expand the rectangle to include another rectangle.

func expandToInclude(me, other: Rectangle)

Grows the rectangle if necessary to contain the entire specified rectangle.

func Rectangle.fitWithin [src]

Fit this rectangle within bounds while maintaining aspect ratio.

func fitWithin(me, bounds: Rectangle)

Scales the rectangle to fit inside bounds without distortion.

func Rectangle.getUnion [src]

Create a rectangle representing the union of two rectangles.

func getUnion(a, b: Rectangle)->Math.Rectangle

Returns the smallest rectangle that completely contains both a and b.

func Rectangle.horzCenter [src]

Get the horizontal center coordinate.

func horzCenter(const me)->f32

Calculated as x + width / 2.

func Rectangle.inflate [src]

Inflate the rectangle uniformly in all directions.

func inflate(me, value: f32)

Expands the rectangle by value on all sides, moving position and increasing dimensions.

Inflate the rectangle by different amounts horizontally and vertically.

func inflate(me, x, y: f32)

Expands by x horizontally and y vertically on all sides.

func Rectangle.intersect [src]

Intersect this rectangle with another rectangle in-place.

func intersect(me, other: Rectangle)

Modifies this rectangle to contain only the overlapping area with other.

Create a rectangle representing the intersection of two rectangles.

func intersect(a, b: Rectangle)->Math.Rectangle

Returns the overlapping area between a and b, or Zero if no intersection exists.

func Rectangle.intersectWith [src]

Test if this rectangle intersects with another rectangle.

func intersectWith(const me, rect: Rectangle)->bool

Returns true if there is any overlap between the two rectangles.

func Rectangle.isEmpty [src]

Returns true if the rectangle has zero area.

func isEmpty(const me)->bool

A rectangle is empty if either width or height is zero.

func Rectangle.isEmptyEpsilon [src]

Returns true if the rectangle has zero area within epsilon tolerance.

func isEmptyEpsilon(const me, eps = ConstF32.Epsilon)->bool

Checks if both width and height are zero within the specified tolerance.

func Rectangle.isEqualEpsilon [src]

Returns true if this rectangle equals other within epsilon tolerance.

func isEqualEpsilon(const me, other: Rectangle, eps = ConstF32.Epsilon)->bool

Compares all four components separately using the specified eps tolerance.

func Rectangle.isNormalized [src]

Returns true if the rectangle has non-negative dimensions.

func isNormalized(me)->bool

A normalized rectangle has width and height greater than or equal to zero.

func Rectangle.isZero [src]

Returns true if all rectangle components are exactly zero.

func isZero(const me)->bool

Performs exact floating-point comparison, which may not work well with computed values.

func Rectangle.isZeroEpsilon [src]

Returns true if all rectangle components are zero within epsilon tolerance.

func isZeroEpsilon(const me, eps = ConstF32.Epsilon)->bool

Uses eps parameter to handle floating-point precision issues.

func Rectangle.moveBottom [src]

Extend the bottom edge downward by the specified amount.

func moveBottom(me, value: f32)

Increases height by value, extending the rectangle downward.

func Rectangle.moveLeft [src]

Move the left edge inward by the specified amount.

func moveLeft(me, value: f32)

Increases x and decreases width by value, effectively shrinking from the left.

func Rectangle.moveRight [src]

Extend the right edge outward by the specified amount.

func moveRight(me, value: f32)

Increases width by value, extending the rectangle to the right.

func Rectangle.moveTop [src]

Move the top edge downward by the specified amount.

func moveTop(me, value: f32)

Increases y and decreases height by value, effectively shrinking from the top.

func Rectangle.normalize [src]

Normalize the rectangle to ensure positive width and height.

func normalize(me)

Adjusts position and dimensions if width or height are negative.

func Rectangle.offset [src]

Offset the rectangle position by the same amount in both directions.

func offset(me, offsetXY: f32)

Adds offsetXY to both x and y coordinates without changing dimensions.

Offset the rectangle position by separate x and y amounts.

func offset(me, offsetX, offsetY: f32)

Adds offsetX to x coordinate and offsetY to y coordinate.

Offset the rectangle position by a point vector.

func offset(me, offset: Math.Point)

Adds the point's x and y components to the rectangle's position.

func Rectangle.opBinary [src]

Scale the rectangle by a scalar value.

func(op: string) opBinary(const me, value: f32)->Math.Rectangle

Multiplies all components (position and dimensions) by the given value.

func Rectangle.opEquals [src]

Check if this rectangle is exactly equal to another rectangle.

func opEquals(const me, other: Rectangle)->bool

Performs exact floating-point comparison of all four components.

func Rectangle.perimeter [src]

Get the perimeter of the rectangle.

func perimeter(const me)->f32

Calculated as 2 × (width + height).

func Rectangle.right [src]

Get the right edge coordinate.

func right(const me)->f32

Calculated as x + width.

func Rectangle.round [src]

Round all rectangle components to the nearest integer values.

func round(me)

Applies Math.round function to position and dimension components in-place.

func Rectangle.scale [src]

Scale the rectangle dimensions uniformly.

func scale(me, value: f32)

Multiplies both width and height by value without changing position.

Scale the rectangle dimensions independently.

func scale(me, x, y: f32)

Multiplies width by x and height by y without changing position.

func Rectangle.set [src]

Initialize the rectangle using two corner points.

func set(me, topLeft, bottomRight: Math.Point)

Automatically handles the case where points are not in top-left/bottom-right order.

func Rectangle.setBottom [src]

Set the bottom edge coordinate by adjusting the height.

func setBottom(me, value: f32)

Modifies height to make the bottom edge equal to value.

func Rectangle.setRight [src]

Set the right edge coordinate by adjusting the width.

func setRight(me, value: f32)

Modifies width to make the right edge equal to value.

func Rectangle.setSize [src]

Set the size of the rectangle.

func setSize(me, newSize: Point)

Modifies width and height without changing position.

func Rectangle.setUnion [src]

Set this rectangle to the union with another rectangle.

func setUnion(me, other: Rectangle)

Modifies this rectangle to be the smallest rectangle containing both this and other.

func Rectangle.size [src]

Get the size of the rectangle as a point.

func size(const me)->Math.Point

Returns a Point containing width and height values.

func Rectangle.toNormalized [src]

Get a normalized copy of the rectangle.

func toNormalized(const me)->Math.Rectangle

Returns a new rectangle with positive width and height without modifying the original.

func Rectangle.topLeft [src]

Get the top-left corner point.

func topLeft(const me)->Math.Point

Returns a Point containing the x and y coordinates.

func Rectangle.topRight [src]

Get the top-right corner point.

func topRight(const me)->Math.Point

Returns a Point at (x + width, y).

func Rectangle.trunc [src]

Truncate all rectangle components to integer values.

func trunc(me)

Applies Math.trunc function to all components, removing fractional parts.

func Rectangle.vertCenter [src]

Get the vertical center coordinate.

func vertCenter(const me)->f32

Calculated as y + height / 2.

struct Math.Transform2 [src]

2D transformation matrix structure.

m11 f32 First row of the 2D transformation matrix.
m12 f32
m21 f32 Second row of the 2D transformation matrix.
m22 f32
m31 f32 Translation components of the transformation.
m32 f32
m [2,2] f32 2x2 matrix view for rotation/scale components.
tx f32 Translation component along X-axis.
ty f32 Translation component along Y-axis.

Functions

createRotation Creates a rotation matrix, with a given center of rotation.
createScale Creates a scale matrix, with a given center.
createTranslation Creates a translation matrix.
getTranslation Gets the translation components.
isIdentity Checks if the transform is the identity matrix.
multiply Multiplies the current transform by another transformation matrix.
setIdentity Set transform to identity.
setTranslation Sets the translation components directly.
transformPoint Applies the transform to a 2D point.

func Transform2.createRotation [src]

Creates a rotation matrix, with a given center of rotation.

func createRotation(angle: f32, centerX, centerY: f32)->Math.Transform2

func Transform2.createScale [src]

Creates a scale matrix, with a given center.

func createScale(scaleX, scaleY: f32, centerX, centerY: f32)->Math.Transform2

func Transform2.createTranslation [src]

Creates a translation matrix.

func createTranslation(x, y: f32)->Math.Transform2

func Transform2.getTranslation [src]

Gets the translation components.

func getTranslation(me)->Math.Vector2

func Transform2.isIdentity [src]

Checks if the transform is the identity matrix.

func isIdentity(const me)->bool

func Transform2.multiply [src]

Multiplies the current transform by another transformation matrix.

func multiply(me, matrix2: Transform2)

func Transform2.setIdentity [src]

Set transform to identity.

func setIdentity(me)

func Transform2.setTranslation [src]

Sets the translation components directly.

func setTranslation(me, translation: Vector2)

func Transform2.transformPoint [src]

Applies the transform to a 2D point.

func transformPoint(me, point: Vector2)->Math.Vector2

struct Math.Vector2 [src]

A 2D vector struct representing a point or direction in 2D space.

x f32 X and Y components of the vector.
y f32

Contains x and y components as 32-bit floating point values.

Functions

angle0To2Pi Returns the angle between this vector and other in the range [0, 2π].
angleTo Returns the angle between this vector and other in radians.
ceil Apply ceiling function to both components in-place.
clamp Clamp this vector's components between min and max values.
clampLength Clamp this vector's length to be within minLength and maxLength.
clampedLength Returns a new vector with length clamped between minLength and maxLength.
cosAngleTo Returns the cosine of the angle between this vector and other.
cross(me, const &Vector2) Returns the Z component of the cross product (scalar cross product in 2D).
cross(me, f32) Returns the perpendicular vector in the 2D plane scaled by axis.
distanceTo Returns the Euclidean distance between this vector and dest.
distanceToSquared Returns the squared distance between this vector and dest.
dot Returns the dot product between this vector and other.
floor Apply floor function to both components in-place.
fromPolar Create a vector from polar coordinates.
isEqualEpsilon Returns true if this vector is equal to other within an epsilon tolerance.
isFinite Returns true if all components are finite (not infinite or NaN).
isNaN Returns true if any component is NaN (Not a Number).
isZero Returns true if this vector is exactly zero.
isZeroEpsilon Returns true if this vector is zero within an epsilon tolerance.
length Returns the length (magnitude) of the vector.
lengthSquared Returns the squared length of the vector.
lerpTo Perform linear interpolation between two vectors.
makeAbs Apply absolute value to both components in-place.
max Returns a vector containing the maximum components of two vectors.
min Returns a vector containing the minimum components of two vectors.
moveTowards Move this vector towards target by a maximum distance of maxDistance.
negate Negate the vector in-place.
normalize Normalize this vector in-place to unit length.
normalizeSafe Normalize this vector in-place safely.
rotateBy Rotate the vector by a given angle around the origin.
round Apply rounding function to both components in-place.
set Set both components of the vector.
setAngle Rotate this vector to face the specified angle in radians.
setLength Set the vector to the specified length.
setLengthSafe Set the vector to the specified length safely.
setZero Set both vector components to zero.
smoothDamp Perform smooth damping interpolation towards target.
toAbs Returns the absolute value of each component.
toAngle Returns the angle of this vector in radians.
toClamped Returns a new vector with components clamped between min and max values.
toMovedTowards Returns a vector moved towards target by a maximum distance of maxDistance.
toNormalized Returns this vector normalized to unit length without modifying the original.
toNormalizedSafe Returns this vector normalized safely without modifying the original.
toPerp Returns a vector perpendicular to this one (rotated 90 degrees counter-clockwise).
toPerpCW Returns a vector perpendicular to this one (rotated 90 degrees clockwise).
toPolar Convert this vector to polar coordinates.
toProject Project this vector onto other vector.
toReflect Reflect this vector across a surface with the given normal.
toSign Returns the component-wise sign of the vector (-1, 0, or 1 for each component).

Special Functions

opAffect Set both components to the same scalar value.
opAssign(me, const &Vector2) Compound assignment operators for vector-vector operations (+=, -=, =, /=).
opAssign(me, f32) Compound assignment operators for vector-scalar operations (+=, -=, =, /=).
opBinary(me, const &Vector2) Binary operators for vector-vector operations (+, -, , /).
opBinary(me, f32) Binary operators for vector-scalar operations (+, -, , /).
opUnary Apply unary operations to the vector.

func Vector2.angle0To2Pi [src]

Returns the angle between this vector and other in the range [0, 2π].

func angle0To2Pi(const me, other: Vector2)->f32

Uses the cross product to determine the sign and adjust the angle accordingly.

func Vector2.angleTo [src]

Returns the angle between this vector and other in radians.

func angleTo(const me, other: Vector2)->f32

The result is in the range [0, π] using the arc cosine of the normalized dot product.

func Vector2.ceil [src]

Apply ceiling function to both components in-place.

func ceil(me)

Rounds each component up to the nearest integer value.

func Vector2.clamp [src]

Clamp this vector's components between min and max values.

func clamp(me, min, max: Vector2)

Each component is independently clamped to stay within the specified range.

func Vector2.clampLength [src]

Clamp this vector's length to be within minLength and maxLength.

func clampLength(me, minLength, maxLength: f32)

Preserves the vector's direction while constraining its magnitude.

func Vector2.clampedLength [src]

Returns a new vector with length clamped between minLength and maxLength.

func clampedLength(const me, minLength, maxLength: f32)->Math.Vector2

Preserves the vector's direction while constraining its magnitude.

func Vector2.cosAngleTo [src]

Returns the cosine of the angle between this vector and other.

func cosAngleTo(const me, other: Vector2)->f32

Calculated using the dot product formula: dot(a,b) / (|a| * |b|).

func Vector2.cross [src]

Returns the perpendicular vector in the 2D plane scaled by axis.

func cross(const me, axis: f32)->Math.Vector2

The axis parameter determines the sign and scale of the result.

Returns the Z component of the cross product (scalar cross product in 2D).

func cross(const me, other: Vector2)->f32

Calculates the determinant of the 2x2 matrix formed by the two vectors.

func Vector2.distanceTo [src]

Returns the Euclidean distance between this vector and dest.

func distanceTo(const me, dest: Vector2)->f32

Calculated as the length of the difference vector between the two positions.

func Vector2.distanceToSquared [src]

Returns the squared distance between this vector and dest.

func distanceToSquared(const me, dest: Vector2)->f32

Faster than distance() when only comparing distances since it avoids the square root operation.

func Vector2.dot [src]

Returns the dot product between this vector and other.

func dot(const me, other: Vector2)->f32

The dot product is calculated as: (x₁ × x₂) + (y₁ × y₂).

func Vector2.floor [src]

Apply floor function to both components in-place.

func floor(me)

Rounds each component down to the nearest integer value.

func Vector2.fromPolar [src]

Create a vector from polar coordinates.

func fromPolar(angle, radius: f32)->Math.Vector2

angle is in radians, radius is the distance from origin.

func Vector2.isEqualEpsilon [src]

Returns true if this vector is equal to other within an epsilon tolerance.

func isEqualEpsilon(const me, other: Vector2, eps = cast(f32) ConstF64.Epsilon)->bool

Compares each component separately using the specified eps tolerance.

func Vector2.isFinite [src]

Returns true if all components are finite (not infinite or NaN).

func isFinite(const me)->bool

Useful for validating vector values after calculations.

func Vector2.isNaN [src]

Returns true if any component is NaN (Not a Number).

func isNaN(const me)->bool

Useful for detecting invalid vector values after calculations.

func Vector2.isZero [src]

Returns true if this vector is exactly zero.

func isZero(const me)->bool

Performs exact floating-point comparison, which may not work well with computed values.

func Vector2.isZeroEpsilon [src]

Returns true if this vector is zero within an epsilon tolerance.

func isZeroEpsilon(const me, eps = cast(f32) ConstF64.Epsilon)->bool

Uses eps parameter to handle floating-point precision issues.

func Vector2.length [src]

Returns the length (magnitude) of the vector.

func length(const me)->f32

Calculated using the Euclidean distance formula: sqrt(x² + y²).

func Vector2.lengthSquared [src]

Returns the squared length of the vector.

func lengthSquared(const me)->f32

Faster than length() when only comparing magnitudes since it avoids the square root operation.

func Vector2.lerpTo [src]

Perform linear interpolation between two vectors.

func lerpTo(me, dst: Vector2, factor: f32)->Math.Vector2

Interpolates each component separately using the given factor (0.0 to 1.0). When factor is 0.0, returns src; when 1.0, returns dst.

func Vector2.makeAbs [src]

Apply absolute value to both components in-place.

func makeAbs(me)

Makes both components positive by removing their sign.

func Vector2.max [src]

Returns a vector containing the maximum components of two vectors.

func max(a, b: Vector2)->Math.Vector2

Each component of the result is the larger of the corresponding components in a and b.

func Vector2.min [src]

Returns a vector containing the minimum components of two vectors.

func min(a, b: Vector2)->Math.Vector2

Each component of the result is the smaller of the corresponding components in a and b.

func Vector2.moveTowards [src]

Move this vector towards target by a maximum distance of maxDistance.

func moveTowards(me, target: Vector2, maxDistance: f32)

If the distance to target is less than maxDistance, moves directly to target.

func Vector2.negate [src]

Negate the vector in-place.

func negate(me)

Multiplies both components by -1, effectively reversing the vector direction.

func Vector2.normalize [src]

Normalize this vector in-place to unit length.

func normalize(me)

Sets the vector's length to 1 while preserving its direction. Asserts that the vector is not zero.

func Vector2.normalizeSafe [src]

Normalize this vector in-place safely.

func normalizeSafe(me)

Sets the vector to unit length, or to zero if the original length is near zero.

func Vector2.opAffect [src]

Set both components to the same scalar value.

func opAffect(me, value: f32)

This allows assignment like 'vec = 5.0' to set both components to 5.0.

func Vector2.opAssign [src]

Compound assignment operators for vector-vector operations (+=, -=, =, /=).

func(op: string) opAssign(me, other: Vector2)

Performs component-wise operations with another vector.

Compound assignment operators for vector-scalar operations (+=, -=, =, /=).

func(op: string) opAssign(me, value: f32)

Applies the scalar value to both components of the vector.

func Vector2.opBinary [src]

Binary operators for vector-vector operations (+, -, , /).

func(op: string) opBinary(const me, other: Vector2)->Math.Vector2

Performs component-wise operations between two vectors and returns the result.

Binary operators for vector-scalar operations (+, -, , /).

func(op: string) opBinary(const me, value: f32)->Math.Vector2

Applies the scalar value to both components and returns the result.

func Vector2.opUnary [src]

Apply unary operations to the vector.

func(op: string) opUnary(const me)->Math.Vector2

Currently supports negation (-) to return a vector with both components negated.

func Vector2.rotateBy [src]

Rotate the vector by a given angle around the origin.

func rotateBy(me, angle: Math.Angle)

Uses standard 2D rotation matrix transformation with the specified angle.

func Vector2.round [src]

Apply rounding function to both components in-place.

func round(me)

Rounds each component to the nearest integer value.

func Vector2.set [src]

Set both components of the vector.

func set(me, x, y: f32)

Parameters x and y specify the new component values.

func Vector2.setAngle [src]

Rotate this vector to face the specified angle in radians.

func setAngle(me, angle: f32)

Preserves the vector's magnitude while changing its direction.

func Vector2.setLength [src]

Set the vector to the specified length.

func setLength(me, newLength: f32)

First normalizes the vector, then scales it to newLength. Assumes the vector is not zero.

func Vector2.setLengthSafe [src]

Set the vector to the specified length safely.

func setLengthSafe(me, newLength: f32)

First normalizes the vector safely, then scales it to newLength. Handles zero-length vectors.

func Vector2.setZero [src]

Set both vector components to zero.

func setZero(me)

Equivalent to assigning the Zero constant but modifies the current instance.

func Vector2.smoothDamp [src]

Perform smooth damping interpolation towards target.

func smoothDamp(current, target: Vector2, currentVelocity: &Vector2, smoothTime, deltaTime: f32)->Math.Vector2

Uses smoothTime and deltaTime for frame-rate independent smooth movement. currentVelocity is modified to track the current rate of change.

func Vector2.toAbs [src]

Returns the absolute value of each component.

func toAbs(const me)->Math.Vector2

Creates a new vector where each component is its absolute value.

func Vector2.toAngle [src]

Returns the angle of this vector in radians.

func toAngle(const me)->f32

The angle is measured from the positive X-axis, counter-clockwise.

func Vector2.toClamped [src]

Returns a new vector with components clamped between min and max values.

func toClamped(const me, min, max: Vector2)->Math.Vector2

Each component is independently clamped to stay within the specified range.

func Vector2.toMovedTowards [src]

Returns a vector moved towards target by a maximum distance of maxDistance.

func toMovedTowards(const me, target: Vector2, maxDistance: f32)->Math.Vector2

If the distance to target is less than maxDistance, returns the target directly.

func Vector2.toNormalized [src]

Returns this vector normalized to unit length without modifying the original.

func toNormalized(const me)->Math.Vector2

Creates a new vector with length 1 in the same direction. Asserts that the vector is not zero.

func Vector2.toNormalizedSafe [src]

Returns this vector normalized safely without modifying the original.

func toNormalizedSafe(const me)->Math.Vector2

Returns a unit vector in the same direction, or the zero vector if length is near zero.

func Vector2.toPerp [src]

Returns a vector perpendicular to this one (rotated 90 degrees counter-clockwise).

func toPerp(const me)->Math.Vector2

The perpendicular vector has the same length but is rotated 90° CCW.

func Vector2.toPerpCW [src]

Returns a vector perpendicular to this one (rotated 90 degrees clockwise).

func toPerpCW(const me)->Math.Vector2

The perpendicular vector has the same length but is rotated 90° CW.

func Vector2.toPolar [src]

Convert this vector to polar coordinates.

func toPolar(const me)->{angle:f32,radius:f32}

Returns angle in radians and radius (magnitude) as a tuple-like struct.

func Vector2.toProject [src]

Project this vector onto other vector.

func toProject(const me, other: Vector2)->Math.Vector2

Returns the component of this vector in the direction of other.

func Vector2.toReflect [src]

Reflect this vector across a surface with the given normal.

func toReflect(const me, normal: Vector2)->Math.Vector2

The normal should be a unit vector pointing away from the surface.

func Vector2.toSign [src]

Returns the component-wise sign of the vector (-1, 0, or 1 for each component).

func toSign(const me)->Math.Vector2

Each component becomes -1 if negative, 0 if zero, or 1 if positive.

struct Math.Vector3 [src]

A 3D vector struct representing a point or direction in 3D space.

x f32 X, Y, and Z components of the vector.
y f32
z f32

Contains x, y, and z components as 32-bit floating point values.

Functions

angleTo Returns the angle between this vector and other in radians.
ceil Apply ceiling function to all components in-place.
clamp Clamp this vector's components between min and max values.
clampLength Clamp this vector's length to be within minLength and maxLength.
clampedLength Returns a new vector with length clamped between minLength and maxLength.
cosAngleTo Returns the cosine of the angle between this vector and other.
cross Returns the cross product between this vector and other.
distanceTo Returns the Euclidean distance between this vector and dest.
distanceToSquared Returns the squared distance between this vector and dest.
dot Returns the dot product between this vector and other.
floor Apply floor function to all components in-place.
fromCylindrical Create a vector from cylindrical coordinates.
fromSpherical Create a vector from spherical coordinates.
isEqualEpsilon Returns true if this vector is equal to other within an epsilon tolerance.
isFinite Returns true if all components are finite (not infinite or NaN).
isNaN Returns true if any component is NaN (Not a Number).
isZero Returns true if this vector is exactly zero.
isZeroEpsilon Returns true if this vector is zero within an epsilon tolerance.
length Returns the length (magnitude) of the vector.
lengthSquared Returns the squared length of the vector.
lerpTo Perform linear interpolation between two vectors.
makeAbs Apply absolute value to all components in-place.
max Returns a vector containing the maximum components of two vectors.
min Returns a vector containing the minimum components of two vectors.
moveTowards Move this vector towards target by a maximum distance of maxDistance.
negate Negate the vector in-place.
normalize Normalize this vector in-place to unit length.
normalizeSafe Normalize this vector in-place safely.
round Apply rounding function to all components in-place.
set Set all three components of the vector.
setLength Set the vector to the specified length.
setLengthSafe Set the vector to the specified length safely.
setZero Set all vector components to zero.
smoothDamp Perform smooth damping interpolation towards target.
toAbs Returns the absolute value of each component.
toClamped Returns a new vector with components clamped between min and max values.
toCylindrical Convert this vector to cylindrical coordinates.
toMovedTowards Returns a vector moved towards target by a maximum distance of maxDistance.
toNormalized Returns this vector normalized to unit length without modifying the original.
toNormalizedSafe Returns this vector normalized safely without modifying the original.
toProject Project this vector onto other vector.
toReflect Reflect this vector across a surface with the given normal.
toSign Returns the component-wise sign of the vector (-1, 0, or 1 for each component).
toSpherical Convert this vector to spherical coordinates.

Special Functions

opAffect Set all components to the same scalar value.
opAssign(me, const &Vector3) Compound assignment operators for vector-vector operations (+=, -=, =, /=).
opAssign(me, f32) Compound assignment operators for vector-scalar operations (+=, -=, =, /=).
opBinary(me, const &Vector3) Binary operators for vector-vector operations (+, -, , /).
opBinary(me, f32) Binary operators for vector-scalar operations (+, -, , /).
opUnary Apply unary operations to the vector.

func Vector3.angleTo [src]

Returns the angle between this vector and other in radians.

func angleTo(const me, other: Vector3)->f32

The result is in the range [0, π] using the arc cosine of the normalized dot product.

func Vector3.ceil [src]

Apply ceiling function to all components in-place.

func ceil(me)

Rounds each component up to the nearest integer value.

func Vector3.clamp [src]

Clamp this vector's components between min and max values.

func clamp(me, min, max: Vector3)

Each component is independently clamped to stay within the specified range.

func Vector3.clampLength [src]

Clamp this vector's length to be within minLength and maxLength.

func clampLength(me, minLength, maxLength: f32)

Preserves the vector's direction while constraining its magnitude.

func Vector3.clampedLength [src]

Returns a new vector with length clamped between minLength and maxLength.

func clampedLength(const me, minLength, maxLength: f32)->Math.Vector3

Preserves the vector's direction while constraining its magnitude.

func Vector3.cosAngleTo [src]

Returns the cosine of the angle between this vector and other.

func cosAngleTo(const me, other: Vector3)->f32

Calculated using the dot product formula: dot(a,b) / (|a| * |b|).

func Vector3.cross [src]

Returns the cross product between this vector and other.

func cross(const me, other: Vector3)->Math.Vector3

The cross product produces a vector perpendicular to both input vectors.

func Vector3.distanceTo [src]

Returns the Euclidean distance between this vector and dest.

func distanceTo(const me, dest: Vector3)->f32

Calculated as the length of the difference vector between the two positions.

func Vector3.distanceToSquared [src]

Returns the squared distance between this vector and dest.

func distanceToSquared(const me, dest: Vector3)->f32

Faster than distance() when only comparing distances since it avoids the square root operation.

func Vector3.dot [src]

Returns the dot product between this vector and other.

func dot(const me, other: Vector3)->f32

The dot product is calculated as: (x₁ × x₂) + (y₁ × y₂) + (z₁ × z₂).

func Vector3.floor [src]

Apply floor function to all components in-place.

func floor(me)

Rounds each component down to the nearest integer value.

func Vector3.fromCylindrical [src]

Create a vector from cylindrical coordinates.

func fromCylindrical(theta, radius, height: f32)->Math.Vector3

theta is the angle in radians, radius is the distance from the z-axis, height is the z-component.

func Vector3.fromSpherical [src]

Create a vector from spherical coordinates.

func fromSpherical(theta, phi, radius: f32)->Math.Vector3

theta is azimuthal angle in radians, phi is polar angle in radians, radius is the distance from origin.

func Vector3.isEqualEpsilon [src]

Returns true if this vector is equal to other within an epsilon tolerance.

func isEqualEpsilon(const me, other: Vector3, eps = cast(f32) ConstF64.Epsilon)->bool

Compares each component separately using the specified eps tolerance.

func Vector3.isFinite [src]

Returns true if all components are finite (not infinite or NaN).

func isFinite(const me)->bool

Useful for validating vector values after calculations.

func Vector3.isNaN [src]

Returns true if any component is NaN (Not a Number).

func isNaN(const me)->bool

Useful for detecting invalid vector values after calculations.

func Vector3.isZero [src]

Returns true if this vector is exactly zero.

func isZero(const me)->bool

Performs exact floating-point comparison, which may not work well with computed values.

func Vector3.isZeroEpsilon [src]

Returns true if this vector is zero within an epsilon tolerance.

func isZeroEpsilon(const me, eps = cast(f32) ConstF64.Epsilon)->bool

Uses eps parameter to handle floating-point precision issues.

func Vector3.length [src]

Returns the length (magnitude) of the vector.

func length(const me)->f32

Calculated using the Euclidean distance formula: sqrt(x² + y² + z²).

func Vector3.lengthSquared [src]

Returns the squared length of the vector.

func lengthSquared(const me)->f32

Faster than length() when only comparing magnitudes since it avoids the square root operation.

func Vector3.lerpTo [src]

Perform linear interpolation between two vectors.

func lerpTo(src, dst: Vector3, factor: f32)->Math.Vector3

Interpolates each component separately using the given factor (0.0 to 1.0). When factor is 0.0, returns src; when 1.0, returns dst.

func Vector3.makeAbs [src]

Apply absolute value to all components in-place.

func makeAbs(me)

Makes all components positive by removing their sign.

func Vector3.max [src]

Returns a vector containing the maximum components of two vectors.

func max(a, b: Vector3)->Math.Vector3

Each component of the result is the larger of the corresponding components in a and b.

func Vector3.min [src]

Returns a vector containing the minimum components of two vectors.

func min(a, b: Vector3)->Math.Vector3

Each component of the result is the smaller of the corresponding components in a and b.

func Vector3.moveTowards [src]

Move this vector towards target by a maximum distance of maxDistance.

func moveTowards(me, target: Vector3, maxDistance: f32)

If the distance to target is less than maxDistance, moves directly to target.

func Vector3.negate [src]

Negate the vector in-place.

func negate(me)

Multiplies all components by -1, effectively reversing the vector direction.

func Vector3.normalize [src]

Normalize this vector in-place to unit length.

func normalize(me)

Sets the vector's length to 1 while preserving its direction. Asserts that the vector is not zero.

func Vector3.normalizeSafe [src]

Normalize this vector in-place safely.

func normalizeSafe(me)

Sets the vector to unit length, or to zero if the original length is near zero.

func Vector3.opAffect [src]

Set all components to the same scalar value.

func opAffect(me, value: f32)

This allows assignment like 'vec = 5.0' to set all components to 5.0.

func Vector3.opAssign [src]

Compound assignment operators for vector-vector operations (+=, -=, =, /=).

func(op: string) opAssign(me, other: Vector3)

Performs component-wise operations with another vector.

Compound assignment operators for vector-scalar operations (+=, -=, =, /=).

func(op: string) opAssign(me, value: f32)

Applies the scalar value to all components of the vector.

func Vector3.opBinary [src]

Binary operators for vector-vector operations (+, -, , /).

func(op: string) opBinary(const me, other: Vector3)->Math.Vector3

Performs component-wise operations between two vectors and returns the result.

Binary operators for vector-scalar operations (+, -, , /).

func(op: string) opBinary(const me, value: f32)->Math.Vector3

Applies the scalar value to all components and returns the result.

func Vector3.opUnary [src]

Apply unary operations to the vector.

func(op: string) opUnary(const me)->Math.Vector3

Currently supports negation (-) to return a vector with all components negated.

func Vector3.round [src]

Apply rounding function to all components in-place.

func round(me)

Rounds each component to the nearest integer value.

func Vector3.set [src]

Set all three components of the vector.

func set(me, x, y, z: f32)

Parameters x, y, and z specify the new component values.

func Vector3.setLength [src]

Set the vector to the specified length.

func setLength(me, newLength: f32)

First normalizes the vector, then scales it to newLength. Assumes the vector is not zero.

func Vector3.setLengthSafe [src]

Set the vector to the specified length safely.

func setLengthSafe(me, newLength: f32)

First normalizes the vector safely, then scales it to newLength. Handles zero-length vectors.

func Vector3.setZero [src]

Set all vector components to zero.

func setZero(me)

Equivalent to assigning the Zero constant but modifies the current instance.

func Vector3.smoothDamp [src]

Perform smooth damping interpolation towards target.

func smoothDamp(current, target: Vector3, currentVelocity: *Vector3, smoothTime, deltaTime: f32)->Math.Vector3

Uses smoothTime and deltaTime for frame-rate independent smooth movement. currentVelocity is modified to track the current rate of change.

func Vector3.toAbs [src]

Returns the absolute value of each component.

func toAbs(const me)->Math.Vector3

Creates a new vector where each component is its absolute value.

func Vector3.toClamped [src]

Returns a new vector with components clamped between min and max values.

func toClamped(const me, min, max: Vector3)->Math.Vector3

Each component is independently clamped to stay within the specified range.

func Vector3.toCylindrical [src]

Convert this vector to cylindrical coordinates.

func toCylindrical(const me)->{theta:f32,radius:f32,height:f32}

Returns theta (angle in radians), radius (distance from z-axis) and height (z-component) as a tuple-like struct.

func Vector3.toMovedTowards [src]

Returns a vector moved towards target by a maximum distance of maxDistance.

func toMovedTowards(const me, target: Vector3, maxDistance: f32)->Math.Vector3

If the distance to target is less than maxDistance, returns the target directly.

func Vector3.toNormalized [src]

Returns this vector normalized to unit length without modifying the original.

func toNormalized(const me)->Math.Vector3

Creates a new vector with length 1 in the same direction. Asserts that the vector is not zero.

func Vector3.toNormalizedSafe [src]

Returns this vector normalized safely without modifying the original.

func toNormalizedSafe(const me)->Math.Vector3

Returns a unit vector in the same direction, or the zero vector if length is near zero.

func Vector3.toProject [src]

Project this vector onto other vector.

func toProject(const me, other: Vector3)->Math.Vector3

Returns the component of this vector in the direction of other.

func Vector3.toReflect [src]

Reflect this vector across a surface with the given normal.

func toReflect(const me, normal: Vector3)->Math.Vector3

The normal should be a unit vector pointing away from the surface.

func Vector3.toSign [src]

Returns the component-wise sign of the vector (-1, 0, or 1 for each component).

func toSign(const me)->Math.Vector3

Each component becomes -1 if negative, 0 if zero, or 1 if positive.

func Vector3.toSpherical [src]

Convert this vector to spherical coordinates.

func toSpherical(const me)->{theta:f32,phi:f32,radius:f32}

Returns theta (azimuthal angle), phi (polar angle) in radians and radius (magnitude) as a tuple-like struct.

struct Math.Vector4 [src]

A 4D vector struct representing a point or direction in 4D space.

x f32 X, Y, Z, and W components of the vector.
y f32
z f32
w f32

Contains x, y, z, and w components as 32-bit floating point values. Commonly used for homogeneous coordinates in 3D graphics or RGBA color values.

Functions

angleTo Returns the angle between this vector and other in radians.
ceil Apply ceiling function to all components in-place.
clamp Clamp this vector's components between min and max values.
clampLength Clamp this vector's length to be within minLength and maxLength.
clampedLength Returns a new vector with length clamped between minLength and maxLength.
cosAngleTo Returns the cosine of the angle between this vector and other.
distanceTo Returns the Euclidean distance between this vector and dest.
distanceToSquared Returns the squared distance between this vector and dest.
dot Returns the dot product between this vector and other.
floor Apply floor function to all components in-place.
fromVector2 Create a Vector4 from Vector2 with specified Z and W components.
fromVector3 Create a Vector4 from Vector3 with specified W component.
isEqualEpsilon Returns true if this vector is equal to other within an epsilon tolerance.
isFinite Returns true if all components are finite (not infinite or NaN).
isNaN Returns true if any component is NaN (Not a Number).
isZero Returns true if this vector is exactly zero.
isZeroEpsilon Returns true if this vector is zero within an epsilon tolerance.
length Returns the length (magnitude) of the vector.
lengthSquared Returns the squared length of the vector.
lerpTo Perform linear interpolation between two vectors.
makeAbs Apply absolute value to all components in-place.
max Returns a vector containing the maximum components of two vectors.
min Returns a vector containing the minimum components of two vectors.
moveTowards Move this vector towards target by a maximum distance of maxDistance.
negate Negate the vector in-place.
normalize Normalize this vector in-place to unit length.
normalizeSafe Normalize this vector in-place safely.
round Apply rounding function to all components in-place.
set Set all four components of the vector.
setLength Set the vector to the specified length.
setLengthSafe Set the vector to the specified length safely.
setZero Set all vector components to zero.
smoothDamp Perform smooth damping interpolation towards target.
toAbs Returns the absolute value of each component.
toClamped Returns a new vector with components clamped between min and max values.
toMovedTowards Returns a vector moved towards target by a maximum distance of maxDistance.
toNormalized Returns this vector normalized to unit length without modifying the original.
toNormalizedSafe Returns this vector normalized safely without modifying the original.
toProject Project this vector onto other vector.
toReflect Reflect this vector across a surface with the given normal.
toSign Returns the component-wise sign of the vector (-1, 0, or 1 for each component).
toVector3 Convert homogeneous coordinates to 3D by dividing x, y, z by w.
xy Extract the XY components as a Vector2, ignoring Z and W components.
xyz Extract the XYZ components as a Vector3, ignoring the W component.

Special Functions

opAffect Set all components to the same scalar value.
opAssign(me, const &Vector4) Compound assignment operators for vector-vector operations (+=, -=, =, /=).
opAssign(me, f32) Compound assignment operators for vector-scalar operations (+=, -=, =, /=).
opBinary(me, const &Vector4) Binary operators for vector-vector operations (+, -, , /).
opBinary(me, f32) Binary operators for vector-scalar operations (+, -, , /).
opUnary Apply unary operations to the vector.

func Vector4.angleTo [src]

Returns the angle between this vector and other in radians.

func angleTo(const me, other: Vector4)->f32

The result is in the range [0, π] using the arc cosine of the normalized dot product.

func Vector4.ceil [src]

Apply ceiling function to all components in-place.

func ceil(me)

Rounds each component up to the nearest integer value.

func Vector4.clamp [src]

Clamp this vector's components between min and max values.

func clamp(me, min, max: Vector4)

Each component is independently clamped to stay within the specified range.

func Vector4.clampLength [src]

Clamp this vector's length to be within minLength and maxLength.

func clampLength(me, minLength, maxLength: f32)

Preserves the vector's direction while constraining its magnitude.

func Vector4.clampedLength [src]

Returns a new vector with length clamped between minLength and maxLength.

func clampedLength(const me, minLength, maxLength: f32)->Math.Vector4

Preserves the vector's direction while constraining its magnitude.

func Vector4.cosAngleTo [src]

Returns the cosine of the angle between this vector and other.

func cosAngleTo(const me, other: Vector4)->f32

Calculated using the dot product formula: dot(a,b) / (|a| * |b|).

func Vector4.distanceTo [src]

Returns the Euclidean distance between this vector and dest.

func distanceTo(const me, dest: Vector4)->f32

Calculated as the length of the difference vector between the two positions.

func Vector4.distanceToSquared [src]

Returns the squared distance between this vector and dest.

func distanceToSquared(const me, dest: Vector4)->f32

Faster than distance() when only comparing distances since it avoids the square root operation.

func Vector4.dot [src]

Returns the dot product between this vector and other.

func dot(const me, other: Vector4)->f32

The dot product is calculated as: (x₁ × x₂) + (y₁ × y₂) + (z₁ × z₂) + (w₁ × w₂).

func Vector4.floor [src]

Apply floor function to all components in-place.

func floor(me)

Rounds each component down to the nearest integer value.

func Vector4.fromVector2 [src]

Create a Vector4 from Vector2 with specified Z and W components.

func fromVector2(v: Vector2, z, w: f32)->Math.Vector4

Useful for extending 2D coordinates to 4D space.

func Vector4.fromVector3 [src]

Create a Vector4 from Vector3 with specified W component.

func fromVector3(v: Vector3, w: f32)->Math.Vector4

Commonly used for creating homogeneous coordinates from 3D positions.

func Vector4.isEqualEpsilon [src]

Returns true if this vector is equal to other within an epsilon tolerance.

func isEqualEpsilon(const me, other: Vector4, eps = cast(f32) ConstF64.Epsilon)->bool

Compares each component separately using the specified eps tolerance.

func Vector4.isFinite [src]

Returns true if all components are finite (not infinite or NaN).

func isFinite(const me)->bool

Useful for validating vector values after calculations.

func Vector4.isNaN [src]

Returns true if any component is NaN (Not a Number).

func isNaN(const me)->bool

Useful for detecting invalid vector values after calculations.

func Vector4.isZero [src]

Returns true if this vector is exactly zero.

func isZero(const me)->bool

Performs exact floating-point comparison, which may not work well with computed values.

func Vector4.isZeroEpsilon [src]

Returns true if this vector is zero within an epsilon tolerance.

func isZeroEpsilon(const me, eps = cast(f32) ConstF64.Epsilon)->bool

Uses eps parameter to handle floating-point precision issues.

func Vector4.length [src]

Returns the length (magnitude) of the vector.

func length(const me)->f32

Calculated using the Euclidean distance formula: sqrt(x² + y² + z² + w²).

func Vector4.lengthSquared [src]

Returns the squared length of the vector.

func lengthSquared(const me)->f32

Faster than length() when only comparing magnitudes since it avoids the square root operation.

func Vector4.lerpTo [src]

Perform linear interpolation between two vectors.

func lerpTo(src, dst: Vector4, factor: f32)->Math.Vector4

Interpolates each component separately using the given factor (0.0 to 1.0). When factor is 0.0, returns src; when 1.0, returns dst.

func Vector4.makeAbs [src]

Apply absolute value to all components in-place.

func makeAbs(me)

Makes all components positive by removing their sign.

func Vector4.max [src]

Returns a vector containing the maximum components of two vectors.

func max(a, b: Vector4)->Math.Vector4

Each component of the result is the larger of the corresponding components in a and b.

func Vector4.min [src]

Returns a vector containing the minimum components of two vectors.

func min(a, b: Vector4)->Math.Vector4

Each component of the result is the smaller of the corresponding components in a and b.

func Vector4.moveTowards [src]

Move this vector towards target by a maximum distance of maxDistance.

func moveTowards(me, target: Vector4, maxDistance: f32)

If the distance to target is less than maxDistance, moves directly to target.

func Vector4.negate [src]

Negate the vector in-place.

func negate(me)

Multiplies all components by -1, effectively reversing the vector direction.

func Vector4.normalize [src]

Normalize this vector in-place to unit length.

func normalize(me)

Sets the vector's length to 1 while preserving its direction. Asserts that the vector is not zero.

func Vector4.normalizeSafe [src]

Normalize this vector in-place safely.

func normalizeSafe(me)

Sets the vector to unit length, or to zero if the original length is near zero.

func Vector4.opAffect [src]

Set all components to the same scalar value.

func opAffect(me, value: f32)

This allows assignment like 'vec = 5.0' to set all components to 5.0.

func Vector4.opAssign [src]

Compound assignment operators for vector-vector operations (+=, -=, =, /=).

func(op: string) opAssign(me, other: Vector4)

Performs component-wise operations with another vector.

Compound assignment operators for vector-scalar operations (+=, -=, =, /=).

func(op: string) opAssign(me, value: f32)

Applies the scalar value to all components of the vector.

func Vector4.opBinary [src]

Binary operators for vector-vector operations (+, -, , /).

func(op: string) opBinary(const me, other: Vector4)->Math.Vector4

Performs component-wise operations between two vectors and returns the result.

Binary operators for vector-scalar operations (+, -, , /).

func(op: string) opBinary(const me, value: f32)->Math.Vector4

Applies the scalar value to all components and returns the result.

func Vector4.opUnary [src]

Apply unary operations to the vector.

func(op: string) opUnary(const me)->Math.Vector4

Currently supports negation (-) to return a vector with all components negated.

func Vector4.round [src]

Apply rounding function to all components in-place.

func round(me)

Rounds each component to the nearest integer value.

func Vector4.set [src]

Set all four components of the vector.

func set(me, x, y, z, w: f32)

Parameters x, y, z, and w specify the new component values.

func Vector4.setLength [src]

Set the vector to the specified length.

func setLength(me, newLength: f32)

First normalizes the vector, then scales it to newLength. Assumes the vector is not zero.

func Vector4.setLengthSafe [src]

Set the vector to the specified length safely.

func setLengthSafe(me, newLength: f32)

First normalizes the vector safely, then scales it to newLength. Handles zero-length vectors.

func Vector4.setZero [src]

Set all vector components to zero.

func setZero(me)

Equivalent to assigning the Zero constant but modifies the current instance.

func Vector4.smoothDamp [src]

Perform smooth damping interpolation towards target.

func smoothDamp(current, target: Vector4, currentVelocity: &Vector4, smoothTime, deltaTime: f32)->Math.Vector4

Uses smoothTime and deltaTime for frame-rate independent smooth movement. currentVelocity is modified to track the current rate of change.

func Vector4.toAbs [src]

Returns the absolute value of each component.

func toAbs(const me)->Math.Vector4

Creates a new vector where each component is its absolute value.

func Vector4.toClamped [src]

Returns a new vector with components clamped between min and max values.

func toClamped(const me, min, max: Vector4)->Math.Vector4

Each component is independently clamped to stay within the specified range.

func Vector4.toMovedTowards [src]

Returns a vector moved towards target by a maximum distance of maxDistance.

func toMovedTowards(const me, target: Vector4, maxDistance: f32)->Math.Vector4

If the distance to target is less than maxDistance, returns the target directly.

func Vector4.toNormalized [src]

Returns this vector normalized to unit length without modifying the original.

func toNormalized(const me)->Math.Vector4

Creates a new vector with length 1 in the same direction. Asserts that the vector is not zero.

func Vector4.toNormalizedSafe [src]

Returns this vector normalized safely without modifying the original.

func toNormalizedSafe(const me)->Math.Vector4

Returns a unit vector in the same direction, or the zero vector if length is near zero.

func Vector4.toProject [src]

Project this vector onto other vector.

func toProject(const me, other: Vector4)->Math.Vector4

Returns the component of this vector in the direction of other.

func Vector4.toReflect [src]

Reflect this vector across a surface with the given normal.

func toReflect(const me, normal: Vector4)->Math.Vector4

The normal should be a unit vector pointing away from the surface.

func Vector4.toSign [src]

Returns the component-wise sign of the vector (-1, 0, or 1 for each component).

func toSign(const me)->Math.Vector4

Each component becomes -1 if negative, 0 if zero, or 1 if positive.

func Vector4.toVector3 [src]

Convert homogeneous coordinates to 3D by dividing x, y, z by w.

func toVector3(const me)->Math.Vector3

Returns a Vector3 representing the 3D position when w != 0. Handles w = 0 case safely.

func Vector4.xy [src]

Extract the XY components as a Vector2, ignoring Z and W components.

func xy(const me)->Math.Vector2

Useful for 2D projections or when using Vector4 for padding.

func Vector4.xyz [src]

Extract the XYZ components as a Vector3, ignoring the W component.

func xyz(const me)->Math.Vector3

Useful when Vector4 is used for color (RGBA) and you need just RGB.

func Math.abs [src]

func abs(x: s8)->s8 func abs(x: s16)->s16 func abs(x: s32)->s32 func abs(x: s64)->s64 func abs(x: f32)->f32 func abs(x: f64)->f64

func Math.acos [src]

func acos(x: f32)->f32 func acos(x: f64)->f64

func Math.asin [src]

func asin(x: f32)->f32 func asin(x: f64)->f64

func Math.atan [src]

func atan(x: f32)->f32 func atan(x: f64)->f64

func Math.atan2 [src]

func atan2(x, y: f32)->f32 func atan2(x, y: f64)->f64

func Math.bigEndianToNative [src]

Convert a big-endian integer to the current architecture's native format.

func(T) bigEndianToNative(x: T)->T

On big-endian systems returns x unchanged, on little-endian systems performs byte swap.

func Math.byteswap [src]

Reverse the byte order of the value.

func byteswap(x: u16)->u16

Converts between little-endian and big-endian representations.

func byteswap(x: u32)->u32 func byteswap(x: u64)->u64

func Math.ceil [src]

func ceil(x: f32)->f32 func ceil(x: f64)->f64

func Math.ceilS32 [src]

func ceilS32(x: f32)->s32

func Math.ceilS64 [src]

func ceilS64(x: f64)->s64

func Math.clamp [src]

Clamp a value between a lower and upper bound.

func(T) clamp(x, low, up: T)->T

Returns low if x < low, up if x > up, otherwise returns x.

func Math.cos [src]

func cos(x: f32)->f32 func cos(x: f64)->f64

func Math.cosh [src]

func cosh(x: f32)->f32 func cosh(x: f64)->f64

func Math.countOnes [src]

Returns the total number of bits set to 1 in the value.

func countOnes(x: u8)->u8

Also known as population count or Hamming weight.

func countOnes(x: u16)->u16 func countOnes(x: u32)->u32 func countOnes(x: u64)->u64

func Math.cubicLerp [src]

Cubic interpolation between a, b, c, and d based on t.

func cubicLerp(a, b, c, d, t: f32)->f32 func cubicLerp(a, b, c, d, t: f64)->f64

func Math.exp [src]

func exp(x: f32)->f32 func exp(x: f64)->f64

func Math.exp2 [src]

func exp2(x: f32)->f32 func exp2(x: f64)->f64

func Math.floor [src]

func floor(x: f32)->f32 func floor(x: f64)->f64

func Math.floorS32 [src]

func floorS32(x: f32)->s32

func Math.floorS64 [src]

func floorS64(x: f64)->s64

func Math.fract [src]

Get the fractional part.

func fract(x: f32)->f32 func fract(x: f64)->f64

func Math.gcd [src]

Find the gcd between a and b.

func gcd(a0, b0: s64)->s64

func Math.hasByte [src]

Determin if an integer has a given byte.

func hasByte(value: u16, byte: u8)->bool func hasByte(value: u32, byte: u8)->bool func hasByte(value: u64, byte: u8)->bool

func Math.hasZeroByte [src]

Determin if any of the bytes is zero.

func hasZeroByte(v: u16)->bool func hasZeroByte(v: u32)->bool func hasZeroByte(v: u64)->bool

func Math.interpHermite [src]

Hermite interpolation function.

func interpHermite(t: f32)->f32 func interpHermite(t: f64)->f64

func Math.interpQuintic [src]

Quintic interpolation function.

func interpQuintic(t: f32)->f32 func interpQuintic(t: f64)->f64

func Math.isEqualEpsilon [src]

Check if x and y are approximately equal within an epsilon threshold.

func isEqualEpsilon(x, y: f32, eps = ConstF32.Epsilon)->bool func isEqualEpsilon(x, y: f64, eps = ConstF64.Epsilon)->bool

func Math.isFinite [src]

Returns true if the value is finite (not infinite and not NaN).

func isFinite(value: f32)->bool

A finite number is any real number that is not positive infinity, negative infinity, or NaN.

Returns true if the value is finite (not infinite and not NaN).

func isFinite(value: f64)->bool

A finite number is any real number that is not positive infinity, negative infinity, or NaN.

func Math.isNaN [src]

Check if x is NaN (not a number).

func isNaN(x: f32)->bool func isNaN(x: f64)->bool

func Math.isPowerOf2 [src]

func isPowerOf2(x: u8)->bool func isPowerOf2(x: u16)->bool func isPowerOf2(x: u32)->bool func isPowerOf2(x: u64)->bool

func Math.isZeroEpsilon [src]

Check if x is approximately zero within an epsilon threshold.

func isZeroEpsilon(x: f32, eps = ConstF32.Epsilon)->bool func isZeroEpsilon(x: f64, eps = ConstF64.Epsilon)->bool

func Math.lcm [src]

Find the Least Common Multiple between a and b.

func lcm(a, b: s64)->s64

func Math.leadingZeros [src]

Returns the number of leading zero bits from the most significant bit.

func leadingZeros(x: u8)->u8

Counts consecutive zero bits starting from the left (most significant) side.

func leadingZeros(x: u16)->u16 func leadingZeros(x: u32)->u32 func leadingZeros(x: u64)->u64

func Math.lerp [src]

Linear interpolation between x and y based on factor.

func lerp(x, y, factor: f32)->f32 func lerp(x, y, factor: f64)->f64

func Math.littleEndianToNative [src]

Convert a little-endian integer to the current architecture's native format.

func(T) littleEndianToNative(x: T)->T

On little-endian systems returns x unchanged, on big-endian systems performs byte swap.

func Math.log [src]

func log(x: f32)->f32 func log(x: f64)->f64

func Math.log10 [src]

func log10(x: f32)->f32 func log10(x: f64)->f64

func Math.log2 [src]

func log2(x: f32)->f32 func log2(x: f64)->f64

func Math.make64 [src]

Make a 64 bits with two 32 bits.

func make64(high, low: u32)->u64

func Math.makeRepeat16 [src]

Make a 16 bits by repeating a given byte 0x20 => 0x2020.

func makeRepeat16(v: u8)->u16

func Math.makeRepeat32 [src]

Make a 32 bits by repeating a given byte 0x20 => 0x20202020.

func makeRepeat32(v: u8)->u32

func Math.makeRepeat64 [src]

Make a 64 bits by repeating a given byte 0x20 => 0x20202020_20202020.

func makeRepeat64(v: u8)->u64

func Math.map [src]

Maps val from the range [minSrc, maxSrc] to [minDst, maxDst].

func map(val, minSrc, maxSrc, minDst, maxDst: f32)->f32 func map(val, minSrc, maxSrc, minDst, maxDst: f64)->f64

func Math.max [src]

Return the larger of two values.

func(T) max(x, y: T)->T

Generic implementation that works with any comparable type T.

Return the largest of three values.

func(T) max(x, y, z: T)->T

Efficiently finds the maximum using nested comparisons.

Return the largest of four values.

func(T) max(x, y, z, w: T)->T

Efficiently finds the maximum using nested comparisons.

func max(x, y: s8)->s8 func max(x, y: s16)->s16 func max(x, y: s32)->s32 func max(x, y: s64)->s64 func max(x, y: u8)->u8 func max(x, y: u16)->u16 func max(x, y: u32)->u32 func max(x, y: u64)->u64 func max(x, y: f32)->f32 func max(x, y: f64)->f64

func Math.min [src]

Return the smaller of two values.

func(T) min(x, y: T)->T

Generic implementation that works with any comparable type T.

Return the smallest of three values.

func(T) min(x, y, z: T)->T

Efficiently finds the minimum using nested comparisons.

Return the smallest of four values.

func(T) min(x, y, z, w: T)->T

Efficiently finds the minimum using nested comparisons.

func min(x, y: s8)->s8 func min(x, y: s16)->s16 func min(x, y: s32)->s32 func min(x, y: s64)->s64 func min(x, y: u8)->u8 func min(x, y: u16)->u16 func min(x, y: u32)->u32 func min(x, y: u64)->u64 func min(x, y: f32)->f32 func min(x, y: f64)->f64

func Math.moveTowards [src]

Interpolation at constant speed - moves a fixed distance per step.

func moveTowards(current, target, speed: f32)->f32 func moveTowards(current, target, speed: f64)->f64

func Math.mulAdd [src]

func mulAdd(x, y, z: f32)->f32 func mulAdd(x, y, z: f64)->f64

func Math.mulU64 [src]

func mulU64(x, y: u64)->{hi:u64,lo:u64}

func Math.nativeToBigEndian [src]

Convert a native architecture integer to big-endian format.

func(T) nativeToBigEndian(x: T)->T

On big-endian systems returns x unchanged, on little-endian systems performs byte swap.

func Math.pow [src]

func pow(x, y: f32)->f32 func pow(x, y: f64)->f64

func Math.powerOf10 [src]

Calculates the smallest power of 10 greater than or equal to the given number val.

func powerOf10(val: f32)->s32 func powerOf10(val: f64)->s32

func Math.reverse [src]

Reverse all bits in an 8-bit value using lookup table.

func reverse(x: u8)->u8

Uses the precomputed Rev8Arr table for optimal performance.

Reverse all bits in a 16-bit value.

func reverse(x: u16)->u16

Splits the value into two bytes, reverses each using the lookup table, then recombines.

Reverse all bits in a 32-bit value using bit manipulation.

func reverse(x: u32)->u32

Uses a series of parallel bit operations with magic constants for efficiency.

Reverse all bits in a 64-bit value using bit manipulation.

func reverse(x: u64)->u64

Uses the same parallel bit operation technique as the 32-bit version with 64-bit constants.

func Math.rol [src]

Rotate bits left by y positions.

func rol(x: u8, y: u8)->u8

Bits that overflow from the left side wrap around to the right side.

func rol(x: u16, y: u8)->u16 func rol(x: u32, y: u8)->u32 func rol(x: u64, y: u8)->u64

func Math.ror [src]

Rotate bits right by y positions.

func ror(x: u8, y: u8)->u8

Bits that overflow from the right side wrap around to the left side.

func ror(x: u16, y: u8)->u16 func ror(x: u32, y: u8)->u32 func ror(x: u64, y: u8)->u64

func Math.round [src]

func round(x: f32)->f32 func round(x: f64)->f64

func Math.roundDownToPowerOf2 [src]

func roundDownToPowerOf2(x: u32)->u32 func roundDownToPowerOf2(x: u64)->u64

func Math.roundS32 [src]

func roundS32(x: f32)->s32

func Math.roundS64 [src]

func roundS64(x: f64)->s64

func Math.roundUpToPowerOf2 [src]

func roundUpToPowerOf2(x: u32)->u32 func roundUpToPowerOf2(x: u64)->u64

func Math.saturate [src]

Clamps x between 0 and 1.

func saturate(x: f32)->f32 func saturate(x: f64)->f64

func Math.sign [src]

Returns the sign of x (-1 for negative, 1 for positive).

func sign(x: f32)->s32 func sign(x: f64)->s32 func sign(x: s8)->s8 func sign(x: s16)->s16 func sign(x: s32)->s32 func sign(x: s64)->s64

func Math.sin [src]

func sin(x: f32)->f32 func sin(x: f64)->f64

func Math.sinh [src]

func sinh(x: f32)->f32 func sinh(x: f64)->f64

func Math.smoothDamp [src]

Perform smooth damping interpolation towards target.

func(T) smoothDamp(current, target: T, currentVelocity: &T, smoothTime, deltaTime: T)->T

Uses smoothTime and deltaTime for frame-rate independent smooth movement. currentVelocity is modified to track the current rate of change. Based on Game Programming Gems 4 Chapter 1.10

func Math.smoothstep [src]

Smoothstep interpolation between edge0 and edge1.

func smoothstep(edge0, edge1, x: f32)->f32 func smoothstep(edge0, edge1, x: f64)->f64

func Math.sqrt [src]

func sqrt(x: f32)->f32 func sqrt(x: f64)->f64

func Math.tan [src]

func tan(x: f32)->f32 func tan(x: f64)->f64

func Math.tanh [src]

func tanh(x: f32)->f32 func tanh(x: f64)->f64

func Math.toDegrees [src]

Convert radians to degrees.

func toDegrees(x: f32)->f32 func toDegrees(x: f64)->f64

func Math.toRadians [src]

func toRadians(x: f32)->f32 func toRadians(x: f64)->f64

func Math.trailingZeros [src]

Returns the number of trailing zero bits from the least significant bit.

func trailingZeros(x: u8)->u8

Counts consecutive zero bits starting from the right (least significant) side.

func trailingZeros(x: u16)->u16 func trailingZeros(x: u32)->u32 func trailingZeros(x: u64)->u64

func Math.trunc [src]

func trunc(x: f32)->f32 func trunc(x: f64)->f64

func Math.truncS32 [src]

func truncS32(x: f32)->s32

func Math.truncS64 [src]

func truncS64(x: f64)->s64

namespace Core.Memory

Functions

align(const [*] void, u32) Align a pointer to the given amount.
align(u64, u32) Align a value to the given amount.
alloc Allocate a given amount of bytes.
assertIsAllocated Check if a given pointer is allocated.
clear Clear one block of memory.
compare Compare two blocks of memory.
copy Copy one block of memory to a given address.
copyOver Move one block of memory to a given address.
delete(*T, IAllocator, string, const &SourceCodeLocation) Drop and release memory of the given type.
delete([*] T, u64, IAllocator, string, const &SourceCodeLocation) Drop and release memory of an array of the given type.
delete(*void, const *TypeInfo, IAllocator, string, const &SourceCodeLocation) Drop and release memory of the given type.
equals Compare two blocks of memory.
free Free the specified memory block.
freeAll Free all allocated memory of the given allocator if possible.
freeTemp Clear the temporary allocator.
new(IAllocator, u32, string, const &SourceCodeLocation) Allocate and initialize the given type.
new(u64, IAllocator, u32, string, const &SourceCodeLocation) Allocate and initialize an array of the given type.
new(const *TypeInfo, IAllocator, u32, string, const &SourceCodeLocation) Allocate and initialize the given type.
pushAllocator Push a new allocator for the given block of code.
pushTempAllocator Push the temporary allocator for the given block of code.
realloc Reallocate/allocate a given amount of bytes.
set Set the content of one block of memory to a specific byte value.
tempAlloc Allocate a given amount of bytes in the temporary allocator.

func Memory.align [src]

Align a value to the given amount.

func align(value: u64, alignment: u32)->u64

Align a pointer to the given amount.

func align(value: const [*] void, alignment: u32)->const [*] void

func Memory.alloc [src]

Allocate a given amount of bytes.

func alloc(size: u64, allocator: IAllocator = null, alignment: u32 = 0, hint: string = null, loc = #callerlocation)->[*] void

func Memory.assertIsAllocated [src]

Check if a given pointer is allocated.

func assertIsAllocated(buffer: [*] void, size: u64, allocator: IAllocator = null, hint: string = null, loc = #callerlocation)

func Memory.clear [src]

Clear one block of memory.

func clear(dest: [*] void, size: u64)

func Memory.compare [src]

Compare two blocks of memory.

func compare(dest, src: const [*] void, size: u64)->s32

func Memory.copy [src]

Copy one block of memory to a given address.

func copy(dest: [*] void, src: const [*] void, size: u64)

func Memory.copyOver [src]

Move one block of memory to a given address.

func copyOver(dest: [*] void, src: const [*] void, size: u64)

func Memory.delete [src]

Drop and release memory of the given type.

func(T) delete(ptr: *T, allocator: IAllocator = null, hint: string = null, loc = #callerlocation) func delete(ptr: *void, type: typeinfo, allocator: IAllocator = null, hint: string = null, loc = #callerlocation)

Drop and release memory of an array of the given type.

func(T) delete(ptr: [*] T, num: u64, allocator: IAllocator = null, hint: string = null, loc = #callerlocation)

func Memory.equals [src]

Compare two blocks of memory.

func(T) equals(dest, src: const *T)->bool

func Memory.free [src]

Free the specified memory block.

func free(buffer: [*] void, size: u64, allocator: IAllocator = null, hint: string = null, loc = #callerlocation)

func Memory.freeAll [src]

Free all allocated memory of the given allocator if possible.

func freeAll(allocator: IAllocator, hint: string = null, loc = #callerlocation)

func Memory.freeTemp [src]

Clear the temporary allocator.

func freeTemp()

func Memory.new [src]

Allocate and initialize the given type.

func new(type: typeinfo, allocator: IAllocator = null, alignment: u32 = 0, hint: string = null, loc = #callerlocation)->*u8 func(T) new(allocator: IAllocator = null, alignment: u32 = 0, hint: string = null, loc = #callerlocation)->*T

Allocate and initialize an array of the given type.

func(T) new(num: u64, allocator: IAllocator = null, alignment: u32 = 0, hint: string = null, loc = #callerlocation)->[*] T

func Memory.pushAllocator [src]

Push a new allocator for the given block of code.

#[Swag.Macro] func pushAllocator(allocator: Swag.IAllocator, stmt: #code void)

func Memory.pushTempAllocator [src]

Push the temporary allocator for the given block of code.

#[Swag.Macro] func pushTempAllocator(stmt: #code void)

func Memory.realloc [src]

Reallocate/allocate a given amount of bytes.

func realloc(buffer: [*] void, newSize: u64, oldSize: u64, allocator: IAllocator = null, alignment: u16 = 0, hint: string = null, loc = #callerlocation)->[*] void

func Memory.set [src]

Set the content of one block of memory to a specific byte value.

func set(dest: [*] void, value: u8, size: u64)

func Memory.tempAlloc [src]

Allocate a given amount of bytes in the temporary allocator.

func tempAlloc(size: u64, alignment: u32 = 0, hint: string = null, loc = #callerlocation)->[*] void

namespace Core.Noise

Structs

FastNoise FastNoise structure for generating different types of noise based on user-defined parameters.

Enums

FastNoiseKind Types of noise that can be generated by FastNoise.

Functions

perlin(f32, f32, f32, s32) Perlin noise in 3D.
perlin(f32, f32, s32) Perlin noise in 2D.

struct Noise.FastNoise [src]

FastNoise structure for generating different types of noise based on user-defined parameters.

kind Noise.FastNoiseKind Type of noise to generate.
seed s32 Seed value for noise generation.
octaves s32 The number of layers of noise. More octaves create a more varied look but are also more resource-intensive to calculate.
frequency f32 The period in which we sample the noise. A higher frequency results in more frequent noise change.
lacunarity f32 The rate of change of the frequency for each successive octave. A lacunarity value of 1 results in each octave having the same frequency.
gain f32 The scaling factor applied to each octave. gain is only used when octaves is set to a value higher than 1.
fractalBounding f32 Normalization factor used to keep the noise within bounds for fractal types.

Functions

noise Get a noise result.
perlinFractalBillow Computes billow-style fractal using Perlin noise.
perlinFractalFBM Computes fractal Brownian Motion using Perlin noise.
perlinFractalRigidMulti Computes rigid multi-fractal using Perlin noise.
update Update internal values.
valueFractalBillow Computes billow-style fractal using value noise.
valueFractalFBM Computes fractal Brownian Motion using value noise.
valueFractalRigidMulti Computes rigid multi-fractal using value noise.

func FastNoise.noise [src]

Get a noise result.

func noise(const me, x, y: f32)->f32

func FastNoise.perlinFractalBillow [src]

Computes billow-style fractal using Perlin noise.

func perlinFractalBillow(const me, x, y: f32)->f32

func FastNoise.perlinFractalFBM [src]

Computes fractal Brownian Motion using Perlin noise.

func perlinFractalFBM(const me, x, y: f32)->f32

func FastNoise.perlinFractalRigidMulti [src]

Computes rigid multi-fractal using Perlin noise.

func perlinFractalRigidMulti(const me, x, y: f32)->f32

func FastNoise.update [src]

Update internal values.

func update(me)

Should be called each time an internal parameter has been changed.

func FastNoise.valueFractalBillow [src]

Computes billow-style fractal using value noise.

func valueFractalBillow(const me, x, y: f32)->f32

func FastNoise.valueFractalFBM [src]

Computes fractal Brownian Motion using value noise.

func valueFractalFBM(const me, x, y: f32)->f32

func FastNoise.valueFractalRigidMulti [src]

Computes rigid multi-fractal using value noise.

func valueFractalRigidMulti(const me, x, y: f32)->f32

enum Noise.FastNoiseKind [src]

Types of noise that can be generated by FastNoise.

Perlin Basic Perlin noise.
PerlinFractalFBM Fractal Brownian Motion using Perlin noise.
PerlinFractalBillow Billow-style fractal using Perlin noise.
PerlinFractalRigidMulti Rigid multi-fractal using Perlin noise.
Value Basic value noise.
ValueFractalFBM Fractal Brownian Motion using value noise.
ValueFractalBillow Billow-style fractal using value noise.
ValueFractalRigidMulti Rigid multi-fractal using value noise.

func Noise.perlin [src]

Perlin noise in 2D.

func perlin(x, y: f32, seed: s32 = 1337)->f32

Result range is [-1, 1]

Perlin noise in 3D.

func perlin(x, y, z: f32, seed: s32 = 1337)->f32

Result range is [-1, 1]

namespace Core.Parser

Structs

RegExp Simple regular expression matcher.

struct Parser.RegExp [src]

Simple regular expression matcher.

* zero or more
? zero or one
+ one or more
. any rune
^<expr> start of buffer
<expr>$ end of buffer
a
b
[abc] match any in list
[a-zA-Z] match any in range
[[:digit:]] [0-9]
[[:xdigit:]] [a-fA-F0-9]
[[:alpha:]] [a-zA-Z]
[[:alnum:]] [a-zA-Z0-9]
[[:lower:]] [a-z]
[[:upper:]] [A-Z]
[[:blank:]] whitespace or tab
[[:space:]] and whitespace character
[[:word:]] [a-zA-Z0-9_]
[[:ascii:]] Any ascii character
[^<interval>] Inverse of <interval>
d [[:digit:]]
D [^[:digit:]]
l [[:lower:]]
L [^[:lower:]]
u [[:upper:]]
U [^[:upper:]]
s [[:space:]]
S [^[:space:]]
w [[:word:]]
W [^[:word:]]
b start or end of word
pL unicode letter
pN unicode number
pS unicode symbol
p{Ll} unicode lower letter
p{Lu} unicode upper letter
p{Sm} unicode symbol math
1 to 9 backreference to a capture block

Functions

clear Clear content.
compile Compile the expression.
create Creates and return an expression.
getCapture Returns the parsed string associated with a given captured group.
getCaptures Returns all the captured strings, in order.
grep(me, string) Find the first occurence in the string.
grep(string, string) Find the first occurence in the string.
grepAll(me, string) Find all the occurences in the string.
grepAll(string, string) Find all the occurences in the string.
match(me, string) Returns true if str matches the regexp.
match(me, string, string, bool) Compile and match the expression.
partialMatch Try to match the start of the string, and returns the matched value or null.

Special Functions

opDrop
opIndex You can get a capture group value by using the derefence syntax.

func RegExp.clear [src]

Clear content.

func clear(me)

func RegExp.compile [src]

Compile the expression.

func compile(me, expr: string, ignoreCase = false) throw

func RegExp.create [src]

Creates and return an expression.

func create(expr: string, ignoreCase = false)->Parser.RegExp throw

func RegExp.getCapture [src]

Returns the parsed string associated with a given captured group.

func getCapture(me, rank: u32)->string

func RegExp.getCaptures [src]

Returns all the captured strings, in order.

func getCaptures(me)->Array'(string)

func RegExp.grep [src]

Find the first occurence in the string.

func grep(expr, str: string)->string throw func grep(me, str: string)->string

func RegExp.grepAll [src]

Find all the occurences in the string.

func grepAll(expr, str: string)->Array'(string) throw func grepAll(me, str: string)->Array'(string)

func RegExp.match [src]

Compile and match the expression.

func match(me, expr, str: string, ignoreCase = false)->bool throw

Returns true if str matches the regexp.

func match(me, str: string)->bool

Should have been compiled before.

func RegExp.opDrop [src]

func opDrop(me)

func RegExp.opIndex [src]

You can get a capture group value by using the derefence syntax.

func opIndex(me, idx: u64)->string

Returns null if the capture group does not exist

func RegExp.partialMatch [src]

Try to match the start of the string, and returns the matched value or null.

func partialMatch(me, str: string)->string

namespace Core.Path

Functions

combine Combines multiple path segments into one, adding a directory separator between them if necessary.
equals Returns true if the two paths are equal (case-insensitive Latin1 comparison).
getAbsolute Transform fullname to an absolute path.
getDirectoryName Returns the directory part of the path, null if not found.
getExtension Returns the file name extension, including the . character Returns null if no extension was found.
getExtensionLowerCase Returns the file name extension in lower case, including the . character Returns null if no extension was found.
getFileName Returns the file name part of the path, null if not found.
getFileNameWithoutExtension Returns the file name without its extension, null if not found.
getRootLength Returns the length of the root part of the path.
getRootName Returns the root part of the path, null if not found.
hasExtension Returns true if the file name contains an extension.
isDirectorySeparator Returns true if the given character is a directory separator.
isExtension Returns true if the given file has the specified extension (case-insensitive).
isRooted Returns true if the given path is rooted (starts with a separator or a drive letter and colon).
isValidFileName Returns true if the given file name is valid.
isValidPathName Returns true if the given path name is valid.
normalize Normalizes the path by replacing ' with /' to conform to standard path format.

func Path.combine [src]

Combines multiple path segments into one, adding a directory separator between them if necessary.

func combine(fullnames: string...)->String

func Path.equals [src]

Returns true if the two paths are equal (case-insensitive Latin1 comparison).

func equals(path1, path2: string)->bool

func Path.getAbsolute [src]

Transform fullname to an absolute path.

func getAbsolute(fullname: string)->String throw

func Path.getDirectoryName [src]

Returns the directory part of the path, null if not found.

func getDirectoryName(fullname: string)->string

func Path.getExtension [src]

Returns the file name extension, including the . character Returns null if no extension was found.

func getExtension(fullname: string)->string

func Path.getExtensionLowerCase [src]

Returns the file name extension in lower case, including the . character Returns null if no extension was found.

func getExtensionLowerCase(fullname: string)->String

func Path.getFileName [src]

Returns the file name part of the path, null if not found.

func getFileName(fullname: string)->string

func Path.getFileNameWithoutExtension [src]

Returns the file name without its extension, null if not found.

func getFileNameWithoutExtension(fullname: string)->string

func Path.getRootLength [src]

Returns the length of the root part of the path.

func getRootLength(fullname: string)->u32

func Path.getRootName [src]

Returns the root part of the path, null if not found.

func getRootName(fullname: string)->string

func Path.hasExtension [src]

Returns true if the file name contains an extension.

func hasExtension(fullname: string)->bool

func Path.isDirectorySeparator [src]

Returns true if the given character is a directory separator.

func isDirectorySeparator(c: u8)->bool

func Path.isExtension [src]

Returns true if the given file has the specified extension (case-insensitive).

func isExtension(fullname, extension: string)->bool

func Path.isRooted [src]

Returns true if the given path is rooted (starts with a separator or a drive letter and colon).

func isRooted(fullname: string)->bool

func Path.isValidFileName [src]

Returns true if the given file name is valid.

func isValidFileName(fullname: string)->bool

func Path.isValidPathName [src]

Returns true if the given path name is valid.

func isValidPathName(fullname: string)->bool

func Path.normalize [src]

Normalizes the path by replacing ' with /' to conform to standard path format.

func normalize(fullname: *String)

namespace Core.Random

Structs

CMWC4096 George Marsaglia's CMWC (Complementary Multiply With Carry) 4096 random number generator.
MWC
Mt64
Rng

Functions

shared Get the default per thread random generator.

struct Random.CMWC4096 [src]

George Marsaglia's CMWC (Complementary Multiply With Carry) 4096 random number generator.

q [4096] u32 State array of 4096 32-bit unsigned integers.
c u32 Carry value.
i u32 Current index into the state array (initialized to an invalid value to trigger seeding).

Functions

nextU32 Generates the next 32-bit unsigned random number.
seedU32 Seeds the generator with a 32-bit unsigned value.

func CMWC4096.nextU32 [src]

Generates the next 32-bit unsigned random number.

func nextU32(me)->u32

func CMWC4096.seedU32 [src]

Seeds the generator with a 32-bit unsigned value.

func seedU32(me, value: u32)

struct Random.MWC [src]

w u32
z u32

Functions

nextU32
seedU32(me, u32)
seedU32(me, u32, u32)

func MWC.nextU32 [src]

func nextU32(me)->u32

func MWC.seedU32 [src]

func seedU32(me, value: u32) func seedU32(me, value1, value2: u32)

struct Random.Mt64 [src]

mt [312] u64
mti u64

Functions

nextU64
seedU64(me, const [..] u64)
seedU64(me, u64)

func Mt64.nextU64 [src]

func nextU64(me)->u64

func Mt64.seedU64 [src]

func seedU64(me, seed: u64) func seedU64(me, seed: const [..] u64)

struct Random.Rng [src]

struct Rng(T = MWC)
rng Random.Rng.T
seedDone bool

Functions

nextBool Returns a random bool.
nextF32(me) Range is [0..1[, so 1.0 will never be returned.
nextF32(me, f32, f32) Returns a float value in a given range max is excluded.
nextF64(me) Range is [0..1[, so 1.0 will never be returned.
nextF64(me, f64, f64) Returns a float value in a given range max is excluded.
nextS32(me) Returns a signed 32 bits random value.
nextS32(me, s32, s32) Returns a signed random value in a given range max is excluded.
nextS64(me) Returns a signed 64 bits random value.
nextS64(me, s64, s64) Returns a signed random value in a given range max is excluded.
nextU32(me) Returns an unsigned 32 bits random value.
nextU32(me, u32, u32) Returns an unsigned random value in a given range max is excluded.
nextU64(me) Returns an unsigned 64 bits random value.
nextU64(me, u64, u64) Returns an unsigned random value in a given range max is excluded.
seedNow Seed the rng with the current time.
seedU32 Seed random generator with a 32 bits value.
seedU64 Seed random generator with a 64 bits value.
shuffle Randomly change the order of a slice.

func Rng.nextBool [src]

Returns a random bool.

func nextBool(me)->bool

func Rng.nextF32 [src]

Range is [0..1[, so 1.0 will never be returned.

func nextF32(me)->f32

Returns a float value in a given range max is excluded.

func nextF32(me, min, max: f32)->f32

func Rng.nextF64 [src]

Range is [0..1[, so 1.0 will never be returned.

func nextF64(me)->f64

Returns a float value in a given range max is excluded.

func nextF64(me, min, max: f64)->f64

func Rng.nextS32 [src]

Returns a signed 32 bits random value.

func nextS32(me)->s32

Returns a signed random value in a given range max is excluded.

func nextS32(me, min, max: s32)->s32

func Rng.nextS64 [src]

Returns a signed 64 bits random value.

func nextS64(me)->s64

Returns a signed random value in a given range max is excluded.

func nextS64(me, min, max: s64)->s64

func Rng.nextU32 [src]

Returns an unsigned 32 bits random value.

func nextU32(me)->u32

Returns an unsigned random value in a given range max is excluded.

func nextU32(me, min, max: u32)->u32

func Rng.nextU64 [src]

Returns an unsigned 64 bits random value.

func nextU64(me)->u64

Returns an unsigned random value in a given range max is excluded.

func nextU64(me, min, max: u64)->u64

func Rng.seedNow [src]

Seed the rng with the current time.

func seedNow(me)

func Rng.seedU32 [src]

Seed random generator with a 32 bits value.

func seedU32(me, seed: u32)

func Rng.seedU64 [src]

Seed random generator with a 64 bits value.

func seedU64(me, seed: u64)

func Rng.shuffle [src]

Randomly change the order of a slice.

func(V) shuffle(me, slice: [..] V)

func Random.shared [src]

Get the default per thread random generator.

func shared()->*Random.Rng'(Random.MWC)

namespace Core.Reflection

Functions

appendValueStructArray Add an element in a Core.Array without knowing the type of the element at compile time but knowing it at runtime (valueType).
canCopy
clearStructArray Used to clear a Core.Array without knowing the type of the element at compile time but knowing it at runtime (valueType).
copy
crcToType Convert a crc to a registered typeinfo.
getAttribute(const *TypeInfo, const *TypeInfo) Returns the given associated attribute to type or null.
getAttribute(const *TypeValue, const *TypeInfo) Returns the given associated attribute to value or null.
getAttributeValue(const *TypeValue, const *TypeInfo, string, T) Returns the given attribute value, or null.
getAttributeValue(const *Attribute, string) Returns the given attribute value, or null.
getAttributeValue(const *TypeInfo, const *TypeInfo, string) Returns the given attribute value, or null.
getAttributeValue(const *TypeValue, const *TypeInfo, string) Returns the given attribute value, or null.
getAttributes(const *TypeInfo, const *TypeInfo) Returns the given associated attributes to type.
getAttributes(const *TypeValue, const *TypeInfo) Returns the given associated attributes to value.
getEnumName Returns the enum value name corresponding to the value pointed by valueAddr Can have multiple names if the enum is tagged with #[Swag.EnumFlags].
getEnumValue Get information about a specific value in a given enum Returns null if the value does not exist.
getField Get information about a specific field in a given struct Returns null if the field does not exist.
getFieldValue Get a field value with a given runtime type.
getMethod Get information about a specific method in a given struct.
getStructArrayType Returns the generic type of the Core.Array typeinfo.
hasAttribute(const *TypeInfo, const *TypeInfo) Returns true if the given type has the associated attribute.
hasAttribute(const *TypeValue, const *TypeInfo) Returns true if the given value has the associated attribute.
hasDrop
hasInterface Returns true if the interface itf is implemented in the given structure type.
hasMethod Helper function to know if a struct has a special method.
hasPostCopy
hasPostMove
isAny
isBool
isEnum
isEnumFlags
isFloat
isGeneric
isInteger
isInterface
isNative
isPod
isPointer
isPointerArithmetic
isPointerRef
isRune
isSimpleNative
isSlice
isStaticArray
isString
isStruct
isStructArray Returns true if the type t is a Core.Array type.
isStructOfName Returns true if this is a struct of the given name.
isTuple
isType
isTypeAlias
makeConcreteAlias In case this is a type alias, need to go deep inside it to find the right type.
makeConcreteEnum Transform an enum type to its underling real native type.
maxSizeOf Returns the maximum sizeof a bunch of typeinfo.
nameToType Convert a crc to a registered typeinfo.
orFlags Make an union of flags of all types.
removeValueStructArray Remove an element in a Core.Array without knowing the type of the element at compile time but knowing it at runtime (valueType).
setFieldValue Set a field value with a given runtime type.

func Reflection.appendValueStructArray [src]

Add an element in a Core.Array without knowing the type of the element at compile time but knowing it at runtime (valueType).

func appendValueStructArray(arrayPtr: *void, valueType: typeinfo)->*void

func Reflection.canCopy [src]

func canCopy(type: typeinfo)->bool

func Reflection.clearStructArray [src]

Used to clear a Core.Array without knowing the type of the element at compile time but knowing it at runtime (valueType).

func clearStructArray(arrayPtr: *void, valueType: typeinfo)

func Reflection.copy [src]

func copy(dst, src: *void, type: typeinfo)

func Reflection.crcToType [src]

Convert a crc to a registered typeinfo.

func crcToType(crc: u32)->const *Swag.TypeInfo

func Reflection.getAttribute [src]

Returns the given associated attribute to value or null.

func getAttribute(value: const *Swag.TypeValue, attribute: typeinfo)->const *Swag.Attribute

Returns the given associated attribute to type or null.

func getAttribute(type: typeinfo, attribute: typeinfo)->const *Swag.Attribute

func Reflection.getAttributeValue [src]

Returns the given attribute value, or null.

func getAttributeValue(type: const *Swag.TypeValue, attribute: typeinfo, value: string)->any func(T) getAttributeValue(type: const *Swag.TypeValue, attribute: typeinfo, value: string, def: T)->T func getAttributeValue(type: typeinfo, attribute: typeinfo, value: string)->any func getAttributeValue(attribute: const *Swag.Attribute, value: string)->any

func Reflection.getAttributes [src]

Returns the given associated attributes to value.

func getAttributes(value: const *Swag.TypeValue, attribute: typeinfo)->Array'(const *Swag.Attribute)

Returns the given associated attributes to type.

func getAttributes(type: typeinfo, attribute: typeinfo)->Array'(const *Swag.Attribute)

func Reflection.getEnumName [src]

Returns the enum value name corresponding to the value pointed by valueAddr Can have multiple names if the enum is tagged with #[Swag.EnumFlags].

func getEnumName(type: typeinfo, valueAddr: const *void, fullname = true)->String

func Reflection.getEnumValue [src]

Get information about a specific value in a given enum Returns null if the value does not exist.

func getEnumValue(type: typeinfo, name: string)->const *Swag.TypeValue

func Reflection.getField [src]

Get information about a specific field in a given struct Returns null if the field does not exist.

func getField(type: typeinfo, name: string)->const *Swag.TypeValue

func Reflection.getFieldValue [src]

Get a field value with a given runtime type.

func getFieldValue(dest: *void, type: const *TypeValue, src: *void, hardCast: bool = false)

func Reflection.getMethod [src]

Get information about a specific method in a given struct.

func getMethod(type: typeinfo, name: string)->const *Swag.TypeValue

Returns null if the method does not exist

func Reflection.getStructArrayType [src]

Returns the generic type of the Core.Array typeinfo.

func getStructArrayType(t: typeinfo)->const *Swag.TypeInfo

If t is not a Core.Array, returns null

func Reflection.hasAttribute [src]

Returns true if the given value has the associated attribute.

func hasAttribute(value: const *Swag.TypeValue, attribute: typeinfo)->bool

Returns true if the given type has the associated attribute.

func hasAttribute(type: typeinfo, attribute: typeinfo)->bool

func Reflection.hasDrop [src]

func hasDrop(type: typeinfo)->bool

func Reflection.hasInterface [src]

Returns true if the interface itf is implemented in the given structure type.

func hasInterface(type: typeinfo, itf: typeinfo)->bool

func Reflection.hasMethod [src]

Helper function to know if a struct has a special method.

func hasMethod(type: typeinfo, name: string)->bool

func Reflection.hasPostCopy [src]

func hasPostCopy(type: typeinfo)->bool

func Reflection.hasPostMove [src]

func hasPostMove(type: typeinfo)->bool

func Reflection.isAny [src]

func isAny(t: typeinfo)->bool

func Reflection.isBool [src]

func isBool(t: typeinfo)->bool

func Reflection.isEnum [src]

func isEnum(t: typeinfo)->bool

func Reflection.isEnumFlags [src]

func isEnumFlags(t: typeinfo)->bool

func Reflection.isFloat [src]

func isFloat(t: typeinfo)->Swag.TypeInfoFlags

func Reflection.isGeneric [src]

func isGeneric(t: typeinfo)->Swag.TypeInfoFlags

func Reflection.isInteger [src]

func isInteger(t: typeinfo)->Swag.TypeInfoFlags

func Reflection.isInterface [src]

func isInterface(t: typeinfo)->bool

func Reflection.isNative [src]

func isNative(t: typeinfo)->bool

func Reflection.isPod [src]

func isPod(type: typeinfo)->bool

func Reflection.isPointer [src]

func isPointer(t: typeinfo)->bool

func Reflection.isPointerArithmetic [src]

func isPointerArithmetic(t: typeinfo)->Swag.TypeInfoFlags

func Reflection.isPointerRef [src]

func isPointerRef(t: typeinfo)->Swag.TypeInfoFlags

func Reflection.isRune [src]

func isRune(t: typeinfo)->bool

func Reflection.isSimpleNative [src]

func isSimpleNative(t: typeinfo)->bool

func Reflection.isSlice [src]

func isSlice(t: typeinfo)->bool

func Reflection.isStaticArray [src]

func isStaticArray(t: typeinfo)->bool

func Reflection.isString [src]

func isString(t: typeinfo)->bool

func Reflection.isStruct [src]

func isStruct(t: typeinfo)->bool

func Reflection.isStructArray [src]

Returns true if the type t is a Core.Array type.

func isStructArray(t: typeinfo)->bool

func Reflection.isStructOfName [src]

Returns true if this is a struct of the given name.

func isStructOfName(type: typeinfo, name: string)->bool

func Reflection.isTuple [src]

func isTuple(t: typeinfo)->Swag.TypeInfoFlags

func Reflection.isType [src]

func isType(t: typeinfo)->Swag.TypeInfoFlags

func Reflection.isTypeAlias [src]

func isTypeAlias(t: typeinfo)->bool

func Reflection.makeConcreteAlias [src]

In case this is a type alias, need to go deep inside it to find the right type.

func makeConcreteAlias(type: typeinfo)->const *Swag.TypeInfo

func Reflection.makeConcreteEnum [src]

Transform an enum type to its underling real native type.

func makeConcreteEnum(type: typeinfo)->const *Swag.TypeInfo

func Reflection.maxSizeOf [src]

Returns the maximum sizeof a bunch of typeinfo.

func maxSizeOf(v: const [..] typeinfo)->u64

func Reflection.nameToType [src]

Convert a crc to a registered typeinfo.

func nameToType(name: string)->const *Swag.TypeInfo

func Reflection.orFlags [src]

Make an union of flags of all types.

func orFlags(v: const [..] typeinfo)->Swag.TypeInfoFlags

func Reflection.removeValueStructArray [src]

Remove an element in a Core.Array without knowing the type of the element at compile time but knowing it at runtime (valueType).

func removeValueStructArray(arrayPtr: *void, valueType: typeinfo, index: u64)

func Reflection.setFieldValue [src]

Set a field value with a given runtime type.

func setFieldValue(dest: *void, type: const *TypeValue, src: const *void, hardCast: bool = false)

namespace Core.Serialization

Structs

Decoder Serialization decoder.
Encoder Serialization encoder.
Serializer

Enums

DecoderFlags
SectionKind

Functions

isPodFinal Determin if a type can be serialized by a simple copy.

Attributes

Alias Accept this other name for the struct field or the struct itself.
Compress Compress a struct or a field.
Final The struct does not need versionning.
NoSerialize Do not serialize a struct or a field.
Version Set the struct version number.

attr Serialization.Alias [src]

Accept this other name for the struct field or the struct itself.

Usage: struct struct-var multi
attr Alias(name: string)

attr Serialization.Compress [src]

Compress a struct or a field.

Usage: struct struct-var

struct Serialization.Decoder [src]

Serialization decoder.

struct Decoder(T)
serializer Serialization.Decoder.T
flags Serialization.DecoderFlags

This is a high level decoder that needs a specific implementation like Core.Serialization.Read.TagBin or Core.Serialization.Read.JSon.

var res = File.readAllBytes(file) var decoder: Decoder'Read.TagBin let myStruct = catch decoder.readAll'MyStruct(res.toSlice())

Functions

end Finish reading.
readAll Read a full struct.
readTypeValue
readTypedContent
start Start reading.

func IDecoder.beginField [src]

func beginField(me, val: Swag.TypeValue)->bool throw

func IDecoder.beginSection [src]

func beginSection(me, kind: SectionKind) throw

func IDecoder.end [src]

func end(me) throw

func IDecoder.endField [src]

func endField(me, val: Swag.TypeValue) throw

func IDecoder.endSection [src]

func endSection(me) throw

func IDecoder.getVersion [src]

func getVersion(me)->u32

func IDecoder.isTextual [src]

func isTextual(me)->bool

func IDecoder.read [src]

func read(me, data: *void, dataType: typeinfo) throw

func IDecoder.readBool [src]

func readBool(me)->bool throw

func IDecoder.readBufferU8 [src]

func readBufferU8(me, count: u64)->*u8 throw

func IDecoder.readF32 [src]

func readF32(me)->f32 throw

func IDecoder.readF64 [src]

func readF64(me)->f64 throw

func IDecoder.readS16 [src]

func readS16(me)->s16 throw

func IDecoder.readS32 [src]

func readS32(me)->s32 throw

func IDecoder.readS64 [src]

func readS64(me)->s64 throw

func IDecoder.readS8 [src]

func readS8(me)->s8 throw

func IDecoder.readString [src]

func readString(me)->String throw

func IDecoder.readU16 [src]

func readU16(me)->u16 throw

func IDecoder.readU32 [src]

func readU32(me)->u32 throw

func IDecoder.readU64 [src]

func readU64(me)->u64 throw

func IDecoder.readU8 [src]

func readU8(me)->u8 throw

func IDecoder.start [src]

func start(me, input: const [..] u8) throw

func Decoder.end [src]

Finish reading.

func end(me) throw

func Decoder.readAll [src]

Read a full struct.

func(TR) readAll(me, input: const [..] u8)->*TR throw

func Decoder.readTypeValue [src]

func readTypeValue(me, typedVal: TypeValue, data: [*] void) throw

func Decoder.readTypedContent [src]

func readTypedContent(me, data: [*] void, dataType: typeinfo) throw

func Decoder.start [src]

Start reading.

func start(me, input: const [..] u8) throw

enum Serialization.DecoderFlags [src]

Zero
IgnoreStructFieldError

struct Serialization.Encoder [src]

Serialization encoder.

struct Encoder(T)
serializer Serialization.Encoder.T
errorIfUnknown bool If true, an error will be raised if a type cannot be saved. The field will be ignored if set to false.

This is a high level encoder that needs a specific implementation like Core.Serialization.Write.TagBin or Core.Serialization.Write.JSon.

var buf: ConcatBuffer var encoder: Encoder'Write.TagBin encoder.writeAll(&buf, myStruct) File.writeAllBytes(file, buf)

Can be serialized:

  • All simple types: bool/u8/u16/u32/u64/s8/s16/s32/s64/rune/f32/f64
  • A type value typeinfo, which will be saved as a CRC.
  • An interface. Will be stored as a type and a typed value.
  • A struct.
  • A Core.String.
  • A Core.Array of valid values.
  • A static array of valid values.
Note

Type string is not supported. Consider using Core.String instead.

A struct can implement the ISerialize interface in order to have a specific serialization. If not defined, then the struct will be saved field by field.

Functions

end End serialization.
start Start serialization.
writeAll Write a full struct.
writeTypeValue Write a given Swag.TypeValue.
writeValue Write a given value with a given type.

func IEncoder.beginField [src]

func beginField(me, val: Swag.TypeValue) throw

func IEncoder.beginSection [src]

func beginSection(me, kind: SectionKind) throw

func IEncoder.end [src]

End serialization.

func end(me) throw

func IEncoder.endField [src]

func endField(me, val: Swag.TypeValue) throw

func IEncoder.endSection [src]

func endSection(me) throw

func IEncoder.isTextual [src]

func isTextual(me)->bool

func IEncoder.start [src]

Start serialization.

func start(me, result: *ConcatBuffer) throw

func IEncoder.write [src]

func write(me, data: const [*] void, type: typeinfo) throw

func IEncoder.writeBool [src]

func writeBool(me, value: bool)

func IEncoder.writeBufferU8 [src]

func writeBufferU8(me, data: const [*] u8, count: u64) throw

func IEncoder.writeF32 [src]

func writeF32(me, value: f32)

func IEncoder.writeF64 [src]

func writeF64(me, value: f64)

func IEncoder.writeS16 [src]

func writeS16(me, value: s16)

func IEncoder.writeS32 [src]

func writeS32(me, value: s32)

func IEncoder.writeS64 [src]

func writeS64(me, value: s64)

func IEncoder.writeS8 [src]

func writeS8(me, value: s8)

func IEncoder.writeString [src]

func writeString(me, value: string)

func IEncoder.writeU16 [src]

func writeU16(me, value: u16)

func IEncoder.writeU32 [src]

func writeU32(me, value: u32)

func IEncoder.writeU64 [src]

func writeU64(me, value: u64)

func IEncoder.writeU8 [src]

func writeU8(me, value: u8)

func Encoder.end [src]

End serialization.

func end(me) throw

func Encoder.start [src]

Start serialization.

func start(me, result: *ConcatBuffer) throw

func Encoder.writeAll [src]

Write a full struct.

func writeAll(me, result: *ConcatBuffer, value: any) throw

Will call Encoder.start, Encoder.writeValue and Encoder.end

func Encoder.writeTypeValue [src]

Write a given Swag.TypeValue.

func writeTypeValue(me, typeVal: TypeValue, data: const [*] void) throw

func Encoder.writeValue [src]

Write a given value with a given type.

func writeValue(me, data: const [*] void, dataType: typeinfo) throw

attr Serialization.Final [src]

The struct does not need versionning.

Usage: struct
attr Final

interface Serialization.IDecoder [src]

getVersion func(*Serialization.IDecoder)->u32
isTextual func(*Serialization.IDecoder)->bool
start func(*Serialization.IDecoder, const [..] u8) throw
end func(*Serialization.IDecoder) throw
beginField func(*Serialization.IDecoder, Swag.TypeValue)->bool throw
endField func(*Serialization.IDecoder, Swag.TypeValue) throw
beginSection func(*Serialization.IDecoder, Serialization.SectionKind) throw
endSection func(*Serialization.IDecoder) throw
read func(*Serialization.IDecoder, *void, const *Swag.TypeInfo) throw
readBufferU8 func(*Serialization.IDecoder, u64)->*u8 throw
readBool func(*Serialization.IDecoder)->bool throw
readS8 func(*Serialization.IDecoder)->s8 throw
readS16 func(*Serialization.IDecoder)->s16 throw
readS32 func(*Serialization.IDecoder)->s32 throw
readS64 func(*Serialization.IDecoder)->s64 throw
readU8 func(*Serialization.IDecoder)->u8 throw
readU16 func(*Serialization.IDecoder)->u16 throw
readU32 func(*Serialization.IDecoder)->u32 throw
readU64 func(*Serialization.IDecoder)->u64 throw
readF32 func(*Serialization.IDecoder)->f32 throw
readF64 func(*Serialization.IDecoder)->f64 throw
readString func(*Serialization.IDecoder)->String throw

interface Serialization.IEncoder [src]

isTextual func(*Serialization.IEncoder)->bool
start func(*Serialization.IEncoder, *ConcatBuffer) throw
end func(*Serialization.IEncoder) throw
beginField func(*Serialization.IEncoder, Swag.TypeValue) throw
endField func(*Serialization.IEncoder, Swag.TypeValue) throw
beginSection func(*Serialization.IEncoder, Serialization.SectionKind) throw
endSection func(*Serialization.IEncoder) throw
write func(*Serialization.IEncoder, const [*] void, const *Swag.TypeInfo) throw
writeBufferU8 func(*Serialization.IEncoder, const [*] u8, u64) throw
writeBool func(*Serialization.IEncoder, bool)
writeS8 func(*Serialization.IEncoder, s8)
writeS16 func(*Serialization.IEncoder, s16)
writeS32 func(*Serialization.IEncoder, s32)
writeS64 func(*Serialization.IEncoder, s64)
writeU8 func(*Serialization.IEncoder, u8)
writeU16 func(*Serialization.IEncoder, u16)
writeU32 func(*Serialization.IEncoder, u32)
writeU64 func(*Serialization.IEncoder, u64)
writeF32 func(*Serialization.IEncoder, f32)
writeF64 func(*Serialization.IEncoder, f64)
writeString func(*Serialization.IEncoder, string)

interface Serialization.ISerialize [src]

read func(*Serialization.ISerialize, Serialization.IDecoder)->bool throw
write func(*Serialization.ISerialize, Serialization.IEncoder)->bool throw
readElement func(*Serialization.ISerialize, Swag.TypeValue, *void, Serialization.IDecoder)->bool throw
writeElement func(*Serialization.ISerialize, Swag.TypeValue, const *void, Serialization.IEncoder)->bool throw
postRead func(*Serialization.ISerialize, *void, Serialization.IDecoder) throw

attr Serialization.NoSerialize [src]

Do not serialize a struct or a field.

Usage: struct struct-var

namespace Core.Serialization.Read

Structs

JSon A simple JSON reader.
TagBin Binary serializer with forward/backward compatibility.
TagBinOptions Configuration options for controlling deserialization behavior.
TagBinSection Section information for tracking deserialization state within structured data.
Xml A simple XML reader.

struct Read.JSon [src]

A simple JSON reader.

stream ByteStream
line u64
col u64
propName String

In the case of a struct, the JSON file must represent the structure layout (order of fields matters).

Functions

beginElement
beginRoot
beginSection
beginSequence
beginStruct
beginValue
endElement
endRoot
endSection
endSequence
endStruct
endValue
getError
getVersion
isTextual
readNative
startRead
toNextSequenceElement
zapBlanks

func JSon.beginElement [src]

func beginElement(me, val: TypeValue)->bool throw

func JSon.beginRoot [src]

func beginRoot(me) throw

func JSon.beginSection [src]

func beginSection(me, _kind: SectionKind) throw

func JSon.beginSequence [src]

func beginSequence(me, _typeElem: typeinfo, _data: *u8, _countElem: *u64)->bool throw

func JSon.beginStruct [src]

func beginStruct(me, _structType: typeinfo, _structData: const *u8)->bool throw

func JSon.beginValue [src]

func beginValue(me) throw

func JSon.endElement [src]

func endElement(me, _val: TypeValue) throw

func JSon.endRoot [src]

func endRoot(me) throw

func JSon.endSection [src]

func endSection(me) throw

func JSon.endSequence [src]

func endSequence(me) throw

func JSon.endStruct [src]

func endStruct(me) throw

func JSon.endValue [src]

func endValue(me) throw

func JSon.getError [src]

func getError(me, val: string)->Errors.SyntaxError

func JSon.getVersion [src]

func getVersion(me)->u32

func JSon.isTextual [src]

func isTextual(me)->bool

func JSon.readNative [src]

func(NT) readNative(me)->NT throw

func JSon.startRead [src]

func startRead(me, input: const [..] u8)

func JSon.toNextSequenceElement [src]

func toNextSequenceElement(me, _countElem: *u64)->bool

func JSon.zapBlanks [src]

func zapBlanks(me)

struct Read.TagBin [src]

Binary serializer with forward/backward compatibility.

version u32 Version of the tagbin in the stream.
ignoreElements Array'(String) A list of element names that should be skipped.
stream ByteStream Input byte stream for reading serialized data.
options Serialization.Read.TagBinOptions Configuration options for deserialization behavior.
freeSections ArrayPtr'(Serialization.Read.TagBinSection) Pool of reusable section objects for memory efficiency.
sections ArrayPtr'(Serialization.Read.TagBinSection) Stack of active sections during deserialization.
convertNextNative const *Swag.TypeInfoNative Type information for pending native type conversion.
convertValToArray bool Flag indicating next value should be converted to array.
convertArrayToVal bool Flag indicating next array should be converted to single value.
outStack Array'({buf:const [..] u8,seek:u64})
elemStack Array'({compressed:bool,tmpBuf:*Array'(u8)})
tmpPool ArrayPtr'(Array'(u8))

Changes that are supported from V to V+1 are :

  • Add a new field. The new field will stay at the default value.
  • Remove a field. It will just be ignored.
  • Reorder of fields, as long as their name/type are the same.
  • Rename a field with Serialization.Alias.

Supported type changes are :

  • Conversion from integer/float/rune/bool to integer/float/rune/bool.
  • Change the size of a static array.
  • Conversion from a static array to a dynamic Core.Array, and vice versa.
  • Conversion from a single value to a static array or Core.Array, and vice versa.
  • Rename a struct with Serialization.Alias.
  • Convert an existing complexe type to Serialization.Final

Supported attributes are :

  • Serialisation.Version. If version is specified, then loading will not have versioning if versions are the same
  • Serialization.Alias. To rename a field or a struct type. Multiple aliases are supported.
  • Serialization.Final. The struct will be loaded/saved without versioning (faster and lower serialization size)

Functions

beginElement Begin reading a field element identified by val.
beginRoot Begin reading the root container of the serialized data.
beginSection Begin reading a new section with the specified kind.
beginSequence Begin reading a sequence (array) of elements of type typeElem.
beginStruct Begin reading a struct of the given structType.
beginValue Begin reading a value within the current context.
endElement Finish reading the current field element.
endRoot Finish reading the root container.
endSection Finish reading the current section.
endSequence Finish reading the current sequence.
endStruct Finish reading the current struct.
endValue Finish reading a value within the current context.
getVersion Get the version number of the current section.
isTextual Check if this serializer uses textual representation.
readNative Read a native type value from the stream with automatic type conversion support.
startRead Initialize the deserializer with the given input byte array.
toNextSequenceElement Advance to the next element in the current sequence.

func TagBin.beginElement [src]

Begin reading a field element identified by val.

func beginElement(me, val: TypeValue)->bool throw

Returns true if the element exists in the stream and should be processed, false to skip it.

func TagBin.beginRoot [src]

Begin reading the root container of the serialized data.

func beginRoot(me) throw

Validates the root signature to ensure the stream contains valid serialized data.

func TagBin.beginSection [src]

Begin reading a new section with the specified kind.

func beginSection(me, kind: SectionKind, skipFat = false) throw

Optionally skips reading the fat table if skipFat is true for performance optimization.

func TagBin.beginSequence [src]

Begin reading a sequence (array) of elements of type typeElem.

func beginSequence(me, typeElem: typeinfo, data: *u8, countElem: *u64)->bool throw

Updates countElem with the actual number of elements and returns true for bulk reading optimization.

func TagBin.beginStruct [src]

Begin reading a struct of the given structType.

func beginStruct(me, structType: typeinfo, _structData: const *u8)->bool throw

Returns false for normal struct processing, true for special handling cases.

func TagBin.beginValue [src]

Begin reading a value within the current context.

func beginValue(me) throw

Currently no special processing is required, but this maintains the symmetric API.

func TagBin.endElement [src]

Finish reading the current field element.

func endElement(me, _val: TypeValue) throw

Clears any pending native type conversion state.

func TagBin.endRoot [src]

Finish reading the root container.

func endRoot(me) throw

Currently no cleanup is required, but this maintains the symmetric begin/end API.

func TagBin.endSection [src]

Finish reading the current section.

func endSection(me) throw

Updates the stream position and releases the section back to the pool.

func TagBin.endSequence [src]

Finish reading the current sequence.

func endSequence(me) throw

Currently no cleanup is required, but this maintains the symmetric API.

func TagBin.endStruct [src]

Finish reading the current struct.

func endStruct(me) throw

Closes the current section that was opened by beginStruct.

func TagBin.endValue [src]

Finish reading a value within the current context.

func endValue(me) throw

Currently no cleanup is required, but this maintains the symmetric API.

func TagBin.getVersion [src]

Get the version number of the current section.

func getVersion(me)->u32

Returns 0 if no sections are active, otherwise returns the version of the most recent section.

func TagBin.isTextual [src]

Check if this serializer uses textual representation.

func isTextual(me)->bool

Always returns false since this is a binary serializer.

func TagBin.readNative [src]

Read a native type value from the stream with automatic type conversion support.

func(NT) readNative(me)->NT throw

Handles string types specially and performs type conversions when convertNextNative is set.

func TagBin.startRead [src]

Initialize the deserializer with the given input byte array.

func startRead(me, input: const [..] u8) throw

Sets up the internal byte stream for reading from the provided data buffer.

func TagBin.toNextSequenceElement [src]

Advance to the next element in the current sequence.

func toNextSequenceElement(me, countElem: *u64)->bool

Decrements countElem and returns false when no more elements remain.

struct Read.TagBinOptions [src]

Configuration options for controlling deserialization behavior.

tryForward bool Accept to try to read a newest version, otherwise error.

struct Read.TagBinSection [src]

Section information for tracking deserialization state within structured data.

mapSeek HashTable'(u32, u64)
afterFatSeek u64 Stream position after the section's fat table.
version u32 Version number of this section.
kind Serialization.SectionKind Type of section (ordered, unordered, or raw).
skipFat bool Whether to skip reading the fat table for this section.

struct Read.Xml [src]

A simple XML reader.

stream ByteStream
line u64
col u64
stackTags Array'(string)

In the case of a struct, the XML file must represent the structure layout (order of fields matters).

Functions

beginElement
beginRoot
beginSection
beginSequence
beginStruct
beginValue
endElement
endRoot
endSection
endSequence
endStruct
endValue
getError
getVersion
isTextual
readEndTag
readNative
readStartTag
readTag
startRead
toNextSequenceElement
zapBlanks

func Xml.beginElement [src]

func beginElement(me, val: TypeValue)->bool throw

func Xml.beginRoot [src]

func beginRoot(me) throw

func Xml.beginSection [src]

func beginSection(me, _kind: SectionKind) throw

func Xml.beginSequence [src]

func beginSequence(me, _typeElem: typeinfo, _data: *u8, _countElem: *u64)->bool throw

func Xml.beginStruct [src]

func beginStruct(me, structType: typeinfo, structData: const *u8)->bool throw

func Xml.beginValue [src]

func beginValue(me) throw

func Xml.endElement [src]

func endElement(me, _val: TypeValue) throw

func Xml.endRoot [src]

func endRoot(me) throw

func Xml.endSection [src]

func endSection(me) throw

func Xml.endSequence [src]

func endSequence(me) throw

func Xml.endStruct [src]

func endStruct(me) throw

func Xml.endValue [src]

func endValue(me) throw

func Xml.getError [src]

func getError(me, val: string)->Errors.SyntaxError

func Xml.getVersion [src]

func getVersion(me)->u32

func Xml.isTextual [src]

func isTextual(me)->bool

func Xml.readEndTag [src]

func readEndTag(me) throw

func Xml.readNative [src]

func(NT) readNative(me)->NT throw

func Xml.readStartTag [src]

func readStartTag(me)->string throw

func Xml.readTag [src]

func readTag(me)->string throw

func Xml.startRead [src]

func startRead(me, input: const [..] u8)

func Xml.toNextSequenceElement [src]

func toNextSequenceElement(me, _countElem: *u64)->bool

func Xml.zapBlanks [src]

func zapBlanks(me)

enum Serialization.SectionKind [src]

Raw
Unordered
Ordered

struct Serialization.Serializer [src]

encode Serialization.IEncoder
decode Serialization.IDecoder
isWrite bool

Functions

beginSection Start a new section.
end End encoding/decoding.
endSection End the previous section.
isReading
isWriting
serialize(me, string, *MT) Serialize one value.
serialize(me, string, u32, *MT) Serialize one value.
startRead Start decoding.
startWrite Start encoding.

func Serializer.beginSection [src]

Start a new section.

func beginSection(me, kind = SectionKind.Unordered) throw

func Serializer.end [src]

End encoding/decoding.

func end(me) throw

func Serializer.endSection [src]

End the previous section.

func endSection(me) throw

func Serializer.isReading [src]

func isReading(me)->bool

func Serializer.isWriting [src]

func isWriting(me)->bool

func Serializer.serialize [src]

Serialize one value.

func(MT) serialize(me, name: string, crc: u32, res: *MT) throw #[Swag.Macro] func(MT) serialize(me, name: string, res: *MT) throw

func Serializer.startRead [src]

Start decoding.

func startRead(me, decoder: IDecoder, input: const [..] u8) throw

func Serializer.startWrite [src]

Start encoding.

func startWrite(me, encoder: IEncoder, output: *ConcatBuffer) throw

attr Serialization.Version [src]

Set the struct version number.

Usage: struct
attr Version(v: u32)

namespace Core.Serialization.Write

Structs

JSon A JSON writer.
JSonOptions Options for customizing JSON formatting.
TagBin Binary writer for serialized data with support for structured and raw output.
TagBinSection Internal state for a binary serialization section.

Enums

TagBinSignatures Signatures used to tag different sections and elements in the binary serialization format.
TagBinValueFlags Additional signature for each value, stored after the value description (crcs).

struct Write.JSon [src]

A JSON writer.

options Serialization.Write.JSonOptions Formatting options.
output *ConcatBuffer Output buffer for generated JSON.
indent u32 Current indentation level.
fmtInt StrConv.ConvertFormatInt Format used for converting integers.
fmtFloat StrConv.ConvertFormatFloat Format used for converting floating-point numbers.
lastSeekValue ConcatBufferSeek Seek position used for rollback of trailing commas.

Functions

beginElement Begins a named JSON element (a key-value pair).
beginRoot Begins the root element (no-op for JSON).
beginSection Begins a JSON object section.
beginSequence Begins a JSON array.
beginStruct Begins writing a struct (treated as a JSON object).
beginValue Begins a JSON value (no-op).
endElement Ends a named JSON element (no-op).
endRoot Ends the root element (no-op for JSON).
endSection Ends a JSON object section.
endSequence Ends a JSON array.
endStruct Ends writing a struct.
endValue Ends a JSON value and appends a comma and optional newline.
isTextual Returns true indicating this writer produces textual output.
startWrite Initializes the JSON writer with the given output buffer.
writeIndent Writes indentation based on the current indent level and settings.
writeNative Writes a native value (bool, float, int, string) as a JSON value.

func JSon.beginElement [src]

Begins a named JSON element (a key-value pair).

func beginElement(me, val: TypeValue)

func JSon.beginRoot [src]

Begins the root element (no-op for JSON).

func beginRoot(me)

func JSon.beginSection [src]

Begins a JSON object section.

func beginSection(me, _kind: SectionKind)

func JSon.beginSequence [src]

Begins a JSON array.

func beginSequence(me, _typeElem: typeinfo, _data: const *void, _countElem: u64)->bool

func JSon.beginStruct [src]

Begins writing a struct (treated as a JSON object).

func beginStruct(me, _structType: typeinfo, _structData: const *u8)->bool

func JSon.beginValue [src]

Begins a JSON value (no-op).

func beginValue(me)

func JSon.endElement [src]

Ends a named JSON element (no-op).

func endElement(me, val: TypeValue)

func JSon.endRoot [src]

Ends the root element (no-op for JSON).

func endRoot(me)

func JSon.endSection [src]

Ends a JSON object section.

func endSection(me)

func JSon.endSequence [src]

Ends a JSON array.

func endSequence(me)

func JSon.endStruct [src]

Ends writing a struct.

func endStruct(me)

func JSon.endValue [src]

Ends a JSON value and appends a comma and optional newline.

func endValue(me)

func JSon.isTextual [src]

Returns true indicating this writer produces textual output.

func isTextual(me)->bool

func JSon.startWrite [src]

Initializes the JSON writer with the given output buffer.

func startWrite(me, buf: *ConcatBuffer)

func JSon.writeIndent [src]

Writes indentation based on the current indent level and settings.

func writeIndent(me)

func JSon.writeNative [src]

Writes a native value (bool, float, int, string) as a JSON value.

func(NT) writeNative(me, value: NT)

struct Write.JSonOptions [src]

Options for customizing JSON formatting.

indentLevel u32 Number of spaces per indentation level.
saveBlanks bool Whether to include indentation and line breaks.

struct Write.TagBin [src]

Binary writer for serialized data with support for structured and raw output.

compressionFlags Compress.Deflate.CompressionFlags
compressionLevel Compress.Deflate.CompressionLevel
compressionStrategy Compress.Deflate.CompressionStrategy

Functions

beginElement Begins a new element inside the current section and records its metadata.
beginRoot Begins the root section of the serialization structure.
beginSection Begins a new section of the specified kind.
beginSequence Begins a sequence and determines if elements can be written in bulk as raw data.
beginStruct Begins a new struct, writing versioning and section metadata.
beginValue Begins a value (stubbed out).
endElement Ends the current element (stubbed out).
endRoot Ends the root section and asserts that all subsections have been closed.
endSection Ends the current section and writes out any required metadata.
endSequence Ends a sequence (stubbed out).
endStruct Ends the current struct section.
endValue Ends a value (stubbed out).
isTextual Always returns true; indicates that output is textual (overridden stub).
startWrite Begins writing to a specified output buffer.
writeNative Writes a native value to the output buffer, with special handling for strings.

func TagBin.beginElement [src]

Begins a new element inside the current section and records its metadata.

func beginElement(me, val: TypeValue)

func TagBin.beginRoot [src]

Begins the root section of the serialization structure.

func beginRoot(me)

func TagBin.beginSection [src]

Begins a new section of the specified kind.

func beginSection(me, kind: SectionKind)

func TagBin.beginSequence [src]

Begins a sequence and determines if elements can be written in bulk as raw data.

func beginSequence(me, typeElem: typeinfo, data: const *void, countElem: u64)->bool

func TagBin.beginStruct [src]

Begins a new struct, writing versioning and section metadata.

func beginStruct(me, structType: typeinfo, _structData: const *u8)->bool

func TagBin.beginValue [src]

Begins a value (stubbed out).

func beginValue(me)

func TagBin.endElement [src]

Ends the current element (stubbed out).

func endElement(me, val: TypeValue)

func TagBin.endRoot [src]

Ends the root section and asserts that all subsections have been closed.

func endRoot(me)

func TagBin.endSection [src]

Ends the current section and writes out any required metadata.

func endSection(me)

func TagBin.endSequence [src]

Ends a sequence (stubbed out).

func endSequence(me)

func TagBin.endStruct [src]

Ends the current struct section.

func endStruct(me)

func TagBin.endValue [src]

Ends a value (stubbed out).

func endValue(me)

func TagBin.isTextual [src]

Always returns true; indicates that output is textual (overridden stub).

func isTextual(me)->bool

func TagBin.startWrite [src]

Begins writing to a specified output buffer.

func startWrite(me, buf: *ConcatBuffer)

func TagBin.writeNative [src]

Writes a native value to the output buffer, with special handling for strings.

func(NT) writeNative(me, value: NT)

struct Write.TagBinSection [src]

Internal state for a binary serialization section.

startSeek ConcatBufferSeek Seek position in the output buffer where the section starts.
mapSeek HashTable'(u32, ConcatBufferSeek) Maps CRC keys to their position in the output buffer.
kind Serialization.SectionKind Type of section (e.g., Raw or Unordered).

enum Write.TagBinSignatures [src]

Signatures used to tag different sections and elements in the binary serialization format.

Root Root element of the serialization structure.
Fat FAT table identifier for unordered sections.
Sequence Start of a sequence (array or list).
Version Indicates that a version number is present.
Raw Indicates raw POD data with no structure.
UnRaw Indicates non-POD structured data.

enum Write.TagBinValueFlags [src]

Additional signature for each value, stored after the value description (crcs).

Zero
Compressed

func Serialization.isPodFinal [src]

Determin if a type can be serialized by a simple copy.

func isPodFinal(type: #null typeinfo)->{raw:bool,sizeof:u64}

namespace Core.Slice

Functions

allOf Returns true if cb returns true for all values.
anyOf Returns true if cb returns true for at least one value.
contains Returns true if the given slice contains the value.
containsSorted Returns true if the given slice contains the value.
equals Returns true if two slices are equal.
findLinear Find value in a slice by performing a linear search.
findSlice Returns true if the given slice contains the sub slice value.
findSorted Find value in a slice by performing a binary search.
insertionSort Insertion sort algorithm (slow).
isSorted(const [..] T) Returns true if the slice is sorted.
isSorted(const [..] T, func(*void, T, T)->s32) Returns true if the slice is sorted.
map Map the content of a slice to an array of type R.
max Get the maximum value of a slice, and the corresponding value index.
min Get the minimum value of a slice, and the corresponding value index.
modify Transform in place the content of a slice with a given lambda.
nextPermutation Get a permutation of the slice Shuffle the slice until no more permutation is possible, and then returns false. To obtain all permutations, the slice must be sorted the first time.
noneOf Returns true if cb returns false for all values.
quickSort Quick sort algorithm.
reduce Reduce the content of a slice to one single value.
reverse Reverse the content of a slice.
sort([..] T, bool) Sort the slice, by picking the right algorithm depending on the type and the number of elements.
sort([..] T, func(*void, T, T)->s32) Sort the slice, by picking the right algorithm depending on the type and the number of elements.

func Slice.allOf [src]

Returns true if cb returns true for all values.

func(T) allOf(values: const [..] T, cb: func||(T)->bool)->bool

func Slice.anyOf [src]

Returns true if cb returns true for at least one value.

func(T) anyOf(values: const [..] T, cb: func||(T)->bool)->bool

func Slice.contains [src]

Returns true if the given slice contains the value.

func(T, V) contains(values: #null const [..] T, value: V)->bool

func Slice.containsSorted [src]

Returns true if the given slice contains the value.

func(T, V) containsSorted(values: #null const [..] T, value: V)->bool

The slice must be sorted in ascending order

func Slice.equals [src]

Returns true if two slices are equal.

func(T) equals(dst, src: #null const [..] T)->bool

func Slice.findLinear [src]

Find value in a slice by performing a linear search.

func(T, V) findLinear(values: #null const [..] T, value: V)->u64

O^n, but slice does not have to be sorted. Returns Swag.U64.Max if not found.

func Slice.findSlice [src]

Returns true if the given slice contains the sub slice value.

func(T) findSlice(values: #null const [..] T, value: const [..] T)->u32

func Slice.findSorted [src]

Find value in a slice by performing a binary search.

func(T, V) findSorted(values: #null const [..] T, value: V)->u64

The slice must be sorted in ascending order Returns Swag.U64.Max if not found.

func Slice.insertionSort [src]

Insertion sort algorithm (slow).

func(T) insertionSort(values: [..] T, cb: func||(T, T)->s32)

func Slice.isSorted [src]

Returns true if the slice is sorted.

func(T) isSorted(values: const [..] T)->bool func(T) isSorted(values: const [..] T, cb: func||(T, T)->s32)->bool

func Slice.map [src]

Map the content of a slice to an array of type R.

func(T, R) map(values: const [..] T, cb: func||(T)->R)->Array'(R)

The lambda must return the value of R for each element of the slice.

func Slice.max [src]

Get the maximum value of a slice, and the corresponding value index.

func(T) max(values: const [..] T)->{value:T,index:u64}

func Slice.min [src]

Get the minimum value of a slice, and the corresponding value index.

func(T) min(values: const [..] T)->{value:T,index:u64}

func Slice.modify [src]

Transform in place the content of a slice with a given lambda.

func(T) modify(values: [..] T, cb: func||(*T))

func Slice.nextPermutation [src]

Get a permutation of the slice Shuffle the slice until no more permutation is possible, and then returns false. To obtain all permutations, the slice must be sorted the first time.

func(T) nextPermutation(arr: [..] T)->bool

func Slice.noneOf [src]

Returns true if cb returns false for all values.

func(T) noneOf(values: const [..] T, cb: func||(T)->bool)->bool

func Slice.quickSort [src]

Quick sort algorithm.

func(T) quickSort(values: [..] T, cb: func||(T, T)->s32)

func Slice.reduce [src]

Reduce the content of a slice to one single value.

func(T) reduce(values: const [..] T, cb: func||(T, T)->T)->T

The lambda is called with the previous reduced value and each element of the slice. The first reduced value is the first element of the slice.

func Slice.reverse [src]

Reverse the content of a slice.

func(T) reverse(values: [..] T)

func Slice.sort [src]

Sort the slice, by picking the right algorithm depending on the type and the number of elements.

func(T) sort(values: [..] T, bigFirst = false) func(T) sort(values: [..] T, cb: func||(T, T)->s32)

struct Core.StaticArray [src]

A stack-allocated array with a fixed capacity known at compile time.

struct StaticArray(T, N: u64)
buffer [?] StaticArray.T The fixed-size me.buffer that holds the elements.
count u64 The number of valid elements currently in the array.

It provides a similar interface to the dynamic Array but does not allocate memory on the heap.

Functions

add(me, &&T) Moves an element to the end of the array.
add(me, T) Adds a copy of an element to the end of the array.
add(me, const [..] T) Appends all elements from a slice to the end of the array.
addOnce Adds an element to the end of the array, but only if it's not already present.
back Returns a copy of the last element of the array.
backPtr Returns a pointer to the last element of the array.
clear Removes all elements from the array, setting its me.count to 0.
contains Returns true if the array contains the given value.
emplaceAddress Makes room for num elements at the end of the array and returns a pointer to the new space.
emplaceAt Moves elements from a slice at a specific index, shifting existing elements to the right.
emplaceInitAddress Makes room for num elements at the end of the array and returns a pointer to the new space.
free Drops all elements in the array, setting its me.count to 0.
front Returns a copy of the first element of the array.
frontPtr Returns a pointer to the first element of the array.
insertAt(me, u64, &&T) Inserts a moved value at a specific index, shifting existing elements to the right.
insertAt(me, u64, T) Inserts a copy of a value at a specific index, shifting existing elements to the right.
insertAt(me, u64, const [..] T) Inserts elements from a slice at a specific index, shifting existing elements to the right.
isEmpty Returns true if the array contains no elements.
popBack Removes the last element from the array and returns it.
remove(me, V) Removes the first occurrence of a given value from the array.
remove(me, u64, u64) Removes a specified number of elements starting from a given index.
removeAt Removes the element at a given index by swapping it with the last element.
removeAtOrdered Removes one or more elements at a given index, shifting subsequent elements to the left.
removeBack Removes the last element from the array.
removeOrdered Removes the first occurrence of a given value, preserving the order of remaining elements.
resize Changes the number of elements in the array to newCount.
sort(me) Sorts the array in ascending order using the default comparison operator.
sort(me, func(*void, T, T)->s32) Sorts the array using a custom comparison function.
sortReverse Sorts the array in descending order.
toSlice Returns a mutable slice containing all valid elements of the array.

Special Functions

opAffect Replaces the content of the array with elements copied from a slice.
opCast(me) Allows the array to be implicitly cast to a mutable slice.
opCast(me) Allows the array to be implicitly cast to an immutable slice.
opCount Returns the number of elements in the array.
opData Returns a raw, constant pointer to the array's buffer.
opDrop Ensures that if elements have destructors, they are called when the array goes out of scope.
opIndex(me, u64) Returns a mutable reference to the element at the specified index.
opIndex(me, u64) Returns a constant reference to the element at the specified index.
opIndexAffect Assigns a new value to the element at the specified index.
opIndexAssign Handles compound assignment operators (e.g., +=, -=) for elements.
opSlice Creates a slice from a sub-part of the array.
opVisit Provides a way to iterate over each element in the array.

func StaticArray.add [src]

Adds a copy of an element to the end of the array.

func add(me, value: T)

Asserts if the array is full.

Moves an element to the end of the array.

func add(me, value: &&T)

Asserts if the array is full.

Appends all elements from a slice to the end of the array.

func add(me, values: const [..] T)

Asserts if the array does not have enough capacity.

func StaticArray.addOnce [src]

Adds an element to the end of the array, but only if it's not already present.

func addOnce(me, value: T)

Asserts if the array is full.

func StaticArray.back [src]

Returns a copy of the last element of the array.

func back(me)->StaticArray.T

Asserts if the array is empty.

func StaticArray.backPtr [src]

Returns a pointer to the last element of the array.

func backPtr(me)->*StaticArray.T

Asserts if the array is empty.

func StaticArray.clear [src]

Removes all elements from the array, setting its me.count to 0.

func clear(me)

This calls the destructor for each element if one exists.

func StaticArray.contains [src]

Returns true if the array contains the given value.

func(V) contains(me, value: V)->bool

func StaticArray.emplaceAddress [src]

Makes room for num elements at the end of the array and returns a pointer to the new space.

func emplaceAddress(me, num: u32 = 1)->[*] StaticArray.T

The new memory is not initialized. Asserts if the array does not have enough capacity.

func StaticArray.emplaceAt [src]

Moves elements from a slice at a specific index, shifting existing elements to the right.

func emplaceAt(me, index: u64, values: [..] T)

Asserts if the array does not have enough capacity. Order is preserved.

func StaticArray.emplaceInitAddress [src]

Makes room for num elements at the end of the array and returns a pointer to the new space.

func emplaceInitAddress(me, num: u32 = 1)->[*] StaticArray.T

The new memory is default-initialized. Asserts if the array does not have enough capacity.

func StaticArray.free [src]

Drops all elements in the array, setting its me.count to 0.

func free(me)

This is equivalent to clear for this type.

func StaticArray.front [src]

Returns a copy of the first element of the array.

func front(me)->StaticArray.T

Asserts if the array is empty.

func StaticArray.frontPtr [src]

Returns a pointer to the first element of the array.

func frontPtr(me)->*StaticArray.T

Asserts if the array is empty.

func StaticArray.insertAt [src]

Inserts a copy of a value at a specific index, shifting existing elements to the right.

func insertAt(me, index: u64, value: T)

Asserts if the array is full. Order is preserved.

Inserts a moved value at a specific index, shifting existing elements to the right.

func insertAt(me, index: u64, value: &&T)

Asserts if the array is full. Order is preserved.

Inserts elements from a slice at a specific index, shifting existing elements to the right.

func insertAt(me, index: u64, values: const [..] T)

Asserts if the array does not have enough capacity. Order is preserved.

func StaticArray.isEmpty [src]

Returns true if the array contains no elements.

func isEmpty(const me)

func StaticArray.opAffect [src]

Replaces the content of the array with elements copied from a slice.

func opAffect(me, arr: const [..] T)

Asserts if the slice is larger than the array's capacity.

func StaticArray.opCast [src]

Allows the array to be implicitly cast to a mutable slice.

func opCast(me)->[..] StaticArray.T

Allows the array to be implicitly cast to an immutable slice.

func opCast(me)->const [..] StaticArray.T

func StaticArray.opCount [src]

Returns the number of elements in the array.

func opCount(me)->u64

func StaticArray.opData [src]

Returns a raw, constant pointer to the array's buffer.

func opData(me)->const *StaticArray.T

func StaticArray.opDrop [src]

Ensures that if elements have destructors, they are called when the array goes out of scope.

func opDrop(me)

func StaticArray.opIndex [src]

Returns a constant reference to the element at the specified index.

func opIndex(const me, index: u64)->const &StaticArray.T

Returns a mutable reference to the element at the specified index.

func opIndex(me, index: u64)->&StaticArray.T

func StaticArray.opIndexAffect [src]

Assigns a new value to the element at the specified index.

func opIndexAffect(me, index: u64, value: T)

func StaticArray.opIndexAssign [src]

Handles compound assignment operators (e.g., +=, -=) for elements.

func(op: string) opIndexAssign(me, index: u64, value: T)

func StaticArray.opSlice [src]

Creates a slice from a sub-part of the array.

func opSlice(me, lower, upper: u64)->[..] StaticArray.T

func StaticArray.opVisit [src]

Provides a way to iterate over each element in the array.

#[Swag.Macro] func(ptr: bool, back: bool) opVisit(me, stmt: #code void)

This is a macro that accepts a code block to execute for each element. Visiting by pointer and in reverse order is supported.

func StaticArray.popBack [src]

Removes the last element from the array and returns it.

func popBack(me)->StaticArray.T

Asserts if the array is empty.

func StaticArray.remove [src]

Removes a specified number of elements starting from a given index.

func remove(me, index, num: u64)

This is an unstable remove; the order of remaining elements is not preserved.

Removes the first occurrence of a given value from the array.

func(V) remove(me, value: V)

This is an unstable remove; order is not preserved. Does nothing if the value is not found.

func StaticArray.removeAt [src]

Removes the element at a given index by swapping it with the last element.

func removeAt(me, index: u64)

This is very fast, but the order of elements is not preserved.

func StaticArray.removeAtOrdered [src]

Removes one or more elements at a given index, shifting subsequent elements to the left.

func removeAtOrdered(me, index: u64, numValues: u64 = 1)

This is slower than removeAt, but preserves the order of the remaining elements.

func StaticArray.removeBack [src]

Removes the last element from the array.

func removeBack(me)

Asserts if the array is empty.

func StaticArray.removeOrdered [src]

Removes the first occurrence of a given value, preserving the order of remaining elements.

func(V) removeOrdered(me, value: V)

Does nothing if the value is not found.

func StaticArray.resize [src]

Changes the number of elements in the array to newCount.

func resize(me, newCount: u64)

Asserts if newCount exceeds the static capacity.

func StaticArray.sort [src]

Sorts the array in ascending order using the default comparison operator.

func sort(me)

Sorts the array using a custom comparison function.

func sort(me, cb: func||(T, T)->s32)

func StaticArray.sortReverse [src]

Sorts the array in descending order.

func sortReverse(me)

func StaticArray.toSlice [src]

Returns a mutable slice containing all valid elements of the array.

func toSlice(me)->[..] StaticArray.T

namespace Core.StrConv

Structs

ConvertFormat
ConvertFormatFloat Format structure to convert a float to a string.
ConvertFormatInt Format structure to convert an integer to a string.
StringBuilder

Functions

convert Templated version. Convert a value of type T.
convertAny Convert a value to an utf8 string, and append the result in a ConcatBuffer.
convertBool Convert a bool to a string, and put the result in a ConcatBuffer.
convertFloat(*ConcatBuffer, any, const &ConvertFormat, string) Convert a float to an utf8 string, and put the result in a ConcatBuffer.
convertFloat(*ConcatBuffer, any, const &ConvertFormatFloat) Convert a float to an utf8 string, and put the result in a ConcatBuffer.
convertInt(*ConcatBuffer, any, const &ConvertFormat, string) Convert an integer to an utf8 string, and put the result in a ConcatBuffer.
convertInt(*ConcatBuffer, any, const &ConvertFormatInt) Convert an integer to an utf8 string, and put the result in a ConcatBuffer.
convertRune Convert a rune to a string, and put the result in a ConcatBuffer.
convertStruct Convert a structure content to an utf8 string, and put the result in a ConcatBuffer.
parseB64 Convert an utf8 buffer in binary to an unsigned integer value.
parseBool Convert an utf8 buffer to a boolean.
parseF32 Convert an utf8 buffer to a floating point value.
parseF64
parseIdentifier Parse an identifier name in the sens of swag (ascii).
parseRune Convert an utf8 buffer to a simple rune.
parseS16
parseS32
parseS64
parseS8 Convert an utf8 buffer to an signed integer value.
parseString Convert an utf8 buffer to a String.
parseU16
parseU32
parseU64
parseU8 Convert an utf8 buffer in decimal to an unsigned integer value.
parseValue This function will parse the string buf and decode the corresponding value in addr.
parseX64 Convert an utf8 buffer in hexadecimal to an unsigned integer value.
toDisplayBitrate Converts a bit rate value into a readable format with Kbps, Mbps, or Gbps.
toDisplayDuration Converts a duration in milliseconds into a string formatted as "Xd Yh Zm Ws".
toDisplaySize Converts a size in bytes into a human-readable string with units (bytes, Kb, Mb, Gb, Tb).
toF32 Transform a string to an f32.
toF64 Transform a string to an f64.
toNum Transform a string to an integer or float.
toS16 Transform a string to an s16.
toS32 Transform a string to an s32.
toS64 Transform a string to an s64.
toS8 Transform a string to an s8.
toU16 Transform a string to an u16.
toU32 Transform a string to an u32.
toU64 Transform a string to an u64.
toU8 Transform a string to an u8.

namespace Core.StrConv.Atod

Functions

parse

func Atod.parse [src]

func parse(s: const [..] u8)->{value:f64,eat:u32,ovf:bool} throw

struct StrConv.ConvertFormat [src]

formatInt StrConv.ConvertFormatInt
formatFloat StrConv.ConvertFormatFloat

struct StrConv.ConvertFormatFloat [src]

Format structure to convert a float to a string.

precision s8 -1 is for 'most possible precision'.
fmt u8
forceSign bool

Functions

setFormat Set some format options with a given user string.

func ConvertFormatFloat.setFormat [src]

Set some format options with a given user string.

func setFormat(me, strFormat: #null string)

Format is [+][fmt][precision]

+

To force the positive sign if the number is positive + fmt This is the output format:

e -d.dddde±dd, a decimal exponent
E -d.ddddE±dd, a decimal exponent
f -ddd.dddd, no exponent
g e for large exponents, f otherwise
G E for large exponents, f otherwise

precision

A number which is the precision of the fractional part

struct StrConv.ConvertFormatInt [src]

Format structure to convert an integer to a string.

base u32
padding u8
width u8
forceSign bool

If signed is true, the value to convert must be stored in signedValue, otherwise it must be stored in unsignedValue.

Functions

setFormat Set some format options with a given user string.

func ConvertFormatInt.setFormat [src]

Set some format options with a given user string.

func setFormat(me, strFormat: #null string)

The format is [+][fmt][padding][width]'

+'

To force the positive sign if the number is positive + fmt This is the output format:

B Binary
D Decimal
X Hexadecimal

padding

The padding character, in ascii. It's mandatory before the next field + width The width of the output, in number of characters

namespace Core.StrConv.Dtoa

Functions

parse Convert of floating value to a string.

func Dtoa.parse [src]

Convert of floating value to a string.

func parse(buf: *ConcatBuffer, val: f64, fmt: u8, precision: s64, forceSign: bool)

The format fmt is one of:

e -d.dddde±dd, a decimal exponent
E -d.ddddE±dd, a decimal exponent
f -ddd.dddd, no exponent
g e for large exponents, f otherwise
G E for large exponents, f otherwise

A negative precision means only as much as needed to be exact

interface StrConv.IConvert [src]

convert func(*StrConv.IConvert, *ConcatBuffer, StrConv.ConvertFormat, string)

interface StrConv.IPokeValue [src]

poke func(*StrConv.IPokeValue, string)->string throw

struct StrConv.StringBuilder [src]

buffer ConcatBuffer

Functions

appendAny Append a value.
appendEOL Append a end of line.
appendFormat Append a formatted string.
appendRune Append a rune.
appendString Append a string.
clear Clear the content of the builder.
count Returns the number of characters.
moveToString Return the content as a string by eating the content of the string builder (if possible).
setBucketSize Set sizes of buckets of the string builder.
toString Return the content as a string.
zeroTerminate Force a ending 0.

func StringBuilder.appendAny [src]

Append a value.

func appendAny(me, value: any, strFormat: string = null)

func StringBuilder.appendEOL [src]

Append a end of line.

func appendEOL(me)

func StringBuilder.appendFormat [src]

Append a formatted string.

func appendFormat(me, fmt: string, values: ...)

func StringBuilder.appendRune [src]

Append a rune.

func appendRune(me, value: rune)

func StringBuilder.appendString [src]

Append a string.

func appendString(me, value: #null string)

func StringBuilder.clear [src]

Clear the content of the builder.

func clear(me)

func StringBuilder.count [src]

Returns the number of characters.

func count(const me)->u64

func StringBuilder.moveToString [src]

Return the content as a string by eating the content of the string builder (if possible).

func moveToString(me)->String

func StringBuilder.setBucketSize [src]

Set sizes of buckets of the string builder.

func setBucketSize(me, size: u64)

func StringBuilder.toString [src]

Return the content as a string.

func toString(const me)->String

func StringBuilder.zeroTerminate [src]

Force a ending 0.

func zeroTerminate(me)

func StrConv.convert [src]

Templated version. Convert a value of type T.

func(T) convert(buf: *ConcatBuffer, value: T, convFmt: ConvertFormat, strFormat: #null string)

func StrConv.convertAny [src]

Convert a value to an utf8 string, and append the result in a ConcatBuffer.

func convertAny(buf: *ConcatBuffer, value: any, convFmt: ConvertFormat, strFormat: #null string)

func StrConv.convertBool [src]

Convert a bool to a string, and put the result in a ConcatBuffer.

func convertBool(buf: *ConcatBuffer, value: bool)

func StrConv.convertFloat [src]

Convert a float to an utf8 string, and put the result in a ConcatBuffer.

func convertFloat(buf: *ConcatBuffer, value: any, fmt: ConvertFormatFloat) func convertFloat(buf: *ConcatBuffer, value: any, convFmt: ConvertFormat, strFormat: #null string)

func StrConv.convertInt [src]

Convert an integer to an utf8 string, and put the result in a ConcatBuffer.

func convertInt(buf: *ConcatBuffer, value: any, fmt: ConvertFormatInt) func convertInt(buf: *ConcatBuffer, value: any, convFmt: ConvertFormat, strFormat: #null string)

func StrConv.convertRune [src]

Convert a rune to a string, and put the result in a ConcatBuffer.

func convertRune(buf: *ConcatBuffer, value: rune)

func StrConv.convertStruct [src]

Convert a structure content to an utf8 string, and put the result in a ConcatBuffer.

func convertStruct(buf: *ConcatBuffer, value: any, convFmt: ConvertFormat, strFormat: #null string)

func StrConv.parseB64 [src]

Convert an utf8 buffer in binary to an unsigned integer value.

func parseB64(str: string)->{value:u64,eat:u32,ovf:bool} throw

Returns the value and the number of bytes used to make the conversion. ovf will be true in case of overflow

func StrConv.parseBool [src]

Convert an utf8 buffer to a boolean.

func parseBool(str: string)->{value:bool,eat:u32} throw

Returns the value and the number of bytes used to make the conversion

func StrConv.parseF32 [src]

Convert an utf8 buffer to a floating point value.

func parseF32(str: string)->{value:f32,eat:u32,ovf:bool} throw

Returns the value and the number of bytes used to make the conversion. ovf will be true in case of overflow

func StrConv.parseF64 [src]

func parseF64(str: string)->{value:f64,eat:u32,ovf:bool} throw

func StrConv.parseIdentifier [src]

Parse an identifier name in the sens of swag (ascii).

func parseIdentifier(str: string)->string throw

func StrConv.parseRune [src]

Convert an utf8 buffer to a simple rune.

func parseRune(str: string)->{value:rune,eat:u32} throw

func StrConv.parseS16 [src]

func parseS16(str: string)->{value:s16,eat:u32,ovf:bool} throw

func StrConv.parseS32 [src]

func parseS32(str: string)->{value:s32,eat:u32,ovf:bool} throw

func StrConv.parseS64 [src]

func parseS64(str: string)->{value:s64,eat:u32,ovf:bool} throw

func StrConv.parseS8 [src]

Convert an utf8 buffer to an signed integer value.

func parseS8(str: string)->{value:s8,eat:u32,ovf:bool} throw

Returns the value and the number of bytes used to make the conversion. ovf will be true in case of overflow

func StrConv.parseString [src]

Convert an utf8 buffer to a String.

func parseString(str: string)->{value:String,eat:u32} throw

String in the buffer can be quoted (but the result will not be in that case)

func StrConv.parseU16 [src]

func parseU16(str: string)->{value:u16,eat:u32,ovf:bool} throw

func StrConv.parseU32 [src]

func parseU32(str: string)->{value:u32,eat:u32,ovf:bool} throw

func StrConv.parseU64 [src]

func parseU64(str: string)->{value:u64,eat:u32,ovf:bool} throw

func StrConv.parseU8 [src]

Convert an utf8 buffer in decimal to an unsigned integer value.

func parseU8(str: string)->{value:u8,eat:u32,ovf:bool} throw

Returns the value and the number of bytes used to make the conversion. ovf will be true in case of overflow

func StrConv.parseValue [src]

This function will parse the string buf and decode the corresponding value in addr.

func parseValue(addr: *void, type: typeinfo, buf: string)->string throw

addr must point to an initialized memory location that can hold type

Accepted types are :

  • s8, s16, s32, s64, u8, u16, u32, u64, rune, bool, f32, f64
  • Core.String literal strings are not supported as buf is supposed to be transient
  • enum with or without Swag.EnumFlags attribute

buf can contain multiple values separated with blanks if type is:

  • a static array of the types above
  • a dynamic Core.Array of the types above

func StrConv.parseX64 [src]

Convert an utf8 buffer in hexadecimal to an unsigned integer value.

func parseX64(str: string)->{value:u64,eat:u32,ovf:bool} throw

Returns the value and the number of bytes used to make the conversion. ovf will be true in case of overflow

func StrConv.toDisplayBitrate [src]

Converts a bit rate value into a readable format with Kbps, Mbps, or Gbps.

func toDisplayBitrate(value: u64)->String

func StrConv.toDisplayDuration [src]

Converts a duration in milliseconds into a string formatted as "Xd Yh Zm Ws".

func toDisplayDuration(ms: u64)->String

func StrConv.toDisplaySize [src]

Converts a size in bytes into a human-readable string with units (bytes, Kb, Mb, Gb, Tb).

func toDisplaySize(value: u64)->String

func StrConv.toF32 [src]

Transform a string to an f32.

func toF32(str: string)->f32 throw

func StrConv.toF64 [src]

Transform a string to an f64.

func toF64(str: string)->f64 throw

func StrConv.toNum [src]

Transform a string to an integer or float.

func(T) toNum(str: string)->T throw

func StrConv.toS16 [src]

Transform a string to an s16.

func toS16(str: string)->s16 throw

func StrConv.toS32 [src]

Transform a string to an s32.

func toS32(str: string)->s32 throw

func StrConv.toS64 [src]

Transform a string to an s64.

func toS64(str: string)->s64 throw

func StrConv.toS8 [src]

Transform a string to an s8.

func toS8(str: string)->s8 throw

func StrConv.toU16 [src]

Transform a string to an u16.

func toU16(str: string)->u16 throw

func StrConv.toU32 [src]

Transform a string to an u32.

func toU32(str: string)->u32 throw

func StrConv.toU64 [src]

Transform a string to an u64.

func toU64(str: string)->u64 throw

func StrConv.toU8 [src]

Transform a string to an u8.

func toU8(str: string)->u8 throw

struct Core.String [src]

buffer [*] u8
length u64
capacity u64
allocator Swag.IAllocator
padding [16] u8

Functions

append(me, rune) Append a rune to the String.
append(me, string) Append a string to the String.
append(me, u8) Append a byte to the String.
appendFormat Append a formatted string.
back Get the last byte.
clear Set the length of the String to 0.
contains(me, const [..] u8)
contains(me, rune)
contains(me, string)
contains(me, u8) Returns true if the string contains what.
ensureNotNull Transform a null string in an empty one.
from Convert a literal string to a String.
grow Ensure the String is big enough to store a given amount of bytes.
indexOf(me, rune, u64)
indexOf(me, string, u64, ComparisonType) Find what, and returns the byte index of it.
insert(me, u64, string) Insert a substring at the given position.
insert(me, u64, u8) Insert an ascii byte at the given position.
isEmpty Returns true if the String has zero length.
isNull Returns true if the String is null (undefined).
isNullOrEmpty Returns true if the String is null or empty.
join Join a list of strings to make a unique one.
joinWith Join an list of strings to make a unique one, by using a given separator between them.
makeLower Convert the string inplace to lower case.
makeUpper Convert the string inplace to upper case.
remove Remove some bytes at the given index.
removeBack Remove some bytes at the end.
replace(me, rune, string) Replace all occurences of what with by.
replace(me, string, string, ComparisonType) Replace all occurences of what with by.
reserve Reserve room for at least newCapacity bytes.
startsWith Return true if the string starts with str.
toLower(me, CharacterSet) Returns a new String in lower case.
toLower(string, CharacterSet) Returns a new String in lower case.
toRuneArray Convert string to a 32 bits character array.
toSlice(me) Returns a slice type.
toSlice(me) Returns a slice type.
toString Returns a string type.
toUpper(me, CharacterSet) Returns a new String in upper case.
toUpper(string, CharacterSet) Returns a new String in lower case.
trim Removes all leading and trailing white-space characters from the current String.
trimEnd Remove whitespaces at the end of the String.
trimStart Remove whitespaces at the start of the String.

Special Functions

opAffect
opAssign(me, const [..] rune)
opAssign(me, const [..] string)
opAssign(me, const [..] u8)
opAssign(me, rune)
opAssign(me, string)
opAssign(me, u8)
opCast(me)
opCast(me)
opCast(me)
opCmp
opCount
opData
opDrop
opEquals
opIndex Returns the byte at the given index.
opIndexAffect
opIndexAssign
opPostCopy
opPostMove
opSlice
opVisit Default foreach, by bytes.
opVisitBytes Visit the String utf8 bytes.
opVisitRunes Visit the String runes See Utf8.visitRunes for aliases.

func IHash32.compute [src]

func compute(const me)->u32

func String.append [src]

Append a byte to the String.

func append(me, value: u8)

Append a rune to the String.

func append(me, value: rune)

Append a string to the String.

func append(me, value: string)

func String.appendFormat [src]

Append a formatted string.

func appendFormat(me, format: string, values: ...)

func String.back [src]

Get the last byte.

func back(me)->u8

func String.clear [src]

Set the length of the String to 0.

func clear(me)

func String.contains [src]

Returns true if the string contains what.

func contains(const me, what: u8)->bool func contains(const me, what: rune)->bool func contains(const me, what: string)->bool func contains(const me, what: const [..] u8)->bool

func String.ensureNotNull [src]

Transform a null string in an empty one.

func ensureNotNull(me)

func String.from [src]

Convert a literal string to a String.

func from(value: #null string)->String

func String.grow [src]

Ensure the String is big enough to store a given amount of bytes.

func grow(me, wantedCapacity: u64)

func String.indexOf [src]

Find what, and returns the byte index of it.

func indexOf(const me, what: string, startByteIndex = 0'u64, comparisonType = Utf8.ComparisonType.Latin1)->u64 func indexOf(const me, what: rune, startByteIndex = 0'u64)->u64

func String.insert [src]

Insert an ascii byte at the given position.

func insert(me, byteIndex: u64, value: u8)

Insert a substring at the given position.

func insert(me, byteIndex: u64, value: string)

func String.isEmpty [src]

Returns true if the String has zero length.

func isEmpty(const me)->bool

func String.isNull [src]

Returns true if the String is null (undefined).

func isNull(const me)->bool

func String.isNullOrEmpty [src]

Returns true if the String is null or empty.

func isNullOrEmpty(const me)->bool

func String.join [src]

Join a list of strings to make a unique one.

func join(values: string...)->String

func String.joinWith [src]

Join an list of strings to make a unique one, by using a given separator between them.

func joinWith(separator: string, values: string...)->String

func String.makeLower [src]

Convert the string inplace to lower case.

func makeLower(me, set = CharacterSet.Latin1)

func String.makeUpper [src]

Convert the string inplace to upper case.

func makeUpper(me, set = CharacterSet.Latin1)

func String.opAffect [src]

func opAffect(me, value: string)

func String.opAssign [src]

func(op: string) opAssign(me, value: const [..] string) func(op: string) opAssign(me, value: const [..] rune) func(op: string) opAssign(me, value: const [..] u8) func(op: string) opAssign(me, value: string) func(op: string) opAssign(me, value: rune) func(op: string) opAssign(me, value: u8)

func String.opCast [src]

func opCast(const me)->cstring func opCast(const me)->string func opCast(const me)->const [..] u8

func String.opCmp [src]

func opCmp(const me, other: string)->s32

func String.opCount [src]

func opCount(const me)->u64

func String.opData [src]

func opData(const me)->const [*] u8

func String.opDrop [src]

func opDrop(me)

func String.opEquals [src]

func opEquals(const me, other: string)->bool

func String.opIndex [src]

Returns the byte at the given index.

func opIndex(const me, index: u64)->u8

func String.opIndexAffect [src]

func opIndexAffect(me, index: u64, value: u8)

func String.opIndexAssign [src]

func(op: string) opIndexAssign(me, index: u64, value: u8)

func String.opPostCopy [src]

func opPostCopy(me)

func String.opPostMove [src]

func opPostMove(me)

func String.opSlice [src]

func opSlice(const me, lower, upper: u64)->string

func String.opVisit [src]

Default foreach, by bytes.

#[Swag.Macro] func(ptr: bool, back: bool) opVisit(const me, stmt: #code void)

func String.opVisitBytes [src]

Visit the String utf8 bytes.

#[Swag.Macro] func(ptr: bool, back: bool) opVisitBytes(const me, stmt: #code void)
  • #alias0 will contain the byte or the pointer to the byte
  • #alias1 will contain the byte index

func String.opVisitRunes [src]

Visit the String runes See Utf8.visitRunes for aliases.

#[Swag.Macro] func(ptr: bool, back: bool) opVisitRunes(const me, stmt: #code void)

func String.remove [src]

Remove some bytes at the given index.

func remove(me, byteIndex: u64, byteCount: u64 = 1)

func String.removeBack [src]

Remove some bytes at the end.

func removeBack(me, byteCount: u64 = 1)

func String.replace [src]

Replace all occurences of what with by.

func replace(me, what: rune, by: string) func replace(me, what, by: string, comparisonType = Utf8.ComparisonType.Latin1)

func String.reserve [src]

Reserve room for at least newCapacity bytes.

func reserve(me, newCapacity: u64)

func String.startsWith [src]

Return true if the string starts with str.

func startsWith(const me, str: string, comparisonType = Utf8.ComparisonType.Latin1)->bool

func String.toLower [src]

Returns a new String in lower case.

func toLower(me, set = CharacterSet.Latin1)->String func toLower(str: #null string, set = CharacterSet.Latin1)->String

func String.toRuneArray [src]

Convert string to a 32 bits character array.

func toRuneArray(const me)->Array'(rune)

func String.toSlice [src]

Returns a slice type.

func toSlice(me)->[..] u8 func toSlice(const me)->const [..] u8

func String.toString [src]

Returns a string type.

func toString(const me)->string

func String.toUpper [src]

Returns a new String in upper case.

func toUpper(me, set = CharacterSet.Latin1)->String

Returns a new String in lower case.

func toUpper(str: #null string, set = CharacterSet.Latin1)->String

func String.trim [src]

Removes all leading and trailing white-space characters from the current String.

func trim(me)

func String.trimEnd [src]

Remove whitespaces at the end of the String.

func trimEnd(me)

func String.trimStart [src]

Remove whitespaces at the start of the String.

func trimStart(me)

namespace Core.Sync

Structs

Event
Mutex
RWLock

Functions

scopedLock
sharedLock

struct Sync.Event [src]

handle Win32.HANDLE

Functions

create Creates a new event.
init Initialize event.
isValid Returns true if the event is valid.
release Destroy an existing event.
reset Reset the event state.
signal Signal the event.
wait Wait for the event to be signaled.

Special Functions

opDrop

func Event.create [src]

Creates a new event.

func create()->Sync.Event

func Event.init [src]

Initialize event.

func init(me, manual, initState = false)

func Event.isValid [src]

Returns true if the event is valid.

func isValid(me)->bool

func Event.opDrop [src]

func opDrop(me)

func Event.release [src]

Destroy an existing event.

func release(me)

func Event.reset [src]

Reset the event state.

func reset(me)

func Event.signal [src]

Signal the event.

func signal(me)

func Event.wait [src]

Wait for the event to be signaled.

func wait(me)

struct Sync.Mutex [src]

v Win32.SRWLOCK

Functions

lock Lock mutex.
tryLock Try to lock the mutex, and return true if it's the case.
unlock Unlock mutex.

func Mutex.lock [src]

Lock mutex.

func lock(me)

func Mutex.tryLock [src]

Try to lock the mutex, and return true if it's the case.

func tryLock(me)->bool

func Mutex.unlock [src]

Unlock mutex.

func unlock(me)

struct Sync.RWLock [src]

v Win32.SRWLOCK

Functions

lock
lockExclusive Lock mutex.
lockShared Lock mutex.
tryLockExclusive Try to lock the mutex, and return true if it's the case.
tryLockShared Try to lock the mutex, and return true if it's the case.
unlock
unlockExclusive Unlock mutex.
unlockShared Unlock mutex.

func RWLock.lock [src]

func lock(me)

func RWLock.lockExclusive [src]

Lock mutex.

func lockExclusive(me)

func RWLock.lockShared [src]

Lock mutex.

func lockShared(me)

func RWLock.tryLockExclusive [src]

Try to lock the mutex, and return true if it's the case.

func tryLockExclusive(me)->bool

func RWLock.tryLockShared [src]

Try to lock the mutex, and return true if it's the case.

func tryLockShared(me)->bool

func RWLock.unlock [src]

func unlock(me)

func RWLock.unlockExclusive [src]

Unlock mutex.

func unlockExclusive(me)

func RWLock.unlockShared [src]

Unlock mutex.

func unlockShared(me)

func Sync.scopedLock [src]

#[Swag.Macro] func(T) scopedLock(syncObj: *T)

func Sync.sharedLock [src]

#[Swag.Macro] func(T) sharedLock(syncObj: *T)

namespace Core.System

Functions

pushContext Push a new execution context for the given block of code.

func System.pushContext [src]

Push a new execution context for the given block of code.

#[Swag.Macro] func pushContext(cxt: Swag.Context, stmt: #code void)

namespace Core.Threading

Structs

Thread

Enums

ThreadPriority

Functions

wait Wait multiple threads.

struct Threading.Thread [src]

userLambda func(Threading.Thread)
context Swag.Context
userParam *void
priority Threading.ThreadPriority
handle Threading.ThreadHandle
id u32
requestEnd bool

Functions

init Initialize a thread in pause state.
isDone Returns true if the thread has finished.
isValid Returns true if the thread is valid.
safeForceEnd Force the thread to safely exist User code needs to check for requestEnd.
setPriority Set the thread priority.
sleep Sleep the current thread for a given amount of milliseconds.
start Resume the given thread, if it was paused.
wait Wait for the given thread to be done, and close it After that call, isValid() will return false.
yield Sleep the current thread for a given amount of milliseconds.

Special Functions

opDrop

func Thread.init [src]

Initialize a thread in pause state.

func init(me, lambda: func||(Thread), userParam: *void = null, priority = ThreadPriority.Normal, tempAllocSize: s32 = -1) throw

func Thread.isDone [src]

Returns true if the thread has finished.

func isDone(me)->bool

func Thread.isValid [src]

Returns true if the thread is valid.

func isValid(const me)->bool

func Thread.opDrop [src]

func opDrop(me)

func Thread.safeForceEnd [src]

Force the thread to safely exist User code needs to check for requestEnd.

func safeForceEnd(me)

func Thread.setPriority [src]

Set the thread priority.

func setPriority(me, priority: ThreadPriority) throw

func Thread.sleep [src]

Sleep the current thread for a given amount of milliseconds.

func sleep(ms: Time.Duration)

func Thread.start [src]

Resume the given thread, if it was paused.

func start(me) throw

func Thread.wait [src]

Wait for the given thread to be done, and close it After that call, isValid() will return false.

func wait(me)

func Thread.yield [src]

Sleep the current thread for a given amount of milliseconds.

func yield()

enum Threading.ThreadPriority [src]

Lowest
BelowNormal
Normal
AboveNormal
Highest

func Threading.wait [src]

Wait multiple threads.

func wait(threads: *Thread...)

namespace Core.Time

Structs

DateTime Represents an instant in time, typically expressed as a date and time of day.
Duration Represents a delay, expressed in seconds.
FrameTiming Holds timing information for frame-based updates.
Stopwatch Provides a set of methods and properties that you can use to accurately measure elapsed time.
TimeSpan Represents an interval of time, stored as a 64-bit integer (in ticks).
Timer

Enums

DateTimeFormat Supported formats for converting DateTime to/from string.
DayOfWeek Day of the week enumeration.

Functions

dateToTicks Convert a date to a 64 bits value.
daysInMonth Returns the number of days of the given month, for the given year.
isLeapYear Returns true if the given year is a leap year.
nowMicroseconds Returns the current time expressed in microseconds.
nowMilliseconds Returns the current time expressed in milliseconds.
nowPrecise Get current time precise value.
preciseFrequency The frequency of the precise counter, in ticks per second.
ticksToDate Convert a 64 bits value to a date.
ticksToTime Convert a 64 bits tick value to a time.
timeToTicks Convert a time to a 64 bits value.

struct Time.DateTime [src]

Represents an instant in time, typically expressed as a date and time of day.

year u16 Year component (1 to 9999).
month u16 Month component (1 to 12).
day u16 Day component (1 to 31 depending on the month).
hour u16 Hour component (0 to 23).
minute u16 Minute component (0 to 59).
second u16 Second component (0 to 59).
millisecond u16 Millisecond component (0 to 999).

Functions

dayOfWeek Returns the day of the week for the current date.
dayOfWeekName Returns the name of the given day of the week.
isValid Returns true if this is a valid DateTime.
monthName Returns the month name corresponding to a month number (1 to 12).
now Returns a DateTime containing the current date and time.
parse Converts a string to a DateTime using the expected format.
setNow Initialize the structure with the current local date and time.
toString Converts the DateTime to a string using the given format.

Special Functions

opCmp Compares two DateTime values. Returns -1, 0, or 1.
opEquals Compares if two DateTime instances are equal.

func IConvert.convert [src]

Converts a DateTime to a string using a single-character format specifier (for use with Format.toString).

func convert(me, buf: *ConcatBuffer, convFormat: StrConv.ConvertFormat, strFormat: string)

func ISerialize.postRead [src]

func postRead(me, data: *void, decoder: Serialization.IDecoder) throw

func ISerialize.read [src]

Reads a DateTime from a textual encoder.

func read(me, decoder: Serialization.IDecoder)->bool throw

func ISerialize.readElement [src]

func readElement(me, type: Swag.TypeValue, data: *void, decoder: Serialization.IDecoder)->bool throw

func ISerialize.write [src]

Writes a DateTime to a textual encoder.

func write(me, encoder: Serialization.IEncoder)->bool throw

func ISerialize.writeElement [src]

func writeElement(me, type: Swag.TypeValue, data: const *void, decoder: Serialization.IEncoder)->bool throw

func DateTime.dayOfWeek [src]

Returns the day of the week for the current date.

func dayOfWeek(const me)->Time.DayOfWeek

func DateTime.dayOfWeekName [src]

Returns the name of the given day of the week.

func dayOfWeekName(day: DayOfWeek)->string

func DateTime.isValid [src]

Returns true if this is a valid DateTime.

func isValid(const me)->bool

func DateTime.monthName [src]

Returns the month name corresponding to a month number (1 to 12).

func monthName(month: u16)->string

func DateTime.now [src]

Returns a DateTime containing the current date and time.

func now()->Time.DateTime

func DateTime.opCmp [src]

Compares two DateTime values. Returns -1, 0, or 1.

func opCmp(const me, other: DateTime)->s32

func DateTime.opEquals [src]

Compares if two DateTime instances are equal.

func opEquals(const me, other: DateTime)->bool

func DateTime.parse [src]

Converts a string to a DateTime using the expected format.

func parse(str: string, checkDate = true)->{value:Time.DateTime,eat:u32} throw

func DateTime.setNow [src]

Initialize the structure with the current local date and time.

func setNow(me)

func DateTime.toString [src]

Converts the DateTime to a string using the given format.

func toString(const me, fmt = DateTimeFormat.DateTime)->String

enum Time.DateTimeFormat [src]

Supported formats for converting DateTime to/from string.

DateIso YYYY-MM-DD.
TimeIso HH:MM:SS.
TimeIsoMs HH:MM:SS.ZZZ.
TimeIsoHM HH:MM.
Date 'DAYOFWEEK MONTH DAY YYYY'.
DateTime 'DAYOFWEEK MONTH DAY YYYY HH:MM:SS'.
DateTimeMs 'DAYOFWEEK MONTH DAY YYYY HH:MM:SS.ZZZ'.
DateTimeIso 'YYYY-MM-DD HH:MM:SS'.
DateTimeIsoMs 'YYYY-MM-DD HH:MM:SS.ZZZ'.
DateTimeIsoHM 'YYYY-MM-DD HH:MM'.

enum Time.DayOfWeek [src]

Day of the week enumeration.

Sunday Sunday.
Monday Monday.
Tuesday Tuesday.
Wednesday Wednesday.
Thursday Thursday.
Friday Friday.
Saturday Saturday.

struct Time.Duration [src]

Represents a delay, expressed in seconds.

timeInSeconds f32 The duration in seconds.

Functions

fromMs Returns a duration initialized with milliseconds.
toMs Returns the value in milliseconds.

Special Functions

opAffect
opAffectLiteral

func Duration.fromMs [src]

Returns a duration initialized with milliseconds.

func fromMs(valueMs: u32)->Time.Duration

func Duration.opAffect [src]

func opAffect(me, valueMs: s32)

func Duration.opAffectLiteral [src]

func(suffix: string) opAffectLiteral(me, value: s32)

func Duration.toMs [src]

Returns the value in milliseconds.

func toMs(const me)->u32

struct Time.FrameTiming [src]

Holds timing information for frame-based updates.

dtMin f32 Minimum delta time allowed (in seconds).
dtMax f32 Maximum delta time allowed (in seconds).
dt f32 Current delta time, in seconds.
frameCount u32 Frame counter.
prevTick u64 Tick of the previous frame.
paused bool Whether timing is currently paused.

Functions

pause Pauses frame timing and frame count.
unpause Resumes frame timing and resets the tick reference.
update Updates the delta time and frame count.

func FrameTiming.pause [src]

Pauses frame timing and frame count.

func pause(me)

func FrameTiming.unpause [src]

Resumes frame timing and resets the tick reference.

func unpause(me)

func FrameTiming.update [src]

Updates the delta time and frame count.

func update(me)

struct Time.Stopwatch [src]

Provides a set of methods and properties that you can use to accurately measure elapsed time.

isStarted bool True if the stopwatch is currently running.
startTimeStamp u64 Timestamp when the stopwatch was last started.
elapsedTicks u64 Accumulated elapsed time in ticks.

Functions

elapsedMicroseconds Returns the total elapsed time in microseconds, after calling stop.
elapsedMicrosecondsNow Returns the current elapsed time in microseconds since the last start.
elapsedMilliseconds Returns the total elapsed time in milliseconds, after calling stop.
elapsedMillisecondsNow Returns the current elapsed time in milliseconds since the last start.
reset Resets the stopwatch and clears the elapsed time.
restart Resets the stopwatch and immediately starts measuring elapsed time.
scopeMeasure Measures elapsed time for the current scope and prints the result when the scope ends.
start Starts or resumes measuring elapsed time.
stop Stops measuring elapsed time and accumulates the result.

func Stopwatch.elapsedMicroseconds [src]

Returns the total elapsed time in microseconds, after calling stop.

func elapsedMicroseconds(me)->u32

func Stopwatch.elapsedMicrosecondsNow [src]

Returns the current elapsed time in microseconds since the last start.

func elapsedMicrosecondsNow(me)->u32

func Stopwatch.elapsedMilliseconds [src]

Returns the total elapsed time in milliseconds, after calling stop.

func elapsedMilliseconds(me)->u32

func Stopwatch.elapsedMillisecondsNow [src]

Returns the current elapsed time in milliseconds since the last start.

func elapsedMillisecondsNow(me)->u32

func Stopwatch.reset [src]

Resets the stopwatch and clears the elapsed time.

func reset(me)

func Stopwatch.restart [src]

Resets the stopwatch and immediately starts measuring elapsed time.

func restart(me)

func Stopwatch.scopeMeasure [src]

Measures elapsed time for the current scope and prints the result when the scope ends.

#[Swag.Macro] func scopeMeasure(name: string = "stopwatch")

func Stopwatch.start [src]

Starts or resumes measuring elapsed time.

func start(me)

func Stopwatch.stop [src]

Stops measuring elapsed time and accumulates the result.

func stop(me)

struct Time.TimeSpan [src]

Represents an interval of time, stored as a 64-bit integer (in ticks).

ticks Time.Ticks Duration represented in ticks.

Functions

addDays Adds or subtracts a number of days to the TimeSpan.
addHours Adds or subtracts a number of hours to the TimeSpan.
addMilliSeconds Adds or subtracts a number of milliseconds to the TimeSpan.
addMinutes Adds or subtracts a number of minutes to the TimeSpan.
addMonths Adds or subtracts a number of months to the TimeSpan.
addSeconds Adds or subtracts a number of seconds to the TimeSpan.
addYears Adds or subtracts a number of years to the TimeSpan.
from Creates a TimeSpan from a DateTime.
now Returns the current time as a TimeSpan.
setNow Sets the TimeSpan to the current time.
toDateTime Converts the TimeSpan to a DateTime.
totalDays Returns the total duration in days.
totalHours Returns the total duration in hours.
totalMilliSeconds Returns the total duration in milliseconds.
totalMinutes Returns the total duration in minutes.
totalSeconds Returns the total duration in seconds.

Special Functions

opCmp Compares two TimeSpan values.

func TimeSpan.addDays [src]

Adds or subtracts a number of days to the TimeSpan.

func addDays(me, days: s32)

func TimeSpan.addHours [src]

Adds or subtracts a number of hours to the TimeSpan.

func addHours(me, hours: s32)

func TimeSpan.addMilliSeconds [src]

Adds or subtracts a number of milliseconds to the TimeSpan.

func addMilliSeconds(me, milliSeconds: s32)

func TimeSpan.addMinutes [src]

Adds or subtracts a number of minutes to the TimeSpan.

func addMinutes(me, minutes: s32)

func TimeSpan.addMonths [src]

Adds or subtracts a number of months to the TimeSpan.

func addMonths(me, months: s32)

func TimeSpan.addSeconds [src]

Adds or subtracts a number of seconds to the TimeSpan.

func addSeconds(me, seconds: s32)

func TimeSpan.addYears [src]

Adds or subtracts a number of years to the TimeSpan.

func addYears(me, years: s32)

func TimeSpan.from [src]

Creates a TimeSpan from a DateTime.

func from(dateTime: DateTime)->Time.TimeSpan

func TimeSpan.now [src]

Returns the current time as a TimeSpan.

func now()->Time.TimeSpan

func TimeSpan.opCmp [src]

Compares two TimeSpan values.

func opCmp(me, other: TimeSpan)->s32

func TimeSpan.setNow [src]

Sets the TimeSpan to the current time.

func setNow(me)

func TimeSpan.toDateTime [src]

Converts the TimeSpan to a DateTime.

func toDateTime(const me)->Time.DateTime

func TimeSpan.totalDays [src]

Returns the total duration in days.

func totalDays(me)->f64

func TimeSpan.totalHours [src]

Returns the total duration in hours.

func totalHours(me)->f64

func TimeSpan.totalMilliSeconds [src]

Returns the total duration in milliseconds.

func totalMilliSeconds(me)->f64

func TimeSpan.totalMinutes [src]

Returns the total duration in minutes.

func totalMinutes(me)->f64

func TimeSpan.totalSeconds [src]

Returns the total duration in seconds.

func totalSeconds(me)->f64

struct Time.Timer [src]

userLambda func(Time.Timer)
handle Time.TimerHandle
context Swag.Context

Functions

create Creates a new timer.
init Initialize timer.
release Release the timer.

func Timer.create [src]

Creates a new timer.

func create(elapsedTimeMs: u32, lambda: func(Timer), periodic = false)->Time.Timer throw

func Timer.init [src]

Initialize timer.

func init(me, elapsedTimeMs: u32, lambda: func(Timer), periodic = false) throw

func Timer.release [src]

Release the timer.

func release(me)

func Time.dateToTicks [src]

Convert a date to a 64 bits value.

func dateToTicks(year, month, day: u16)->Time.Ticks

func Time.daysInMonth [src]

Returns the number of days of the given month, for the given year.

func daysInMonth(year, month: u16)->u16

func Time.isLeapYear [src]

Returns true if the given year is a leap year.

func isLeapYear(year: u16)->bool

func Time.nowMicroseconds [src]

Returns the current time expressed in microseconds.

func nowMicroseconds()->u32

func Time.nowMilliseconds [src]

Returns the current time expressed in milliseconds.

func nowMilliseconds()->u32

func Time.nowPrecise [src]

Get current time precise value.

func nowPrecise()->u64

func Time.preciseFrequency [src]

The frequency of the precise counter, in ticks per second.

func preciseFrequency()->u64

func Time.ticksToDate [src]

Convert a 64 bits value to a date.

func ticksToDate(ticks: Ticks)->{year:u16,month:u16,day:u16}

func Time.ticksToTime [src]

Convert a 64 bits tick value to a time.

func ticksToTime(ticks: Ticks)->{hour:u16,minute:u16,second:u16,millisecond:u16}

func Time.timeToTicks [src]

Convert a time to a 64 bits value.

func timeToTicks(hour, minute, second, millisecond: u16)->Time.Ticks

namespace Core.Tokenize

Functions

eatCount Eats count bytes from the beginning of the string and returns the remaining string.
eatQuotes Removes surrounding double quotes from the string, if present.
eatSpaces Removes leading space characters from the string and returns the trimmed result.
getTo Returns a substring of src starting at startByteIndex and ending at the first occurrence of delimiter Includes the delimiter if includeDelimiter is true.
getToSpace Returns the first substring of str stopping at the first whitespace character.
getWhileAlnum Returns the first substring of str that contains only alphanumeric characters.
split(string, rune, u32, bool) Splits the string into substrings using a rune as separator Note that this returns an array of native strings, not copies. All strings will be invalid if src is destroyed.
split(string, string, u32, bool) Splits the string into substrings using another string as separator Note that this returns an array of native strings, not copies. All strings will be invalid if src String is destroyed.
split(string, u8, u32, bool) Splits the string into substrings using a byte as separator Note that this returns an array of native strings, not copies. All strings will be invalid if src String is destroyed.
splitAny Splits the string into substrings using any rune from the given array as separator Note that this returns an array of native strings, not copies. All strings will be invalid if src String is destroyed.
splitLines Splits the string into an array of lines using newline or carriage return as delimiters Note that this returns an array of native strings, not copies. All strings will be invalid if src is destroyed.

func Tokenize.eatCount [src]

Eats count bytes from the beginning of the string and returns the remaining string.

func eatCount(str: string, count: u64)->string

func Tokenize.eatQuotes [src]

Removes surrounding double quotes from the string, if present.

func eatQuotes(str: string)->string

func Tokenize.eatSpaces [src]

Removes leading space characters from the string and returns the trimmed result.

func eatSpaces(str: string)->string

func Tokenize.getTo [src]

Returns a substring of src starting at startByteIndex and ending at the first occurrence of delimiter Includes the delimiter if includeDelimiter is true.

func getTo(src: string, delimiter: u8, startByteIndex = 0'u64, includeDelimiter = true)->string

func Tokenize.getToSpace [src]

Returns the first substring of str stopping at the first whitespace character.

func getToSpace(str: string)->string

func Tokenize.getWhileAlnum [src]

Returns the first substring of str that contains only alphanumeric characters.

func getWhileAlnum(str: string)->string

func Tokenize.split [src]

Splits the string into substrings using a byte as separator Note that this returns an array of native strings, not copies. All strings will be invalid if src String is destroyed.

func split(src: string, separator: u8, maxSplit: u32 = 0, removeEmpty = true)->Array'(string)

Splits the string into substrings using another string as separator Note that this returns an array of native strings, not copies. All strings will be invalid if src String is destroyed.

func split(src: string, separator: string, maxSplit: u32 = 0, removeEmpty = true)->Array'(string)

Splits the string into substrings using a rune as separator Note that this returns an array of native strings, not copies. All strings will be invalid if src is destroyed.

func split(src: string, separator: rune, maxSplit: u32 = 0, removeEmpty = true)->Array'(string)

func Tokenize.splitAny [src]

Splits the string into substrings using any rune from the given array as separator Note that this returns an array of native strings, not copies. All strings will be invalid if src String is destroyed.

func splitAny(src: string, separators: const [..] rune, maxSplit: u32 = 0, removeEmpty = true)->Array'(string)

func Tokenize.splitLines [src]

Splits the string into an array of lines using newline or carriage return as delimiters Note that this returns an array of native strings, not copies. All strings will be invalid if src is destroyed.

func splitLines(src: string)->Array'(string)

namespace Core.Unicode

Functions

fromUtf8([..] rune, const [..] u8) Convert an utf8 buffer to a character sequence, and returns the number of valid elements in the destination buffer.
fromUtf8(const [..] u8) Convert an utf8 buffer to a character sequence.
isAscii
isControl
isDigit
isLatin1
isLetter
isLetterOrDigit
isLower
isNumber
isSpace
isSymbol
isSymbolMath
isTitle
isUpper
isWord
makeLower Make a rune buffer lower case.
makeUpper Make a rune buffer upper case.
toLower
toTitle
toUpper

func Unicode.fromUtf8 [src]

Convert an utf8 buffer to a character sequence, and returns the number of valid elements in the destination buffer.

func fromUtf8(dest: [..] rune, src: const [..] u8)->u32

Convert an utf8 buffer to a character sequence.

func fromUtf8(src: const [..] u8)->Array'(rune)

func Unicode.isAscii [src]

func isAscii(c: rune)->bool

func Unicode.isControl [src]

func isControl(c: rune)->bool

func Unicode.isDigit [src]

func isDigit(c: rune)->bool

func Unicode.isLatin1 [src]

func isLatin1(c: rune)->bool

func Unicode.isLetter [src]

func isLetter(c: rune)->bool

func Unicode.isLetterOrDigit [src]

func isLetterOrDigit(c: rune)->bool

func Unicode.isLower [src]

func isLower(c: rune)->bool

func Unicode.isNumber [src]

func isNumber(c: rune)->bool

func Unicode.isSpace [src]

func isSpace(c: rune)->bool

func Unicode.isSymbol [src]

func isSymbol(c: rune)->bool

func Unicode.isSymbolMath [src]

func isSymbolMath(c: rune)->bool

func Unicode.isTitle [src]

func isTitle(c: rune)->bool

func Unicode.isUpper [src]

func isUpper(c: rune)->bool

func Unicode.isWord [src]

func isWord(c: rune)->bool

func Unicode.makeLower [src]

Make a rune buffer lower case.

func makeLower(buffer: [..] rune)

func Unicode.makeUpper [src]

Make a rune buffer upper case.

func makeUpper(buffer: [..] rune)

func Unicode.toLower [src]

func toLower(c: rune)->rune

func Unicode.toTitle [src]

func toTitle(c: rune)->rune

func Unicode.toUpper [src]

func toUpper(c: rune)->rune

namespace Core.Utf16

Functions

decodeRune Get the unicode character pointed by buffer, and the number of u16 to encode it Will return RuneError for an invalid utf16 sequence.
encodeRune Convert unicode character src to an utf16 sequence, and returns the number of u16 that were needed to make the conversion. dest must be at least 2 u16 long.
fromUnicode([..] u16, const [..] rune) Convert a character array (32 bits unicode) to an utf16 buffer Returns the number of bytes written in the destination buffer dest must be at least 2 bytes long.
fromUnicode(const [..] rune) Convert a character array (32 bits unicode) to an utf16 sequence.
fromUtf8([..] u16, const [..] u8) Convert an utf8 buffer to a utf16 buffer, and returns the number of valid elements in the destination buffer.
fromUtf8(const [..] u8) Convert an utf8 buffer to an utf16 sequence.
lengthZeroTerminated Compute the string length of a zero terminated utf16 buffer.
toZeroTerminated Convert string to an utf16 array, zero terminated.

func Utf16.decodeRune [src]

Get the unicode character pointed by buffer, and the number of u16 to encode it Will return RuneError for an invalid utf16 sequence.

func decodeRune(buffer: const [..] u16)->{c:rune,eat:u32}

func Utf16.encodeRune [src]

Convert unicode character src to an utf16 sequence, and returns the number of u16 that were needed to make the conversion. dest must be at least 2 u16 long.

func encodeRune(dest: [..] u16, src: rune)->u32

func Utf16.fromUnicode [src]

Convert a character array (32 bits unicode) to an utf16 buffer Returns the number of bytes written in the destination buffer dest must be at least 2 bytes long.

func fromUnicode(dest: [..] u16, src: const [..] rune)->u64

Convert a character array (32 bits unicode) to an utf16 sequence.

func fromUnicode(src: const [..] rune)->Array'(u16)

func Utf16.fromUtf8 [src]

Convert an utf8 buffer to a utf16 buffer, and returns the number of valid elements in the destination buffer.

func fromUtf8(dest: [..] u16, src: const [..] u8)->u64

Convert an utf8 buffer to an utf16 sequence.

func fromUtf8(src: const [..] u8)->Array'(u16)

func Utf16.lengthZeroTerminated [src]

Compute the string length of a zero terminated utf16 buffer.

func lengthZeroTerminated(buf: const [*] u16)->u64

func Utf16.toZeroTerminated [src]

Convert string to an utf16 array, zero terminated.

func toZeroTerminated(src: string)->Array'(u16)

namespace Core.Utf8

Enums

ComparisonType

Functions

beautifyName
byteIndex Returns the byte index of the given rune index.
compare Compare two utf8 buffers with the given algorithm.
contains(const [..] u8, const [..] u8) Returns true if src contains the slice what.
contains(const [..] u8, rune) Returns true if src contains the string what.
contains(const [..] u8, string) Returns true if src contains the string what.
contains(const [..] u8, u8) Returns true if src contains the string what.
countBytesAt Returns the number of bytes to encode the first rune of the utf8 buffer.
countRunes Returns the number of runes in an utf8 buffer.
decodeLastRune Get the last unicode rune of the utf8 slice, and the number of bytes to encode it.
decodeRune Get the unicode rune pointed by buffer, and the number of bytes to encode it.
encodeRune Convert rune src to an utf8 sequence, and returns the number of bytes that were needed to make the conversion.
endsWith Return true if the string ends with str.
firstRune Returns the first rune of the slice.
fromUnicode([..] u8, const [..] rune) Convert a rune array to an utf8 buffer.
fromUnicode(const [..] rune) Convert an unicode buffer to a String.
fromUtf16([..] u8, const [..] u16) Convert an utf16 array to an utf8 buffer.
fromUtf16(const [..] u16) Convert an utf16 buffer to a String.
indexOf(const [..] u8, rune, u64) Find the first occurence of rune what, and returns the byte index of it.
indexOf(const [..] u8, string, u64, ComparisonType) Find the given string, and returns the byte index of it.
indexOfAny(const [..] u8, const [..] rune, u64) Find one of the runes in what, and returns the byte index of it.
indexOfAny(const [..] u8, const [..] u8, u64) Find one of the runes in what, and returns the byte index of it.
isValid Returns true if the utf8 sequence is valid.
isValidRune Returns true if the given unicode rune can be encoded in utf8.
lastIndexOf(const [..] u8, rune) Find the last rune occurence of what, and returns the byte index of it.
lastIndexOf(const [..] u8, string, ComparisonType) Returns the last index (in bytes) of a string.
lastIndexOfAny(const [..] u8, const [..] rune) Returns the last index (in bytes) of a any of the runes in what.
lastIndexOfAny(const [..] u8, const [..] u8) Returns the last index (in bytes) of a any of the bytes in what.
lastRune Returns the last rune of the slice.
startsWith Return true if the string starts with str.
visitRunes Macro to foreach the unicode characters of the utf8 sequence.

enum Utf8.ComparisonType [src]

Latin1
Latin1NoCase
Unicode
UnicodeNoCase

func Utf8.beautifyName [src]

func beautifyName(name: const [..] u8)->String

func Utf8.byteIndex [src]

Returns the byte index of the given rune index.

func byteIndex(buffer: const [..] u8, charIndex: u64)->{index:u64,success:bool}

func Utf8.compare [src]

Compare two utf8 buffers with the given algorithm.

func compare(src, dst: const [..] u8, comparisonType = ComparisonType.Latin1)->s32

func Utf8.contains [src]

Returns true if src contains the string what.

func contains(src: const [..] u8, what: string)->bool func contains(src: const [..] u8, what: rune)->bool func contains(src: const [..] u8, what: u8)->bool

Returns true if src contains the slice what.

func contains(src, what: const [..] u8)->bool

func Utf8.countBytesAt [src]

Returns the number of bytes to encode the first rune of the utf8 buffer.

func countBytesAt(buffer: const [..] u8)->u32

If it's an invalid encoding, returns 1.

func Utf8.countRunes [src]

Returns the number of runes in an utf8 buffer.

func countRunes(buffer: const [..] u8)->u64

func Utf8.decodeLastRune [src]

Get the last unicode rune of the utf8 slice, and the number of bytes to encode it.

func decodeLastRune(buffer: const [..] u8)->{c:rune,eat:u32}

func Utf8.decodeRune [src]

Get the unicode rune pointed by buffer, and the number of bytes to encode it.

func decodeRune(buffer: const [..] u8)->{c:rune,eat:u32}

Will return RuneError for an invalid utf8 sequence

func Utf8.encodeRune [src]

Convert rune src to an utf8 sequence, and returns the number of bytes that were needed to make the conversion.

func encodeRune(dest: [..] u8, src: rune)->u32

dest must be at least 4 bytes long

func Utf8.endsWith [src]

Return true if the string ends with str.

func endsWith(src: #null const [..] u8, str: string, comparisonType = ComparisonType.Latin1)->bool

func Utf8.firstRune [src]

Returns the first rune of the slice.

func firstRune(src: #null const [..] u8)->rune

func Utf8.fromUnicode [src]

Convert a rune array to an utf8 buffer.

func fromUnicode(dest: [..] u8, src: const [..] rune)->u64

Returns the number of bytes written in the destination buffer dest must be at least 4 bytes long

Convert an unicode buffer to a String.

func fromUnicode(src: const [..] rune)->String

func Utf8.fromUtf16 [src]

Convert an utf16 array to an utf8 buffer.

func fromUtf16(dest: [..] u8, src: const [..] u16)->u64

Returns the number of bytes written in the destination buffer. dest must be at least 4 bytes long

Convert an utf16 buffer to a String.

func fromUtf16(src: const [..] u16)->String

func Utf8.indexOf [src]

Find the first occurence of rune what, and returns the byte index of it.

func indexOf(src: const [..] u8, what: rune, startByteIndex = 0'u64)->u64

Returns Swag.U64.Max if not found

Find the given string, and returns the byte index of it.

func indexOf(src: const [..] u8, what: string, startByteIndex = 0'u64, comparisonType = ComparisonType.Latin1)->u64

func Utf8.indexOfAny [src]

Find one of the runes in what, and returns the byte index of it.

func indexOfAny(src: const [..] u8, what: const [..] u8, startByteIndex = 0'u64)->u64

Returns Swag.U64.Max if not found

Find one of the runes in what, and returns the byte index of it.

func indexOfAny(src: const [..] u8, what: const [..] rune, startByteIndex = 0'u64)->u64

func Utf8.isValid [src]

Returns true if the utf8 sequence is valid.

func isValid(buffer: const [..] u8)->bool

func Utf8.isValidRune [src]

Returns true if the given unicode rune can be encoded in utf8.

func isValidRune(c: rune)->bool

func Utf8.lastIndexOf [src]

Find the last rune occurence of what, and returns the byte index of it.

func lastIndexOf(src: const [..] u8, what: rune)->u64

Returns Swag.U64.Max if not found

Returns the last index (in bytes) of a string.

func lastIndexOf(src: const [..] u8, what: string, comparisonType = ComparisonType.Latin1)->u64

Returns Swag.U64.Max if not found

func Utf8.lastIndexOfAny [src]

Returns the last index (in bytes) of a any of the runes in what.

func lastIndexOfAny(src: const [..] u8, what: const [..] rune)->u64

Returns Swag.U64.Max if not found

Returns the last index (in bytes) of a any of the bytes in what.

func lastIndexOfAny(src: const [..] u8, what: const [..] u8)->u64

Returns Swag.U64.Max if not found

func Utf8.lastRune [src]

Returns the last rune of the slice.

func lastRune(src: #null const [..] u8)->rune

func Utf8.startsWith [src]

Return true if the string starts with str.

func startsWith(src: #null const [..] u8, str: string, comparisonType = ComparisonType.Latin1)->bool

func Utf8.visitRunes [src]

Macro to foreach the unicode characters of the utf8 sequence.

#[Swag.Macro] func visitRunes(buffer: const [..] u8, stmt: #code void)
  • #alias0 will contain the character
  • #alias1 will contain the character index
  • #alias2 will contain the byte index of that character within the utf8 sequence

func Core.add [src]

func(T) add(flags: &T, value: T)

func Core.equals [src]

func(T) equals(flags, value: T)->bool

func Core.has [src]

func(T) has(flags, value: T)->bool

func Core.orderMaxMin [src]

Ensures that the first value is greater than or equal to the second value.

func(T) orderMaxMin(x, y: *T)

If the first value is less than the second, their contents are swapped.

func Core.orderMinMax [src]

Ensures that the first value is less than or equal to the second value.

func(T) orderMinMax(x, y: *T)

If the first value is greater than the second, their contents are swapped.

func Core.remove [src]

func(T) remove(flags: &T, value: T)

func Core.set [src]

func(T) set(flags: &T, value: T)

func Core.swap [src]

Swaps the values of two variables.

func(T) swap(x, y: *T)

Takes pointers to the two values to be swapped.

func Core.toggle [src]

func(T) toggle(flags: &T, value: T)
Generated on 12-10-2025 with swag 0.45.0