Manual: Difference between revisions

From NEOSYS Dev Wiki
Jump to navigationJump to search
Tag: Reverted
m (Reverted edits by Steve (talk) to last revision by Greg)
Tag: Rollback
Line 1: Line 1:
=== Programmer's Guides ===
=== Programmer's Guides ===
Only for C++ at the moment. For all others, see some examples:
http://code.google.com/p/exodusdb/source/browse/#svn%2Ftrunk%2Fswig%2Fshare
==== [[Python]] ====
==== [[Perl]] ====
==== [[PHP]] ====
==== [[Java]] ====
==== [[C#]] ====
==== [[C++]] ====


=== ICONV/OCONV PATTERNS ===
=== ICONV/OCONV PATTERNS ===
Line 146: Line 156:
Exodus dictionaries enable classic multivalue database data definition. Dictionaries are just normal Exodus multivalue files that contain one record for each data column definition. You can use Exodus's edir program to manually edit dictionaries.
Exodus dictionaries enable classic multivalue database data definition. Dictionaries are just normal Exodus multivalue files that contain one record for each data column definition. You can use Exodus's edir program to manually edit dictionaries.


Dictionary file names must start with the word "dict.". For example, if you have a "books" file, then you will probably have a "dict.books" file.
Dictionary file names must start with the word "dict_". For example, if you have a "books" file, then you will probably have a "dict_books" file.


You can list the contents of a dictionary by typing "list dict.filename".
You can list the contents of a dictionary by typing "list dict_filename".


==== Exodus Dictionary Format ====
==== Exodus Dictionary Format ====
Line 216: Line 226:
  } ...
  } ...
</pre>
</pre>
=== Traditional Multivalue Functions and Statements (non-OO) ===
Exodus clones traditional multivalue function and statement behaviour and retains their syntax as far as possible.
* Traditional functions are rendered as Exodus functions.
* Traditional statements are rendered as Exodus subroutines.
PRINT OCONV(DATE(),'D')
in Exodus becomes:
printl(oconv(date(),"D"));
==== String Commands ====
The use of most of Exodus's functions will be fairly obvious to traditional multivalue programmers.
Ηοwever it is not so obvious that all the functions ending in "-er" correspond to the old string commands.
For example, the classic multivalue "modify in-place" character conversion command:
CONVERT 'ab' TO 'cd' IN ZZ
is now represented in Exodus by:
converter(zz,"ab","cd");
Exodus provides a complete set of string modification commands even where there was no specific command in classic mv basic.
To guarantee fast performance (regardless of compiler optimisation) you should always use the command instead of the old "self assign" idiom.
For example:
ZZ=TRIM(ZZ)
should appear in Exodus as:
trimmer(zz);
and not:
zz=trim(zz);


==== Function Types ====
==== Function Types ====
Line 228: Line 281:
|cmd ||traditional commands with no outputs||
|cmd ||traditional commands with no outputs||
|-
|-
|expr ||traditional commands that now have outputs and can be used in expressions||
|cmd2 ||traditional commands that now have outputs and can be used in expressions||
|}
|}


Line 264: Line 317:
|}
|}


==== Complete List of Functions ====


==== Complete List of Functions ====


===== Math/Boolean =====
===== Environment =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|-
|var=||var.abs()||Absolute value
<syntaxhighlight lang="c++">var(-12.34).abs(); // 12.34</syntaxhighlight>
|-
|var=||var.pwr(exponent)||Power
<syntaxhighlight lang="c++">var(2).pwr(8); // 256</syntaxhighlight>
|-
|var=||var.rnd()||Random number generator
<syntaxhighlight lang="c++">var(100).rnd(); // 0 to 99 pseudo random</syntaxhighlight>
|-
|cmd||var.initrnd()||Initialise Random seed
<syntaxhighlight lang="c++">var(123).initrnd(); // Set pseudo random seed to 123</syntaxhighlight>
|-
|var=||var.exp()||Power of e
<syntaxhighlight lang="c++">var(1).exp(); // 2.718281828459045</syntaxhighlight>
|-
|var=||var.sqrt()||Square root
<syntaxhighlight lang="c++">var(100).sqrt(); // 10</syntaxhighlight>
|-
|var=||var.sin()||Sine of degrees
<syntaxhighlight lang="c++">var(30).sin(); // 0.5</syntaxhighlight>
|-
|var=||var.cos()||Cosine of degrees
<syntaxhighlight lang="c++">var(60).cos(); // 0.5</syntaxhighlight>
|-
|var=||var.tan()||Tangent of degrees
<syntaxhighlight lang="c++">var(45).tan(); // 1</syntaxhighlight>
|-
|var=||var.atan()||Arctangent of degrees
<syntaxhighlight lang="c++">var(1).atan(); // 45</syntaxhighlight>
|-
|var=||var.loge()||Natural logarithm
<syntaxhighlight lang="c++">var(2.718281828459045).loge(); // 1</syntaxhighlight>
|-
|var=||var.integer()||Truncate decimal numbers towards zero.
<syntaxhighlight lang="c++">var(2.9).integer(); // 2
var(-2.9).integer(); // -2</syntaxhighlight>
|-
|-
|var=||var.floor()||Truncate decimal numbers towards negative
|var= ||osgetenv(envname)||
<syntaxhighlight lang="c++">var(2.9).floor(); // 2
var(-2.9).floor(); // -3</syntaxhighlight>
|-
|-
|var=||var.round(ndecimals = 0)||Round decimal numbers to a desired number of decimal places<br>
|if ||osgetenv(envname, out value)||
.5 rounds away from zero.
<syntaxhighlight lang="c++">var(23.455).round(2); // "23.46"
var(-23.455).round(2); // "-23.46"</syntaxhighlight>
|-
|-
|var=||var.mod(divisor)||Remainder function<br>
|if ||ossetenv(envname, newvalue)||
Result is between [0 , limit) if limit is positive<br>
Result is between (limit, 0] if limit is negative
<syntaxhighlight lang="c++">var(7).mod(5); // 2
mod(7, 5); // ditto</syntaxhighlight>
|}
|}


===== Locale =====
===== Time/Date/Sleep =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var= ||date()||
|-
|-
|expr||var.getxlocale()||Gets the current thread's default locale codepage code
|var= ||time()||
<syntaxhighlight lang="c++">var().getxlocale(); // e.g. "en_US.utf8"
getxlocale(); // ditto</syntaxhighlight>
|-
|-
|if||var.setxlocale()||Sets the current thread's default locale codepage code
|var= ||timedate()||
<syntaxhighlight lang="c++">"de_DE.utf8"_var.setxlocale(); // true if successful
setxlocale("de_DE.utf8"); // ditto</syntaxhighlight>
|}
 
===== String Creation =====
 
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|-
|-
|var=||var.chr(num)||Create a string of a single char (byte) given an integer 0-255.<br>
|cmd ||ossleep(milliseconds)||
0-127 -> ASCII, 128-255 -> invalid UTF-8 so cannot be written to database or used various exodus string operations
<syntaxhighlight lang="c++">var().chr(0x61); // "a"
chr(0x61); // ditto</syntaxhighlight>
|-
|-
|var=||var.textchr(num)||Create a string of a single unicode code point in utf8 encoding.<br>
|var= ||ostime()||
To get utf codepoints > 2^63 you must provide negative ints<br>
Not providing implicit constructor from var to unsigned int due to getting ambigious conversions<br>
since int and unsigned int are parallel priority in c++ implicit conversions
<syntaxhighlight lang="c++">var().textchr(171416); // "𩶘" or "\xF0A9B698"
textchr(171416); // ditto</syntaxhighlight>
|-
|var=||var.str(num)||Create a string by repeating a given character or string
<syntaxhighlight lang="c++">"ab"_var.str(3); // "ababab"
str("ab"_var, 3); // ditto</syntaxhighlight>
|-
|var=||var.space()||Create string of space characters.
<syntaxhighlight lang="c++">var(3).space(); // "␣␣␣"
space(3); // ditto</syntaxhighlight>
|-
|var=||var.numberinwords(languagename_or_locale_id = "")||Create a string describing a given number in words
<syntaxhighlight lang="c++">var(123.45).numberinwords("de_DE").outputl();
//"ein­hundert­drei­und­zwanzig Komma vier fünf"</syntaxhighlight>
|}
|}


