SWAG

Table of Contents

Namespaces

Structs

Interfaces

Enums

Constants

Attributes

Functions

Swag Runtime

Content

const F32.Constants [src]

Bias s32
ExpBits s32
Inf f32
MantBits s32
Max f32
Min f32
Nan f32
NegInf f32
Bias s32
ExpBits s32
Inf f64
MantBits s32
Max f64
Min f64
Nan f64
NegInf f64
MaxErrors s32 Maximum nested errors.
MaxTraces s32 Maximum error traces.
Max s16
Min s16
Max s32
Min s32
Max s64
Min s64
Max s8
Min s8
SafetyAll u32
SafetyAny u32
SafetyBool u32
SafetyBoundCheck u32
SafetyMath u32
SafetyNaN u32
SafetyNone u32
SafetyNullCheck u32
SafetyOverflow u32
SafetySanity u32
SafetySwitch u32
SafetyUnreachable u32
Max u16
Min u16
Max u32
Min u32
Max u64
Min u64
Max u8 Max u8 value.
Min u8 Min u8 value.

func @abs [src]

func @abs(value: s8)->s8 func @abs(value: s16)->s16 func @abs(value: s32)->s32 func @abs(value: s64)->s64 func @abs(value: f32)->f32 func @abs(value: f64)->f64

func @acos [src]

func @acos(value: f32)->f32 func @acos(value: f64)->f64

func @alloc [src]

Returns a system allocated memory block of size bytes.

func @alloc(size: u64)->^void

Use @free to release the allocated memory.

func @args [src]

func @args()->const [..] string

func @as [src]

func @as(toType, fromType: const *TypeInfoStruct, ptr: *void)->*void

func @asin [src]

func @asin(value: f32)->f32 func @asin(value: f64)->f64

func @assert [src]

Panic if the expression is false. Typically used in tests.

func @assert(value: bool)

func @atan [src]

func @atan(value: f32)->f32 func @atan(value: f64)->f64

func @atan2 [src]

func @atan2(value1, value2: f32)->f32 func @atan2(value1, value2: f64)->f64

func @atomadd [src]

Atomic add.

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

func @atomand [src]

Atomic and.

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

func @atomcmpxchg [src]

Atomic 'compare and exchange'.

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

func @atomor [src]

Atomic or.

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

func @atomxchg [src]

Atomic exchange.

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

func @atomxor [src]

Atomic xor.

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

func @bitcountlz [src]

Returns the index+1 of the first set bit, starting from the left (msb). 0 if all zero.

func @bitcountlz(value: u8)->u8 func @bitcountlz(value: u16)->u16 func @bitcountlz(value: u32)->u32 func @bitcountlz(value: u64)->u64

func @bitcountnz [src]

Count the number of bits set to 1.

func @bitcountnz(value: u8)->u8 func @bitcountnz(value: u16)->u16 func @bitcountnz(value: u32)->u32 func @bitcountnz(value: u64)->u64

func @bitcounttz [src]

Returns the index+1 of the first set bit, starting from right (lsb). 0 if all zero.

func @bitcounttz(value: u8)->u8 func @bitcounttz(value: u16)->u16 func @bitcounttz(value: u32)->u32 func @bitcounttz(value: u64)->u64

func @breakpoint [src]

Stop a bytecode execution, and launch the bytecode debugger.

func @breakpoint()

func @byteswap [src]

Reverses the order of bytes in an integer.

func @byteswap(value: u16)->u16 func @byteswap(value: u32)->u32 func @byteswap(value: u64)->u64

func @ceil [src]

func @ceil(value: f32)->f32 func @ceil(value: f64)->f64

func @compiler [src]

Returns an ICompiler interface to communicate with the compiler.

func @compiler()->Swag.ICompiler

func @compilererror [src]

Raise a compiler error at the given source location.

func @compilererror(message: string, loc: SourceCodeLocation)

func @compilerwarning [src]

Raise a compiler warning at the given source location.

func @compilerwarning(message: string, loc: SourceCodeLocation)

func @cos [src]

func @cos(value: f32)->f32 func @cos(value: f64)->f64

func @cosh [src]

func @cosh(value: f32)->f32 func @cosh(value: f64)->f64

func @dbgalloc [src]

func @dbgalloc()->*Swag.DebugAllocator

func @err [src]

Returns the current raised error, or null if none.

func @err()->any

func @exp [src]

func @exp(value: f32)->f32 func @exp(value: f64)->f64

func @exp2 [src]

func @exp2(value: f32)->f32 func @exp2(value: f64)->f64

func @floor [src]

func @floor(value: f32)->f32 func @floor(value: f64)->f64

func @free [src]

Free a system memory block allocated with @alloc.

func @free(ptr: ^void)

func @getcontext [src]

Get the current thread context.

func @getcontext()->*Swag.Context

func @gvtd [src]

Returns the list of all global variables.

func @gvtd()->const [..] Swag.Gvtd

func @is [src]

func @is(toType, fromType: const *TypeInfoStruct)->bool

func @isbytecode [src]

Returns true is the current execution is bytecode.

func @isbytecode()->bool

func @itftableof [src]

