Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Functions | |
std_sfCmpExtension (filename, ext) | |
Compare if a path has a given extension. More... | |
std_sfConvertListPtoS (pFiles) | |
Convert a list of read file references to a list of file references. More... | |
std_sfConvertListPtoW (pFiles) | |
Convert a list of read file references to a list of write file references. More... | |
std_sfConvertListWtoP (wFiles) | |
Convert a list of write file references to a list of read file references. More... | |
std_sfConvertListWtoS (wFiles) | |
Convert a list of write file references to a list of file references. More... | |
std_sfGetExtension (path, with) | |
Return the extension of a path name. More... | |
std_sfGetFatherDirectory (rep, withSep) | |
Return the father path directory in a path name. More... | |
std_sfGetFirstPosSlash (s) | |
Return the position of the first slash (/) in a path name. More... | |
std_sfGetLastPosPoint (s) | |
Return the position of the last point (.) in a path name. More... | |
std_sfGetLastPosSlash (s) | |
Return the position of the last slash (/) in a path name. More... | |
std_sfGetPathFile (longfile, file) | |
Get a file path and file name from a path. More... | |
std_sfGetPathWithoutExtension (path) | |
Return the path without the extension, if any. More... | |
std_sfGetRootDirectory (rep, withSep) | |
Return the root directory in a path name. More... | |
std_sfGetTree (rep) | |
Return the list of file names in some folders and its subfolders. More... | |
std_sfGetTreeCb (lrep, cb) | |
List all files and all subdirectories from a list of directories. For each directory, a function is called with the list of its files. More... | |
std_sfPathFromRelativePath (relativePath, rootdir) | |
Return the absolute path from a relative path. More... | |
std_sfRelativePathFromPath (absolutePath, rootdir) | |
Return the relative path from an absolute path. More... | |
std_sfXor (pFile, wFile, szKey) | |
To cipher/uncipher a file to another file by the XOR algorithm. More... | |
Package to load : lib/std/systemfiles.pkg
Dependancies :
std_sfGetTree | ( | rep | ) |
Return the list of file names in some folders and its subfolders.
Prototype: fun [[S r1]] [S r1]
[S | r1] : a list of folder (e.g. "lib" :: "locked/lib" :: nil) |
std_sfGetTreeCb | ( | lrep | , |
cb | |||
) |
List all files and all subdirectories from a list of directories. For each directory, a function is called with the list of its files.
Prototype: fun [[S r1] fun [S [S r1]] u0] I
[S | r1] : a list of directories (e.g. "lib" :: "locked/lib" :: nil) |
fun | [S [S r1]] u0 : function to call for each directory read. These arguments are :
|
std_sfGetLastPosSlash | ( | s | ) |
Return the position of the last slash (/) in a path name.
Prototype: fun [S] I
S | : a path name |
std_sfGetFirstPosSlash | ( | s | ) |
Return the position of the first slash (/) in a path name.
Prototype: fun [S] I
S | : a path name |
std_sfGetLastPosPoint | ( | s | ) |
Return the position of the last point (.) in a path name.
Prototype: fun [S] I
S | : a path name |
std_sfGetFatherDirectory | ( | rep | , |
withSep | |||
) |
Return the father path directory in a path name.
Prototype: fun [S I] S
S | : a pathname |
I | : a flag : 1 to add a slash at the end, else 0 |
std_sfGetRootDirectory | ( | rep | , |
withSep | |||
) |
Return the root directory in a path name.
Prototype: fun [S I] S
S | : a pathname |
I | : a flag : 1 to add a slash at the end, else 0 |
std_sfGetPathWithoutExtension | ( | path | ) |
Return the path without the extension, if any.
Prototype: fun [S] S
S | : a pathname |
std_sfGetExtension | ( | path | , |
with | |||
) |
Return the extension of a path name.
Prototype: fun [S I] S
S | : a pathname |
I | : a flag : 1 to add a . at the begin, else 0 |
std_sfCmpExtension | ( | filename | , |
ext | |||
) |
Compare if a path has a given extension.
Prototype: fun [S S] I
S | : a pathname |
S | : an extension, such as "pkg" or "png" |
std_sfGetPathFile | ( | longfile | , |
file | |||
) |
Get a file path and file name from a path.
Prototype: fun [S S] [S S]
S | : the path |
S | : should set to nil |
std_sfPathFromRelativePath | ( | relativePath | , |
rootdir | |||
) |
Return the absolute path from a relative path.
let "./std/systemfiles.pkg" -> relative in let "lib" -> rootdir in _fooS std_sfPathFromRelativePath relative rootdir; // lib/std/systemfiles.pkg
Prototype: fun [S S] [S S]
S | : the relative path |
S | : the root directory |
std_sfRelativePathFromPath | ( | absolutePath | , |
rootdir | |||
) |
Return the relative path from an absolute path.
let "lib/std/systemfiles.pkg" -> absolute in let "lib" -> rootdir in _fooS std_sfRelativePathFromPath absolute rootdir; // ./std/systemfiles.pkg
Prototype: fun [S S] [S S]
S | : the absolute path |
S | : the root directory |
std_sfConvertListPtoS | ( | pFiles | ) |
Convert a list of read file references to a list of file references.
Prototype: fun [[P r1]] [S r1]
[P | r1] : a list of read file references |
std_sfConvertListWtoS | ( | wFiles | ) |
Convert a list of write file references to a list of file references.
Prototype: fun [[W r1]] [S r1]
[W | r1] : a list of write file references |
std_sfConvertListWtoP | ( | wFiles | ) |
Convert a list of write file references to a list of read file references.
Prototype: fun [[W r1]] [P r1]
[W | r1] : a list of write file references |
std_sfConvertListPtoW | ( | pFiles | ) |
Convert a list of read file references to a list of write file references.
Prototype: fun [[P r1]] [W r1]
[P | r1] : a list of read file references |
std_sfXor | ( | pFile | , |
wFile | , | ||
szKey | |||
) |
To cipher/uncipher a file to another file by the XOR algorithm.
The same function ciphers and unciphers the initial file if the same key is given.
This algorithm is simple but not secure for critical data.
Prototype: fun [P W S] I
P | : a read file references. This is the file to cipher/uncipher. This file isn't loaded in Scol memory. |
W | : a write file references. This is the ciphering output. |
S | : the key to cipher/uncipher. Its length mist be >= at 1. |