===== String Scanning =====
===== System File =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|if ||osopen(filename, out filehandle, in locale="")||
|-
|-
|var=||var.seq()||Returns the character number of the first char.
|cmd ||osclose(filehandle)||
<syntaxhighlight lang="c++">"abc"_var.seq(); // 0x61 97
seq("abc"_var); // 0x61 97</syntaxhighlight>
|-
|-
|var=||var.textseq()||Returns the Unicode character number of the first unicode code point.
|var= ||osbread(filehandle, startoffset, length)||
<syntaxhighlight lang="c++">"Γ"_var.textseq(); // 915 U+0393: Greek Capital Letter Gamma (Unicode Character)
textseq("Γ"); // ditto</syntaxhighlight>
|-
|-
|var=||var.len()||Returns the length of a string in number of chars
|cmd ||osbread(out data, filehandle, startoffset, length)||
<syntaxhighlight lang="c++">"abc"_var.len(); // 3
len("abc"_var); // ditto</syntaxhighlight>
|-
|-
|var=||var.textwidth()||Returns the number of output columns.<br>
|cmd ||osbwrite(data, filehandle, startoffset)||
Allows multi column unicode and reduces combining characters etc. like e followed by grave accent<br>
Possibly does not properly calculate combining sequences of graphemes e.g. face followed by colour
<syntaxhighlight lang="c++">"🤡x🤡"_var.textwidth(); // 5
textwidth("🤡x🤡"_var); // ditto</syntaxhighlight>
|-
|-
|var=||var.textlen()||Returns the number of Unicode code points
|if ||osread(out data, osfilename, in locale="")||
<syntaxhighlight lang="c++">"Γιάννης"_var.textlen(); // 7
textlen("Γιάννης"_var); // ditto</syntaxhighlight>
|-
|-
|var=||var.fcount(sepstr)||Returns the number of fields separated by sepstr present.<br>
|var= ||osread(osfilename, in locale="")||
It is the same as var.count(sepstr) + 1 except that and empty string returns 0
<syntaxhighlight lang="c++">"a1**c3"_var.fcount("*"); // 3
fcount("a1**c3"_var, "*"); // ditto</syntaxhighlight>
|-
|-
|var=||var.count(sepstr)||Return the number of sepstr found
|if ||oswrite(data, osfilename, in locale="")||
<syntaxhighlight lang="c++">"a1*b2*c3"_var.count("*"); // 3
count("a1*b2*c3"_var, "*"); // ditto</syntaxhighlight>
|-
|-
|if||var.starts(prefix)||Returns true if starts with prefix
|if ||osdelete(osfilename)||
<syntaxhighlight lang="c++">"abc"_var.starts("ab"); // true</syntaxhighlight>
|-
|-
|if||var.ends(suffix)||Returns true if ends with suffix
|if ||osrename(oldosdir_or_filename, newosdir_or_filename)||
<syntaxhighlight lang="c++">"abc"_var.ends("bc"); // true</syntaxhighlight>
|-
|-
|if||var.contains(substr)||Return true if starts, ends or contains substr
|if ||oscopy(fromosdir_or_filename, newosdir_or_filename)||
<syntaxhighlight lang="c++">"abcd"_var.contains("bc"); // true</syntaxhighlight>
|-
|-
|var=||var.index(substr, startchar1 = 1)||Returns char no if found or 0 if not. startchar1 is byte no to start at.
|cmd ||osflush()||
<syntaxhighlight lang="c++">"abcd"_var.index("bc"); // 2</syntaxhighlight>
|-
|var=||var.indexn(substr, occurrence)||ditto. Occurrence 1 = find first occurrence
<syntaxhighlight lang="c++">"abcabc"_var.index("bc", 2); // 5</syntaxhighlight>
|-
|var=||var.indexr(substr, startchar1 = -1)||ditto. Reverse search.<br>
startchar1 defaults to -1 meaning start searching from the last byte
<syntaxhighlight lang="c++">"abcabc"_var.indexr("bc"); // 5</syntaxhighlight>
|-
|var=||var.match(regex, regex_options = "")||Returns all results of regex matching<br>
Multiple matches are in fields<br>
Groups are in values
<syntaxhighlight lang="c++">"abc1abc2"_var.match("bc(\\d)"_rex); // "bc1]1^bc2]2"</syntaxhighlight>
|-
|var=||var.match(regex)||Ditto
|-
|var=||var.search(regex, io startchar1, regex_options = "")||Search for first match of a regular expression starting at startchar1<br>
Updates startchar1 ready to search for the next match
<syntaxhighlight lang="c++">var startchar1 = 1;
"abc1abc2"_var.search("bc(\\d)", startchar1); // returns "bc1]1"
// startchar1 becomes 5 ready for the next search</syntaxhighlight>
|-
|var=||var.search(regex)||Ditto starting from first char
|-
|var=||var.search(regex, io startchar1)||Ditto given a rex
|-
|var=||var.search(regex)||Ditto starting from first char.
|}
|}