func @itftableof(structType, itfType: const *TypeInfoStruct)->const *void

func @log [src]

func @log(value: f32)->f32 func @log(value: f64)->f64

func @log10 [src]

func @log10(value: f32)->f32 func @log10(value: f64)->f64

func @log2 [src]

func @log2(value: f32)->f32 func @log2(value: f64)->f64

func @max [src]

func @max(value1, value2: s8)->s8 func @max(value1, value2: s16)->s16 func @max(value1, value2: s32)->s32 func @max(value1, value2: s64)->s64 func @max(value1, value2: u8)->u8 func @max(value1, value2: u16)->u16 func @max(value1, value2: u32)->u32 func @max(value1, value2: u64)->u64 func @max(value1, value2: f32)->f32 func @max(value1, value2: f64)->f64

func @memcmp [src]

Compare two memory blocks, and returns -1, 0 if equal, or 1.

func @memcmp(dst, src: const ^void, size: u64)->s32

func @memcpy [src]

Copy one memory block to another address.

func @memcpy(dst: ^void, src: const ^void, size: u64)

func @memmove [src]

Move one memory block to another address.

func @memmove(dst: ^void, src: const ^void, size: u64)

func @memset [src]

Set all bytes of a given memory block to value.

func @memset(dst: ^void, value: u8, size: u64)

func @min [src]

func @min(value1, value2: s8)->s8 func @min(value1, value2: s16)->s16 func @min(value1, value2: s32)->s32 func @min(value1, value2: s64)->s64 func @min(value1, value2: u8)->u8 func @min(value1, value2: u16)->u16 func @min(value1, value2: u32)->u32 func @min(value1, value2: u64)->u64 func @min(value1, value2: f32)->f32 func @min(value1, value2: f64)->f64

func @modules [src]

Returns the list of all loaded modules.

func @modules()->const [..] Swag.Module

func @muladd [src]

Returns '(val1 * val2) + val3'.

func @muladd(val1, val2, val3: f32)->f32 func @muladd(val1, val2, val3: f64)->f64

func @panic [src]

Stop the execution and panic.

func @panic(message: string, loc: SourceCodeLocation)

func @pinfos [src]

Get information about the current process.

func @pinfos()->*Swag.ProcessInfos

func @pow [src]

func @pow(value1, value2: f32)->f32 func @pow(value1, value2: f64)->f64

func @print [src]

Basic print to console function.

func @print(params: ...)

func @realloc [src]

Realloc a system memory block allocated with @alloc.

func @realloc(ptr: ^void, size: u64)->^void

func @rol [src]

Rotate bits left.

func @rol(value, num: u8)->u8 func @rol(value, num: u16)->u16 func @rol(value, num: u32)->u32 func @rol(value, num: u64)->u64

func @ror [src]

Rotate bits right.

func @ror(value, num: u8)->u8 func @ror(value, num: u16)->u16 func @ror(value, num: u32)->u32 func @ror(value, num: u64)->u64

func @round [src]

func @round(value: f32)->f32 func @round(value: f64)->f64

func @rtflags [src]

func @rtflags()->Swag.RuntimeFlags

func @setcontext [src]

Replace the current thread context.

func @setcontext(context: const *Swag.Context)

func @sin [src]

func @sin(value: f32)->f32 func @sin(value: f64)->f64

func @sinh [src]

func @sinh(value: f32)->f32 func @sinh(value: f64)->f64

func @sqrt [src]

func @sqrt(value: f32)->f32 func @sqrt(value: f64)->f64

func @strcmp [src]

Compare two zero terminated strings, and returns -1, 0 if equal, or 1.

func @strcmp(str1, str2: cstring)->s32

func @stringcmp [src]

Compares two strings, and returns true if they are equal.

func @stringcmp(str1: string, str2: string)->bool

func @strlen [src]

Returns the length of the given 0 terminated string.

func @strlen(str: cstring)->u64

func @sysalloc [src]

func @sysalloc()->*Swag.SystemAllocator

func @tan [src]

func @tan(value: f32)->f32 func @tan(value: f64)->f64

func @tanh [src]

func @tanh(value: f32)->f32 func @tanh(value: f64)->f64

func @trunc [src]

func @trunc(value: f32)->f32 func @trunc(value: f64)->f64

func @typecmp [src]

func @typecmp(typeA, typeB: typeinfo, cmpFlags: TypeCmpFlags)->bool

namespace Swag

Structs

AllocatorRequest Represents the request for a given allocator.
Attribute
AttributeParam
BaseError This is the base of all errors.
BuildCfg The current module build configuration.
BuildCfgBackendLLVM LLVM backend specific options.
BuildCfgBackendSCBE SCBE backend specific options.
BuildCfgGenDoc This contains all options when generating documentation.
CVaList
CompilerMessage A message received in a #message function.
Context Thread context as returned by [@context].
DebugAllocator
DebugAllocatorFooter Will be put just after the returned address.
DebugAllocatorHeader Will be put just before the returned address.
ErrorValue Store a throw error information.
Gvtd Defined a global variable that needs to be dropped when exiting.
Interface
Module Defined some information about a loaded module.
ProcessInfos Defined some information about the current process.
ScratchAllocator
SourceCodeLocation Represent a part of a source code file.
SystemAllocator
SystemError An error raised by the system.
TypeInfo Will be available for all types.
TypeInfoAlias
TypeInfoArray
TypeInfoEnum
TypeInfoFunc
TypeInfoGeneric
TypeInfoNamespace
TypeInfoNative
TypeInfoPointer
TypeInfoSlice
TypeInfoStruct
TypeInfoVariadic
TypeValue Represents a value, like a function parameter or an enum value.

