UNPKG

emcellent-toolkit

Version:

A toolkit for performing neat functions with M/MUMPS data.

105 lines 12.2 kB
[{ "routineName": "BREAK", "routineSyntax": "BREAK:Postconditional", "routineDesc": "Stops execution of current process for debugging until signaled." },{ "routineName": "CLOSE", "routineSyntax": "CLOSE:Postconditional Device:Parameters", "routineDesc": "Releases ownership of an i/o device. Close can also use device parameters to manipulate the device as it is released. If the current device is closed, the special variable $io will be empty or reset to a default value." },{ "routineName": "DO", "routineSyntax": "DO:Postconditional Argument:Postconditional", "routineDesc": "Executes a subroutine, then returns control to the next command after the do; for multiple arguments, each subroutine in turn is executed. The line referenced in each argument must have a line level of one, or the do will cause error m14. Argumentless do executes the following block of code, with a line level one greater than the do’s line level, then returns." },{ "routineName": "ELSE", "routineSyntax": "ELSE", "routineDesc": "Lets rest of the line execute only if $test evaluates to false." },{ "routineName": "FOR", "routineSyntax": "FOR Variable=Parameters", "routineDesc": "Repeats execution of the rest of the line, and sets the value of a variable each time. Argumentless for repeats execution of the rest of the line without setting a variable. A quit or goto command terminates a for loop on the current line; quit terminates only the most recent in a series of nested for loops on the line, whereas goto terminates all active for loops on the line. Argument indirection not allowed. Each for parameter defines a series of one or more values for the variable to accept, and executes the rest of the line once for each value in that series. Each for parameter can be either a single evaluated expression, or a range of numeric values. Ranges include a starting value, an increment with which to calculate subsequent values, and an optional maximum value. A for loop that runs out of values stops without needing a quit or goto." },{ "routineName": "GOTO", "routineSyntax": "GOTO:Postconditional Reference:Postconditional", "routineDesc": "Transfers execution to a different line of code, without returning when that block of code completes. Trying to goto a line at a different line level, or trying to cross block boundaries when the goto’s line level is greater than one, causes error m45." },{ "routineName": "HALT", "routineSyntax": "HALT:Postconditional", "routineDesc": "Ends the process. Releases all locked names, closes all opened devices, and aborts all active transactions. Halt never takes an argument." },{ "routineName": "HANG", "routineSyntax": "HANG:Postconditional Expression", "routineDesc": "Suspends execution of the process for approximately the specified number of seconds. Negative numbers or zero do not stop execution. Hang always takes an argument." },{ "routineName": "IF", "routineSyntax": "IF Expression", "routineDesc": "Lets the rest of the line execute only if all arguments evaluate to true; sets $test to whether the if succeeded. Argumentless if lets the rest of the line execute only if $test = 1. Note that because if with multiple arguments is identical to multiple, independent if commands, later arguments are evaluated only if earlier ones succeed." },{ "routineName": "JOB", "routineSyntax": "JOB:Postconditional Argument:Parameters:Timeout", "routineDesc": "Makes an independent process that begins execution at the specified line of code. Timed job sets $test to whether the job command succeeded in the time specified. Note that the job command can only pass parameters by value; trying to pass by reference causes error m40." },{ "routineName": "KILL", "routineSyntax": "KILL:Postconditional Argument", "routineDesc": "Removes specified variables, and all their array descendants. Argumentless kill removes all local variables, and their array descendants. An exclusive kill, a kill argument in the form of a parenthesized list of local variables, removes all local variables and their descendants, except those listed within the parentheses and their descendants." },{ "routineName": "LOCK", "routineSyntax": "LOCK:Postconditional Argument:Timeout", "routineDesc": "Gets and/or releases ownership of names. Argumentless lock releases ownership of all names held by current process. Names, like devices, can only be owned by one process at a time. Ownership of a name includes all array descendants of that name. Locked names are logical names that look like local and global names for convenience only. A name used as an argument of a lock command does not change the naked reference, nor can it be referred to by the naked reference. Unlike devices, names can be used when not owned; locking is a voluntary signaling mechanism, not a method for preventing access. Locking a name does not prevent other processes from accessing or manipulating variables with the same names, only from successfully locking those names. Mumps code should voluntarily lock names, especially global names, whose simultaneous use by multiple processes would lead to problems, such as loss of database integrity. Each non-incremental lock argument (those without + or -) first releases all names owned by this process, and then gets ownership of the name specified. Incremental and decremental lock arguments get (+) or release (-) ownership of the specified names without releasing any other names. A name incrementally locked multiple times must be decrementally locked an equal number of times to release it. A lock of a list of names enclosed by parentheses will not succeed until all names listed are simultaneously available. A nonincremental lock of a list of names will not release the names owned by the process until it can simultaneously get ownership of all the names in its list. Timed lock sets $test to whether it got ownership of the name in the time requested; network latency and other extraneous delays are not counted in the timeout period. For arguments without a timeout, lock waits indefinitely until the name is released by whatever process owns it. Improperly coded, this can result in a deadly embrace, in which two processes stop execution at lock commands because each owns names for which the other is waiting." },{ "routineName": "MERGE", "routineSyntax": "MERGE:Postconditional Variable=Variable", "routineDesc": "Copies the value and all array descendants from one variable to another variable. If either variable is an array descendant of the other, it causes error m19." },{ "routineName": "NEW", "routineSyntax": "NEW:Postconditional Argument", "routineDesc": "Saves and temporarily removes locals and their array descendants, and restores them when this block of code ends. Argumentless new saves and temporarily removes all locals and their array descendants, and restores them when this block of code ends. Only unsubscripted local variables or the intrinsic special variables $estack and $etrap may be used in the argument of the new command. An exclusive new, a new argument consisting of a list of names within parentheses, saves and temporarily removes all locals, except those listed and their descendants." },{ "routineName": "OPEN", "routineSyntax": "OPEN:Postconditional Device:Parameters", "routineDesc": "Gets ownership of an i/o device, selects the list of available mnemonic spaces for that device, and sets the current mnemonic space to the first in the list selected. Open can also use device parameters to manipulate the device as it is acquired. Trying to open a device with a mnemonic space it doesn’t support causes error m35; trying to open it with incompatible mnemonic spaces causes error m36. Timed open sets $test to whether it got ownership in the specified time." },{ "routineName": "QUIT", "routineSyntax": "QUIT:Postconditional Expression", "routineDesc": "Ends the current process level and returns a value; doing so when an argument is not expected causes error m16. Argumentless quit ends the current process level without returning a value, but if one is expected it causes error m17. Quit can also be used to end a for loop on the same line." },{ "routineName": "READ", "routineSyntax": "READ:Postconditional Argument", "routineDesc": "Gets input from the current i/o device and puts the response in the specified variables. Any text and format control characters in the argument of the read command are output on the current device. Timed read sets $test to whether read got a response in the specified time. When the argument contains an asterisk preceding a variable name, a code representing a single character is obtained. When the argument contains a variable followed by a \"#\" and a numeric expression, this expression specifies the maximum number of characters to accept. A number less than zero causes error m18." },{ "routineName": "SET", "routineSyntax": "SET:Postconditional Destination=Expression", "routineDesc": "Puts values into variables. When the set destination is a list of destinations within parentheses, each destination is given the value following the assignment symbol. The $extract and $piece destinations change the specified part of their first arguments. Trying to set $x or $y to a negative or non-integer value causes error m43." },{ "routineName": "TCOMMIT", "routineSyntax": "TCOMMIT:Postconditional", "routineDesc": "Commits and ends the current transaction: makes its global changes visible. A tcommit when there is no current transaction causes error m44." },{ "routineName": "TRESTART", "routineSyntax": "TRESTART:Postconditional", "routineDesc": "Rolls back the current transaction (see trollback), optionally restores some or all of the symbol table (as dictated by the tstart command, see below), and starts the current transaction again. Attempting to restart a non-restartable transaction rolls back the transaction, ends it, and causes error m27. A trestart when there is no current transaction causes error m44." },{ "routineName": "TROLLBACK", "routineSyntax": "TROLLBACK:Postconditional", "routineDesc": "Rolls back a transaction; that is, undoes its global changes and releases any locks acquired within the transaction. A trollback when there is no current transaction causes error m44." },{ "routineName": "TSTART", "routineSyntax": "TSTART:Postconditional Variables:Parameters", "routineDesc": "Starts a restartable transaction. Argumentless tstart starts a nonrestartable transaction. When variables are specified, they are restored to their previous values if the transaction is restarted." },{ "routineName": "USE", "routineSyntax": "USE:Postconditional Device:Parameters:MnemSpace", "routineDesc": "Picks the current device from the list of i/o devices owned by the current process, and the device’s mnemonic space from the list currently available for that device. Use can also use device parameters to manipulate the current device as it is selected." },{ "routineName": "VIEW", "routineSyntax": "VIEW:Postconditional Argument", "routineDesc": "Returns or changes implementation-dependent information." },{ "routineName": "WRITE", "routineSyntax": "WRITE:Postconditional Argument", "routineDesc": "Formats and outputs values to the current i/o device. When an argument includes an asterisk followed by an integer value, one character whose code (not necessarily ascii) is the number represented by the integer is sent to the current device; the effect this code has on the device is implementation-specific." },{ "routineName": "XECUTE", "routineSyntax": "XECUTE:Postconditional Expression:Postcondition", "routineDesc": "Interprets and executes a value as mumps text. Xecute provides a means of interpreting a data value created during program execution as if it were mumps code. Each argument of the xecute command is interpreted as if it were the text part of a line of mumps code (without label, line start indicator, or line level indicator)." }]