===== String Conversion - Chainable. Non-Mutating =====
===== System Directory =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var= ||oslist(path=".", wildcard="", mode=0)||
|-
|var=||var.ucase()||To upper case
<syntaxhighlight lang="c++">"Γιάννης"_var.ucase(); // "ΓΙΆΝΝΗΣ"</syntaxhighlight>
|-
|var=||var.lcase()||Lower case
<syntaxhighlight lang="c++">"ΓΙΆΝΝΗΣ"_var.lcase(); // "γιάννης"</syntaxhighlight>
|-
|var=||var.tcase()||Title case (first letters)
<syntaxhighlight lang="c++">"γιάννης"_var.tcase(); // "Γιάννης"</syntaxhighlight>
|-
|var=||var.fcase()||Fold case (lower case and remove accents for indexing)
|-
|var=||var.normalize()||Normalise Unicode to NFC to eliminate different code combinations of the same character
|-
|var=||var.invert()||Simple reversible disguising of text
<syntaxhighlight lang="c++">"abc"_var.invert(); // "\x{C29EC29DC29C}"</syntaxhighlight>
|-
|var=||var.lower()||Convert all FM to VM, VM to SM etc.
<syntaxhighlight lang="c++">"a1^b2^c3"_var.lower(); // "a1]b2]c3"</syntaxhighlight>
|-
|var=||var.raise()||Convert all VM to FM, SM to VM etc.
<syntaxhighlight lang="c++">"a1]b2]c3"_var.raise(); // "a1^b2^c3"</syntaxhighlight>
|-
|var=||var.crop()||Remove any redundant FM, VM etc. characters (Trailing FM; VM before FM etc.)
<syntaxhighlight lang="c++">"a1^b2]]^c3^^"_var.crop(); // "a1^b2^c3"</syntaxhighlight>
|-
|var=||var.quote()||Wrap in double quotes
<syntaxhighlight lang="c++">"abc"_var.quote(); // ""abc""</syntaxhighlight>
|-
|var=||var.squote()||Wrap in single quotes
<syntaxhighlight lang="c++">"abc"_var.squote(); // "'abc'"</syntaxhighlight>
|-
|var=||var.unquote()||Remove one pair of double or single quotes
<syntaxhighlight lang="c++">"'abc'"_var.unquote(); // "abc"</syntaxhighlight>
|-
|var=||var.trim(trimchars = " ")||Remove leading, trailing and excessive inner bytes
<syntaxhighlight lang="c++">"␣␣a1␣␣b2␣c3␣␣"_var.trim(); // "a1␣b2␣c3"</syntaxhighlight>
|-
|var=||var.trimfirst(trimchars = " ")||Ditto leading
<syntaxhighlight lang="c++">"␣␣a1␣␣b2␣c3␣␣"_var.trimfirst(); // "a1␣␣b2␣c3␣␣"</syntaxhighlight>
|-
|var=||var.trimlast(trimchars = " ")||Ditto trailing
<syntaxhighlight lang="c++">"␣␣a1␣␣b2␣c3␣␣"_var.trimlast(); // "␣␣a1␣␣b2␣c3"</syntaxhighlight>
|-
|var=||var.trimboth(trimchars = " ")||Ditto leading, trailing but not inner
<syntaxhighlight lang="c++">"␣␣a1␣␣b2␣c3␣␣"_var.trimboth(); // "a1␣␣b2␣c3"</syntaxhighlight>
|-
|var=||var.first()||Extract first char or "" if empty
<syntaxhighlight lang="c++">"abc"_var.first(); // "a"</syntaxhighlight>
|-
|var=||var.last()||Extract last char or "" if empty
<syntaxhighlight lang="c++">"abc"_var.last(); // "c"</syntaxhighlight>
|-
|var=||var.first(std::size_t length)||Extract up to length leading chars
<syntaxhighlight lang="c++">"abc"_var.first(2); // "ab"</syntaxhighlight>
|-
|var=||var.last(std::size_t length)||Extract up to length trailing chars
<syntaxhighlight lang="c++">"abc"_var.last(2); // "bc"</syntaxhighlight>
|-
|var=||var.cut(length)||Remove length leading chars
<syntaxhighlight lang="c++">"abcd"_var.cut(2); // "cd"</syntaxhighlight>
|-
|var=||var.paste(pos1, length, insertstr)||Insert text at char position overwriting length chars
<syntaxhighlight lang="c++">"abcd"_var.paste(2, 2, "XYZ"); // "aXYZd"</syntaxhighlight>
|-
|var=||var.paste(pos1, insertstr)||Insert text at char position without overwriting any following characters
<syntaxhighlight lang="c++">"abcd"_var.paste(2, "XYZ"); // "aXYbcd"</syntaxhighlight>
|-
|var=||var.prefix(insertstr)||Insert text at the beginning
<syntaxhighlight lang="c++">"abc"_var.prefix("XY"); // "XYabc"</syntaxhighlight>
|-
|var=||var.pop()||Remove one trailing char
<syntaxhighlight lang="c++">"abc"_var.pop(); // "ab"</syntaxhighlight>
|-
|var=||var.fieldstore(separator, fieldno, nfields, replacement)||fieldstore() replaces nfields of subfield(s) in a string.
<syntaxhighlight lang="c++">"aa*bb*cc*dd"_var.fieldstore("*", 2, 3, "X*Y"); // "aa*X*Y*"</syntaxhighlight>
If nfields is 0 then insert fields before fieldno
<syntaxhighlight lang="c++">"a1*b2*c3*d4"_var.fieldstore("*", 2, 0, "X*Y"); // "a1*X*Y*b2*c3*d4"</syntaxhighlight>
If nfields is negative then delete nfields before inserting.
<syntaxhighlight lang="c++">"a1*b2*c3*d4"_var.fieldstore("*", 2, -3, "X*Y"); // "a1*X*Y"</syntaxhighlight>
|-
|var=||var.substr(startindex1, length)||substr version 1. Extract length chars starting at startindex1
<syntaxhighlight lang="c++">"abcd"_var.substr(2, 2); // "bc"</syntaxhighlight>
If length is negative then work backwards and return chars reversed
<syntaxhighlight lang="c++">"abcd"_var.substr(3, -2); // "cb"</syntaxhighlight>
|-
|var=||var.substr(startindex1)||substr version 2. Extract all chars from startindex1 up to the end
<syntaxhighlight lang="c++">"abcd"_var.substr(2); // "bcd"</syntaxhighlight>
|-
|var=||var.b(pos1, length)||Same as substr version 1.
|-
|-
|var=||var.b(pos1)||Same as substr version 2.
|var= ||oslistf(path=".", wildcard="")||
|-
|-
|var=||var.convert(fromchars, tochars)||Convert chars to other chars one for one or delete where tochars is shorter.
|var= ||oslistd(path=".", wildcard="")||
<syntaxhighlight lang="c++">"abcde"_var.convert("aZd", "XY"); // "Xbce" (a is replaced and d is removed)</syntaxhighlight>
|-
|-
|var=||var.textconvert(fromchars, tochars)||Ditto for Unicode code points.
|var= ||osfile(filename)||
<syntaxhighlight lang="c++">"🤡😀✌"_var.textconvert("🤡😀", "👋"); // "👋✌ "</syntaxhighlight>
|-
|-
|var=||var.replace(fromstr, tostr)||Replace all occurrences of a substr with another. Case sensitive
|var= ||osdir(filename)||
<syntaxhighlight lang="c++">"Abc Abc"_var.replace("bc", "X"); // "AX AX"</syntaxhighlight>
|-
|-
|var=||var.replace(regex, tostr)||Replace substring(s) using a regular expression.<br>
|if ||osmkdir(newdirname)||
Use $0, $1, $2 in tostr to refer to groups defined in the regex.
<syntaxhighlight lang="c++">"A a B b"_var.replace("[A-Z]"_rex, "'$0'"); // "'A' a 'B' b"</syntaxhighlight>
|-
|-
|var=||var.unique()||Remove duplicate fields in an FM or VM etc. separated list
|if ||osrmdir(dirname, evenifnotempty=false)||
<syntaxhighlight lang="c++">"a1^b2^a1^c2"_var.unique(); // "a1^b2^c2"</syntaxhighlight>
|-
|-
|var=||var.sort(sepchar = FM)||Reorder fields in an FM or VM etc. separated list in ascending order
|var= ||oscwd()||
<syntaxhighlight lang="c++">"20^10^2^1^1.1"_var.sort(); // "1^1.1^2^10^20"</syntaxhighlight>
<syntaxhighlight lang="c++">"b1^a1^c20^c10^c2^c1^b2"_var.sort(); // "a1^b1^b2^c1^c10^c2^c20"</syntaxhighlight>
|-
|-
|var=||var.reverse(sepchar = FM)||Reorder fields in an FM or VM etc. separated list in descending order
|var= ||oscwd(newdirname)||
<syntaxhighlight lang="c++">"20^10^2^1^1.1"_var.reverse(); // "1.1^1^2^10^20"</syntaxhighlight>
|-
|var=||var.shuffle(sepchar = FM)||Randomise the order of fields in an FM, VM separated list
<syntaxhighlight lang="c++">"20^10^2^1^1.1"_var.shuffle(); // "2^1^20^1.1^10" (random order depending on initrand())</syntaxhighlight>
|-
|var=||var.parse(char sepchar = ' ')||Replace separator characters with FM char except inside double or single quotes ignoring escaped quotes \\" \&squot;
<syntaxhighlight lang="c++">"abc,\"def,\"123\" fgh\",12.34"_var.parse(','); // "abc^"def,"123" fgh"^12.34"</syntaxhighlight>
|}
|}


===== String Mutators Not Chainable. All Similar To Non-Mutators =====
===== Program Control =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var= ||suspend(command)||
|-
|cmd||var.ucaser()||
|-
|cmd||var.lcaser()||
|-
|cmd||var.tcaser()||
|-
|cmd||var.fcaser()||
|-
|cmd||var.normalizer()||
|-
|cmd||var.inverter()||
|-
|cmd||var.quoter()||
|-
|cmd||var.squoter()||
|-
|cmd||var.unquoter()||
|-
|cmd||var.lowerer()||
|-
|cmd||var.raiser()||
|-
|cmd||var.cropper()||
|-
|cmd||var.trimmer(trimchars = " ")||
|-
|cmd||var.trimmerfirst(trimchars = " ")||
|-
|cmd||var.trimmerlast(trimchars = " ")||
|-
|-
|cmd||var.trimmerboth(trimchars = " ")||
|var= ||osshell(command)||
|-
|-
|cmd||var.firster()||
|var=    ||osshellread(command)||
|-
|-
|cmd||var.laster()||
|cmd   ||osshellread(out commandoutput, command)||
|-
|-
|cmd||var.firster(std::size_t length)||
|cmd   ||osshellwrite(commandinput, command)||
|-
|-
|cmd||var.laster(std::size_t length)||
|cmd ||stop(text="")||
|-
|-
|cmd||var.cutter(length)||
|cmd ||abort(text)||
|-
|-
|cmd||var.paster(pos1, length, insertstr)||
|var= ||perform(command)||
|-
|-
|cmd||var.paster(pos1, insertstr)||
|var= ||execute(command)||
|-
|-
|cmd||var.prefixer(insertstr)||
|var= ||chain(command)||
|-
|-
|cmd||var.popper()||
|var= ||logoff()||
|-
|-
|cmd||var.fieldstorer(sepchar, fieldno, nfields, replacement)||
|cmd ||debug()||
|-
|cmd||var.substrer(pos1, length)||
|-
|cmd||var.substrer(startindex1)||
|-
|cmd||var.converter(fromchars, tochars)||
|-
|cmd||var.textconverter(fromchars, tochars)||
|-
|cmd||var.replacer(regex, tostr)||
|-
|cmd||var.replacer(fromstr, tostr)||
|-
|cmd||var.uniquer()||
|-
|cmd||var.sorter(sepchar = FM)||
|-
|cmd||var.reverser(sepchar = FM)||
|-
|cmd||var.shuffler(sepchar = FM)||
|-
|cmd||var.parser(char sepchar = ' ')||
|}
|}


