The modern and fun way to program.
std.systemThe box std.system contains miscellaneous environment
settings and utilities.
VERSIONAn integer containing the Smudge version XXYYZZ using the following rule:
in decimal:
XX (major)YY (minor)ZZ (patch)For example: version 7.4.3 becomes 70403.
STR_VERSIONA string containing a human readable Smudge version.
DATE_VERSIONA string containing the date of the current Smudge version expressed in MM.YYYY.
check ()Returns true only if the environment is ready to execute commands (via run (cmd) or
() (cmd)), false otherwise.
run (cmd) and () (cmd)Executes the command contained in the string cmd.
Returns null.
exit (i)Exits the program with, as return value, the integer i.
Does not return anything.
abort ()Aborts the current program (terminates the process with signal SIGABRT).
Does not return anything.
sterr (str)Exits the current program but prints the stack trace and the given error message
str. If str is not a string, it will be converted to it through std.cast::string(x).
Does not return anything.
get (str)Gets the environment variable named str (which has to be a string)
and stores its value to a string.
Returns the string, or null if str is not a string.
alloc (nbytes)Creates a new Chunk instance of length equal to nbytes.
Returns the instance, or null if nbytes is not an integer.
ChunkClass Chunk contains an array of bytes allocated in the heap memory.
new (num)Allocates the Chunk with size num (or does nothing if num is not an integer).
Returns null.
delete ()Frees the allocated memory.
Returns null.
failed ()Returns true if the allocation of the array failed, false otherwise.
get (idx)Returns the value of the byte at the offset idx.
idx can be negative, in that case it will ve counted from the end.
set (idx[, val = 1])Sets the byte at the offset idx to the value val.
idx can be negative, in that case it will ve counted from the end.
Returns false if the operation failed, true otherwise.
reset (idx)Sets the byte at the offset idx to 0.
idx can be negative, in that case it will ve counted from the end.
Returns false if the operation failed, true otherwise.
iterate ()Returns an instance of ChunkIterator pointing to the begin of the array.
ChunkIteratorAn iterator class form Chunk.
new (chunk)Constructs a new iterator starting from the given Chunk instance chunk.
delete ()Destroys the iterator instance.
next ()Advances the iterator.
Returns a tuple containing the pointed byte and an int (true if it’s valid,
false otherwise).
| Home |