2. Built-in runtime¶
Builtin module is automatically required by any other das file. It includes basic language infrastructure, support for containers, heap, miscellaneous iterators, profiler, and interaction with host application.
2.1. Type aliases¶
-
print_flags is a bitfield
¶
field |
bit |
value |
---|---|---|
escapeString |
0 |
1 |
namesAndDimensions |
1 |
2 |
typeQualifiers |
2 |
4 |
refAddresses |
3 |
8 |
humanReadable |
4 |
16 |
singleLine |
5 |
32 |
this bitfield specifies how exactly values are to be printed
2.2. Constants¶
-
INT_MIN = -2147483648
¶
minimum possible value of ‘int’
-
INT_MAX = 2147483647
¶
maximum possible value of ‘int’
-
UINT_MAX = 0xffffffff
¶
maximum possible value of ‘uint’
-
LONG_MIN = -2147483648
¶
minimum possible value of ‘int64’
-
LONG_MAX = 2147483647
¶
maximum possible value of ‘int64’
-
ULONG_MAX = 0xffffffff
¶
minimum possible value of ‘uint64’
-
FLT_MIN = 1.
17549e-38f
¶
smallest possible non-zero value of ‘float’. if u want minimum possible value use -FLT_MAX
-
FLT_MAX = 3.
40282e+38f
¶
maximum possible value of ‘float’
-
DBL_MIN = 2.
22507e-308lf
¶
smallest possible non-zero value of ‘double’. if u want minimum possible value use -DBL_MAX
-
DBL_MAX = 1.
79769e+308lf
¶
maximum possible value of ‘double’
-
LOG_CRITICAL = 50000
¶
indicates maximum log level. critial errors, panic, shutdown
-
LOG_ERROR = 40000
¶
indicates log level recoverable errors
-
LOG_WARNING = 30000
¶
indicates log level for API misuse, non-fatal errors
-
LOG_INFO = 20000
¶
indicates log level for miscellaneous informative messages
-
LOG_DEBUG = 10000
¶
indicates log level for debug messages
-
LOG_TRACE = 0
¶
indicates log level for the most noisy debug and tracing messages
-
print_flags_debugger = bitfield
¶
printing flags similar to those used by the ‘debug’ function
2.3. Function annotations¶
-
marker
¶
marker annotation is used to attach arbitrary marker values to a function (in form of annotation arguments). its typically used for implementation of macros
-
generic
¶
indicates that the function is generic, regardless of its argument types. generic functions will be instanced in the calling module
-
_macro
¶
indicates that the function will be called during the macro pass, similar to [init]
-
macro_function
¶
indicates that the function is part of the macro implementation, and will not be present in the final compiled context, unless explicitly called.
-
export
¶
indicates that function is to be exported to the final compiled context
-
no_lint
¶
indicates that the lint pass should be skipped for the specific function
-
sideeffects
¶
indicates that the function should be treated as if it has side-effects. for example it will not be optimized out
-
run
¶
ensures that the function is always evaluated at compilation time
-
unsafe_operation
¶
indicates that function is unsafe, and will require unsafe keyword to be called
-
no_aot
¶
indicates that the AOT will not be generated for this specific function
-
init
¶
indicates that the function would be called at the context initialization time
-
finalize
¶
indicates that the function would be called at the context shutdown time
-
hybrid
¶
indicates that the function is likely candidate for later patching, and the AOT will generate hybrid calls to it - instead of direct calls. that way modyfing the function will not affect AOT of other functions.
-
unsafe_deref
¶
optimization, which indicates that pointer dereference, array and string indexing, and few other operations would not check for null or bounds
-
unused_argument
¶
marks function arguments, which are unused. that way when code policies make unused arguments an error, a workaround can be provided
-
local_only
¶
indicates that function can only accept local make expressions, like [[make tuple]] and [[make structure]]
-
expect_any_vector
¶
indicates that function can only accept das::vector templates
-
builtin_array_sort
¶
indicates sort function for builtin ‘sort’ machinery. used internally
2.4. Call macros¶
-
concept_assert
¶
similar to regular assert function, but always happens at compilation time. it would also display the error message from where the asserted function was called from, not the assert line itself.
-
__builtin_table_key_exists
¶
part of internal implementation for key_exists
-
static_assert
¶
similar to regular assert function, but always happens at compilation time
-
verify
¶
assert for the expression with side effects. expression will not be optimized out if asserts are disabled
-
debug
¶
prints value and returns that same value
-
assert
¶
throws panic if first operand is false. can be disabled. second operand is error message
-
memzero
¶
initializes section of memory with ‘0’
-
__builtin_table_find
¶
part of internal implementation for find
-
invoke
¶
invokes block, function, or lambda
-
__builtin_table_erase
¶
part of internal implementation for erase
2.5. Reader macros¶
-
_esc
¶
returns raw string input, without regards for escape sequences. For example %_esc\n\r%_esc will return 4 character string ‘',’n’,’',’r’
2.7. Handled types¶
-
das_string
¶
das::string which is typically std::string or equivalent
-
clock
¶
das::Time which is a wrapper around time_t
2.8. Containers¶
resize (Arr:array<auto(numT)> -const;newSize:int const) : auto
reserve (Arr:array<auto(numT)> -const;newSize:int const) : auto
push (Arr:array<auto(numT)> -const;value:numT const;at:int const) : auto
push (Arr:array<auto(numT)> -const;varr:array<numT> const) : auto
push (Arr:array<auto(numT)> -const;varr:numT const[-1]) : auto
emplace (Arr:array<auto(numT)> -const;value:numT -const;at:int const) : auto
emplace (Arr:array<auto(numT)> -const;value:numT -const) : auto
push_clone (Arr:array<auto(numT)> -const;value:numT const implicit;at:int const) : auto
push_clone (Arr:array<auto(numT)> -const;value:numT const implicit) : auto
push_clone (A:auto(CT) -const -#;b:auto(TT) const implicit) : auto
find (Tab:table<auto(keyT);auto(valT)> const;at:keyT const implicit) : valT const?
find (Tab:table<auto(keyT);auto(valT)> const#;at:keyT const implicit) : valT const?#
find_for_edit (Tab:table<auto(keyT);auto(valT)> -const;at:keyT const implicit) : valT?
erase (Tab:table<auto(keyT);auto(valT)> -const;at:keyT const implicit) : bool
key_exists (Tab:table<auto(keyT);auto(valT)> const;at:keyT const implicit) : bool
keys (a:table<auto(keyT);auto(valT)> const implicit) : iterator<keyT const&>
values (a:table<auto(keyT);auto(valT)> const implicit =const) : iterator<valT const&>
values (a:table<auto(keyT);auto(valT)> implicit =const -const) : iterator<valT&>
lock_forever (Tab:table<auto(keyT);auto(valT)> -const) : table<keyT;valT>#
each (lam:lambda<(arg:auto(argT) -const):bool> const) : iterator<argT -&>
each_ref (lam:lambda<(arg:auto(argT)? -const):bool> const) : iterator<argT&>
to_array (it:iterator<auto(TT)> const) : array<TT -const -&>
to_table (a:tuple<auto(keyT);auto(valT)> const[-1]) : table<keyT -const;valT>
to_table_move (a:tuple<auto(keyT);auto(valT)>[-1] -const) : table<keyT -const;valT>
sort (a:auto(TT)[-1] implicit -const;cmp:block<(x:TT const;y:TT const):bool> const) : auto
sort (a:array<auto(TT)> implicit -const;cmp:block<(x:TT const;y:TT const):bool> const) : auto
lock (a:array<auto(TT)> =const -const;blk:block<(x:array<TT># implicit -const):auto> const) : auto
lock (a:array<auto(TT)> const =const;blk:block<(x:array<TT> const# implicit):auto> const) : auto
find_index (arr:array<auto(TT)> const implicit;key:TT const) : auto
find_index (arr:auto(TT) const[-1] implicit;key:TT const) : auto
find_index (arr:iterator<auto(TT)> const;key:TT const -&) : auto
find_index_if (arr:array<auto(TT)> const implicit;blk:block<(key:TT const):bool> const) : auto
find_index_if (arr:auto(TT) const[-1] implicit;blk:block<(key:TT const):bool> const) : auto
find_index_if (arr:iterator<auto(TT)> const;blk:block<(key:TT const -&):bool> const) : auto
-
clear
(array: array implicit)¶
argument |
argument type |
---|---|
array |
array implicit |
clear will clear whole table or array arg. The size of arg after clear is 0.
-
length
(array: array const implicit)¶
length returns int
argument |
argument type |
---|---|
array |
array const implicit |
length will return current size of table or array arg.
-
capacity
(array: array const implicit)¶
capacity returns int
argument |
argument type |
---|---|
array |
array const implicit |
capacity will return current capacity of table or array arg. Capacity is the count of elements, allocating (or pushing) until that size won’t cause reallocating dynamic heap.
-
empty
(iterator: iterator const implicit)¶
empty returns bool
argument |
argument type |
---|---|
iterator |
iterator const implicit |
returns true if iterator is empty, i.e. would not produce any more values or uninitialized
-
clear
(table: table implicit)
argument |
argument type |
---|---|
table |
table implicit |
clear will clear whole table or array arg. The size of arg after clear is 0.
-
length
(table: table const implicit)
length returns int
argument |
argument type |
---|---|
table |
table const implicit |
length will return current size of table or array arg.
-
capacity
(table: table const implicit)
capacity returns int
argument |
argument type |
---|---|
table |
table const implicit |
capacity will return current capacity of table or array arg. Capacity is the count of elements, allocating (or pushing) until that size won’t cause reallocating dynamic heap.
-
resize
(Arr: array<auto(numT)>; newSize: int const)¶
resize returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
newSize |
int const |
Resize will resize array_arg array to a new size of new_size. If new_size is bigger than current, new elements will be zeroed.
-
reserve
(Arr: array<auto(numT)>; newSize: int const)¶
reserve returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
newSize |
int const |
makes sure array has sufficient amount of memory to hold specified number of elements. reserving arrays will speed up pushing to it
-
pop
(Arr: array<auto(numT)>)¶
pop returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
removes last element of the array
-
push
(Arr: array<auto(numT)>; value: numT const; at: int const)¶
push returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
value |
numT const |
at |
int const |
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
-
push
(Arr: array<auto(numT)>; value: numT const)
push returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
value |
numT const |
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
-
push
(Arr: array<auto(numT)>; varr: array<numT> const)
push returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
varr |
array<numT> const |
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
-
push
(Arr: array<auto(numT)>; varr: numT const[-1])
push returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
varr |
numT const[-1] |
push will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be copied (assigned) to it.
-
emplace
(Arr: array<auto(numT)>; value: numT; at: int const)¶
emplace returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
value |
numT |
at |
int const |
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
-
emplace
(Arr: array<auto(numT)>; value: numT)
emplace returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
value |
numT |
emplace will push to dynamic array array_arg the content of value. value has to be of the same type (or const reference to same type) as array values. if at is provided value will be pushed at index at, otherwise to the end of array. The content of value will be moved (<-) to it.
-
push_clone
(Arr: array<auto(numT)>; value: numT const implicit; at: int const)¶
push_clone returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
value |
numT const implicit |
at |
int const |
similar to push, only values would be cloned instead of copied
-
push_clone
(Arr: array<auto(numT)>; value: numT const implicit)
push_clone returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
value |
numT const implicit |
similar to push, only values would be cloned instead of copied
-
push_clone
(A: auto(CT); b: auto(TT) const implicit)
push_clone returns auto
argument |
argument type |
---|---|
A |
auto(CT) |
b |
auto(TT) const implicit |
similar to push, only values would be cloned instead of copied
-
back
(a: array<auto(TT)> =const)¶
back returns TT&
argument |
argument type |
---|---|
a |
array<auto(TT)>! |
returns last element of the array
-
back
(a: array<auto(TT)> const =const)
back returns TT const&
argument |
argument type |
---|---|
a |
array<auto(TT)> const! |
returns last element of the array
-
erase
(Arr: array<auto(numT)>; at: int const)¶
erase returns auto
argument |
argument type |
---|---|
Arr |
array<auto(numT)> |
at |
int const |
erase will erase at index element in arg array.
-
length
(a: auto const[-1])
length returns int
argument |
argument type |
---|---|
a |
auto const[-1] |
length will return current size of table or array arg.
-
empty
(a: array<auto> const)
empty returns bool
argument |
argument type |
---|---|
a |
array<auto> const |
returns true if iterator is empty, i.e. would not produce any more values or uninitialized
-
find
(Tab: table<auto(keyT);auto(valT)> const; at: keyT const implicit; blk: block<(p:valT? const):void> const)¶
find returns auto
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> const |
at |
keyT const implicit |
blk |
block<(p:valT? const):void> const |
will execute block_arg with argument pointer-to-value in table_arg pointing to value indexed by key, or null if key doesn’t exist in table_arg.
-
find_if_exists
(Tab: table<auto(keyT);auto(valT)> const; at: keyT const implicit; blk: block<(p:valT? const):void> const)¶
find_if_exists returns auto
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> const |
at |
keyT const implicit |
blk |
block<(p:valT? const):void> const |
similar to find, but the block will only be called, if the key is found
-
find
(Tab: table<auto(keyT);auto(valT)> const; at: keyT const implicit)
find returns valT const?
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> const |
at |
keyT const implicit |
will execute block_arg with argument pointer-to-value in table_arg pointing to value indexed by key, or null if key doesn’t exist in table_arg.
-
find
(Tab: table<auto(keyT);auto(valT)> const#; at: keyT const implicit)
find returns valT const?#
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> const# |
at |
keyT const implicit |
will execute block_arg with argument pointer-to-value in table_arg pointing to value indexed by key, or null if key doesn’t exist in table_arg.
-
find_for_edit
(Tab: table<auto(keyT);auto(valT)>; at: keyT const implicit; blk: block<(p:valT? -const):void> const)¶
find_for_edit returns auto
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> |
at |
keyT const implicit |
blk |
block<(p:valT?):void> const |
similar to find, but pointer to the value would be read-write
-
find_for_edit_if_exists
(Tab: table<auto(keyT);auto(valT)>; at: keyT const implicit; blk: block<(p:valT? -const):void> const)¶
find_for_edit_if_exists returns auto
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> |
at |
keyT const implicit |
blk |
block<(p:valT?):void> const |
similar to find_if_exists, but pointer to the value would be read-write
-
find_for_edit
(Tab: table<auto(keyT);auto(valT)>; at: keyT const implicit)
find_for_edit returns valT?
Warning
This is unsafe operation.
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> |
at |
keyT const implicit |
similar to find, but pointer to the value would be read-write
-
erase
(Tab: table<auto(keyT);auto(valT)>; at: keyT const implicit)
erase returns bool
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> |
at |
keyT const implicit |
erase will erase at index element in arg array.
-
key_exists
(Tab: table<auto(keyT);auto(valT)> const; at: keyT const implicit)¶
key_exists returns bool
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> const |
at |
keyT const implicit |
will return true if element key exists in table table_arg.
-
keys
(a: table<auto(keyT);auto(valT)> const implicit)¶
keys returns iterator<keyT const&>
argument |
argument type |
---|---|
a |
table<auto(keyT);auto(valT)> const implicit |
returns iterator to all keys of the table
-
values
(a: table<auto(keyT);auto(valT)> const implicit =const)¶
values returns iterator<valT const&>
argument |
argument type |
---|---|
a |
table<auto(keyT);auto(valT)> const implicit! |
returns iterator to all values of the table
-
values
(a: table<auto(keyT);auto(valT)> implicit =const)
values returns iterator<valT&>
argument |
argument type |
---|---|
a |
table<auto(keyT);auto(valT)> implicit! |
returns iterator to all values of the table
-
lock
(Tab: table<auto(keyT);auto(valT)> const; blk: block<(t:table<keyT;valT> const#):void> const)¶
lock returns auto
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> const |
blk |
block<(t:table<keyT;valT> const#):void> const |
locks array or table for the duration of the block invocation, so that it can’t be resized. values can’t be pushed or popped, etc.
-
lock
(Tab: table<auto(keyT);auto(valT)> const#; blk: block<(t:table<keyT;valT> const#):void> const)
lock returns auto
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> const# |
blk |
block<(t:table<keyT;valT> const#):void> const |
locks array or table for the duration of the block invocation, so that it can’t be resized. values can’t be pushed or popped, etc.
-
lock_forever
(Tab: table<auto(keyT);auto(valT)>)¶
lock_forever returns table<keyT;valT>#
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> |
locks array or table forever
-
next
(it: iterator<auto(TT)> const; value: TT&)¶
next returns bool
argument |
argument type |
---|---|
it |
iterator<auto(TT)> const |
value |
TT& |
returns next element in the iterator as the ‘value’. result is true if there is element returned, or false if iterator is null or empty
-
length
(vec: auto const)
length returns auto
argument |
argument type |
---|---|
vec |
auto const |
length will return current size of table or array arg.
-
each
(rng: range const)¶
each returns iterator<int>
argument |
argument type |
---|---|
rng |
range const |
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
-
each
(str: string const)
each returns iterator<int>
Warning
This is unsafe operation.
argument |
argument type |
---|---|
str |
string const |
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
-
each
(a: auto(TT) const[-1])
each returns iterator<TT&>
Warning
This is unsafe operation.
argument |
argument type |
---|---|
a |
auto(TT) const[-1] |
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
-
each
(a: array<auto(TT)> const)
each returns iterator<TT&>
Warning
This is unsafe operation.
argument |
argument type |
---|---|
a |
array<auto(TT)> const |
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
-
each
(lam: lambda<(arg:auto(argT) -const):bool> const)
each returns iterator<argT>
argument |
argument type |
---|---|
lam |
lambda<(arg:auto(argT)):bool> const |
returns iterator, which iterates though each element of the object. object can be range, static or dynamic array, another iterator.
-
each_ref
(lam: lambda<(arg:auto(argT)? -const):bool> const)¶
each_ref returns iterator<argT&>
argument |
argument type |
---|---|
lam |
lambda<(arg:auto(argT)?):bool> const |
similar to each, but iterator returns references instead of values
-
each_enum
(tt: auto(TT) const)¶
each_enum returns iterator<TT>
argument |
argument type |
---|---|
tt |
auto(TT) const |
iterates over each element in the enumeration
-
nothing
(it: iterator<auto(TT)>)¶
nothing returns iterator<TT>
argument |
argument type |
---|---|
it |
iterator<auto(TT)> |
returns empty iterator
-
to_array
(it: iterator<auto(TT)> const)¶
to_array returns array<TT>
argument |
argument type |
---|---|
it |
iterator<auto(TT)> const |
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be cloned
-
to_array
(a: auto(TT) const[-1])
to_array returns array<TT>
argument |
argument type |
---|---|
a |
auto(TT) const[-1] |
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be cloned
-
to_array_move
(a: auto(TT)[-1])¶
to_array_move returns array<TT>
argument |
argument type |
---|---|
a |
auto(TT)[-1] |
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be copied or moved
-
to_array_move
(a: auto(TT))
to_array_move returns array<TT>
argument |
argument type |
---|---|
a |
auto(TT) |
will convert argument (static array, iterator, another dynamic array) to an array. argument elements will be copied or moved
-
to_table
(a: tuple<auto(keyT);auto(valT)> const[-1])¶
to_table returns table<keyT;valT>
argument |
argument type |
---|---|
a |
tuple<auto(keyT);auto(valT)> const[-1] |
will convert an array of key-value tuples into a table<key;value> type. arguments will be cloned
-
to_table_move
(a: tuple<auto(keyT);auto(valT)>[-1])¶
to_table_move returns table<keyT;valT>
argument |
argument type |
---|---|
a |
tuple<auto(keyT);auto(valT)>[-1] |
will convert an array of key-value tuples into a table<key;value> type. arguments will be copied or moved
-
sort
(a: auto(TT)[-1] implicit)¶
sort returns auto
argument |
argument type |
---|---|
a |
auto(TT)[-1] implicit |
sorts an array in ascending order.
-
sort
(a: array<auto(TT)> implicit)
sort returns auto
argument |
argument type |
---|---|
a |
array<auto(TT)> implicit |
sorts an array in ascending order.
-
sort
(a: auto(TT)[-1] implicit; cmp: block<(x:TT const;y:TT const):bool> const)
sort returns auto
argument |
argument type |
---|---|
a |
auto(TT)[-1] implicit |
cmp |
block<(x:TT const;y:TT const):bool> const |
sorts an array in ascending order.
-
sort
(a: array<auto(TT)> implicit; cmp: block<(x:TT const;y:TT const):bool> const)
sort returns auto
argument |
argument type |
---|---|
a |
array<auto(TT)> implicit |
cmp |
block<(x:TT const;y:TT const):bool> const |
sorts an array in ascending order.
-
lock
(a: array<auto(TT)> =const; blk: block<(x:array<TT># implicit -const):auto> const)
lock returns auto
argument |
argument type |
---|---|
a |
array<auto(TT)>! |
blk |
block<(x:array<TT># implicit):auto> const |
locks array or table for the duration of the block invocation, so that it can’t be resized. values can’t be pushed or popped, etc.
-
lock
(a: array<auto(TT)> const =const; blk: block<(x:array<TT> const# implicit):auto> const)
lock returns auto
argument |
argument type |
---|---|
a |
array<auto(TT)> const! |
blk |
block<(x:array<TT> const# implicit):auto> const |
locks array or table for the duration of the block invocation, so that it can’t be resized. values can’t be pushed or popped, etc.
-
find_index
(arr: array<auto(TT)> const implicit; key: TT const)¶
find_index returns auto
argument |
argument type |
---|---|
arr |
array<auto(TT)> const implicit |
key |
TT const |
returns index of they key in the array
-
find_index
(arr: auto(TT) const[-1] implicit; key: TT const)
find_index returns auto
argument |
argument type |
---|---|
arr |
auto(TT) const[-1] implicit |
key |
TT const |
returns index of they key in the array
-
find_index
(arr: iterator<auto(TT)> const; key: TT const)
find_index returns auto
argument |
argument type |
---|---|
arr |
iterator<auto(TT)> const |
key |
TT const |
returns index of they key in the array
-
find_index_if
(arr: array<auto(TT)> const implicit; blk: block<(key:TT const):bool> const)¶
find_index_if returns auto
argument |
argument type |
---|---|
arr |
array<auto(TT)> const implicit |
blk |
block<(key:TT const):bool> const |
returns index of the key in the array, where key is checked via compare block
-
find_index_if
(arr: auto(TT) const[-1] implicit; blk: block<(key:TT const):bool> const)
find_index_if returns auto
argument |
argument type |
---|---|
arr |
auto(TT) const[-1] implicit |
blk |
block<(key:TT const):bool> const |
returns index of the key in the array, where key is checked via compare block
-
find_index_if
(arr: iterator<auto(TT)> const; blk: block<(key:TT const -&):bool> const)
find_index_if returns auto
argument |
argument type |
---|---|
arr |
iterator<auto(TT)> const |
blk |
block<(key:TT const):bool> const |
returns index of the key in the array, where key is checked via compare block
-
has_value
(a: auto const; key: auto const)¶
has_value returns auto
argument |
argument type |
---|---|
a |
auto const |
key |
auto const |
returns true if iterable a (array, dim, etc) contains key
-
subarray
(a: auto(TT) const[-1]; r: range const)¶
subarray returns auto
argument |
argument type |
---|---|
a |
auto(TT) const[-1] |
r |
range const |
returns new array which is copy of a slice of range of the source array
-
subarray
(a: auto(TT) const[-1]; r: urange const)
subarray returns auto
argument |
argument type |
---|---|
a |
auto(TT) const[-1] |
r |
urange const |
returns new array which is copy of a slice of range of the source array
-
subarray
(a: array<auto(TT)> const; r: range const)
subarray returns auto
argument |
argument type |
---|---|
a |
array<auto(TT)> const |
r |
range const |
returns new array which is copy of a slice of range of the source array
-
subarray
(a: array<auto(TT)> const; r: urange const)
subarray returns auto
argument |
argument type |
---|---|
a |
array<auto(TT)> const |
r |
urange const |
returns new array which is copy of a slice of range of the source array
2.9. das::string manipulation¶
-
peek
(src: das_string const implicit; block: block<(string const#):void> const implicit)¶
argument |
argument type |
---|---|
src |
builtin::das_string const implicit |
block |
block<(string const#):void> const implicit |
returns contents of the das::string as temporary string value. this is fastest way to access contents of das::string as string
2.10. Heap reporting¶
string_heap_bytes_allocated (context:__context const) : uint64
string_heap_collect (validate:bool const;context:__context const;at:__lineInfo const) : void
string_heap_report (context:__context const;line:__lineInfo const) : void
heap_report (context:__context const;line:__lineInfo const) : void
memory_report (errorsOnly:bool const;context:__context const;lineinfo:__lineInfo const) : void
-
heap_bytes_allocated
()¶
heap_bytes_allocated returns uint64
will return bytes allocated on heap (i.e. really used, not reserved)
-
heap_depth
()¶
heap_depth returns int
returns number of generations in the regular heap
-
string_heap_bytes_allocated
()¶
string_heap_bytes_allocated returns uint64
returns number of bytes allocated in the string heap
-
string_heap_depth
()¶
string_heap_depth returns int
returns number of generations in the string heap
-
string_heap_collect
(validate: bool const)¶
Warning
This is unsafe operation.
argument |
argument type |
---|---|
validate |
bool const |
calls garbage collection on the string heap
-
heap_collect
(string_heap: bool const; validate: bool const)¶
Warning
This is unsafe operation.
argument |
argument type |
---|---|
string_heap |
bool const |
validate |
bool const |
calls garbage collection on the regular heap
-
string_heap_report
()¶
reports string heap usage and allocations
-
heap_report
()¶
reports heap usage and allocations
-
memory_report
(errorsOnly: bool const)¶
argument |
argument type |
---|---|
errorsOnly |
bool const |
reports memory allocation, optionally GC errors only
2.11. GC0 infrastructure¶
-
gc0_save_ptr
(name: string const implicit; data: void? const implicit)¶
argument |
argument type |
---|---|
name |
string const implicit |
data |
void? const implicit |
saves pointer to gc0 storage by specifying name
-
gc0_save_smart_ptr
(name: string const implicit; data: smart_ptr<void> const implicit)¶
argument |
argument type |
---|---|
name |
string const implicit |
data |
smart_ptr<void> const implicit |
saves smart_ptr to gc0 storage by specifying name
-
gc0_restore_ptr
(name: string const implicit)¶
gc0_restore_ptr returns void?
argument |
argument type |
---|---|
name |
string const implicit |
restores pointer from gc0 storage by name
-
gc0_restore_smart_ptr
(name: string const implicit)¶
gc0_restore_smart_ptr returns smart_ptr<void>
argument |
argument type |
---|---|
name |
string const implicit |
restores smart_ptr from gc0 storage name
-
gc0_reset
()¶
resets gc0 storage. stored pointers will no longer be accessible
2.12. Smart ptr infrastructure¶
-
smart_ptr_clone
(dest: smart_ptr<void>& implicit; src: void? const implicit)¶
argument |
argument type |
---|---|
dest |
smart_ptr<void>& implicit |
src |
void? const implicit |
clones smart_ptr, internal use-count is incremented
-
smart_ptr_clone
(dest: smart_ptr<void>& implicit; src: smart_ptr<void> const implicit)
argument |
argument type |
---|---|
dest |
smart_ptr<void>& implicit |
src |
smart_ptr<void> const implicit |
clones smart_ptr, internal use-count is incremented
-
smart_ptr_use_count
(ptr: smart_ptr<void> const implicit)¶
smart_ptr_use_count returns uint
argument |
argument type |
---|---|
ptr |
smart_ptr<void> const implicit |
returns internal use-count for the smart_ptr
-
get_ptr
(src: smart_ptr<auto(TT)> const)¶
get_ptr returns TT?
argument |
argument type |
---|---|
src |
smart_ptr<auto(TT)> const |
returns regular pointer from the smart_ptr
-
get_const_ptr
(src: smart_ptr<auto(TT)> const)¶
get_const_ptr returns TT? const
argument |
argument type |
---|---|
src |
smart_ptr<auto(TT)> const |
return constant pointer from regular pointer
2.13. Macro infrastructure¶
-
is_compiling
()¶
is_compiling returns bool
returns true if context is being compiled
-
is_compiling_macros
()¶
is_compiling_macros returns bool
returns true if context is being compiled and the compiler is currently executing macro pass
-
is_compiling_macros_in_module
(name: string const implicit)¶
is_compiling_macros_in_module returns bool
argument |
argument type |
---|---|
name |
string const implicit |
returns true if context is being compiled, its macro pass, and its in the specific module
2.14. Profiler¶
-
reset_profiler
()¶
resets counters in the built-in profiler
-
dump_profile_info
()¶
dumps use counts of all lines collected by built-in profiler
-
collect_profile_info
()¶
collect_profile_info returns string
enabling collecting of the use counts by built-in profiler
-
profile
(count: int const; category: string const implicit; block: block<> const implicit)¶
profile returns float
argument |
argument type |
---|---|
count |
int const |
category |
string const implicit |
block |
block<> const implicit |
profiles specified block by evaluating it count times and returns minimal time spent in the block in seconds, as well as prints it.
2.15. System infastructure¶
panic (text:string const implicit;context:__context const;at:__lineInfo const) : void
print (text:string const implicit;context:__context const) : void
error (text:string const implicit;context:__context const) : void
stackwalk (args:bool const;vars:bool const;context:__context const;lineinfo:__lineInfo const) : void
-
get_das_root
()¶
get_das_root returns string
returns path to where daslib and other libraries exist. this is typically root folder of the daScript main repository
-
panic
(text: string const implicit)¶
argument |
argument type |
---|---|
text |
string const implicit |
will cause panic. The program will be determinated if there is no recover. Panic is not a error handling mechanism and can not be used as such. It is indeed panic, fatal error. It is not supposed that program can completely correctly recover from panic, recover construction is provided so program can try to correcly shut-down or report fatal error. If there is no recover withing script, it will be called in calling eval (in C++ callee code).
-
print
(text: string const implicit)¶
argument |
argument type |
---|---|
text |
string const implicit |
outputs string into current context log output
-
error
(text: string const implicit)¶
argument |
argument type |
---|---|
text |
string const implicit |
similar to ‘print’ but outputs to context error output
-
sprint
(value: any const; flags: print_flags)¶
sprint returns string
argument |
argument type |
---|---|
value |
any const |
flags |
|
similar to ‘print’ but returns string instead of printing it
-
terminate
()¶
terminates current context execution
-
breakpoint
()¶
breakpoint will call os_debugbreakpoint, which is link-time unresolved dependency. It’s supposed to call breakpoint in debugger tool, as sample implementation does.
-
stackwalk
(args: bool const; vars: bool const)¶
argument |
argument type |
---|---|
args |
bool const |
vars |
bool const |
stackwalk prints call stack and local variables values
-
is_in_aot
()¶
is_in_aot returns bool
returns true if compiler is currently generating AOT
-
to_log
(arg0: int const; arg1: string const implicit)¶
argument |
argument type |
---|---|
arg0 |
int const |
arg1 |
string const implicit |
similar to print but output goes to the logging infrastructure. arg0 specifies log level, i.e. LOG_… constants
2.16. Memory manipulation¶
-
variant_index
(arg0: variant<> const implicit)¶
variant_index returns int
argument |
argument type |
---|---|
arg0 |
variant<> const implicit |
returns internal index of the variant value
-
set_variant_index
(variant: variant<> implicit; index: int const)¶
Warning
This is unsafe operation.
argument |
argument type |
---|---|
variant |
variant<> implicit |
index |
int const |
sets internal index of the variant value
-
hash
(data: any const)¶
hash returns uint64
argument |
argument type |
---|---|
data |
any const |
returns hash value of the data. current implementation uses FNV64a hash.
-
memcpy
(left: void? const implicit; right: void? const implicit; size: int const)¶
Warning
This is unsafe operation.
argument |
argument type |
---|---|
left |
void? const implicit |
right |
void? const implicit |
size |
int const |
copies size bytes of memory from right to left
-
memcmp
(left: void? const implicit; right: void? const implicit; size: int const)¶
memcmp returns int
Warning
This is unsafe operation.
argument |
argument type |
---|---|
left |
void? const implicit |
right |
void? const implicit |
size |
int const |
similar to C ‘memcmp’, compares size bytes of left` and right memory. returns -1 if left is less, 1 if left is greater, and 0 if left is same as right
-
intptr
(p: void? const)¶
intptr returns uint64
argument |
argument type |
---|---|
p |
void? const |
returns int64 representation of a pointer
-
intptr
(p: smart_ptr<auto> const)
intptr returns uint64
argument |
argument type |
---|---|
p |
smart_ptr<auto> const |
returns int64 representation of a pointer
-
lock_data
(a: array<auto(TT)> =const; blk: block<(p:TT?# implicit -const;s:int const):auto> const)¶
lock_data returns auto
argument |
argument type |
---|---|
a |
array<auto(TT)>! |
blk |
block<(p:TT?# implicit;s:int const):auto> const |
locks array and invokes block with a pointer to array’s data
-
lock_data
(a: array<auto(TT)> const =const; blk: block<(p:TT const? const# implicit;s:int const):auto> const)
lock_data returns auto
argument |
argument type |
---|---|
a |
array<auto(TT)> const! |
blk |
block<(p:TT const? const# implicit;s:int const):auto> const |
locks array and invokes block with a pointer to array’s data
-
map_to_array
(data: void? const; len: int const; blk: block<(arg:array<auto(TT)># -const):auto> const)¶
map_to_array returns auto
Warning
This is unsafe operation.
argument |
argument type |
---|---|
data |
void? const |
len |
int const |
blk |
block<(arg:array<auto(TT)>#):auto> const |
builds temporary array from the specified memory
-
map_to_ro_array
(data: void? const; len: int const; blk: block<(arg:array<auto(TT)> const#):auto> const)¶
map_to_ro_array returns auto
Warning
This is unsafe operation.
argument |
argument type |
---|---|
data |
void? const |
len |
int const |
blk |
block<(arg:array<auto(TT)> const#):auto> const |
same as map_to_array but array is read-only
2.17. Binary serializer¶
-
binary_save
(obj: auto const; subexpr: block<(data:array<uint8> const):void> const)¶
binary_save returns auto
argument |
argument type |
---|---|
obj |
auto const |
subexpr |
block<(data:array<uint8> const):void> const |
saves any data to array<uint8>. obsolete, use daslib/archive instead
-
binary_load
(obj: auto; data: array<uint8> const)¶
binary_load returns auto
argument |
argument type |
---|---|
obj |
auto |
data |
array<uint8> const |
loads any data from array<uint8>. obsolete, use daslib/archive instead
2.18. Path and command line¶
-
get_command_line_arguments
()¶
get_command_line_arguments returns array<string>
returns array of command line arguments.
2.19. Time and date¶
-
get_clock
()¶
get_clock returns builtin::clock
return a current calendar time. The value returned generally represents the number of seconds since 00:00 hours, Jan 1, 1970 UTC (i.e., the current unix timestamp).
-
ref_time_ticks
()¶
ref_time_ticks returns int64
returns current time in ticks
-
get_time_usec
(arg0: int64 const)¶
get_time_usec returns int
argument |
argument type |
---|---|
arg0 |
int64 const |
returns time interval in usec, since the specified reft (usually from ref_time_ticks)
2.20. Algorithms¶
-
iter_range
(foo: auto const)¶
iter_range returns auto
argument |
argument type |
---|---|
foo |
auto const |
returns range(foo)
-
swap
(a: auto(TT)&; b: auto(TT)&)¶
swap returns auto
argument |
argument type |
---|---|
a |
auto(TT)& |
b |
auto(TT)& |
swaps two values a and ‘b’
2.21. Uncategorized¶
-
interval
(arg0: int const; arg1: int const)¶
interval returns range
argument |
argument type |
---|---|
arg0 |
int const |
arg1 |
int const |
returns range(‘arg0’,’arg1’)
-
interval
(arg0: uint const; arg1: uint const)
interval returns urange
argument |
argument type |
---|---|
arg0 |
uint const |
arg1 |
uint const |
returns range(‘arg0’,’arg1’)
-
lock_count
(array: array const implicit)¶
lock_count returns int
argument |
argument type |
---|---|
array |
array const implicit |
returns internal lock count for the array or table
-
class_rtti_size
(ptr: void? const implicit)¶
class_rtti_size returns int
argument |
argument type |
---|---|
ptr |
void? const implicit |
returns size of specific TypeInfo for the class
-
_move_with_lockcheck
(a: auto(valA)&; b: auto(valB)&)¶
_move_with_lockcheck returns auto
argument |
argument type |
---|---|
a |
auto(valA)& |
b |
auto(valB)& |
moves b into a, checks if a or b is locked, recursively for each lockable element of a and b
-
_return_with_lockcheck
(a: auto(valT)& =const)¶
_return_with_lockcheck returns valT&
argument |
argument type |
---|---|
a |
auto(valT)&! |
returns a. check if a is locked, recursively for each lockable element of a
-
_return_with_lockcheck
(a: auto(valT) const& =const)
_return_with_lockcheck returns valT&
argument |
argument type |
---|---|
a |
auto(valT) const&! |
returns a. check if a is locked, recursively for each lockable element of a
-
_at_with_lockcheck
(Tab: table<auto(keyT);auto(valT)>; at: keyT const implicit)¶
_at_with_lockcheck returns valT&
argument |
argument type |
---|---|
Tab |
table<auto(keyT);auto(valT)> |
at |
keyT const implicit |
returns element of the table Tab, also checks if Tab is locked, recursively for each lockable element of Tab
-
move_to_ref
(a: auto&; b: auto)¶
move_to_ref returns auto
argument |
argument type |
---|---|
a |
auto& |
b |
auto |
moves b into a. if b is value, it will be copied to a instead