===== Other String Access =====
 
===== Variable Control =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|if    ||assigned(anyvar)||
|-
|-
|var=||var.hash(std::uint64_t modulus = 0)||MurmurHash3 hashing.
|if    ||unassigned(anyvar)||
<syntaxhighlight lang="c++">"abc"_var.hash(); // 6715211243465481821</syntaxhighlight>
|-
|-
|var=||var.substr(pos1, delimiterchars, out endindex)||substr version 3.<br>
|cmd2    ||exchange(var1,var2)||
Extract substr starting from pos1 up to any one of some delimiter chars also returning the next pos1 after the delimiter found
|-
|-
|var=||var.b(pos1, delimiterchars, out endindex)||Alias of substr version 3.
|cmd2    ||transfer(fromvar,tovar)||
|-
|var=||var.substr2(io startstopindex, io delimiterno)||substr version 4.<br>
Returns the substr from a given index offset (0 based) up to the next RM/FM/VM/SM/TM/STM delimiter char. Also returns the next index/offset and the delimiter no. found 1-6 or 0 if not found.
|-
|var=||var.b2(io startstopindex, io delimiterno)||Alias of substr version 4
|-
|var=||var.field(strx, fieldnx = 1, nfieldsx = 1)||Extract one or more consecutive fields given a delimiter char or substr.
<syntaxhighlight lang="c++">"aa*bb*cc"_var.field("*", 2);m // "bb"</syntaxhighlight>
|-
|var=||var.field2(separator, fieldno, nfields = 1)||field2 is a version that treats fieldn -1 as the last field, -2 the penultimate field etc. -<br>
TODO Should probably make field() do this (since -1 is basically an erroneous call) and remove field2<br>
Same as var.field() but negative fieldnos work backwards from the last field.
`"aa*bb*cc"_var.field("*", -1); // "cc"
|}
|}


===== I/O Conversion =====
===== Console Output =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|cmd ||print(instring)||
|-
|var=||var.oconv(convstr)||Converts to output format
<syntaxhighlight lang="c++">var(30123).oconv("D/E"); // "21/06/2050"</syntaxhighlight>
|-
|-
|var=||var.iconv(convstr)||Converts to input format
|cmd ||printl(instring="")||
<syntaxhighlight lang="c++">"21 JUN 2050"_var.iconv("D/E"); // 30123</syntaxhighlight>
|-
|-
|var=||var.format(fmt_str, Args&&... args)||Classic format function in printf style
|cmd ||printt(instring="")||
<syntaxhighlight lang="c++">format("Text and aligned {:9.2f} number", var(123.456)); // "Text and aligned ␣␣␣123.46 number"</syntaxhighlight>
|-
|var=||var.from_codepage(codepage)||Converts from codepage encoded text to UTF-8 encoded text<br>
e.g. Codepage "CP1251" (Ukrainian).<br>
Use Linux command "iconv -l" for complete list of code pages and encodings.
|-
|var=||var.to_codepage(codepage)||Converts to codepage encoded text from UTF-8 encoded text
|}
|}


===== Basic Dynamic Array Functions =====
===== Cursor =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var= ||at(column0orcode)||
|-
|-
|var=||var.f(fieldno, valueno = 0, subvalueno = 0)||f() is a highly abbreviated alias for the PICK OS field/value/subvalue extract() function.<br>
|var= ||at(column0, row0)||
"f()" can be thought of as "field" although the function can extract values and subvalues as well.<br>
The convenient PICK OS angle bracket syntax for field extraction (e.g. xxx<20>) is not available in C++.<br>
The abbreviated exodus field extraction function (e.g. xxx.f(20)) is provided instead since field access is extremely heavily used in source code.
<syntaxhighlight lang="c++">"f1^f2v1]f2v2]f2v3^f2"_var.f(2, 2); // "f2v2"</syntaxhighlight>
|-
|-
|var=||var.extract(fieldno, valueno = 0, subvalueno = 0)||Extract a specific field, value or subvalue from a dynamic array.<br>
|var= ||getcursor()||
The alias "f" is usually used instead
|-
|-
|var=||var.pickreplace(fieldno, valueno, subvalueno, replacement)||Same as var.r() function but returns a new string instead of updating a variable in place.<br>Rarely used.
|cmd ||setcursor(cursorstr)||
|-
|-
|var=||var.pickreplace(fieldno, valueno, replacement)||Ditto for a specific multivalue
|var= ||getprompt()||
|-
|-
|var=||var.pickreplace(fieldno, replacement)||Ditto for a specific field
|cmd ||setprompt(promptchar)||
|-
|var=||var.insert(fieldno, valueno, subvalueno, insertion)||Same as var.inserter() function but returns a new string instead of updating a variable in place.
|-
|var=||var.insert(fieldno, valueno, insertion)||Ditto for a specific multivalue
|-
|var=||var.insert(fieldno, insertion)||Ditto for a specific field
|-
|var=||var.remove(fieldno, valueno = 0, subvalueno = 0)||Same as var.remover() function but returns a new string instead of updating a variable in place.<br>
"remove" was called "delete" in Pick OS.
|}
|}


===== Dynamic Array Filters =====
===== Console Input =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|-
|-
|var=||var.sum()||Sum up multiple values into one higher level
|var= ||input()||
<syntaxhighlight lang="c++">"1]2]3^4]5]6"_var.sum(); // "6^15"</syntaxhighlight>
|-
|-
|var=||var.sumall()||Sum up all levels into a single figure
|var= ||input(out inputstr)||
<syntaxhighlight lang="c++">"1]2]3^4]5]6"_var.sumall(); // "21"</syntaxhighlight>
|-
|-
|var=||var.sum(sepchar)||Ditto allowing commas etc.
|var= ||input(prompt, out inputstr)||
<syntaxhighlight lang="c++">"10,20,33"_var.sum(","); // "60"</syntaxhighlight>
|-
|-
|var=||var.mv(opcode, var2)||Binary ops (+, -, *, /) in parallel on multiple values
|var= ||inputn(n)||
<syntaxhighlight lang="c++">"10]20]30"_var.mv("+","2]3]4"); // "12]23]34"</syntaxhighlight>
|}
|}


===== Dynamic Array Mutators (Standalone And Cannot Be Chained) =====
===== Math =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var=    ||rnd(number)||
|-
|cmd||var.r(fieldno, replacement)||Replaces a specific field in a dynamic array
<syntaxhighlight lang="c++">var v1 = "f1^v1]v2}s2}s3^f3"_var;
v1.r(2, 2, "X"); // v1 -> "f1^X^f3"</syntaxhighlight>
|-
|-
|cmd||var.r(fieldno, valueno, replacement)||Ditto for specific value in a specific field.
|cmd   ||initrnd(seednumber)||
<syntaxhighlight lang="c++">var v1 = "f1^v1]v2}s2}s3^f3"_var;
v1.r(2, 2, "X"); // v1 -> "f1^v1]X^f3"</syntaxhighlight>
|-
|-
|cmd||var.r(fieldno, valueno, subvalueno, replacement)||Ditto for a specific subvalue in a specific value of a specific field
|var=    ||mod(dividend, divisor)||
<syntaxhighlight lang="c++">var v1 = "f1^v1]v2}s2}s3^f3"_var;
v1.r(2, 2, 2, "X"); // v1 -> "f1^v1]v2}X}s3^f3"</syntaxhighlight>
|-
|-
|cmd||var.inserter(fieldno, insertion)||Insert a specific field in a dynamic array, moving all other fields up.
|var=    ||abs(number)||
<syntaxhighlight lang="c++">var v1 = "f1^v1]v2}s2}s3^f3"_var;
v1.inserter(2, "X"); // v1 -> "f1^X^v1]v2}s2}s3^f3"</syntaxhighlight>
|-
|-
|cmd||var.inserter(fieldno, valueno, insertion)||Ditto for a specific value in a specific field, moving all other fields up.
|var=    ||pwr(base, exponent)||
<syntaxhighlight lang="c++">var v1 = "f1^v1]v2}s2}s3^f3"_var;
v1.inserter(2, 2, "X"); // v1 -> "f1^v1]X]v2}s2}s3^f3"</syntaxhighlight>
|-
|-
|cmd||var.inserter(fieldno, valueno, subvalueno, insertion)||Ditto for a specific subvalue in a dynamic array, moving all other subvalues up.
|var=    ||exp(power)||
<syntaxhighlight lang="c++">var v1 = "f1^v1]v2}s2}s3^f3"_var;
v1.inserter(2, 2, 2, "X"); // v1 -> "f1^v1]v2}X}s2}s3^f3"</syntaxhighlight>
|-
|-
|cmd||var.remover(fieldno, valueno = 0, subvalueno = 0)||Remove a specific field (or value, or subvalue) from a dynamic array, moving all other fields (or values, or subvalues) down.
|var=   ||sqrt(number)||
<syntaxhighlight lang="c++">var v1 = "f1^v1]v2}s2}s3^f3"_var;
v1.remover(2, 2); // v1 -> "f1^v1^f3"</syntaxhighlight>
|}
 
===== Dynamic Array Search =====
 
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|-
|-
|if||var.locate(target)||locate() with only the target substr argument provided searches unordered values separated by VM chars.<br>
|var=    ||sin(degrees)||
Returns true if found and false if not.
<syntaxhighlight lang="c++">if ("UK]US]UA"_var.locate("US")) ... // true</syntaxhighlight>
|-
|-
|if||var.locate(target, out valueno)||locate() with only the target substr and valueno arguments provided searches unordered values separated by VM chars.<br>
|var=    ||cos(degrees)||
Returns true if found and with the value number in valueno.<br>
Returns false if not found and with the max value number + 1 in setting. Suitable for additiom of new values
<syntaxhighlight lang="c++">var valueno; if ("UK]US]UA"_var.locate("US", valueno)) ... // returns true and valueno = 2</syntaxhighlight>
|-
|-
|if||var.locate(target, out setting, fieldno, valueno = 0)||locate() the target in unordered fields if fieldno is 0, or values if a fieldno is specified, or subvalues if the valueno argument is provided.<br>
|var=    ||tan(degrees)||
Returns true if found and with the field, value or subvalue number in setting.<br>
Returns false if not found and with the max field, value or subvalue number found + 1 in setting. Suitable for replacement of new fields, values or subvalues.
<syntaxhighlight lang="c++">var setting; if ("f1^f2v1]f2v2]s1}s2}s3}s4^f3^f4"_var.locate("s4", setting, 2, 3)) ... // returns true and setting = 4</syntaxhighlight>
|-
|-
|if||var.locateby(ordercode, target, out valueno)||locateby() without fieldno or valueno arguments searches ordered values separated by VM chars.<br>
|var=    ||atan(number)||
The order code can be AL, DL, AR, DR meaning Ascending Left, Descending Right, Ascending Right, Ascending Left.<br>
Left is used to indicate alphabetic order where 10 < 2.<br>
Right is used to indicate numeric order where 10 > 2.<br>
Data must be in the correct order for searching to work properly.<br>
Returns true if found.<br>
In case the target is not exactly found then the correct value no for inserting the target is returned in setting.
<syntaxhighlight lang="c++">var valueno; if ("aaa]bbb]ccc"_var.locateby("AL", "bb", valueno)) ... // returns false and valueno = 2 where it could be correctly inserted.</syntaxhighlight>
|-
|-
|if||var.locateby(ordercode, target, out setting, fieldno, valueno = 0)||locateby() ordered as above but in fields if fieldno is 0, or values in a specific fieldno, or subvalues in a specific valueno.
|var=    ||loge(number)||
<syntaxhighlight lang="c++">var setting; if ("f1^f2^aaa]bbb]ccc^f4"_var.locateby("AL", "bb", setting, 3)) ... // returns false and setting = 2 where it could be correctly inserted.</syntaxhighlight>
|-
|-
|if||var.locateusing(usingchar, target)||locate() a target substr in the whole unordered string using a given delimiter char returning true if found.<br>
|var=    ||integer(number)||
if (`"AB,EF,CD"_var.locateusing(",", "EF")) ... // true
|-
|-
|if||var.locateusing(usingchar, target, out setting, fieldno = 0, valueno = 0, subvalueno = 0)||locate() the target in a specific field, value or subvalue using a specified delimiter and unordered data<br>
|var=   ||floor(number)||
Returns true If found and returns in setting the number of the delimited field found.<br>
Returns false if not found and returns in setting the maximum number of delimited fields + 1 if not found.<br>
This is similar to the main locate command but the delimiter char can be specified e.g. a comma or TM etc.
<syntaxhighlight lang="c++">var setting; if ("f1^f2^f3c1,f3c2,f3c3^f4"_var.locateusing(",", "f3c2", setting, 3)) ... // returns true and setting = 2</syntaxhighlight>
|-
|-
|if||var.locatebyusing(ordercode, usingchar, target, out setting, fieldno = 0, valueno = 0, subvalueno = 0)||locatebyusing() supports all the above features in a single function.<br>
|var=    ||round(number, ndecimals=0)||
Returns true if found.
|}
|}