Enums

AllocatorMode The mode of an AllocatorRequest.
AttributeUsage
Backend The type of backend to use.
BuildCfgBackendKind The kind of native backend to generate.
BuildCfgBackendOptim These are the optimization levels for the backend.
BuildCfgBackendSubKind The native backend sub category.
BuildCfgDocKind
CompilerMsgKind The kind of message in CompilerMessage.
CompilerMsgMask The type of message you want to retreive in a #message function.
ContextFlags
ExceptionKind
RuntimeFlags
TargetArch Target processor.
TargetOs The OS to target when generating native code.
TypeCmpFlags
TypeInfoFlags Flags in each TypeInfo.
TypeInfoKind The kind of the typeinfo.
TypeInfoNativeKind The native type if the type is... native.
TypeValueFlags
WarningLevel Warning behavior for Warning attribute.

Attributes

Align
AllowOverflow
AttrMulti
AttrUsage Hardcoded usage.
CalleeReturn A return in the following inlined function must be done in the callee context.
Compiler The following function or variable is only defined at compile time.
Complete The following switch must be complete.
ConstExpr Can be executed at compile time.
Deprecated The following definition is deprecated and should not be used.
Discardable The following function accepts that the called does not use its return value.
EnumFlags The following enum is a set of flags.
EnumIndex The following enum can be used to index arrays without casting.
ExportType
Foreign The following function is foreign (imported).
Global
Implicit Can force an opCast special function to work as implicit.
Incomplete The following switch is incomplete.
Inline Force a function to be inlined.
Macro The following function is a macro.
Match
Mixin The following function is a mixin.
NoCopy The following struct should never be copied.
NoDoc Do not generate documentation.
NoDuplicate The following enum can't have duplicated values.
NoInline Never inline the following function.
NotGeneric The following function is forced to not be generic, even if defined inside a generic struct.
Offset Struct field member relocation.
Opaque When exporting the following struct,: not export its content.
Optimize Enable/Disable a given function optimization.
Overload The following function can be overloaded.
Pack struct packing information.
PrintBc On a function or a struct, this will print the associated generated bytecode (after bytecode optimizations).
PrintGenBc On a function or a struct, this will print the associated generated bytecode (right after generation, without bytecode optimizations).
Safety Enable/Disable one or more safety checks.
Strict
Tls Put the following global variable in the tls segment.
Using
Warning Change the behavior of a given warning or list of warnings.

attr Swag.Align [src]

Usage:
attr Align(value: u8)

enum Swag.AllocatorMode [src]

The mode of an AllocatorRequest.

Alloc Allocate a block of memory.
Free Free a block of memory.
Realloc Reallocate a block of memory.
FreeAll Free all memory allocated with the underlying allocator (ff possible).
AssertIsAllocated The allocator must assert if the address is not currently allocated (if possible).

struct Swag.AllocatorRequest [src]

Represents the request for a given allocator.

callerLoc Swag.SourceCodeLocation The caller code, to help tracking leaks. Optional.
hint string A hint message, to help tracking leaks. Optional.
address *void The returned address or the address to deal with.
size u64 The requested size or the size to deal with.
oldSize u64 When reallocating.
mode Swag.AllocatorMode Alloc, free, reallocate...
alignment u32 Alignment constraint.

To allocate:

  • mode must be AllocatorMode.Alloc
  • size must be the size in bytes to allocate
  • alignment must be the alignment constraint in bytes (or 0)
  • address will be the returned allocated memory address

To free:

  • mode must be AllocatorMode.Free
  • size must be the original allocated size in bytes of address
  • address must be the memory address to release

To reallocate:

  • mode must be AllocatorMode.Realloc
  • size must be the original allocated size in bytes of address
  • address must be the memory address to reallocate

See IAllocator

attr Swag.AllowOverflow [src]

Usage: all
attr AllowOverflow(value: bool)

attr Swag.AttrMulti [src]

Usage: all

attr Swag.AttrUsage [src]

Hardcoded usage.

Usage: all

struct Swag.Attribute [src]

type const *Swag.TypeInfo
params const [..] Swag.AttributeParam Attribute parameters.

struct Swag.AttributeParam [src]

name string Name of the attribute parameter.
value any Optional default value.

enum Swag.AttributeUsage [src]

Enum Attribute can be used on an enum.
EnumValue Attribute can be used on an enum value.
StructVariable Attribute can be used on an struct member.
GlobalVariable Attribute can be used on a global variable.
Variable Attribute can be used on any variable.
Struct Attribute can be used on a struct.
Function Attribute can be used on a function.
FunctionParameter Attribute can be used on a struct parameter.
File Attribute can be used with #global.
Constant Attribute can be used on a constant.
Multi Attribute can be used more than once.
Gen
All

