backIndex

Xelagot action script

Mem - inifile structure in memory

Requires xelagot 3.607

An inifile structure in memory, persistent between scripts during a session, allows scripts to read and write parameters, and pass them on to concatenated scripts. The read and write statements are similar to Ini File statements, Mem replacing Ini in the statement. There is no open or close statements, as no file is involved. A few extra operations are possible: clear all, clear section, save to (ini)file, load from (ini)file, merge from (ini)file.

All read operations require that you specify a variable where to store the value, a Section (string, do not include the square brackets), a Key (string), and a default value for the case there in no such value in the inifile.

All write operations require that you specify a Section (string, no square brackets), a Key (string), and an appropriate value.

Keys with empty values are removed.

MemReadInt %v $section $key %default Stores in %v the integer value section/key or the default.
MemWriteInt $section $key %v Writes the integer value %v to the section/key.
MemReadBool %v section $key %default Stores in %v an integer value from the section/key or the default. The value 0 corresponds to false, otherwise 1 is stored.
MemWriteBool $section $key %v Writes the value %v to the section/key. If %v is 0, the boolean is false, else it is true (reperesented by the number 1 in memory).
MemReadFloat %v $section $key %default Stores in %v the real (float) value from the section/key or the default.
MemWriteFloat $section $key %v Writes the real (float) value %v to the section/key.
MemReadString $s $section $key $default Stores in $s the string value from the section/key or the default.
MemWriteString $section $key $s Writes the trimmed (leading and trailing spaces removed) value of $s to the section/key.
MemClear Clears the memory, deleting all sections and keys.
MemClearSection $section Removes a whole section and its keys.
MemSave $filename [%rc] Dumps the whole content to a file. Optionally, stores 0 in %rc if succeds, otherwise -1.

xelagot 3.607 or newer
The filename convention is explained in the section Filenames. If the destination path and folder does not exist, it will be created to accommodate the file.

xelagot 3.606
Upgrade to 3.607 or newest :)
MemLoad $filename [%rc] Clears the memory, then parses the file $filename (which must have an ini file structure), attempts to reconstruct its inifile structure in memory. Optionally, stores 0 in %rc if succeds, otherwise -1.

xelagot 3.607 or newer
The filename convention is explained in the section Filenames.

xelagot 3.606
Upgrade to 3.607 or newest :)
MemMerge $filename [%rc] Does not clear the memory, parses the file $filename (which must have an ini file structure), attempts to add its contents to sections and keys in memory, adding sections and keys when necessary, overwriting existing keys. Optionally, stores 0 in %rc if succeds, otherwise -1.

xelagot 3.607 or newer
The filename convention is explained in the section Filenames.

xelagot 3.606
Upgrade to 3.607 or newest :)
MemGetKeysSDF $r $section Gets all names of Keys in a Section, puts them in a (SDF) comma separated string $r.
Use GetFirstSDF $k $r repeatedly to recover the individual key names in $k, until $k has an empty string.
MemGetSectionsSDF $r Gets all names of Sections, puts them in a (SDF) comma separated string $r.
Use GetFirstSDF $s $r repeatedly to recover the individual section names in $s, until $s has an empty string.


backIndex