===== Database Access =====
===== String Creation =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var=  ||chr(integer)||
|-
|-
|if||var.connect(conninfo = "")||for all db operations, var() can be a db connection or a default connection.<br>var db="mydb";<br>if (not db.connect()) abort(db.lasterror());<br>db.version().outputl();<br>db.disconnect();
|var=    ||str(instring, number)||
|-
|-
|cmd||var.disconnect()||
|var=    ||space(number)||
|}
 
 
===== String Info/Search =====
 
{|border="1" cellpadding="10" cellspacing="0"
|-
|-
|cmd||var.disconnectall()||
|var=  ||count(instring, substr)||
|-
|-
|if||var.attach(filenames)||Connect specific filenames on specific databases for the current default session
|var=  ||dcount(instring, substr)||
|-
|-
|cmd||var.detach(filenames)||
|var=  ||index(instring, substr, occurrenceno=1)||
|-
|-
|if||var.begintrans()||
|var=  ||index2(instring, substr, startcharno=1)||
|-
|-
|if||var.rollbacktrans()||
|var=  ||len(instring)||
|-
|-
|if||var.committrans()||
|var=  ||length(instring)||
|-
|-
|if||var.statustrans()||
|if   ||match(instring, matchstr, options="")||
|-
|-
|if||var.sqlexec(sqlcmd)||
|var= ||seq(inchar)||
|-
|if||var.sqlexec(sqlcmd, io response)||
|-
|var=||var.lasterror()||
|-
|var=||var.loglasterror(source = "")||
|}
|}


===== Database Management =====
===== String Functions =====
 
Return new and doesnt change original.


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var= ||convert(instring, oldchars, newchars)||
|-
|var=  ||crop(instring)||
|-
|-
|if||var.dbcreate(dbname)||Create a named database on a particular connection
|var=  ||field(instring, sepchar, fieldno, nfields=1)||
|-
|-
|var=||var.dblist()||Return a list of available databases on a particular connection
|var= ||field2(instring, sepchar, fieldno, nfields=1)||
|-
|-
|if||var.dbcopy(from_dbname, to_dbname)||Create a named database from an existing database
|var=  ||fieldstore(instring, sepchar, fieldno, nfields, replacementstr)||
|-
|-
|if||var.dbdelete(dbname)||Delete (drop) a named database
|var= ||lcase(instring)||
|-
|-
|if||var.createfile(filename)||Create a named file
|var=    ||ucase(instring)||
|-
|-
|if||var.renamefile(filename, newfilename)||Rename a file
|var= ||lower(instring)||
|-
|-
|if||var.deletefile(filename)||Delete (drop) a file
|var=  ||raise(instring)||
|-
|-
|if||var.clearfile(filename)||Delete all records in a file
|cmd2  ||quote(instring)||
|-
|-
|var=||var.listfiles()||Return a list of all files in a database
|cmd2  ||squote(instring)||
|-
|-
|if||var.createindex(fieldname, dictfile = "")||
|cmd2  ||unquote(instring)||
|-
|-
|if||var.deleteindex(fieldname)||
|var=  ||splice(instring, fromcharno, nchars, insertionstr)||
|-
|-
|var=||var.listindex(filename = "", fieldname = "")||
|var= ||substr(instring, fromcharno)||
|-
|-
|var=||var.version()||
|var= ||substr(instring, fromcharno, nchars)||
|-
|-
|var=||var.reccount(filename = "")||
|var= ||swap(instring, oldstr, newstr, options="")||
|-
|-
|var=||var.flushindex(filename = "")||
|var= ||trim(instring, trimchars=" ")||
|-
|var=  ||trimb(instring, trimchars=" ")||
|-
|var=  ||trimf(instring, trimchars=" ")||
|}
 