enum Swag.Backend [src]

The type of backend to use.

ByteCode Bytecode.
SCBE SCBE backend (SwagCustomBackEnd).
LLVM LLVM backend.

struct Swag.BaseError [src]

This is the base of all errors.

message string

struct Swag.BuildCfg [src]

The current module build configuration.

moduleVersion u32 The module version.
moduleRevision u32 The module revision.
moduleBuildNum u32 The module build value.
moduleNamespace string The namespace name of the module.
embeddedImports bool Module should embed all its dependencies.
tempAllocatorCapacity s32 Default capacity of the temp allocator (in bytes).
errorAllocatorCapacity u32 Default capacity of the error allocator (in bytes).
safetyGuards u16 Activate specific safety checks.
debugAllocator bool Use Swag.DebugAllocator by default.
debugAllocatorCaptureStack bool Capture the call stack for each allocation.
debugAllocatorLeaks bool Detect memory leaks.
errorStackTrace bool Add stack trace in case a throw is raised.
warnAsErrors string Force some warnings to be treated as errors. Format is "WrnXXXX|WrnXXXX...".
warnAsWarning string Override warnAsErrors, restoring warnings as warnings.
warnAsDisabled string Disable some specific warnings.
warnDefaultDisabled bool All warnings are disabled, except those specified above.
warnDefaultErrors bool All warnings are treated as errors, except those specified above.
byteCodeOptimizeLevel s32 Optimization level of bytecode [0, 1 or 2].
byteCodeEmitAssume bool assume will panic if an error is raised.
byteCodeInline bool Enable bytecode inlining with #[Swag.Inline].
byteCodeAutoInline bool Automatic inlining of some other functions.
backendKind Swag.BuildCfgBackendKind Backend type (executable, dynamic lib...).
backendSubKind Swag.BuildCfgBackendSubKind Backend sub kind.
backendDebugInformations bool Output debug information if true.
backendDebugInline bool Generate specific line information for inline code.
backendOptimize Swag.BuildCfgBackendOptim Backend optimization level.
backendNumCU u32
linkerArgs string Additional linker arguments.
backendLLVM Swag.BuildCfgBackendLLVM Specific LLVM options.
backendSCBE Swag.BuildCfgBackendSCBE Specific SCBE options.
repoPath string Repository access path to the module.
genDoc Swag.BuildCfgGenDoc Parameters for document generation.

See ICompiler

enum Swag.BuildCfgBackendKind [src]

The kind of native backend to generate.

None Nothing.
Export The module is an export module which does not have its own code.
Executable The module needs to be compiled to an executable application.
Library The module needs to be compiled as a library.

struct Swag.BuildCfgBackendLLVM [src]

LLVM backend specific options.

outputIR bool Output IR in a file.
fpMathFma bool true in release.
fpMathNoNaN bool true in release.
fpMathNoInf bool true in release.
fpMathNoSignedZero bool true in release.
fpMathUnsafe bool
fpMathApproxFunc bool

enum Swag.BuildCfgBackendOptim [src]

These are the optimization levels for the backend.

O0 No optimization.
O1 Optimizations level 1.
O2 Optimizations level 2.
O3 Optimizations level 3.
Os Optim for size level 1.
Oz Optim for size level 2.

Only LLVM backend uses this, as the X86_64 backend does not have an optimization pass.

struct Swag.BuildCfgBackendSCBE [src]

SCBE backend specific options.

enum Swag.BuildCfgBackendSubKind [src]

The native backend sub category.

Default
Console

Under windows, by default, the application will be compiled to make a windowed application. But you can change it and force the application to behave like a console one.

enum Swag.BuildCfgDocKind [src]

None Do not generate documentation for that module.
Api Generate 'api like' documentation.
Examples Generate 'examples like' documentation.
Pages Generate one page per file.

struct Swag.BuildCfgGenDoc [src]

This contains all options when generating documentation.

kind Swag.BuildCfgDocKind The kind of documentation to generate.
outputName string The name of the output file (without extension).
outputExtension string The output extension.
titleToc string Title for the table of content.
titleContent string Title for the main document content.
css string The css file to include in generated documentations.
icon string The icon path of the page.
startHead string Content to insert at the start of the <head> section.
endHead string Content to insert at the end of the <head> section.
startBody string Content to insert at the start of the <body> section.
endBody string Content to insert at the end of the <body> section.
morePages string Additional external file pages to process (separated with ;).
quoteIconNote string The icon for the note blockquote.
quoteIconTip string The icon for the tip blockquote.
quoteIconWarning string The icon for the warning blockquote.
quoteIconAttention string The icon for the attention blockquote.
quoteIconExample string The icon for the example blockquote.
quoteTitleNote string The title for the note blockquote.
quoteTitleTip string The title for the tip blockquote.
quoteTitleWarning string The title for the warning blockquote.
quoteTitleAttention string The title for the attention blockquote.
quoteTitleExample string The title for the example blockquote.
syntaxDefaultColor u32 Code syntax default color (if not colorized).
syntaxColorLum f32 Code syntax color luminosity in range ]0, 1].
hasFontAwesome bool Generate a reference to the FontAwesome script (icons).
hasStyleSection bool Generate a default <style> section.
hasSwagWatermark bool Generate a swag watermark at the bottom of each page.

