Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Functions | |
std_addFlag (flags, flag) | |
Add a flag in a flags combination, like 'WN_MENU|WN_SIZEBOX|WN_MINBOX'. More... | |
std_clamp (v, m, M) | |
Clamp a value between two values. More... | |
std_clampT (v, tuple, default) | |
Clamp a value to a tuple. More... | |
std_cmpI (a, b) | |
Returns if two integers are equals or not. More... | |
std_cmpS (s, t) | |
Returns if two float numbers are equals or not. More... | |
std_cmpSi (s, t) | |
Returns if two string are equals. Case-insensitive. More... | |
std_divide (a, b) | |
Perform an entire division. More... | |
std_enumClamp (v, tuple) | |
Clamp an integer like an enum. The tuple should be sorted : only the first and the last element are compared. More... | |
std_enumClampF (v, tuple) | |
Clamp a float number like an enum. The tuple should be sorted : only the first and the last element are compared. More... | |
std_getLoadedPackages (chn) | |
Returns the list of all loaded packages in a given channel. More... | |
std_isFlagPresent (flags, flag) | |
Check if a flag is in a flags combination, like 'WN_MENU|WN_SIZEBOX|WN_MINBOX'. More... | |
std_memory () | |
Return some infos about the operating system. See 'memoryInfos' for more informations about the memory. More... | |
std_ncmpI (a, b) | |
Returns if two integers are not equals. More... | |
std_ncmpS (s, t) | |
Returns if two float numbers are not equals. More... | |
std_ncmpSi (s, t) | |
Returns if two string are not equals. Case-insensitive. More... | |
std_newUnChn (szScript) | |
Create a new unplugged channel with the minimal environment. More... | |
std_newUnCurChn (szScript) | |
Create a new unplugged channel with the current environment. More... | |
std_newUnCurChnEx (szScript, funCon, funClo) | |
Create a new unplugged channel with the current environment. More... | |
std_objIsEqual (obj1, obj2) | |
Returns if two Scol objects are equal. More... | |
std_objIsNil (obj) | |
Get if an Scol object is nil. More... | |
std_os () | |
Return some infos about the operating system. See 'osInfos'. More... | |
std_random (max) | |
Return a random integer. More... | |
std_removeFlag (flags, flag) | |
Remove a flag in a flags combination, like 'WN_MENU|WN_SIZEBOX|WN_MINBOX'. More... | |
std_sameType (o1, o2) | |
Check if two objects have the same type. More... | |
std_sleep (second) | |
Perform a pause. More... | |
std_starterScriptParse () | |
Parse the launcher script of the current application. More... | |
std_starterScriptParseP (pFile) | |
Parse a launcher script. More... | |
std_tupleCmp (tuple1, tuple2, fCmp) | |
Compare two tuples. More... | |
std_tupleHasNil (tuple) | |
Return if a tuple has an (or more) item at nil. More... | |
std_tupleIsFound (tuple, v) | |
Return if a value is found in a tuple. More... | |
std_tupleIsFoundS (tuple, s) | |
Return if a string is found in a tuple. Case sensitive. More... | |
std_tupleIsFoundSi (tuple, s) | |
Return if a string is found in a tuple. Case insensitive. More... | |
std_tupleIsNil (tuple) | |
Return if a tuple is nil or each item is nil. More... | |
std_tupleNew (size, values, tuple) | |
Create a tuple. More... | |
std_tupleSize (tuple) | |
Return the size of a tuple. More... | |
std_tupleSort (tuple) | |
Sort the values of an integer tuple. More... | |
std_tupleSortF (tuple) | |
Sort the values of a float tuple. More... | |
std_tupleSortFR (tuple) | |
Sort the values of a float tuple (reverse). More... | |
std_tupleSortR (tuple) | |
Sort the values of an integer tuple (reverse). More... | |
std_vectorAddF (fV1, fV2) | |
Add two vectors (float number) More... | |
std_vectorAddI (iV1, iV2) | |
Add two vectors (integer) More... | |
std_vectorAddS (szV1, szV2) | |
Add two vectors (string element) More... | |
std_vectorDivideF (fV1, fV2) | |
Divide two vectors (float number) More... | |
std_vectorDivideI (iV1, iV2) | |
Divide two vectors (integer) More... | |
std_vectorIsEqual (v1, v2) | |
Return if two integer vectors are equals. More... | |
std_vectorIsEqualAny (v1, v2) | |
Return if two vectors are equals. More... | |
std_vectorIsEqualS (v1, v2) | |
Return if two string vectors are equals. Case-sensitive. More... | |
std_vectorIsEqualSi (v1, v2) | |
Return if two string vectors are equals. Case-insensitive. More... | |
std_vectorIsNil (v) | |
Return if a vector is nil or not. More... | |
std_vectorIsNullF (v) | |
Return if a vector is null or not. More... | |
std_vectorIsNullI (v) | |
Return if a vector is null or not. More... | |
std_vectorIsNullS (v) | |
Return if a vector is "" or not. More... | |
std_vectorMultiplyF (fV1, fV2) | |
Multiply two vectors (float number) More... | |
std_vectorMultiplyI (iV1, iV2) | |
multiply two vectors (integer) More... | |
std_vectorSet (v) | |
Create a vector in duplicating a same given value. More... | |
std_vectorSubF (fV1, fV2) | |
Sub two vectors (float number) More... | |
std_vectorSubI (iV1, iV2) | |
Sub two vectors (integer) More... | |
Package to load : lib/std/stdlib.pkg
Dependancies :
std_objIsNil | ( | obj | ) |
Get if an Scol object is nil.
Prototype : fun [u0] I
u0 | : any Scol object |
std_objIsEqual | ( | obj1 | , |
obj2 | |||
) |
Returns if two Scol objects are equal.
Prototype : fun [u0 u0] I
u0 | : any Scol object |
u0 | : another Scol object |
std_cmpI | ( | a | , |
b | |||
) |
Returns if two integers are equals or not.
Prototype : fun [I I] I
I | : any integer |
I | : another integer |
std_cmpS | ( | s | , |
t | |||
) |
Returns if two float numbers are equals or not.
Prototype : fun [F F] I
F | : any float number |
F | : another float number |
Returns if two string are equals or not- Case-sensitive.
Prototype : fun [S S] I
S | : any string |
S | : another string |
std_cmpSi | ( | s | , |
t | |||
) |
Returns if two string are equals. Case-insensitive.
Prototype : fun [S S] I
S | : any string |
S | : another string |
std_ncmpI | ( | a | , |
b | |||
) |
Returns if two integers are not equals.
Prototype : fun [I I] I
I | : any integer |
I | : another integer |
std_ncmpS | ( | s | , |
t | |||
) |
Returns if two float numbers are not equals.
Prototype : fun [F F] I
F | : any float number |
F | : another float number |
Returns if two string are not equals. Case-sensitive.
Prototype : fun [S S] I
S | : any string |
S | : another string |
std_ncmpSi | ( | s | , |
t | |||
) |
Returns if two string are not equals. Case-insensitive.
Prototype : fun [S S] I
S | : any string |
S | : another string |
std_divide | ( | a | , |
b | |||
) |
Perform an entire division.
Prototype : fun [I I] I
I | : a |
I | : b (if is equal to 0, the result will be nil) |
std_os | ( | ) |
Return some infos about the operating system. See 'osInfos'.
Prototype : fun [] S
std_memory | ( | ) |
Return some infos about the operating system. See 'memoryInfos' for more informations about the memory.
Prototype : fun [] [I I I]
std_sleep | ( | second | ) |
Perform a pause.
Prototype : fun [I] I
I | : the number of second |
std_random | ( | max | ) |
Return a random integer.
Prototype : fun [I] I
I | : the maximum, the number will be between 0 and this maximum (it should not be greater than 32767). |
std_starterScriptParse | ( | ) |
Parse the launcher script of the current application.
Prototype : fun [] [[S r1] [[S [S r1]] r1]]
std_starterScriptParseP | ( | pFile | ) |
Parse a launcher script.
Prototype : fun [P] [[S r1] [[S [S r1]] r1]]
P | : a script read reference file |
std_getLoadedPackages | ( | chn | ) |
Returns the list of all loaded packages in a given channel.
Prototype : fun [Chn] [S r1]
Chn | : a channel, like _channel |
std_tupleSort | ( | tuple | ) |
Sort the values of an integer tuple.
Prototype: fun [u0] u0
u0 | : a tuple of integers |
std_tupleSortR | ( | tuple | ) |
Sort the values of an integer tuple (reverse).
Prototype: fun [u0] u0
u0 | : a tuple of integers |
std_tupleSortF | ( | tuple | ) |
Sort the values of a float tuple.
Prototype: fun [u0] u0
u0 | : a tuple of float numbers |
std_tupleSortFR | ( | tuple | ) |
Sort the values of a float tuple (reverse).
Prototype: fun [u0] u0
u0 | : a tuple of float numbers |
std_clamp | ( | v | , |
m | , | ||
M | |||
) |
Clamp a value between two values.
Prototype: fun [I I I] I
I | : an integer to clamp |
I | : the minimum |
I | : the maximum (if it is lesser than the minimum, the function will return nil) |
std_clampT | ( | v | , |
tuple | , | ||
default | |||
) |
Clamp a value to a tuple.
Prototype: fun [I u0 I] I
I | : an integer to clamp |
u0 | : a tuple |
I | : a default value to set if not found in the tuple |
std_enumClamp | ( | v | , |
tuple | |||
) |
Clamp an integer like an enum. The tuple should be sorted : only the first and the last element are compared.
Prototype: fun [I u0] I
I | : an integer to clamp |
u0 | : any integer tuple |
std_enumClampF | ( | v | , |
tuple | |||
) |
Clamp a float number like an enum. The tuple should be sorted : only the first and the last element are compared.
Prototype: fun [F u0] F
F | : a float to clamp |
u0 | : any float tuple |
std_tupleSize | ( | tuple | ) |
Return the size of a tuple.
Prototype: fun [u0] I
u0 | : any tuple |
std_tupleCmp | ( | tuple1 | , |
tuple2 | , | ||
fCmp | |||
) |
Compare two tuples.
Prototype: fun [u0 u0 fun [u0 u0] I] I
u0 | : any tuple |
u0 | : another tuple |
fun | [u0 u0] I : function called to compare two elements. It should return 1 if these two elements are equals. |
std_tupleIsFound | ( | tuple | , |
v | |||
) |
Return if a value is found in a tuple.
Prototype: fun [u0 u1] I
u0 | : any tuple |
u1 | : a value |
std_tupleIsFoundS | ( | tuple | , |
s | |||
) |
Return if a string is found in a tuple. Case sensitive.
Prototype: fun [u0 S] I
u0 | : any string tuple |
u1 | : a value |
std_tupleIsFoundSi | ( | tuple | , |
s | |||
) |
Return if a string is found in a tuple. Case insensitive.
Prototype: fun [u0 S] I
u0 | : any tuple |
u1 | : a value |
std_tupleNew | ( | size | , |
values | , | ||
tuple | |||
) |
Create a tuple.
Prototype: fun [I [u0 r1] u1] u1
I | : the size of the new tuple (1 or +) |
[u0 | r1] : a list to set the tuple elements. Initially, each element is set to nil, this list is a convenience to set another values. If the list is bigger than the size, its last elements will be ignored. If it is smaller than the size, another elements will keep at nil. |
u1 | : should be always nil. |
std_tupleIsNil | ( | tuple | ) |
Return if a tuple is nil or each item is nil.
Prototype: fun [u0] I
u0 | : any tuple |
std_tupleHasNil | ( | tuple | ) |
Return if a tuple has an (or more) item at nil.
Prototype: fun [u0] I
u0 | : any tuple |
std_vectorIsNullI | ( | v | ) |
Return if a vector is null or not.
Prototype: fun [[I I I]] I
[I | I I] : integer vector |
std_vectorIsNullF | ( | v | ) |
Return if a vector is null or not.
Prototype: fun [[F F F]] I
[F | F F] : float vector |
std_vectorIsNullS | ( | v | ) |
Return if a vector is "" or not.
Prototype: fun [[S S S]] I
[S | S S] : string vector |
std_vectorIsNil | ( | v | ) |
Return if a vector is nil or not.
Prototype: fun [[u0 u1 u2]] I
[u0 | u1 u2] : a vector |
std_vectorIsEqual | ( | v1 | , |
v2 | |||
) |
Return if two integer vectors are equals.
Prototype: fun [[I I I] [I I I]] I
[I | I I] : first integer vector |
[I | I I] : second integer vector |
std_vectorIsEqualS | ( | v1 | , |
v2 | |||
) |
Return if two string vectors are equals. Case-sensitive.
Prototype: fun [[S S S] [S S S]] I
[S | S S] : first string vector |
[S | S S] : second string vector |
std_vectorIsEqualSi | ( | v1 | , |
v2 | |||
) |
Return if two string vectors are equals. Case-insensitive.
Prototype: fun [[S S S] [S S S]] I
[S | S S] : first string vector |
[S | S S] : second string vector |
std_vectorIsEqualAny | ( | v1 | , |
v2 | |||
) |
Return if two vectors are equals.
Prototype: fun [[u0 u1 u2] [u0 u1 u2]] I
[u0 | u1 u2] : first vector |
[u0 | u1 u2] : second vector |
std_vectorAddI | ( | iV1 | , |
iV2 | |||
) |
Add two vectors (integer)
Prototype: fun [[I I I] [I I I]] [I I I]
[I | I I] : first integer vector |
[I | I I] : second integer vector |
std_vectorAddF | ( | fV1 | , |
fV2 | |||
) |
Add two vectors (float number)
Prototype: fun [[F F F] [F F F]] [F F F]
[F | F F] : first float vector |
[F | F F] : second float vector |
std_vectorAddS | ( | szV1 | , |
szV2 | |||
) |
Add two vectors (string element)
Prototype: fun [[S S S] [S S S]] [S S S]
[S | S S] : first string vector |
[S | S S] : second string vector |
std_vectorSubI | ( | iV1 | , |
iV2 | |||
) |
Sub two vectors (integer)
Prototype: fun [[I I I] [I I I]] [I I I]
[I | I I] : first integer vector |
[I | I I] : second integer vector |
std_vectorSubF | ( | fV1 | , |
fV2 | |||
) |
Sub two vectors (float number)
Prototype: fun [[F F F] [F F F]] [F F F]
[F | F F] : first float vector |
[F | F F] : second float vector |
std_vectorMultiplyI | ( | iV1 | , |
iV2 | |||
) |
multiply two vectors (integer)
Prototype: fun [[I I I] [I I I]] [I I I]
[I | I I] : first integer vector |
[I | I I] : second integer vector |
std_vectorMultiplyF | ( | fV1 | , |
fV2 | |||
) |
Multiply two vectors (float number)
Prototype: fun [[F F F] [F F F]] [F F F]
[F | F F] : first float vector |
[F | F F] : second float vector |
std_vectorDivideI | ( | iV1 | , |
iV2 | |||
) |
Divide two vectors (integer)
Prototype: fun [[I I I] [I I I]] [I I I]
[I | I I] : first integer vector |
[I | I I] : second integer vector |
std_vectorDivideF | ( | fV1 | , |
fV2 | |||
) |
Divide two vectors (float number)
Prototype: fun [[F F F] [F F F]] [F F F]
[F | F F] : first float vector |
[F | F F] : second float vector |
std_vectorSet | ( | v | ) |
Create a vector in duplicating a same given value.
Prototype: fun [u0] [u0 u0 u0]
u0 | : any value |
std_isFlagPresent | ( | flags | , |
flag | |||
) |
Check if a flag is in a flags combination, like 'WN_MENU|WN_SIZEBOX|WN_MINBOX'.
Prototype : fun [I I] I
I | : a flags combination |
I | : a flag to check |
std_removeFlag | ( | flags | , |
flag | |||
) |
Remove a flag in a flags combination, like 'WN_MENU|WN_SIZEBOX|WN_MINBOX'.
Prototype : fun [I I] I
I | : a flags combination |
I | : a flag to remove |
std_addFlag | ( | flags | , |
flag | |||
) |
Add a flag in a flags combination, like 'WN_MENU|WN_SIZEBOX|WN_MINBOX'.
Prototype : fun [I I] I
I | : a flags combination |
I | : a flag to add |
std_sameType | ( | o1 | , |
o2 | |||
) |
Check if two objects have the same type.
This function should be NEVER used in production !
In development or debug mode, this function causes a runtime error if the two objects have a different type.
Prototype : fun [u0 u0] I
u0 | : any object |
u0 | : any object |
std_newUnChn | ( | szScript | ) |
Create a new unplugged channel with the minimal environment.
Prototype : fun [S] Chn
S | : a script to execute immediately in the new channel. |
std_newUnCurChn | ( | szScript | ) |
Create a new unplugged channel with the current environment.
Prototype : fun [S] Chn
S | : a script to execute immediately in the new channel. |
std_newUnCurChnEx | ( | szScript | , |
funCon | , | ||
funClo | |||
) |
Create a new unplugged channel with the current environment.
Prototype : fun [S S S] Chn
S | : a script to execute immediately in the new channel. |
S | : the function name to call when a connection is received. |
S | : the function name to call when a connection is closed. |
Create a new unplugged channel with the minimal environment.
Prototype : fun [S S S] Chn
S | : a script to execute immediately in the new channel. |
S | : the function name to call when a connection is received. |
S | : the function name to call when a connection is closed. |
Create a new unplugged channel with the minimal environment.
Prototype : fun [[S r1] S S] Chn
[S | r1] : a list of files to load immediately in the new channel. |
S | : the function name to call when a connection is received. |
S | : the function name to call when a connection is closed. |