===== String Commands =====
 
Modify original in place
 
{|border="1" cellpadding="10" cellspacing="0"
|-
|-
|if||var.open(dbfilename, connection = "")||
|cmd2  ||converter(io instring, oldchars, newchars)||
|-
|-
|cmd||var.close()||
|var=  ||cropper(io instring)||
|-
|-
|var=||var.lock(key)||Returns 1=ok, 0=failed, ""=already locked
|cmd2  ||fieldstorer(io instring, sepchar, fieldno, nfields, replacementstr)||
|-
|-
|if||var.unlock(key)||
|cmd2  ||lcaser(io instring)||
|-
|-
|if||var.unlockall()||
|var=  ||ucaser(io instring)||
|-
|-
|if||var.read(filehandle, key)||DB file i/o
|cmd2  ||lowerer(io instring)||
|-
|-
|cmd||var.write(filehandle, key)||
|cmd2  ||raiser(io instring)||
|-
|-
|if||var.deleterecord(key)||
|cmd2  ||quoter(io instring)||
|-
|-
|if||var.updaterecord(filehandle, key)||
|cmd2  ||squoter(io instring)||
|-
|-
|if||var.insertrecord(filehandle, key)||
|cmd2  ||unquoter(io instring)||
|-
|-
|if||var.readf(filehandle, key, fieldno)||Specific db field i/o
|cmd2  ||splicer(io instring, fromcharno, nchars, insertion)||
|-
|-
|cmd||var.writef(filehandle, key, fieldno)||
|var=  ||substrer(io instring, fromcharno)||
|-
|-
|if||var.readc(filehandle, key)||Cached db file i/o lives in exodus process memory not the database
|var=  ||substrer(io instring, fromcharno, nchars)||
|-
|-
|cmd||var.writec(filehandle, key)||
|cmd2  ||swapper(io instring, oldstr, newstr, options="")||
|-
|-
|if||var.deletec(key)||
|cmd2  ||trimmer(io instring, trimchars=" ")||
|-
|-
|cmd||var.cleardbcache()||
|cmd2  ||trimmerb(io instring, trimchars=" ")||
|-
|-
|var=||var.xlate(filename, fieldno, mode)||
|cmd2  ||trimmerf(io instring, trimchars=" ")||
|}
|}


===== Database Sort/Select =====
===== iconv/oconv =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var= ||oconv(instring, conversionstring)||
|-
|if||var.select(sortselectclause = "")||
|-
|cmd||var.clearselect()||
|-
|if||var.hasnext()||
|-
|if||var.readnext(out key)||
|-
|-
|if||var.readnext(out key, out valueno)||
|var= ||iconv(instring, conversionstring)||
|-
|if||var.readnext(out record, out key, out valueno)||
|-
|if||var.savelist(listname)||
|-
|if||var.getlist(listname)||
|-
|if||var.makelist(listname, keys)||
|-
|if||var.deletelist(listname)||
|-
|if||var.formlist(keys, fieldno = 0)||
|}
|}


===== OS Time/Date =====
===== Database =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|if ||connect(connectionstring="")||
|-
|var=||var.date()||int days since pick epoch 1967-12-31
|-
|var=||var.time()||int seconds since last midnight
|-
|-
|var=||var.ostime()||
|if ||disconnect()||
|-
|-
|var=||var.timestamp()||floating point fractional days since pick epoch 1967-12-31 00:00:00
|if    ||createdb(dbname, out errmsg)||
|-
|-
|var=||var.timestamp(ostime)||construct a timestamp from a date and time
|if    ||deletedb(dbname, out errmsg)||
|-
|-
|cmd||var.ossleep(milliseconds)||
|if ||createfile(filename, options="")||
|-
|var=||var.oswait(milliseconds, directory)||
|}
 
===== OS Files =====
 
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|-
|-
|if||var.osopen(filename, locale = "")||
|if ||deletefile(filename)||
|-
|-
|if||var.osbread(osfilevar, io offset, length)||
|if ||clearfile(filename)||
|-
|-
|if||var.osbwrite(osfilevar, io offset)||
|var= ||listfiles()||
|-
|-
|cmd||var.osclose()||
|if ||createindex(filename, fieldname, usingdictfilename="")||
|-
|-
|if||var.osread(osfilename, codepage = "")||
|if ||deleteindex(filename, fieldname)||
|-
|-
|if||var.oswrite(osfilename, codepage = "")||
|var= ||listindexes(filename="")||
|-
|-
|if||var.osremove()||
|if   ||begintrans()||
|-
|-
|if||var.osrename(new_dirpath_or_filepath)||
|if   ||rollbacktrans()||
|-
|-
|if||var.oscopy(to_osfilename)||
|if   ||committrans()||
|-
|if||var.osmove(to_osfilename)||
|}
|}


===== OS Directories =====
===== Database Files and Records =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|if ||open(filename, out filehandle)||
|-
|-
|var=||var.oslist(globpattern = "", mode = 0)||
|if ||read(out record, filehandle, key)||
|-
|-
|var=||var.oslistf(globpattern = "")||
|if ||matread(out dimrecord, filehandle, key)||
|-
|-
|var=||var.oslistd(globpattern = "")||
|if ||readv(out record, filehandle, key, fieldnumber)||
|-
|-
|var=||var.osinfo(mode)||
|if ||write(record, filehandle, key)||
|-
|-
|var=||var.osfile()||
|if ||matwrite(in dimrecord, filehandle, key)||
|-
|-
|var=||var.osdir()||
|if ||writev(record, filehandle, key, fieldn)||
|-
|-
|var=||var.osinfo()||
|if ||deleterecord(filehandle, key)||
|-
|-
|if||var.osmkdir()||
|if ||updaterecord(record, filehandle, key)||the record key must already exist
|-
|-
|if||var.osrmdir(evenifnotempty = false)||
|if ||insertrecord(record, filehandle, key)||the record key must not already exist
|-
|-
|var=||var.oscwd()||
|if    ||lock(filehandle, key)||
|-
|-
|if||var.oscwd(newpath)||
|cmd    ||unlock(filehandle, key)||
|-
|-
|cmd||var.osflush()||
|cmd   ||unlockall()||
|}
|}


===== OS Shell/Environment =====
===== Record Selection =====


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|if ||select(sortselectclause="")||
|-
|-
|if||var.osshell()||Execute a shell command and return true if the process terminates with error status 0 and false otherwise.
|cmd ||clearselect()||
<syntaxhighlight lang="c++">let cmd = "ls -l xyz";
if (not cmd.osshell())</syntaxhighlight>
Alternative:
<syntaxhighlight lang="c++">if (not osshell("ls -l xyz"))</syntaxhighlight>
|-
|-
|if||var.osshellread(oscmd)||Same as osshell but captures stdout
|if ||readnext(out key)||
<syntaxhighlight lang="c++">var text; if (not text.osshellread("ls -l xyz"))</syntaxhighlight>
Alternative: Capture stdout but ignore exit status
<syntaxhighlight lang="c++">let text2 = osshellread("ls -l xyz");</syntaxhighlight>
|-
|-
|if||var.osshellwrite(oscmd)||
|if ||readnext(out key, out valueno)||valueno returns multivalue numbers if your sortselectclause sorted BY-EXP on a multivalued field. Not implemented yet.
|-
|-
|var=||var.ostempdirpath()||
|if ||selectrecord(sortselectclause="")||
|-
|-
|var=||var.ostempfilename()||
|if ||readnextrecord(out record, out id)||must be preceded by a selectrecord() not select()
|-
|}
|if||var.osgetenv(envcode)||
 
|-
===== Dictionary =====
|cmd||var.ossetenv(envcode)||
 
|-
{|border="1" cellpadding="10" cellspacing="0"
|var=||var.ospid()||
|var= ||calculate(fieldname)||
|-
|-
|var=||var.ostid()||
|var= ||xlate(filename, key, fieldno, mode)||
|}
|}


===== Output =====
 
===== Dynamic Array Functions =====
 