struct Swag.CVaList [src]

buf [2048] u8

attr Swag.CalleeReturn [src]

A return in the following inlined function must be done in the callee context.

Usage: function

attr Swag.Compiler [src]

The following function or variable is only defined at compile time.

Usage: function global-var const

struct Swag.CompilerMessage [src]

A message received in a #message function.

moduleName string Name of the module for which the message is sent.
name string Depends on kind.
type const *Swag.TypeInfo Depends on kind.
kind Swag.CompilerMsgKind Kind of the message.

In a #message function, you can retreive the associated message by calling getMessage of the interface returned by @compiler

enum Swag.CompilerMsgKind [src]

The kind of message in CompilerMessage.

PassAfterSemantic Called once the program semantic has been done.
PassBeforeRunByteCode Called just before running bytecode.
PassBeforeOutput Called just before generating the native code.
PassAllDone Called when everything has be done.
SemFunctions Called for each function in the module.
SemTypes Called for each type in the module.
SemGlobals Called for each global variable in the module.
AttributeGen

enum Swag.CompilerMsgMask [src]

The type of message you want to retreive in a #message function.

PassAfterSemantic
PassBeforeRun
PassBeforeOutput
PassAllDone
SemFunctions
SemTypes
SemGlobals
AttributeGen
All

The function could be called for more than one reason, as this is a mask.

attr Swag.Complete [src]

The following switch must be complete.

Usage: function

attr Swag.ConstExpr [src]

Can be executed at compile time.

Usage: function struct

struct Swag.Context [src]

Thread context as returned by [@context].

allocator Swag.IAllocator The current allocator interface.
flags Swag.ContextFlags Context flags.
tempAllocator Swag.ScratchAllocator A temporary allocator for the user.
errorAllocator Swag.ScratchAllocator A temporary allocator to store the error values.
debugAllocator *void If defined, the used debug allocator.
runtimeFlags Swag.RuntimeFlags As initialized by the runtime.
user0 u64 For user usage.
user1 u64 For user usage.
user2 u64 For user usage.
user3 u64 For user usage.
traces [32] const *Swag.SourceCodeLocation Stack trace, in case of errors.
errors [32] Swag.ErrorValue All errors.
exceptionLoc Swag.SourceCodeLocation When an exception is raised, this is the code location.
exceptionParams [4] const *void When an exception is raised, this are the parameters.
panic func(string, Swag.SourceCodeLocation) A function to call if there's a panic.
curError any The current raised error returns by @err().
errorIndex u32 Number of errors in the array.
traceIndex u32 Number of traces in the array.
hasError u32 <> 0 if an error is raised.

enum Swag.ContextFlags [src]

None
Test
ByteCode

struct Swag.DebugAllocator [src]

allocator Swag.IAllocator
mutex MutexRW
firstAlloc *Swag.DebugAllocatorHeader First allocated block.
firstFree *Swag.DebugAllocatorHeader First freed block.
lastFree *Swag.DebugAllocatorHeader Last freed block.
sizeAlloc u64 Total allocated memory, in bytes.
sizeFree u64 Total of free blocks in quarantine.
countAlloc u32 Number of allocated blocks.
nextId u32 The next allocated id to assign.
maxFreeSize u64 Maximum total size (in kbs) of free blocks in quarantine.
breakOnAllocId u32 Will @assert when the current allocation id reaches that value.
showMaxLeaks u32 Maximum number of memory leaks to show.
captureAllocStack bool For each allocation, capture stack.
detectLeaks bool Detect memory leaks if true.

Functions

assertIsAllocated This function will assert if the given user address is not conform to an allocated block.
checkAllMemory Check all allocated blocks.
checkIsAllocated
checkIsFreed
memAlign
printDisplaySize
printLeaks Output to the console the list of all allocated blocks (leaks).
setup Setup the allocator.

Special Functions

opDrop

func IAllocator.alloc [src]

func alloc(using self, request: *AllocatorRequest)

func IAllocator.free [src]

func free(using self, request: *AllocatorRequest)

func IAllocator.releaseLast [src]

func releaseLast(using self)

func IAllocator.req [src]

func req(using self, request: *AllocatorRequest)

func DebugAllocator.assertIsAllocated [src]

This function will assert if the given user address is not conform to an allocated block.