Return modified, dont change original


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|var=    ||replace(instring, fieldno, replacement)||
|-
|-
|expr||var.output()||stdout no new line, buffered
|var= ||replace(instring, fieldno, valueno, replacement)||
|-
|-
|expr||var.outputl()||stdout starts a new line, flushed
|var=    ||replace(instring, fieldno, valueno, subvalueno, replacement)||
|-
|-
|expr||var.outputt()||stdout adds a tab, buffered
|var= ||extract(instring, fieldno, valueno=0, subvalueno=0)||
|-
|-
|expr||var.logput()||stdlog no new line, buffered
|var= ||erase(instring, fieldno, valueno=0, subvalueno=0)||
|-
|-
|expr||var.logputl()||stdlog starts a new line, flushed
|var=  ||insert(instring, fieldno, insertion)||
|-
|-
|expr||var.errput()||stderr no new line, flushed
|var=  ||insert(instring, fieldno, valueno, insertion)||
|-
|-
|expr||var.errputl()||stderr starts a new line, flushed
|var=  ||insert(instring, fieldno, valueno, subvalueno, insertion)||
|-
|-
|expr||var.output(prefix)||stdout with a prefix, no new line, buffered
|if ||locate(instring, target, out setting, fieldn=0, valuen=0)||
|-
|-
|expr||var.outputl(prefix)||stdout with a prefix, starts a new line, flushed
|if ||locateby(instring, target, ordercode, out setting, fieldn=0, valuen=0)||
|-
|-
|expr||var.outputt(prefix)||stdout with a prefix, adds a tab, buffered
|if ||locateusing(instring, target, usingchar, out setting, fieldn=0, valuen=0, subvaluen=0)||
|-
|-
|expr||var.logput(prefix)||stdlog with a prefix, no new line, buffered
|if ||locateusing(instring, target, usingchar)||
|-
|-
|expr||var.logputl(prefix)||stdlog with a prefix, starts a new line, flushed
|var=  ||remove(fromstr, io startx, out delimiterno)||
|-
|-
|expr||var.errput(prefix)||stderr with a prefix, no new line, flushed
|var= ||sum(instring, sepchar=VM_)||
|-
|expr||var.errputl(prefix)||stderr with a prefix, starts a new line, flushed
|-
|expr||var.put(std::ostream& ostream1)||Output to a given stream
|}
|}


===== Standard Input =====
===== Dynamic Array Commands =====
 
Modify original in place


{|border="1" cellpadding="10" cellspacing="0"
{|border="1" cellpadding="10" cellspacing="0"
!Usage!!Function!!Comment
|cmd2 ||replacer(io instring, fieldno, replacement)||
|-
|expr||var.input()||Wait for stdin until cr or eof
|-
|expr||var.input(prompt)||Ditto after outputting prompt to stdout
|-
|expr||var.inputn(nchars)||Wait for nbytes from stdin
|-
|-
|if||var.isterminal()||true if terminal is available
|cmd2  ||replacer(io instring, fieldno, valueno, replacement)||
|-
|-
|if||var.hasinput(milliseconds = 0)||true if stdin bytes available within milliseconds
|cmd2 ||replacer(io instring, fieldno, valueno, subvalueno, replacement)||
|-
|-
|if||var.eof()||true if stdin is at end of file
|cmd2 ||inserter(io instring, fieldno, insertion)||
|-
|-
|if||var.echo(on_off)||Reflect all stdin to stdout if terminal available
|cmd2 ||inserter(io instring, fieldno, valueno, insertion)||
|-
|-
|cmd||var.breakon()||Allow interrupt Ctrl+C
|cmd2 ||inserter(io instring, fieldno, valueno, subvalueno, insertion)||
|-
|-
|cmd||var.breakoff()||Prevent interrupt Ctr+C
|cmd2 ||eraser(io instring, fieldno, valueno=0, subvalueno=0)||
|}
|}

Revision as of 20:47, 27 January 2025

Programmer's Guides

Only for C++ at the moment. For all others, see some examples: http://code.google.com/p/exodusdb/source/browse/#svn%2Ftrunk%2Fswig%2Fshare

Python

Perl

PHP

Java

C#

C++

ICONV/OCONV PATTERNS

Decimal (MD/MC)

input conversion (string) output
1234 MD2 12.34
1234 MD20 1234.00
1234 MD20, 1,234.00
1234.5678 MD2 12.35
1234.5678 MD20 1234.57
1234.5678 MD20, 1,234.57
1234 MC2 12,34
1234 MC20 1234,00
1234 MC20, 1.234,00
1234 MD20- 1234.00

Date (D)

input conversion (string) output
12345 D 18 OCT 2001
12345 D/ 10/18/2001
12345 D- 10-18-2001
12345 D2 18 OCT 01
12345 D/E 18/10/2001
12345 DS 2001 OCT 18
12345 DS/ 2001/10/18
12345 DM 10
12345 DMA OCTOBER
12345 DY 2001
12345 DY2 01
12345 DD 18
12345 DW 4
12345 DWA THURSDAY
12345 DQ 4
12345 DJ 291
12345 DL 31

Time (MT)

input conversion (string) output
234800 MT 17:13
234800 MTH 05:13PM
234800 MTS 17:13:20
234800 MTHS 05:13:20PM
0 MT 00:00
0 MTH 12:00AM
0 MTS 00:00:00
0 MTHS 12:00:00AM

Hex (HEX/MX)

input conversion (string) output
ab HEX (same as HEX8 or HEX4 depending on platform)
ab HEX8 0000006100000062
ab HEX4 00610062
ab HEX2 6162
15 MX F
254 MX FE
255 MX FF
256 MX 100
27354234 MX 1A1647A

Text (L/R/T)

input conversion (string)output
abcd L#3 abc
ab L#3 ab␣
abcd R#3 bcd
ab R#3 ␣ab
ab T#3 ab␣
abcd T#3 abc™d␣␣
42 L(0)#5 42000
42 R(0)#5 00042
42 T(0)#5 42000

Dictionaries

Exodus dictionaries enable classic multivalue database data definition. Dictionaries are just normal Exodus multivalue files that contain one record for each data column definition. You can use Exodus's edir program to manually edit dictionaries.

Dictionary file names must start with the word "dict_". For example, if you have a "books" file, then you will probably have a "dict_books" file.

You can list the contents of a dictionary by typing "list dict_filename".

Exodus Dictionary Format

0 DICTID Field/Column Code
1 DICTTYPE "F" or "S" : "F" means use Field No (i.e. raw data) and "S" means use Source Code (i.e. a function).
2 FIELDNO Field number (0=key, 1=field 1 etc for "Fields"
3 TITLE Title on reports
4 SM S or M or Mnn : "Single Value" or "Multivalue" or "Multivalue Group nn"
5 KEYPARTNO Multipart keys are separated by * characters.
6
7 CONVERSION Conversion (MD/MT/D etc.)
8 SOURCE Source Code of a subroutine to calculate the field. Multivalues are lines and the result must be placed in a variable "ANS".
9 JUST "L" or "R" or "T" requesting left, right or text justification
10 WIDTH Column Width on fixed width reports

Sort/Select Command

Exodus provides the classic multivalue sort/select command within any Exodus program followed by readnext().

Classic multivalue select/readnext functions only provide the keys of the selected records. Exodus provides the classic select/readnext and also selectrecords/readnextrecord which provides complete records instead of just keys.

The format of the select/sselect command is as follows:

 SELECT|SSELECT

 {max_number_of_records}

 {using filename}

 filename

 {datakeyvalue} ...

 {BY|BY-DSND fieldname} ...
 
 {

  WITH

  {NO|ALL|ANY}

  dict_field_id

  {
   CONTAINING|STARTING|ENDING|LIKE|EQ|NE|NOT|GT|LT|GE|LE=|<>|>|<|>=|<= value(s)
   |
   BETWEEN value AND value
  }

  {AND|OR}

 } ...

Traditional Multivalue Functions and Statements (non-OO)

Exodus clones traditional multivalue function and statement behaviour and retains their syntax as far as possible.

  • Traditional functions are rendered as Exodus functions.
  • Traditional statements are rendered as Exodus subroutines.
PRINT OCONV(DATE(),'D')

in Exodus becomes:

printl(oconv(date(),"D"));

String Commands

The use of most of Exodus's functions will be fairly obvious to traditional multivalue programmers.

Ηοwever it is not so obvious that all the functions ending in "-er" correspond to the old string commands.

For example, the classic multivalue "modify in-place" character conversion command:

CONVERT 'ab' TO 'cd' IN ZZ

is now represented in Exodus by:

converter(zz,"ab","cd");

Exodus provides a complete set of string modification commands even where there was no specific command in classic mv basic.

To guarantee fast performance (regardless of compiler optimisation) you should always use the command instead of the old "self assign" idiom.

For example:

ZZ=TRIM(ZZ)

should appear in Exodus as:

trimmer(zz);

and not:

zz=trim(zz);

Function Types

TYPE FUNCTION TYPE
var= traditional functions that return values and can be used in expressions and be on the right hand side of assignments
if traditional conditional statements that started with "if" or ended with "then/else" (or could have)
cmd traditional commands with no outputs
cmd2 traditional commands that now have outputs and can be used in expressions

Parameters/Argument Types

in Parameters that provide data to the function. Can be variables or raw data like 1 or "X"
unspecified Same as "in". Omission of the most common type de-clutters the documentation. NB When defining your own subroutines and functions "in" cannot be omitted from the source code.
io Parameters that may provide and/or return data. Must be variables. Cannot be raw data like 1 or "X"
out Parameters that return data. Must be variables. Cannot be raw data like 1 or "X"

Optional Parameters

Key Default
="" ""
=" " " "
="." "."
=1 1
=0 0
=true true
=false false

Complete List of Functions

Environment
var= osgetenv(envname)
if osgetenv(envname, out value)
if ossetenv(envname, newvalue)
Time/Date/Sleep
var= date()
var= time()
var= timedate()
cmd ossleep(milliseconds)
var= ostime()
System File
if osopen(filename, out filehandle, in locale="")
cmd osclose(filehandle)
var= osbread(filehandle, startoffset, length)
cmd osbread(out data, filehandle, startoffset, length)
cmd osbwrite(data, filehandle, startoffset)
if osread(out data, osfilename, in locale="")
var= osread(osfilename, in locale="")
if oswrite(data, osfilename, in locale="")
if osdelete(osfilename)
if osrename(oldosdir_or_filename, newosdir_or_filename)
if oscopy(fromosdir_or_filename, newosdir_or_filename)
cmd osflush()
System Directory
var= oslist(path=".", wildcard="", mode=0)
var= oslistf(path=".", wildcard="")
var= oslistd(path=".", wildcard="")
var= osfile(filename)
var= osdir(filename)
if osmkdir(newdirname)
if osrmdir(dirname, evenifnotempty=false)
var= oscwd()
var= oscwd(newdirname)
Program Control
var= suspend(command)
var= osshell(command)
var= osshellread(command)
cmd osshellread(out commandoutput, command)
cmd osshellwrite(commandinput, command)
cmd stop(text="")
cmd abort(text)
var= perform(command)
var= execute(command)
var= chain(command)
var= logoff()
cmd debug()


Variable Control
if assigned(anyvar)
if unassigned(anyvar)
cmd2 exchange(var1,var2)
cmd2 transfer(fromvar,tovar)
Console Output
cmd print(instring)
cmd printl(instring="")
cmd printt(instring="")
Cursor
var= at(column0orcode)
var= at(column0, row0)
var= getcursor()
cmd setcursor(cursorstr)
var= getprompt()
cmd setprompt(promptchar)
Console Input
var= input()
var= input(out inputstr)
var= input(prompt, out inputstr)
var= inputn(n)
Math
var= rnd(number)
cmd initrnd(seednumber)
var= mod(dividend, divisor)
var= abs(number)
var= pwr(base, exponent)
var= exp(power)
var= sqrt(number)
var= sin(degrees)
var= cos(degrees)
var= tan(degrees)
var= atan(number)
var= loge(number)
var= integer(number)
var= floor(number)
var= round(number, ndecimals=0)
String Creation
var= chr(integer)
var= str(instring, number)
var= space(number)


String Info/Search
var= count(instring, substr)
var= dcount(instring, substr)
var= index(instring, substr, occurrenceno=1)
var= index2(instring, substr, startcharno=1)
var= len(instring)
var= length(instring)
if match(instring, matchstr, options="")
var= seq(inchar)
String Functions

Return new and doesnt change original.

var= convert(instring, oldchars, newchars)
var= crop(instring)
var= field(instring, sepchar, fieldno, nfields=1)
var= field2(instring, sepchar, fieldno, nfields=1)
var= fieldstore(instring, sepchar, fieldno, nfields, replacementstr)
var= lcase(instring)
var= ucase(instring)
var= lower(instring)
var= raise(instring)
cmd2 quote(instring)
cmd2 squote(instring)
cmd2 unquote(instring)
var= splice(instring, fromcharno, nchars, insertionstr)
var= substr(instring, fromcharno)
var= substr(instring, fromcharno, nchars)
var= swap(instring, oldstr, newstr, options="")
var= trim(instring, trimchars=" ")
var= trimb(instring, trimchars=" ")
var= trimf(instring, trimchars=" ")
String Commands

Modify original in place

cmd2 converter(io instring, oldchars, newchars)
var= cropper(io instring)
cmd2 fieldstorer(io instring, sepchar, fieldno, nfields, replacementstr)
cmd2 lcaser(io instring)
var= ucaser(io instring)
cmd2 lowerer(io instring)
cmd2 raiser(io instring)
cmd2 quoter(io instring)
cmd2 squoter(io instring)
cmd2 unquoter(io instring)
cmd2 splicer(io instring, fromcharno, nchars, insertion)
var= substrer(io instring, fromcharno)
var= substrer(io instring, fromcharno, nchars)
cmd2 swapper(io instring, oldstr, newstr, options="")
cmd2 trimmer(io instring, trimchars=" ")
cmd2 trimmerb(io instring, trimchars=" ")
cmd2 trimmerf(io instring, trimchars=" ")
iconv/oconv
var= oconv(instring, conversionstring)
var= iconv(instring, conversionstring)
Database
if connect(connectionstring="")
if disconnect()
if createdb(dbname, out errmsg)
if deletedb(dbname, out errmsg)
if createfile(filename, options="")
if deletefile(filename)
if clearfile(filename)
var= listfiles()
if createindex(filename, fieldname, usingdictfilename="")
if deleteindex(filename, fieldname)
var= listindexes(filename="")
if begintrans()
if rollbacktrans()
if committrans()
Database Files and Records
if open(filename, out filehandle)
if read(out record, filehandle, key)
if matread(out dimrecord, filehandle, key)
if readv(out record, filehandle, key, fieldnumber)
if write(record, filehandle, key)
if matwrite(in dimrecord, filehandle, key)
if writev(record, filehandle, key, fieldn)
if deleterecord(filehandle, key)
if updaterecord(record, filehandle, key) the record key must already exist
if insertrecord(record, filehandle, key) the record key must not already exist
if lock(filehandle, key)
cmd unlock(filehandle, key)
cmd unlockall()
Record Selection
if select(sortselectclause="")
cmd clearselect()
if readnext(out key)
if readnext(out key, out valueno) valueno returns multivalue numbers if your sortselectclause sorted BY-EXP on a multivalued field. Not implemented yet.
if selectrecord(sortselectclause="")
if readnextrecord(out record, out id) must be preceded by a selectrecord() not select()
Dictionary
var= calculate(fieldname)
var= xlate(filename, key, fieldno, mode)


Dynamic Array Functions

Return modified, dont change original

var= replace(instring, fieldno, replacement)
var= replace(instring, fieldno, valueno, replacement)
var= replace(instring, fieldno, valueno, subvalueno, replacement)
var= extract(instring, fieldno, valueno=0, subvalueno=0)
var= erase(instring, fieldno, valueno=0, subvalueno=0)
var= insert(instring, fieldno, insertion)
var= insert(instring, fieldno, valueno, insertion)
var= insert(instring, fieldno, valueno, subvalueno, insertion)
if locate(instring, target, out setting, fieldn=0, valuen=0)
if locateby(instring, target, ordercode, out setting, fieldn=0, valuen=0)
if locateusing(instring, target, usingchar, out setting, fieldn=0, valuen=0, subvaluen=0)
if locateusing(instring, target, usingchar)
var= remove(fromstr, io startx, out delimiterno)
var= sum(instring, sepchar=VM_)
Dynamic Array Commands

Modify original in place

cmd2 replacer(io instring, fieldno, replacement)
cmd2 replacer(io instring, fieldno, valueno, replacement)
cmd2 replacer(io instring, fieldno, valueno, subvalueno, replacement)
cmd2 inserter(io instring, fieldno, insertion)
cmd2 inserter(io instring, fieldno, valueno, insertion)
cmd2 inserter(io instring, fieldno, valueno, subvalueno, insertion)
cmd2 eraser(io instring, fieldno, valueno=0, subvalueno=0)