func assertIsAllocated(using self, addr: *void, callerLoc = #callerlocation)

func DebugAllocator.checkAllMemory [src]

Check all allocated blocks.

func checkAllMemory(using self)

func DebugAllocator.checkIsAllocated [src]

func checkIsAllocated(using self, ptrHeader: ^DebugAllocatorHeader, callerLoc = #callerlocation)

func DebugAllocator.checkIsFreed [src]

func checkIsFreed(using self, ptrHeader: ^DebugAllocatorHeader)

func DebugAllocator.memAlign [src]

func memAlign(value: u64, alignment: u32)->u64

func DebugAllocator.opDrop [src]

func opDrop(using self)

func DebugAllocator.printDisplaySize [src]

func printDisplaySize(value: u64)

func DebugAllocator.printLeaks [src]

Output to the console the list of all allocated blocks (leaks).

func printLeaks(using self)

func DebugAllocator.setup [src]

Setup the allocator.

func setup(using self, allocator: IAllocator)

struct Swag.DebugAllocatorFooter [src]

Will be put just after the returned address.

magic u32

struct Swag.DebugAllocatorHeader [src]

Will be put just before the returned address.

loc Swag.SourceCodeLocation
allocAddr ^void
allocSize u64
userSize u64
hint string
prev *Swag.DebugAllocatorHeader
next *Swag.DebugAllocatorHeader
stack [16] *void
stackCount u32
magic u32
allocId u32

attr Swag.Deprecated [src]

The following definition is deprecated and should not be used.

Usage: function enum enum-value struct
attr Deprecated(msg: string = null)

attr Swag.Discardable [src]

The following function accepts that the called does not use its return value.

Usage: function var

attr Swag.EnumFlags [src]

The following enum is a set of flags.

Usage: enum

attr Swag.EnumIndex [src]

The following enum can be used to index arrays without casting.

Usage: enum

struct Swag.ErrorValue [src]

Store a throw error information.

value any Error value (or null).
pushUsedAlloc u32 Internal.
pushTraceIndex u32 Internal.
pushHasError u32 Internal.
padding u32

enum Swag.ExceptionKind [src]

Panic
Error
Warning

attr Swag.ExportType [src]

Usage: struct
attr ExportType(what: string)

namespace Swag.F32

namespace Swag.F64

attr Swag.Foreign [src]

The following function is foreign (imported).

Usage: function
attr Foreign(module: string, function: string = "")

attr Swag.Global [src]

Usage:
attr Global

struct Swag.Gvtd [src]

Defined a global variable that needs to be dropped when exiting.

ptr *void Pointer to the global variable memory.
opDrop func(*void) The opDrop function to call when the process must exit.
sizeOf u32 Size of one element.
count u32 Number of elements to drop.

interface Swag.IAllocator [src]

req func(*Swag.IAllocator, *Swag.AllocatorRequest)

interface Swag.ICompiler [src]

This is the interface to communicate with the compiler.

getMessage func(*Swag.ICompiler)->const *Swag.CompilerMessage
getBuildCfg func(*Swag.ICompiler)->*Swag.BuildCfg
compileString func(*Swag.ICompiler, string)

The intrinsic @compiler will return that interface at compile-time, and null at runtime.

attr Swag.Implicit [src]

Can force an opCast special function to work as implicit.

Usage: function

attr Swag.Incomplete [src]

The following switch is incomplete.

Usage: enum

attr Swag.Inline [src]

Force a function to be inlined.

Usage: function
attr Inline

struct Swag.Interface [src]

obj *void Pointer to the associated struct instance.
itable const ^^void Pointer to the virtual table.

attr Swag.Macro [src]

The following function is a macro.

Usage: function
attr Macro

attr Swag.Match [src]

Usage: all
attr Match(what: string, value: bool)

attr Swag.Mixin [src]

The following function is a mixin.

Usage: function
attr Mixin

struct Swag.Module [src]

Defined some information about a loaded module.

name string Name of the module.
types const [..] const *Swag.TypeInfo All exported types.

attr Swag.NoCopy [src]

The following struct should never be copied.

Usage: struct
attr NoCopy

attr Swag.NoDoc [src]

Do not generate documentation.

Usage: all
attr NoDoc

attr Swag.NoDuplicate [src]

The following enum can't have duplicated values.

Usage: enum

attr Swag.NoInline [src]

Never inline the following function.

Usage: function

This is a hint for the llvm backend.

attr Swag.NotGeneric [src]

The following function is forced to not be generic, even if defined inside a generic struct.

Usage: function

attr Swag.Offset [src]

Struct field member relocation.

Usage: struct-var
attr Offset(name: string)

The field offset in the struct should be the same as the variable name

attr Swag.Opaque [src]

When exporting the following struct,: not export its content.

Usage: struct
attr Opaque

attr Swag.Optimize [src]

Enable/Disable a given function optimization.

Usage: function multi
attr Optimize(what: string, value: bool)

Options are:

bytecode Enable/Disable bytecode optimization for the function
backend Enable/Disable backend machine code optimization for the function (llvm only)

If what is null or empty, every options will be affected.

attr Swag.Overload [src]

The following function can be overloaded.

Usage: function

attr Swag.Pack [src]

struct packing information.

Usage: struct
attr Pack(value: u8)

attr Swag.PrintBc [src]

On a function or a struct, this will print the associated generated bytecode (after bytecode optimizations).

Usage: function struct
attr PrintBc

attr Swag.PrintGenBc [src]

On a function or a struct, this will print the associated generated bytecode (right after generation, without bytecode optimizations).

Usage: function struct

struct Swag.ProcessInfos [src]

Defined some information about the current process.

modules const [..] Swag.Module The list of all modules.
args string The application arguments, as returned by @args.

enum Swag.RuntimeFlags [src]

Zero
FromCompiler

namespace Swag.S16

namespace Swag.S32

namespace Swag.S64

namespace Swag.S8

attr Swag.Safety [src]

Enable/Disable one or more safety checks.

Usage: all multi
attr Safety(what: string, value: bool)

For example:

#[Swag.Safety("", false)] // Disable all #[Swag.Safety("boundcheck|nan", false)] // Disable 'boundcheck' and 'nan' checks

Safety checks are:

boundcheck Check out of bound access
overflow Check type conversion lost of bits or precision
math Various math checks (like a negative @sqrt)
switch Check an invalid case in a #[Swag.Complete] switch
unreachable Panic if an @unreachable instruction is executed
any Panic if a cast from a any variable does not match the real underlying type
bool Panic if a bool does not have a valid value (true or false)
nan Panic if a nan is used in a float arithmetic operation
sanity Do a sanity check (per function)
null Panic on dereferencing some null pointers

If what is null or empty, every options are will be affected.

struct Swag.ScratchAllocator [src]

allocator Swag.IAllocator
block ^u8
capacity u64
used u64
maxUsed u64
firstLeak *void
totalLeak u64
maxLeak u64

Functions

align Adapt the value depending on the requested alignment.
alloc Allocate a block.
free Free a block, if possible.
freeAll Release all memory.
release Release the allocated block.
setCapacity This will call release prior to changing the capacity, so this must be called at an early stage.

func IAllocator.alloc [src]

func alloc(using self, request: *AllocatorRequest)

func IAllocator.free [src]

func free(using self, request: *AllocatorRequest)

func IAllocator.req [src]

func req(using self, request: *AllocatorRequest)

struct ScratchAllocator.LeakHeader [src]

prev *Swag.ScratchAllocator.LeakHeader
next *Swag.ScratchAllocator.LeakHeader
size u64

func ScratchAllocator.align [src]

Adapt the value depending on the requested alignment.

func align(value: u64, alignment: u32)->u64

func ScratchAllocator.alloc [src]

Allocate a block.

func alloc(using self, size: u64, alignment: u32 = 0)->*void

func ScratchAllocator.free [src]

Free a block, if possible.

func free(using self, addr: *void, size: u64)

func ScratchAllocator.freeAll [src]

Release all memory.

func freeAll(using self)

func ScratchAllocator.release [src]

Release the allocated block.

func release(using self)

func ScratchAllocator.setCapacity [src]

This will call release prior to changing the capacity, so this must be called at an early stage.

func setCapacity(using self, newCapacity: u64, allocator: IAllocator)

struct Swag.SourceCodeLocation [src]

Represent a part of a source code file.

fileName string Full path name of the source file.
lineStart u32 Start line (starts at 0).
colStart u32 Start column.
lineEnd u32 End line.
colEnd u32 End column.

This is typically what will be returned by #curlocation or #callerlocation.

attr Swag.Strict [src]

Usage:
attr Strict

struct Swag.SystemAllocator [src]

func IAllocator.free [src]

func free(request: *AllocatorRequest)

func IAllocator.req [src]

func req(using self, request: *AllocatorRequest)

struct Swag.SystemError [src]

An error raised by the system.

using base Swag.BaseError
errorID u64

enum Swag.TargetArch [src]

Target processor.

X86_64

enum Swag.TargetOs [src]

The OS to target when generating native code.

Windows Windows 10/11.
Linux Linux (unsupported).
MaxOSX MacOS (unsupported).

attr Swag.Tls [src]

Put the following global variable in the tls segment.

Usage: global-var
attr Tls

A copy of the variable will be available for each thread.

enum Swag.TypeCmpFlags [src]

Strict
CastAny
UnScoped

struct Swag.TypeInfo [src]

Will be available for all types.

fullname string The full scoped name of the type.
name string The unscoped name.
sizeof u32 Size in bytes.
crc32 u32 A unique CRC to identify the type.
flags Swag.TypeInfoFlags Some additional flags.
kind Swag.TypeInfoKind The kind of the type.
padding [3] u8

struct Swag.TypeInfoAlias [src]

using base Swag.TypeInfo
rawType const *Swag.TypeInfo The underlying type.

struct Swag.TypeInfoArray [src]

using base Swag.TypeInfo
pointedType const *Swag.TypeInfo The underlying type.
finalType const *Swag.TypeInfo If this is an array with multiple dimensions, this will be the final type.
count u64 Number of elements in the array.
totalCount u64 The total number of elements in case this has multiple dimensions.

struct Swag.TypeInfoEnum [src]

using base Swag.TypeInfo
values const [..] Swag.TypeValue All the values.
rawType const *Swag.TypeInfo The underlying enum type.
attributes const [..] Swag.Attribute All the attributes.

enum Swag.TypeInfoFlags [src]

Flags in each TypeInfo.

Zero
PointerTypeInfo This is a pointer to a TypeInfo struct.
Integer This is a native integer.
Float This is a native float.
Unsigned This is a native unsigned integer.
HasPostCopy This is a struct with a opPostCopy.
HasPostMove This is a struct with a opPostMove.
HasDrop This is a struct with a opDrop.
Strict This is a alias with the Swag.Strict attribute.
CanCopy This is a struct that can be copied.
Tuple This is a tuple.
CString This is a cstring.
Generic This is a generic type.
PointerRef This is a reference.
PointerMoveRef This is a move reference.
PointerArithmetic This is a pointer to multiple values.
Character This is a 32 bits character.
Const This is const.

struct Swag.TypeInfoFunc [src]

using base Swag.TypeInfo
generics const [..] Swag.TypeValue Generic parameters.
parameters const [..] Swag.TypeValue Parameters.
returnType const *Swag.TypeInfo The return type, or null.
attributes const [..] Swag.Attribute All the attributes.

struct Swag.TypeInfoGeneric [src]

using base Swag.TypeInfo
rawType const *Swag.TypeInfo

enum Swag.TypeInfoKind [src]

The kind of the typeinfo.

Invalid
Native The typeinfo is a TypeInfoNative. See TypeInfoNativeKind for the underlying type.
Namespace The typeinfo is a TypeInfoNamespace.
Enum The typeinfo is a TypeInfoEnum.
Func The typeinfo is a TypeInfoFunc.
Lambda The typeinfo is a TypeInfoFunc, but this is a lambda or a func.
Pointer The typeinfo is a TypeInfoPointer.
Array The typeinfo is a TypeInfoArray.
Slice The typeinfo is a TypeInfoSlice.
TypeListTuple The typeinfo is a TypeInfoStruct.
TypeListArray The typeinfo is a TypeInfoArray.
Variadic The typeinfo is a TypeInfoVariadic.
TypedVariadic The typeinfo is a TypeInfoVariadic.
CVariadic The typeinfo is a TypeInfoVariadic.
Struct The typeinfo is a TypeInfoStruct.
Generic The typeinfo is a TypeInfoGeneric.
Alias The typeinfo is a TypeInfoAlias.
Code The typeinfo is a TypeInfo.
Interface The typeinfo is a TypeInfoStruct, but this is an interface.
Attribute The typeinfo is a TypeInfoFunc, but this is an attribute.

struct Swag.TypeInfoNamespace [src]

using base Swag.TypeInfo

struct Swag.TypeInfoNative [src]

using base Swag.TypeInfo
nativeKind Swag.TypeInfoNativeKind

enum Swag.TypeInfoNativeKind [src]

The native type if the type is... native.

Void
S8
S16
S32
S64
U8
U16
U32
U64
F32
F64
Bool
Rune
String
Any
CString
Undefined

If the kind of the type is TypeInfoKind.Native, then this is the real native type.

struct Swag.TypeInfoPointer [src]

using base Swag.TypeInfo
pointedType const *Swag.TypeInfo The pointed type.

struct Swag.TypeInfoSlice [src]

using base Swag.TypeInfo
pointedType const *Swag.TypeInfo The underlying type.

struct Swag.TypeInfoStruct [src]

using base Swag.TypeInfo
opInit func(*void) Pointer to the function to initialize an instance of that struct.
opDrop func(*void) Pointer to the function to drop an instance of that struct.
opPostCopy func(*void) Pointer to the function to call after a copy.
opPostMove func(*void) Pointer to the function to call after a move.
structName string User name of the struct.
fromGeneric const *Swag.TypeInfo If it comes from a generic instantiation, this is the original generic struct.
generics const [..] Swag.TypeValue Generic parameters.
fields const [..] Swag.TypeValue All the fields.
usingFields const [..] Swag.TypeValue All the fields marked with using.
methods const [..] Swag.TypeValue All the methods, if exported.
interfaces const [..] Swag.TypeValue All the interfaces.
attributes const [..] Swag.Attribute All the attributes.

struct Swag.TypeInfoVariadic [src]

using base Swag.TypeInfo
rawType const *Swag.TypeInfo The underlying type.

struct Swag.TypeValue [src]

Represents a value, like a function parameter or an enum value.

name string Name of the value.
pointedType const *Swag.TypeInfo Type of the value.
value const *void Pointer to the constant value.
attributes const [..] Swag.Attribute Associated attributes.
offset u32 Offset, in bytes.
crc32 u32 Unique crc32.
flags Swag.TypeValueFlags Associated flags.
padding u32

enum Swag.TypeValueFlags [src]

Zero
AutoName
HasUsing

namespace Swag.U16

namespace Swag.U32

namespace Swag.U64

namespace Swag.U8

attr Swag.Using [src]

Usage: all
attr Using(what: typeinfo...)

attr Swag.Warning [src]

Change the behavior of a given warning or list of warnings.

Usage: all multi
attr Warning(what: string, level: WarningLevel)

For example:

#[Swag.Warning("Wrn0006", Swag.WarningLevel.Error) #[Swag.Warning("Wrn0002|Wrn0006", Swag.WarningLevel.Disable) #global #[Swag.Warning("Wrn0005", Swag.WarningLevel.Enable)]

You can also change the warning behaviors for the whole module in your BuildCfg

enum Swag.WarningLevel [src]

Warning behavior for Warning attribute.

Enable Enable the given warning.
Disable Disable the given warning.
Error Force the given warning to be raised as an error.
Generated on 08-09-2024 with swag 0.40.0