IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.CommandLineApplicationInterpreter Class Reference

Simple command-line application interpreters, holds a set of commands that can be executed by name. Each of these command can take an arbitrary number of string arguments. Interpreter has its internal variables, which are strings. Each variable has a name and a value. If any arguments (and even command) start with the '$' character then then it is treated as reference to a variable and is substituted with the value of that variable (whose name follows the '$' character) before it is used. More...

+ Inheritance diagram for IG.Lib.CommandLineApplicationInterpreter:
+ Collaboration diagram for IG.Lib.CommandLineApplicationInterpreter:

Classes

class  InterpreterPipeClient
 Client to the interpreter pipe server (classes derived from InterpreterPipeServer). More...
 
class  InterpreterPipeServer
 Command-line interpreter's server that creates a named pipe, listens on its input stream for client requests, executes requests in the corresponding interpreter, and sends responses back to the client. More...
 

Public Member Functions

 CommandLineApplicationInterpreter ()
 Creates a new MessyApplication object initialized with some basisc applications. More...
 
 CommandLineApplicationInterpreter (bool caseSensitive)
 Construct a new commandline interpreter object initialized with some basisc commands. More...
 
CommandThreadBase GetCommmandThread (int whichCommandThread)
 Returns the specified command thread for the current interpreter. More...
 
CommandThread AddNewThread ()
 
InterpreterVariable GetLocalVariable (CommandThread cmdThread, string varName, int framesBelowTop)
 Returns local variable with the specified name that is defined specified number of frames below the top stack frame. More...
 
InterpreterVariable GetFirstLocalVariable (CommandThread cmdThread, string value)
 
InterpreterVariable GetFiestLocalOrGlobalVariable (CommandThread cmdThread, string value)
 
virtual InterpreterVariable GetGlobalVariable (string varName)
 Returns the specified global variable, if such a variable exists. More...
 
virtual string GetGlobalVariableValue (string varName)
 Returns value of the specified global variable, if such a global variable exists. More...
 
virtual void SetGetGlobalVariableValue (string varName, string varValue)
 Assigns value to the specified global variable, if such a global variable exists. More...
 
virtual string GetVariableValue (CommandThread cmdThread, string varName)
 Returns the value of the specified variable of the current command line interpreter. null is returned if the specified variable does not exist. More...
 
virtual string SetVariableValue (CommandThread cmdThread, string varName, string value)
 Sets the specified variable to the specified value. More...
 
virtual string ClearVariable (CommandThread cmdThread, string varName)
 Clears (removes) the specified variable. More...
 
virtual string PrintVariable (CommandThread cmdThread, string varName)
 Prints the specified variable. More...
 
virtual void EnterBlock (CommandThread cmdThread, bool executeCommands=true, bool saveCommands=false)
 Enters a new code block. A new stack frame is added where code is executed, such that the embedded code block has isolated local variables. More...
 
virtual string ExitBlock (CommandThread cmdThread)
 Exits the current code block. More...
 
virtual void EnterRepeatBlock (CommandThread cmdThread, int numRepetitions=1)
 Enters a new repeat code block. A new stack frame is added where code is executed, such that the embedded code block has isolated local variables. More...
 
virtual string ExitRepeatBlock (CommandThread cmdThread)
 Exits the current repetition code block. More...
 
virtual void EnterJsBlock (CommandThread cmdThread)
 Enters a new JavaScript calculator's code block. A new stack frame is added, such that the embedded code block collects command lines independently of the containing blocks, and lines can be later concatenated into a single string and sent to JavaScript evaluator when the block exits. More...
 
virtual string ExitJsBlock (CommandThread cmdThread)
 Exits the current JavaScript code block, and sends the JavaScrit code contained within the block (consisting of concatenated command lines entered within the block) to the JavaScript evaluator for execution. More...
 
virtual void EnterIf (CommandThread cmdThread, bool condition)
 Enters the If block. More...
 
virtual void EnterElseIf (CommandThread cmdThread, bool condition)
 Enters the ElseIf block. More...
 
virtual void EnterElse (CommandThread cmdThread)
 Enters the ElseIf block. More...
 
virtual string ExitIf (CommandThread cmdThread)
 Enters the EndIf block. More...
 
virtual void EnterWhile (CommandThread cmdThread, string conditionString)
 Enters the While block. More...
 
virtual string ExitWhile (CommandThread cmdThread)
 Exits the current JavaScript code block, and sends the JavaScrit code contained within the block (consisting of concatenated command lines entered within the block) to the JavaScript evaluator for execution. More...
 
virtual string[] GetArguments (string commandLine)
 Parses a command line and extracts arguments from it. Arguments can be separated according to usual rules for command-line arguments: spaces are separators, there can be arbitraty number of spaces, and if we want an argument to contain spaces, we must enclose it in double quotes. Command line can also contain the command name followed by arguments. In this case it is treated in the same way, and command can be obtained simply as the first string in the returned array. More...
 
virtual string RunFile (CommandThread cmdThread, string filePath)
 Runs all commands that are written in a file. Each line of a file is interpreted as a single command, consisting of command name followed by arguments. More...
 
virtual string RunInteractive (CommandThread cmdThread)
 Reads commands one by one from the standard input and executes them. More...
 
string EvaluateJsInteractive ()
 Runs interpreter's JavaScript expression evaluator interactively. More...
 
string EvaluateJs (string codeBlock)
 Evaluates the specified block of code by the internal JavaScript evaluator. More...
 
string EvaluateJs (string[] args)
 Evaluates a JavaScript expression obtained by merging elements of the array parameter args . These usually represent parts of the code block to evaluate, obtained through command arguments or as commandlines read (but not executed) by the commandline interpreter. More...
 
string[] GetCommands ()
 Returns an array of installed commands. More...
 
bool ContainsCommand (string commandName)
 Returns true if the specified command is installed on the interpreter, false if not. More...
 
virtual string RunRepeat (CommandThread cmdThread, string[] args)
 Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate. More...
 
virtual string RunRepeatVerbose (CommandThread cmdThread, string[] args)
 Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate. More...
 
virtual string RunRepeatSilent (CommandThread cmdThread, string[] args)
 Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate. More...
 
virtual string RunRepeatSpecificOutputLevel (CommandThread cmdThread, string[] args)
 Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate. More...
 
virtual string RunRepeat (CommandThread cmdThread, int outputLevel, string[] args)
 Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate. More...
 
virtual string RunTryCatch (CommandThread cmdThread, int outputLevel, string[] args)
 Runs command in a try-catch block, where first argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate. More...
 
virtual void Run (CommandThread cmdThread, List< string > commandLines)
 Runs a set of command by the current interpreter. More...
 
string RunWithoutModifications (CommandThread cmdThread, string commandName, params string[] commandArguments)
 Runs the specified command with specified name, installed on the current application object, without any modifications of the command arguments. More...
 
virtual string Run (CommandThread cmdThread, string commandName, params string[] commandArguments)
 Runs the specified command with specified name, installed on the current application object. More...
 
string Run (CommandThread cmdThread, string[] args)
 Runs command where the first argument is command name. Extracts command name and runs the corresponding command delegate.Before running it, arguments for the application delegate are extracted and then passed to the delegate. More...
 
string Run (CommandThread cmdThread, string commandLine)
 Runs command that is specified as a single string, composed of command name and its argumens. Splits the command and runs it. More...
 
virtual string Run (string command)
 Runs the specified (unsplit) command on the interpreter's main thread. More...
 
virtual string Run (params string[] commandAndArgs)
 Runs the specified (split) command with arguments on the interpreter's main thread. More...
 
void AddParallelCommand (CommandLineJobContainer commandData)
 Adds a new parallel command data to the list of commands executed by in parallel. More...
 
CommandLineJobContainer GetParallelCommandData (int id)
 Returns the command data object of the parallel command that with the specified ID. More...
 
void PrintParallelCommands (bool printAll)
 Prints the commands that were scheduled for parallel execution, together with their current status, results and execution times (when available). More...
 
virtual void UpdateThreadPriorityFromSystem ()
 Updates thread priority (property ThreadPriority) of the interpreter to the current global thread priority (the UtilSystem.ThreadPriority property). More...
 
void RegisterSystemPriorityUpdating ()
 Registers the UpdateThreadPriorityFromSystem method as "event handler" for system priority changes. After registration, this method will be called every time the value of the UtilSystem.ThreadPriority property changes. More...
 
void UnregisterSystemPriorityUpdating ()
 Unregisters the UpdateThreadPriorityFromSystem method as "event handler" for system priority changes. More...
 
int[] RunParallelRepeat (int numRepeat, string command, string[] commandArguments)
 Runs the specified command with arguments the specified number of times in parallel threads by using the interpreter's job dispatcher with corresponding parallel servers. More...
 
int RunParallel (string command, string[] commandArguments)
 Runs she specified command with arguments once in a parallel thread by using the interpreter's job dispatcher with corresponding parallel servers. More...
 
virtual string RunAsync (CommandThread cmdThread, string[] args)
 Runs a command asynchronously where the first argument is command name. Extracts command name and runs the corresponding application delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate. More...
 
virtual string RunAsync (CommandThread cmdThread, string commandName, params string[] commandArguments)
 Runs the command with specified name (installed on the current interpreter object) asynchronously. More...
 
bool AsyncIsCompleted (int id)
 Returns true if the asynchronous command execution identified by id has completed, and false otherwise. More...
 
bool AsyncIsAllCompleted ()
 Returns true if all asynchronous command executions have completed, and false otherwise. More...
 
void AsyncWaitAll ()
 Waits until all asynchronously commands that have been eventually executed by the current interpreter, complete. More...
 
string AsyncWait (int callId)
 Waits for the specified asynchronous command (specified by command ID) to complete. More...
 
virtual void AddCommand (string commandName, ApplicationCommandDelegate commandDelegate)
 Adds command with the specified name. More...
 
virtual void AddCommand (string commandName, ApplicationCommandDelegateMt commandDelegate)
 Adds command with the specified name. More...
 
virtual void AddCommandMt (string commandName, ApplicationCommandDelegateMt commandDelegate)
 Adds command with the specified name. More...
 
virtual void RemoveCommand (string commandName)
 Removes the command with the specified name. More...
 
virtual void RemoveAllCommands ()
 Removes all commands from the current interpreter. More...
 
virtual void AddModule (string moduleName, ModuleDelegate moduleDelegate)
 Adds a new module to the interpreter. This adds an initialization function (via a delegate) which is executed when module module initialization is performed. More...
 
virtual void LoadModule (string moduleName)
 Loads and initializes the specified module. More...
 
virtual string ModuleTestCommandName (string modulename)
 Returns the standard name for the command that gets installed when a module is loaded. More...
 
virtual bool IsModuleLoaded (string moduleName)
 Returns true if the specified module has been loaded on the interpreter, false if not. More...
 
virtual string RunScriptFile (string scriptFilePath, string[] initAndRunArgs)
 Dynamically loads (temporarily, just for execution of the current commad) a class form the script contained in the specified file and executes its executable method. The file must contain the script that is dynamically loaded and executed, in form of definition of the appropriate class of type ILoadableScript. The dynamically loadable script class is loaded from the file and instantiated by the LoadableScriptInterpreter interpreter that is based on loadable scripts. More...
 
void LoadScript (string newCommandName, string scriptFilePath, string[] initArgs)
 Dynamically loads (compiles and instantiates) a loadable script class contained in the specified file, and installs a new command on LoadableScriptInterpreter and on the current interpreter, based on the dynamically created instance of the loaded (dynamically compiled) class. More...
 
virtual string RunLoadedScript (string commandName, string[] arguments)
 Executes the specified command that has been dynamically loaded form a script. More...
 
string[] GetLoadableScriptReferencedAssemblies ()
 Returns an array of assemblies that are currently referenced by the script loader that takes care of loading the dynamic scripts. More...
 
InterpreterPipeServer CreatePipeServer (string pipeName, string serverName=null, bool createCommand=false, int outputLevel=3)
 Creates and registers a new interpreter's named pipe server. More...
 
string RemovePipeServers (params string[] serverNames)
 Removes the specified interpreter's named pipe servers. Servers are stopped and their pipes closed. Returns a string contaiing information about the removed servers. More...
 
string PipeServerInfo (string serverName=null)
 Returns a string containing informattion on the installed named pipe servers. More...
 
InterpreterPipeClient CreatePipeClient (string pipeName, string clientName=null, bool createCommand=false, int outputLevel=3)
 Creates and registers a new interpreter's named pipe client. More...
 
string RemovePipeClients (params string[] clientNames)
 Removes the specified interpreter's named pipe clients. Client's pipes are closed. Returns a string contaiing information about the removed clients. More...
 
string PipeClientInfo (string clientName=null)
 Returns a string containing informattion on the installed named pipe clients. More...
 
string PipeClientGetServerResponse (string clientName, string commandLineString)
 Sends the specified command to the corresponding pipe serverr and reads and returns its response. More...
 
- Public Member Functions inherited from IG.Lib.ICommandLineApplicationInterpreter
string Run (CommandThread commandThread, string commandName, string[] args)
 Runs the command with specified name, installed on the current application object. More...
 

Static Public Member Functions

static void ExecuteSystemCommand (string[] args)
 Executes the specified system commmand and blocks until the execution completes. More...
 
static void ExecuteSystemCommand (string command, params string[] args)
 Executes system command with arguments. More...
 

Public Attributes

const bool DefaultCaseSensitive = false
 Default value of the flg indicating whether command names are case sensitive. More...
 
const string DefaultName = "ApplicationIntepreter"
 Default interpreter name. More...
 
const string AutoGlobalName = "AutomaticGlobalInterpreter"
 
const string AutoGlobalDescription = "Automatically created global command-line interpreter."
 
readonly string Command_Block = "Block"
 
readonly string Command_EndBlock = "EndBlock"
 
readonly string Command_BeginRepeat = "BeginRepeat"
 
readonly string Command_EndRepeat = "EndRepeat"
 
readonly string Command_BeginCalc = "BeginCalc"
 
readonly string Command_EndCalc = "EndCalc"
 
readonly string Command_If = "If"
 
readonly string Command_ElseIf = "ElseIf"
 
readonly string Command_Else = "Else"
 
readonly string Command_EndIf = "EndIf"
 
readonly string Command_While = "While"
 
readonly string Command_EndWhile = "EndWhile"
 

Static Public Attributes

static int DefaultOutputLevel = 1
 
static bool DefaultWarnCommandReplacement = true
 

Protected Member Functions

virtual void InitCommandLineApplicationInterpreterBasic (bool caseSensitive)
 Performs basic initializations of the interpreter. More...
 
virtual void InitCommands ()
 Installs basic commands on the interpreter. More...
 
virtual bool IsVariableReference (CommandThread cmdThread, string str)
 Returns true if the specified string represents a variable reference, false otherwise. More...
 
virtual string SubstituteVariableOrExpressionReference (CommandThread cmdThread, string str)
 Returns value of the referenced variable if the specified string represents a variable reference (begins with the variableStart character, usually '$'), otherwise the original sting is returned. More...
 
virtual void AddEnterExitCommands_Block (CommandStackFrame frame)
 Adds block enter/exit commands for the "Block" block to the specified stack frame. More...
 
virtual void AddEnterExitCommands_BeginRepeat (CommandStackFrame frame)
 Adds block enter/exit commands for the "BeginRepeat" block to the specified stack frame. More...
 
virtual void AddEnterExitCommands_BeginCalc (CommandStackFrame frame)
 Adds block enter/exit commands for the "BeginCalc" block to the specified stack frame. More...
 
virtual void AddEnterExitCommands_If (CommandStackFrame frame)
 Adds block enter/exit commands for the "If" block to the specified stack frame. More...
 
virtual void AddEnterExitCommands_ElseIf (CommandStackFrame frame)
 Adds block enter/exit commands for the "ElseIf" block to the specified stack frame. More...
 
virtual void AddEnterExitCommands_Else (CommandStackFrame frame)
 Adds block enter/exit commands for the "ElseIf" block to the specified stack frame. More...
 
virtual void AddEnterExitCommands_While (CommandStackFrame frame)
 Adds block enter/exit commands for the "While" block to the specified stack frame. More...
 
virtual void ExecuteSystemCommandsInteractive ()
 Reads commands with their arguments ont by one from the console and executes them as system commands. More...
 
virtual bool GetCommandDelegate (string commandName, ref ApplicationCommandDelegateMt appDelegate)
 Obtains and stores the delegate that is used for execution of the specified command, and retrns an iindicator ehether the command is installed on the interpreter or not. More...
 
void AsyncRunCallback (IAsyncResult ar)
 Callback method for asynchronous command executions. More...
 
virtual string CmdSetVariableBase (CommandThread cmdThread, string cmdName, string[] args, bool setCommandResult)
 Command. Sets the specified interpreter variable to the specified value.
Usage:
More...
 
virtual string CmdSetVariable (CommandThread cmdThread, string cmdName, string[] args)
 Command. Sets the specified interpreter variable to the specified value.
Usage:
More...
 
virtual string CmdSetVariableToCommandResult (CommandThread cmdThread, string cmdName, string[] args)
 Command. Sets the specified interpreter variable to the result of the command (with arguments) that follow variable name.
Usage:
More...
 
virtual string CmdGetVariable (CommandThread cmdThread, string cmdName, string[] args)
 Command. Gets the specified variable and returns its value (or null if the variable does not exist). Variable name must be the only argument of the command. More...
 
virtual string CmdClearVariable (CommandThread cmdThread, string cmdName, string[] args)
 Command. Clears the specified variable. Variable name must be the only argument of the command. More...
 
virtual string CmdPrintVariable (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints the specified variable. Variable name must be the only argument of the command. More...
 
virtual string CmdThreadInfo (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints the specified variable. Variable name must be the only argument of the command. More...
 
virtual string CmdThreadId (CommandThread cmdThread, string cmdName, string[] args)
 Command. Returns the interpreter's current executing thread Id. More...
 
virtual string CmdStackLevel (CommandThread cmdThread, string cmdName, string[] args)
 Command. Returns the current interpreter's stack level for the currently executed interpreter thread. More...
 
virtual string CmdSuppressInteractive (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints and returns or sets and returns value of the flag that specifies whether interactive helpers and outputs are suppressed at the thread level. More...
 
virtual string CmdSuppressInteractiveFrame (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints and returns or sets and returns value of the flag that specifies whether interactive helpers and outputs are suppressed for the currentt stack frame (the effect of this setting vanished when the stack frame exits). More...
 
virtual string CmdBlock (CommandThread cmdThread, string cmdName, string[] args)
 Command. Enters a new command block. Optional arguments specify whether commands in the block are readily executed, and whether they are saved (for later execution or inspection). More...
 
virtual string CmdEndBlock (CommandThread cmdThread, string cmdName, string[] args)
 Command. Exits the current command block. Exception is thrown if we are not currently within a plain code block. More...
 
virtual string CmdBeginRepeat (CommandThread cmdThread, string cmdName, string[] args)
 Command. Enters a new repeat block, which repeats execution of its body for the specified number of time and reports execution speed. Number of block execution repetitions must be specified as the only parameter of the command. More...
 
virtual string CmdEndRepeat (CommandThread cmdThread, string cmdName, string[] args)
 Command. Exits the current repeat block, which repeats execution of its body for the specified number of time and reports execution speed. More...
 
virtual string CmdCalcJsBlock (CommandThread cmdThread, string cmdName, string[] args)
 Command. Enters a new block of JavaScript expressions that are evaluated. All lines within the block are treated as part of JavaScript code block, which is evaluated by the interpreter's JavaScript evaluator when the end of the block is reached. More...
 
virtual string CmdEndCalcJsBlock (CommandThread cmdThread, string cmdName, string[] args)
 Command. Exits the current JavaScript expression block. If execution is active then the block of commands is sent to the internal JavaScript evaluator for execution. More...
 
virtual string CmdIf (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints the specified variable. Variable name must be the only argument of the command. More...
 
virtual string CmdElseIf (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints the specified variable. Variable name must be the only argument of the command. More...
 
virtual string CmdElse (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints the specified variable. Variable name must be the only argument of the command. More...
 
virtual string CmdEndIf (CommandThread cmdThread, string cmdName, string[] args)
 Command. Ends the If/ElseIf/Else block. Variable name must be the only argument of the command. More...
 
virtual string CmdWhile (CommandThread cmdThread, string cmdName, string[] args)
 Command. Enters the while block. Arguments represent loop contioton that is evaluated at the begining of each iteration. Variable name must be the only argument of the command. More...
 
virtual string CmdEndWhile (CommandThread cmdThread, string cmdName, string[] args)
 Command. Ends (closes) the while loop. Variable name must be the only argument of the command. More...
 
virtual string CmdOutputLevel (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints or sets the current output level of the interpreter. More...
 
virtual string CmdOutputLevelCalc (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints or sets the current output level of the calculator (i.e., the JavaScript expression evaluator). More...
 
virtual string CmdUseJint (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints and returns or sets and returns value of the flag that specifies whether the Jint engine is used to interpret JavaScript expressions. More...
 
virtual string CmdWriteLine (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints concatenated argument with spaces between them. More...
 
virtual string CmdWrite (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints concatenated argument with spaces between them. More...
 
virtual string CmdRead (CommandThread cmdThread, string cmdName, string[] args)
 Command. Reads value of the specified variable from console. Variable name must be the first argument; Eventual other arguments are concatenated and written to console. More...
 
virtual string CmdRunFile (CommandThread cmdThread, string cmdName, string[] args)
 Command. Runs a file by running all its lines in the current interpreter. File name must be the only argument of the command. More...
 
virtual string CmdRunRepeatVerbose (CommandThread cmdThread, string cmdName, string[] args)
 Command. Runs another command repetitively the specified number of times. First argument must be the number of times command is run, the second argument must be command to be run repetitively, and the rest of the arguments are passed to that command as its arguments. More...
 
virtual string CmdRunRepeat (CommandThread cmdThread, string cmdName, string[] args)
 Command. Runs another command repetitively the specified number of times. First argument must be the number of times command is run, the second argument must be command to be run repetitively, and the rest of the arguments are passed to that command as its arguments. More...
 
virtual string CmdTryRun (CommandThread cmdThread, string cmdName, string[] args)
 Command. Runs another command in a try-catch block, such that if command throws an exception execution is not broken. The second argument must be command to be run, and the rest of the arguments are passed to that command as its arguments. More...
 
virtual string CmdThtrowExceptions (CommandThread cmdThread, string cmdName, string[] args)
 Command. Sets the flag for rethrowing exceptions in the interaction mode. Optional boolean arguemnt, default is true. More...
 
virtual string CmdRunInteractive (CommandThread cmdThread, string cmdName, string[] args)
 Command. Runs interpreter commands interactively. Reads commands one by one from console and executes them, until only Enter is pressed. More...
 
virtual string CmdRunSystem (CommandThread cmdThread, string cmdName, string[] args)
 Command. Runs the specified command-line by the operating system. The first argument is the command to be executed while the following arguments are arguments to this command. If there are no arguments then user is requested to insert commands interactively. More...
 
virtual string CmdCurrentDirectory (CommandThread cmdThread, string cmdName, string[] args)
 Command. Rturns or sets the current directory. More...
 
virtual string CmdExpressionEvaluatorJavascript (CommandThread cmdThread, string cmdName, string[] args)
 Command. Runs the built in expression evaluator. More...
 
virtual string CmdSetPriority (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Sets the priority of the current process. More...
 
virtual string CmdRunParallel (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Runs the specified command-line in parallel thread. More...
 
virtual string CmdRunParallelRepeat (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Runs the specified command-line several times in the specified number of parallel threads. More...
 
virtual string CmdPrintParallelCommands (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Prints data about commands executed in parallel threads. More...
 
virtual string CmdRunAsync (CommandThread cmdThread, string cmdName, string[] args)
 Command. Runs the specified command-line asynchronously. More...
 
virtual string CmdAsyncWaitResults (CommandThread cmdThread, string cmdName, string[] args)
 Command. Wait until asynchronously invoked command with the specified ID (first argument, must represent an int) completes. More...
 
virtual string CmdAsyncCompleted (CommandThread cmdThread, string cmdName, string[] args)
 Command. Returns a flag indicating whether the asynchroneous command invocation identified by the specified ID (first argument, must represent an int) has completed. More...
 
virtual string CmdSleepSeconds (CommandThread cmdThread, string cmdName, string[] args)
 Command. Sleeps (suspends execution of the executing thread) for the specified number of seconds. More...
 
virtual string CmdLoadModule (CommandThread cmdThread, string cmdName, string[] args)
 Command. Loads the specified module (whos name must be the first argument) and performs its initialization. If there are more than 1 arguments then the rest of the arguments specify a command and (if more than 1) its arguments, and the specified command is also run. More...
 
virtual string CmdIsModuleLoaded (CommandThread thread, string cmdName, string[] args)
 Executinon method for command that checks if module is loaded. Writes to condole whether module is loaded or not, and returns "1" if module is loaded and "0" if not. More...
 
virtual string CmdModuleTestCommand (CommandThread cmdThread, string cmdName, string[] args)
 Executinon method for test command that is installed when a module is installed. This is a command that enables to verify that a module with the specified name has been installed. More...
 
virtual string CmdTestFromTestModules (CommandThread cmdThread, string cmdName, string[] args)
 Executinon method for test command, which just prints its name and arguments. This is a replacement for usuel test command, which gets installed when one of the two basic test modules are installed. More...
 
virtual string CmdPipeServerCreate (CommandThread cmdThread, string cmdName, string[] args)
 Command. Creates a new server that listens for interpreter commands on a named pipe, executes them, and writes result back to the named pipe. Command arguments are pipe name and server name (optional, if not specified then server name is the same as pipe name). More...
 
virtual string CmdPipeServersRemove (CommandThread cmdThread, string cmdName, string[] args)
 Command. Removes the spcified (or all, if names are not specified) named pipe servers. Command arguments are names of the pipe servers to be removed. If none is specified then all pipe servers installed on the interperter are removed. More...
 
virtual string CmdPipeServerInfo (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints and returns inormation on the installed named pipe servers. Optional command argument is server name. If not specified then information about all installed servers is printed and returned. More...
 
virtual string CmdPipeClientCreate (CommandThread cmdThread, string cmdName, string[] args)
 Command. Creates a new client to the interpreter pipe server. The client can send command to the server listening on the specified named pipe, and recieves responses from the server and returns them. Command arguments are pipe name and client name (optional, if not specified then server name is the same as pipe name). More...
 
virtual string CmdPipeClientsRemove (CommandThread cmdThread, string cmdName, string[] args)
 Command. Removes the spcified (or all, if names are not specified) named pipe clients. Command arguments are names of the pipe clients to be removed. If none is specified then all pipe clients installed on the interperter are removed. More...
 
virtual string CmdPipeClientInfo (CommandThread cmdThread, string cmdName, string[] args)
 Command. Prints and returns inormation on the installed named pipe clients. Optional command argument is client name. If not specified then information about all installed clients is printed and returned. More...
 
virtual string CmdPipeClientGetServerResponse (CommandThread cmdThread, string cmdName, string[] args)
 Command. Sends the specified command to the corresponding pipe serverr and reads and returns its response. Command argument is the (interpreter's) name of the pipe client followed by command and eventual arguments sent to the server. More...
 
virtual string CmdRunInternalScriptClass (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Dynamically creates and runs an internal script object, i.e. an object of the class that is already compiled in the code. Interpreter command arguments: The first argument must be a full name of the script class whose object is run. The rest of the arguments (if any) are directly transferred to the executable method of the script and are also used as argument to script initialization method. More...
 
virtual string CmdRunScriptFile (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Dynamically loads (temporarily, just for execution of the current commad) a class form the script contained in the specified file and executes its executable method. The file must contain the script that is dynamically loaded and executed, in form of definition of the appropriate class of type ILoadableScript. The dynamically loadable script class is loaded from the file and instantiated by the LoadableScriptInterpreter loadable script-based interpreter object. Interpreter command arguments: Path to the file containing loadable script must be the first argument to the method. The rest of the arguments (if any) are directly transferred to the executable method of the script. More...
 
virtual string CmdLoadScript (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Dynamically loads (compiles and instantiates) a loadable script class contained in the specified file, and installs a new command on LoadableScriptInterpreter and on the current interpreter, based on the dynamically allocated instance of the loaded (dynamically compiled) class. Required arguments to the interpreter command are: More...
 
virtual string CmdRunLoadedScript (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Runs a command based on dynamically loaded loadable script class. Arguments passed to this command are directly passed on to the dynamically loaded script class installed on LoadableScriptInterpreter under the same cmdName . Typically, the command that is executed by the current method, has been previously installed by the CmdLoadScript(...) method. More...
 
virtual string WriteLoadableScriptReferencedAssemblies (CommandThread cmdThread, string cmdName, string[] args)
 Interpreter command. Writes to the console the assemblies that are currently referenced by compiler used for dynamic loading of scripts. This information can be used for control if something goes wrong with dynamic script loading. More...
 
virtual string CmdExit (CommandThread cmdThread, string cmdName, string[] args)
 Execution method that exits the interpreter. More...
 
virtual string CmdHelp (CommandThread cmdThread, string cmdName, string[] args)
 Execution method for applications help. More...
 
virtual string CmdAbout (CommandThread cmdThread, string cmdName, string[] args)
 Execution method that prints some information about the application. More...
 
virtual string CmdApplicationInfo (CommandThread cmdThread, string cmdName, string[] args)
 Execution method that prints some information about the current application. More...
 
virtual string CmdComment (CommandThread cmdThread, string cmdName, string[] args)
 Execution method that does nothing (for comments). More...
 
virtual string CmdPrintCommands (CommandThread cmdThread, string cmdName, string[] args)
 Execution method for command that prints names of all installed applications. More...
 
virtual string CmdTestProduct (CommandThread cmdThread, string cmdName, string[] args)
 Executinon method for test command, which just prints its name and arguments. More...
 
virtual string CmdTest (CommandThread cmdThread, string cmdName, string[] args)
 Executinon method for test command, which just prints its name and arguments. More...
 
virtual string CmdTestSpeed (CommandThread cmdThread, string cmdName, string[] args)
 Executinon method for TestSpeed command, performs test of speed of numerical computations on LU decomposition, and outputs the result and comparison with reference results (usually achieved on Igor's computer). More...
 
virtual string CmdTestSpeedLong (CommandThread cmdThread, string cmdName, string[] args)
 Executinon method for TestSpeedLong command, performs a longer test of speed of numerical computations on QR decomposition, and outputs the result and comparison with reference results (usually achieved on Igor's computer). More...
 
virtual string CmdTestQR (CommandThread cmdThread, string cmdName, string[] args)
 Executinon method for TestQR command, performs test of QR decomposition. More...
 
virtual double TestComputationalTimesQR (int numEq, int outLevel)
 Test of QR decomposition. Writes times necessary for all steps. More...
 
virtual string CmdTestLU (CommandThread cmdThread, string cmdName, string[] args)
 Executinon method for TestLU command, performs test of LU decomposition. More...
 
virtual double TestComputationalTimesLU (int numEq, int outLevel)
 Test of LU decomposition. More...
 

Protected Attributes

bool _caseSensitive = false
 
SortedDictionary< string,
ApplicationCommandDelegateMt
_commandsMt = new SortedDictionary<string, ApplicationCommandDelegateMt >()
 
CommandThread _globalThread = null
 
CommandStackFrame _globalAuxiliaryFrame = null
 
SortedDictionary< string, string > _variables = new SortedDictionary<string, string>()
 
SortedDictionary< string,
ModuleDelegate
_modules = new SortedDictionary<string, ModuleDelegate>()
 
List< String > _loadedModules = new List<string>()
 
string _name = DefaultName
 
string _sescription = "Application's command-line interpreter."
 
string _description
 
char _variableStart = '$'
 
char _expressionStart = '#'
 
bool _exit = false
 
int _outputLevel = DefaultOutputLevel
 Default level of output for some of the interpreters' functionality (e.g. asynchronous command execution). More...
 
ExpressionEvaluatorJs _evalutorJs
 
ExpressionEvaluatorJint _evaluatorJint
 
string[] _emptyCommandLine = { null }
 
List< CommandLineJobContainer_parallelCommands
 
ThreadPriority _threadPriority = UtilSystem.ThreadPriority
 
bool _systemPriorityUpdatesRegistered = false
 Whether the "event" handler for system priprity changes has already been registered. More...
 
int _maxNumParallelServers = 0
 
string _ModuleTestCommandPrefix = "TestModule_"
 
const string TestSpeedReferenceSystem = "Intel Core i7 2.8 GHz"
 Description of reference configuration. More...
 
const int TestSpeedNumEq = 500
 Number of equations used to test speed of numerical computations. More...
 
const double TestSpeedReferenceTime = 0.640917
 Reference execution time for speed test for numerical operations. More...
 
const int TestSpeedLongNumEq = 1000
 Number of equations used to test speed of numerical computations. More...
 
const double TestSpeedLongReferenceTime = 63.9688
 Reference execution time for speed test for numerical operations. More...
 

Static Protected Attributes

static List
< CommandLineApplicationInterpreter
_interpreters = new List<CommandLineApplicationInterpreter>()
 
static int DefaultNumEquations = 1000
 

Properties

bool CaseSensitive [get, protected set]
 
object Lock [get]
 This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More...
 
CommandStackFrame GlobalFrame [get]
 Global frame where global variables are stored. More...
 
CommandThread MainThread [get, protected set]
 Stack frames (containing variables) and other data for the main interpretation thread. More...
 
List< CommandThreadCommandThreads [get, set]
 List of command threads that exist on the interpreter. More...
 
int NumCommandThreads [get]
 Returns the number of command threads that are currently contained on the interpreter. More...
 
bool Exit [get, protected set]
 Whether the exit flag is set, usually causing interpreter to stop. More...
 
static List
< CommandLineApplicationInterpreter
Interpreters [get]
 
static
CommandLineApplicationInterpreter 
Global [get]
 Global command-line interpreter. More...
 
string Name [get, set]
 Name of the current interpreter. More...
 
string Description [get, set]
 Description of hte current interpreter. More...
 
int OutputLevel [get, set]
 Level of output for some of the interpreter's functionality (e.g. asynchronous command execution). More...
 
bool WarnCommandReplacement [get, set]
 Specifies whether a wrning should be launched whenever an installed command is being replaced. More...
 
virtual bool ThrowExceptions [get, set]
 Flag specifying whether exceptions are thrown in interactive mode or not. More...
 
bool UseJint [get, protected set]
 Flag that specified whether Jint JavaCcript engine is used or not. More...
 
ExpressionEvaluatorJs EvaluatorJs [get, protected set]
 Expression evaluator used by the current More...
 
string[] EmptyCommandLine [get]
 
List< CommandLineJobContainerParallelCommands [get]
 List where parallel commands are stored. More...
 
ThreadPriority ThreadPriority [get, set]
 Priority of the current interpreter main thread and threads for executing the parallel commands. More...
 
int MaxNumParallelServers [get, set]
 Maximal number of parallel servers allowed to be created for parallel command execution. More...
 
List< IAsyncResult > AsyncCommandResults [get]
 List of IAsyncResult objects that were returned by asynchronous command invocations. More...
 
bool AsyncEndInvokeInCallback [get, set]
 Flag indicating whether Endinvoke must be called in the callback of asynchronous command calls. More...
 
virtual
LoadableScriptInterpreterBase 
LoadableScriptInterpreter [get, set]
 Interpreter based on dynamically loadable scripts. This enables installation and running of commands that are based on C# code that is dynamically compiled. Ihe object is created on first get access if it has not been assigned before. This property can be overridden in derived classes such that getter creates a dynamically loadable script - based interpreter of another kind. This is important because different script loaders (in particuar with different dynamic libraries referenced) will be used in different contexts. Another possibility is that a custom object is assigned to this property, usually in the initialization stage of the current interpreter. More...
 
ScriptLoaderBase ScriptLoader [get]
 Gets the script loader that is used by the current command-line interpreter for dynamically loading commands from scripts. More...
 
SortedList< string,
IpcStreamServerBase
PipeServers [get]
 Array of registered pipe servers, accessible through server name. More...
 
SortedList< string,
IpcStreamClientBase
IpcClients [get]
 Array of registered pipe clients, accessible through client name. More...
 
- Properties inherited from IG.Lib.ICommandLineApplicationInterpreter
string Name [get, set]
 Name of the current interpreter. More...
 
string Description [get, set]
 Description of hte current interpreter. More...
 
CommandStackFrame GlobalFrame [get]
 Global frame where global variables are stored. More...
 
CommandThread MainThread [get]
 Main command thread of the interpreter (usually run in the same thread where interpreter was created). More...
 
int NumCommandThreads [get]
 Returns the number of command threads that are currently contained on the interpreter. More...
 
bool Exit [get]
 Whether the exit flag is set, usually causing interpreter to stop. More...
 
int OutputLevel [get, set]
 Level of output for some of the interpreter's functionality (e.g. asynchronous command execution). More...
 
bool WarnCommandReplacement [get, set]
 Specifies whether a wrning should be launched whenever an installed command is being replaced. More...
 
LoadableScriptInterpreterBase LoadableScriptInterpreter [get, set]
 Interprater based on dynamically loadable scripts. This enables installation and running of commands that are based on C# code that is dynamically compiled. Ihe object is created on first get access if it has not been assigned before. This property can be overridden in derived classes such that getter creates a dynamically loadable script - based interpreter of another kind. This is important because different script loaders (in particuar with different dynamic libraries referenced) will be used in different contexts. Another possibility is that a custom object is assigned to this property, usually in the initialization stage of the current interpreter. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Private Member Functions

void ModuleTest1 (string name, ICommandLineApplicationInterpreter interpreter)
 Loads the first built-in test module (just for testing modules). More...
 
void ModuleTest2 (string name, ICommandLineApplicationInterpreter interpreter)
 Loads the second built-in test module (just for testing modules). More...
 

Private Attributes

object _mainLock = new object()
 
CommandThread _mainThread = null
 
List< CommandThread_commandThreads = new List<CommandThread>()
 Main command thread of the interpreter (usually run in the same thread where interpreter was created). More...
 
bool _warnCommandReplacement = DefaultWarnCommandReplacement
 
bool _throwExceptions = false
 
bool _useJint = true
 
ParallelJobDispatcherGen
< CommandLineJobContainer,
CommandLineJobContainer
_parallelDispatcher
 
List< IAsyncResult > _asyncCommandResults
 List of asynchronous results objects from individual asynchronous executions. More...
 
bool _asyncEndInvokeInCallback = true
 
List
< CommandAdapterSingleThreaded
_stAdapters = new List<CommandAdapterSingleThreaded>()
 
LoadableScriptInterpreterBase _loadableScriptInterpreter
 
SortedList< string,
IpcStreamServerBase
_pipeServers = null
 
SortedList< string,
IpcStreamClientBase
_pipeClients = null
 

Detailed Description

Simple command-line application interpreters, holds a set of commands that can be executed by name. Each of these command can take an arbitrary number of string arguments. Interpreter has its internal variables, which are strings. Each variable has a name and a value. If any arguments (and even command) start with the '$' character then then it is treated as reference to a variable and is substituted with the value of that variable (whose name follows the '$' character) before it is used.

This is a case of a very primitive interpreter, which can be used only for finding and executing commands by name and passing an array of strig arguments to them.

$A Igor Nov08;

Constructor & Destructor Documentation

IG.Lib.CommandLineApplicationInterpreter.CommandLineApplicationInterpreter ( )
inline

Creates a new MessyApplication object initialized with some basisc applications.

The flag indicating whether interpreter is case sensitive or not is set to DefaultCaseSensitive

IG.Lib.CommandLineApplicationInterpreter.CommandLineApplicationInterpreter ( bool  caseSensitive)
inline

Construct a new commandline interpreter object initialized with some basisc commands.

Parameters
caseSensitiveFlag that specifies whether command names are case sensitive.

Member Function Documentation

virtual void IG.Lib.CommandLineApplicationInterpreter.InitCommandLineApplicationInterpreterBasic ( bool  caseSensitive)
inlineprotectedvirtual

Performs basic initializations of the interpreter.

Parameters
caseSensitiveWhether interpreter is case sensitive or not.
virtual void IG.Lib.CommandLineApplicationInterpreter.InitCommands ( )
inlineprotectedvirtual

Installs basic commands on the interpreter.

CommandThreadBase IG.Lib.CommandLineApplicationInterpreter.GetCommmandThread ( int  whichCommandThread)
inline

Returns the specified command thread for the current interpreter.

Parameters
whichCommandThreadIndex of the thread on the list of interpreter's threads.

Implements IG.Lib.ICommandLineApplicationInterpreter.

CommandThread IG.Lib.CommandLineApplicationInterpreter.AddNewThread ( )
inline
virtual bool IG.Lib.CommandLineApplicationInterpreter.IsVariableReference ( CommandThread  cmdThread,
string  str 
)
inlineprotectedvirtual

Returns true if the specified string represents a variable reference, false otherwise.

Parameters
cmdThreadCommand thread that is being executed.
strString that is checked.
virtual string IG.Lib.CommandLineApplicationInterpreter.SubstituteVariableOrExpressionReference ( CommandThread  cmdThread,
string  str 
)
inlineprotectedvirtual

Returns value of the referenced variable if the specified string represents a variable reference (begins with the variableStart character, usually '$'), otherwise the original sting is returned.

Parameters
cmdThreadCommand thread that is being executed.
strString that is eventually substituted by variable value in the case that it represents a variable reference.
InterpreterVariable IG.Lib.CommandLineApplicationInterpreter.GetLocalVariable ( CommandThread  cmdThread,
string  varName,
int  framesBelowTop 
)
inline

Returns local variable with the specified name that is defined specified number of frames below the top stack frame.

Null is returned if the variable does not exist on that frame.

Parameters
cmdThreadThread where this method is executed.
varNameName of the variable to be returned.
framesBelowTopNumber of frames below the top-most stack frame where the variable is defined.
Returns

References IG.Lib.CommandStackFrame.GetParentStackFrame().

InterpreterVariable IG.Lib.CommandLineApplicationInterpreter.GetFirstLocalVariable ( CommandThread  cmdThread,
string  value 
)
inline
InterpreterVariable IG.Lib.CommandLineApplicationInterpreter.GetFiestLocalOrGlobalVariable ( CommandThread  cmdThread,
string  value 
)
inline
virtual InterpreterVariable IG.Lib.CommandLineApplicationInterpreter.GetGlobalVariable ( string  varName)
inlinevirtual

Returns the specified global variable, if such a variable exists.

Parameters
varNameName of the global variable to be returned.
virtual string IG.Lib.CommandLineApplicationInterpreter.GetGlobalVariableValue ( string  varName)
inlinevirtual

Returns value of the specified global variable, if such a global variable exists.

Parameters
varNameName of the global variable whose value is returned.
virtual void IG.Lib.CommandLineApplicationInterpreter.SetGetGlobalVariableValue ( string  varName,
string  varValue 
)
inlinevirtual

Assigns value to the specified global variable, if such a global variable exists.

Parameters
varNameName of the variable.

Value that is assigned to the variable.

Parameters
varValueValue to be assigned.
virtual string IG.Lib.CommandLineApplicationInterpreter.GetVariableValue ( CommandThread  cmdThread,
string  varName 
)
inlinevirtual

Returns the value of the specified variable of the current command line interpreter. null is returned if the specified variable does not exist.

Parameters
cmdThreadCommand thread that is being executed.
varNameName of the variable.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual string IG.Lib.CommandLineApplicationInterpreter.SetVariableValue ( CommandThread  cmdThread,
string  varName,
string  value 
)
inlinevirtual

Sets the specified variable to the specified value.

Parameters
cmdThreadCommand thread that is being executed.
varNameName of the variable to be set.
valueValue that is assigned to the variable.
Returns
New value of the variable.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual string IG.Lib.CommandLineApplicationInterpreter.ClearVariable ( CommandThread  cmdThread,
string  varName 
)
inlinevirtual

Clears (removes) the specified variable.

Parameters
cmdThreadCommand thread that is being executed.
varNameName of the variable to be cleared.
Returns
null.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual string IG.Lib.CommandLineApplicationInterpreter.PrintVariable ( CommandThread  cmdThread,
string  varName 
)
inlinevirtual

Prints the specified variable.

Parameters
cmdThreadCommand thread that is being executed.
varNameName of the variable to be cleared.
Returns
null.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual void IG.Lib.CommandLineApplicationInterpreter.AddEnterExitCommands_Block ( CommandStackFrame  frame)
inlineprotectedvirtual

Adds block enter/exit commands for the "Block" block to the specified stack frame.

This method should be executed by the appropriate block enter command for the specific kind of code blocks.

Parameters
frameStack frame on which the block entry/exit commands are added.
virtual void IG.Lib.CommandLineApplicationInterpreter.AddEnterExitCommands_BeginRepeat ( CommandStackFrame  frame)
inlineprotectedvirtual

Adds block enter/exit commands for the "BeginRepeat" block to the specified stack frame.

This method should be executed by the appropriate block enter command for the specific kind of code blocks.

Parameters
frameStack frame on which the block entry/exit commands are added.
virtual void IG.Lib.CommandLineApplicationInterpreter.AddEnterExitCommands_BeginCalc ( CommandStackFrame  frame)
inlineprotectedvirtual

Adds block enter/exit commands for the "BeginCalc" block to the specified stack frame.

This method should be executed by the appropriate block enter command for the specific kind of code blocks.

Parameters
frameStack frame on which the block entry/exit commands are added.
virtual void IG.Lib.CommandLineApplicationInterpreter.AddEnterExitCommands_If ( CommandStackFrame  frame)
inlineprotectedvirtual

Adds block enter/exit commands for the "If" block to the specified stack frame.

This method should be executed by the appropriate block enter command for the specific kind of code blocks.

Parameters
frameStack frame on which the block entry/exit commands are added.
virtual void IG.Lib.CommandLineApplicationInterpreter.AddEnterExitCommands_ElseIf ( CommandStackFrame  frame)
inlineprotectedvirtual

Adds block enter/exit commands for the "ElseIf" block to the specified stack frame.

This method should be executed by the appropriate block enter command for the specific kind of code blocks.

Parameters
frameStack frame on which the block entry/exit commands are added.
virtual void IG.Lib.CommandLineApplicationInterpreter.AddEnterExitCommands_Else ( CommandStackFrame  frame)
inlineprotectedvirtual

Adds block enter/exit commands for the "ElseIf" block to the specified stack frame.

This method should be executed by the appropriate block enter command for the specific kind of code blocks.

Parameters
frameStack frame on which the block entry/exit commands are added.
virtual void IG.Lib.CommandLineApplicationInterpreter.AddEnterExitCommands_While ( CommandStackFrame  frame)
inlineprotectedvirtual

Adds block enter/exit commands for the "While" block to the specified stack frame.

This method should be executed by the appropriate block enter command for the specific kind of code blocks.

Parameters
frameStack frame on which the block entry/exit commands are added.
virtual void IG.Lib.CommandLineApplicationInterpreter.EnterBlock ( CommandThread  cmdThread,
bool  executeCommands = true,
bool  saveCommands = false 
)
inlinevirtual

Enters a new code block. A new stack frame is added where code is executed, such that the embedded code block has isolated local variables.

Must be paired with ExitBlock.

Parameters
cmdThreadCommand thread on which code is exected.
executeCommandsWhether commands should be exected immediately as they are encountered.

If false then execution is deferred until end of block is reached.

Parameters
saveCommandsWhether commands hould be saved. Mainly used for testing purposes, but if executeCommands this flag is switched on, so that commands are collected and can be executed when the end of the block is reached.
virtual string IG.Lib.CommandLineApplicationInterpreter.ExitBlock ( CommandThread  cmdThread)
inlinevirtual

Exits the current code block.

Must be paired with EnterBlock.

Parameters
cmdThreadCommand execution thread where execution occurs.

References IG.Lib.CommandStackFrame.GetParentStackFrame().

virtual void IG.Lib.CommandLineApplicationInterpreter.EnterRepeatBlock ( CommandThread  cmdThread,
int  numRepetitions = 1 
)
inlinevirtual

Enters a new repeat code block. A new stack frame is added where code is executed, such that the embedded code block has isolated local variables.

Block will be executed (repeatedly) the specified number of times and execution time measured and reported.

Must be paired with ExitRepeatBlock.

Parameters
cmdThreadCommand thread on which code is exected.
numRepetitionsNumber of times the code block will be repeated.
virtual string IG.Lib.CommandLineApplicationInterpreter.ExitRepeatBlock ( CommandThread  cmdThread)
inlinevirtual

Exits the current repetition code block.

Must be paired with EnterRepeatBlock.

Parameters
cmdThreadCommand execution thread where execution occurs.

References IG.Lib.CommandStackFrame.GetParentStackFrame(), IG.Lib.StopWatch1.Start(), IG.Lib.StopWatch1.Stop(), IG.Lib.StopWatch1.Time, IG.Lib.StopWatch1.TotalCpuTime, and IG.Lib.StopWatch1.TotalTime.

virtual void IG.Lib.CommandLineApplicationInterpreter.EnterJsBlock ( CommandThread  cmdThread)
inlinevirtual

Enters a new JavaScript calculator's code block. A new stack frame is added, such that the embedded code block collects command lines independently of the containing blocks, and lines can be later concatenated into a single string and sent to JavaScript evaluator when the block exits.

Must be paired with ExitJsBlock.

Important: JavaScript code block is executed in the parent stack frame (i.e. the frame that was executiing before the JavaScript block entered).

Parameters
cmdThreadCommand thread on which code is exected.
virtual string IG.Lib.CommandLineApplicationInterpreter.ExitJsBlock ( CommandThread  cmdThread)
inlinevirtual

Exits the current JavaScript code block, and sends the JavaScrit code contained within the block (consisting of concatenated command lines entered within the block) to the JavaScript evaluator for execution.

Must be paired with EnterJsBlock.

JavaScript code is executed in the parent stack frame (i.e. the frame on which code block was called).

Parameters
cmdThreadCommand execution thread where execution occurs.
virtual void IG.Lib.CommandLineApplicationInterpreter.EnterIf ( CommandThread  cmdThread,
bool  condition 
)
inlinevirtual

Enters the If block.

Parameters
cmdThreadCommand thread where commands are executed.
conditionValue of the condition of the if branch.
virtual void IG.Lib.CommandLineApplicationInterpreter.EnterElseIf ( CommandThread  cmdThread,
bool  condition 
)
inlinevirtual

Enters the ElseIf block.

Parameters
cmdThreadCommand thread where commands are executed.
conditionValue of the condition of the branch.
virtual void IG.Lib.CommandLineApplicationInterpreter.EnterElse ( CommandThread  cmdThread)
inlinevirtual

Enters the ElseIf block.

Parameters
cmdThreadCommand thread where commands are executed.
virtual string IG.Lib.CommandLineApplicationInterpreter.ExitIf ( CommandThread  cmdThread)
inlinevirtual

Enters the EndIf block.

Parameters
cmdThreadCommand thread where commands are executed.
virtual void IG.Lib.CommandLineApplicationInterpreter.EnterWhile ( CommandThread  cmdThread,
string  conditionString 
)
inlinevirtual

Enters the While block.

Parameters
cmdThreadCommand thread where commands are executed.
conditionStringValue of the condition of the while loop.
virtual string IG.Lib.CommandLineApplicationInterpreter.ExitWhile ( CommandThread  cmdThread)
inlinevirtual

Exits the current JavaScript code block, and sends the JavaScrit code contained within the block (consisting of concatenated command lines entered within the block) to the JavaScript evaluator for execution.

Must be paired with EnterJsBlock.

JavaScript code is executed in the parent stack frame (i.e. the frame on which code block was called).

Parameters
cmdThreadCommand execution thread where execution occurs.

References IG.Lib.Util.TryParseBoolean().

virtual string [] IG.Lib.CommandLineApplicationInterpreter.GetArguments ( string  commandLine)
inlinevirtual

Parses a command line and extracts arguments from it. Arguments can be separated according to usual rules for command-line arguments: spaces are separators, there can be arbitraty number of spaces, and if we want an argument to contain spaces, we must enclose it in double quotes. Command line can also contain the command name followed by arguments. In this case it is treated in the same way, and command can be obtained simply as the first string in the returned array.

Parameters
commandLineCommand line that is split to individual arguments. Command line can also contain a command, which is treated equally.
Returns
An array of arguments.

Implements IG.Lib.ICommandLineApplicationInterpreter.

References IG.Lib.UtilStr.GetArgumentsArray().

virtual string IG.Lib.CommandLineApplicationInterpreter.RunFile ( CommandThread  cmdThread,
string  filePath 
)
inlinevirtual

Runs all commands that are written in a file. Each line of a file is interpreted as a single command, consisting of command name followed by arguments.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
filePathPath to the file containing commands.
Returns
Return value of the last command.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual string IG.Lib.CommandLineApplicationInterpreter.RunInteractive ( CommandThread  cmdThread)
inlinevirtual

Reads commands one by one from the standard input and executes them.

Parameters
cmdThreadCommand thread that is being executed.

Implements IG.Lib.ICommandLineApplicationInterpreter.

References IG.Lib.UtilConsole.Read().

static void IG.Lib.CommandLineApplicationInterpreter.ExecuteSystemCommand ( string[]  args)
inlinestatic

Executes the specified system commmand and blocks until the execution completes.

Parameters
argsArray of strings where the first element is command to be executed, and the subsequent elements are command-line arguments.
static void IG.Lib.CommandLineApplicationInterpreter.ExecuteSystemCommand ( string  command,
params string[]  args 
)
inlinestatic

Executes system command with arguments.

Parameters
commandCommand string, usually a path to executable or other type of command.
argsArguments to system command.

References IG.Lib.UtilSystem.ExecuteSystemCommand().

virtual void IG.Lib.CommandLineApplicationInterpreter.ExecuteSystemCommandsInteractive ( )
inlineprotectedvirtual

Reads commands with their arguments ont by one from the console and executes them as system commands.

References IG.Lib.UtilConsole.Read().

string IG.Lib.CommandLineApplicationInterpreter.EvaluateJsInteractive ( )
inline

Runs interpreter's JavaScript expression evaluator interactively.

string IG.Lib.CommandLineApplicationInterpreter.EvaluateJs ( string  codeBlock)
inline

Evaluates the specified block of code by the internal JavaScript evaluator.

Parameters
codeBlockBlock of JavaScript code that is evaluateed (executed).
Returns
The returned value of the evaluated code (or null if the code does not return anything).
string IG.Lib.CommandLineApplicationInterpreter.EvaluateJs ( string[]  args)
inline

Evaluates a JavaScript expression obtained by merging elements of the array parameter args . These usually represent parts of the code block to evaluate, obtained through command arguments or as commandlines read (but not executed) by the commandline interpreter.

Parameters
argsAn array of strings that are concatenated in order to form the evaluated expression.
string [] IG.Lib.CommandLineApplicationInterpreter.GetCommands ( )
inline

Returns an array of installed commands.

The returned array is created anew and command names are copied to it from a collection of keys of a sorted dictionary (type SortedDictionary{T, T}).

virtual bool IG.Lib.CommandLineApplicationInterpreter.GetCommandDelegate ( string  commandName,
ref ApplicationCommandDelegateMt  appDelegate 
)
inlineprotectedvirtual

Obtains and stores the delegate that is used for execution of the specified command, and retrns an iindicator ehether the command is installed on the interpreter or not.

Interpreter seinsitivity is handled by the method.

Parameters
commandNameName of the command for which execution delegate is obtained.
appDelegateReference to the variable where this function stores the obtained command execution delegate.
Returns
True if the specified command is installed on the current interpreter, false if not.
bool IG.Lib.CommandLineApplicationInterpreter.ContainsCommand ( string  commandName)
inline

Returns true if the specified command is installed on the interpreter, false if not.

Case sensitivity of the interpreter is treated appropriately.

Parameters
commandNameName of the command that is checked.
Returns
True if the specified command is installed on the current interpreter, false if not.

Implements IG.Lib.ICommandLineApplicationInterpreter.

References IG.Lib.ApplicationCommandDelegateMt().

virtual string IG.Lib.CommandLineApplicationInterpreter.RunRepeat ( CommandThread  cmdThread,
string[]  args 
)
inlinevirtual

Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate.

The interpreter's output level is used.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
argsCommand arguments where the first argument is command name. The rest of the arguments are collected and passed to the command delegate.
virtual string IG.Lib.CommandLineApplicationInterpreter.RunRepeatVerbose ( CommandThread  cmdThread,
string[]  args 
)
inlinevirtual

Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate.

Output level 3 is used, such that all information is output to console.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
argsCommand arguments where the first argument is command name. The rest of the arguments are collected and passed to the command delegate.
virtual string IG.Lib.CommandLineApplicationInterpreter.RunRepeatSilent ( CommandThread  cmdThread,
string[]  args 
)
inlinevirtual

Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate.

Output level 0 is used, such that no information is output to console.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
argsCommand arguments where the first argument is command name. The rest of the arguments are collected and passed to the command delegate.
virtual string IG.Lib.CommandLineApplicationInterpreter.RunRepeatSpecificOutputLevel ( CommandThread  cmdThread,
string[]  args 
)
inlinevirtual

Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate.

Output level is defined by the first argument. Level 0 means no output, level 1 means that summary is written to the console, and level e means that a note is printed before and afterr each repetition starts.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
argsCommand arguments where the first argument is command name. The rest of the arguments are collected and passed to the command delegate.
virtual string IG.Lib.CommandLineApplicationInterpreter.RunRepeat ( CommandThread  cmdThread,
int  outputLevel,
string[]  args 
)
inlinevirtual

Runs command several times where the first argument is number of repetitions, second argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
outputLevelLevel of output of the command.
argsCommand arguments where the first argument is command name. The rest of the arguments are collected and passed to the command delegate.

References IG.Lib.StopWatch1.Start(), IG.Lib.StopWatch1.Stop(), IG.Lib.StopWatch1.Time, IG.Lib.StopWatch1.TotalCpuTime, and IG.Lib.StopWatch1.TotalTime.

virtual string IG.Lib.CommandLineApplicationInterpreter.RunTryCatch ( CommandThread  cmdThread,
int  outputLevel,
string[]  args 
)
inlinevirtual

Runs command in a try-catch block, where first argument is command name. Extracts command name and runs the corresponding command delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
outputLevelLevel of output of the command.
argsCommand arguments where the first argument is command name. The rest of the arguments are collected and passed to the command delegate.
virtual void IG.Lib.CommandLineApplicationInterpreter.Run ( CommandThread  cmdThread,
List< string >  commandLines 
)
inlinevirtual

Runs a set of command by the current interpreter.

Parameters
cmdThreadInterpreter's thread where commands are executed.
commandLinesList of comands, in raw string form, to be executed.

Referenced by IG.Lib.ApplicationCommandlineBase.AplicationMain().

string IG.Lib.CommandLineApplicationInterpreter.RunWithoutModifications ( CommandThread  cmdThread,
string  commandName,
params string[]  commandArguments 
)
inline

Runs the specified command with specified name, installed on the current application object, without any modifications of the command arguments.

Parameters
cmdThreadInterpreter's command thread where command is executed.
commandNameCommand name.
commandArgumentsCommand arguments.

This method should not be overriden, but the Run(CommandThread, string, string[]) method can be, e.g. in order to perform some argument or command name transformations.

Implements IG.Lib.ICommandLineApplicationInterpreter.

References IG.Lib.ApplicationCommandDelegateMt().

virtual string IG.Lib.CommandLineApplicationInterpreter.Run ( CommandThread  cmdThread,
string  commandName,
params string[]  commandArguments 
)
inlinevirtual

Runs the specified command with specified name, installed on the current application object.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
commandNameCommand name.
commandArgumentsCommand arguments.

Reimplemented in IG.Lib.CommandLineApplicationScriptInterpreter.

string IG.Lib.CommandLineApplicationInterpreter.Run ( CommandThread  cmdThread,
string[]  args 
)
inline

Runs command where the first argument is command name. Extracts command name and runs the corresponding command delegate.Before running it, arguments for the application delegate are extracted and then passed to the delegate.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
argsCommand arguments where the first argument is command name. The rest of the arguments are collected and passed to the command delegate.

Implements IG.Lib.ICommandLineApplicationInterpreter.

string IG.Lib.CommandLineApplicationInterpreter.Run ( CommandThread  cmdThread,
string  commandLine 
)
inline

Runs command that is specified as a single string, composed of command name and its argumens. Splits the command and runs it.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
commandLineCommandline - string containing command and its arguments.
virtual string IG.Lib.CommandLineApplicationInterpreter.Run ( string  command)
inlinevirtual

Runs the specified (unsplit) command on the interpreter's main thread.

Parameters
commandComamnd to be run (command with arguments, separated by spaces).
Returns
virtual string IG.Lib.CommandLineApplicationInterpreter.Run ( params string[]  commandAndArgs)
inlinevirtual

Runs the specified (split) command with arguments on the interpreter's main thread.

Parameters
commandAndArgsArray containing command to be run and its arguments.
Returns
void IG.Lib.CommandLineApplicationInterpreter.AddParallelCommand ( CommandLineJobContainer  commandData)
inline

Adds a new parallel command data to the list of commands executed by in parallel.

Parameters
commandDataCommand data object that is added to the list of barallelly executed commands.
CommandLineJobContainer IG.Lib.CommandLineApplicationInterpreter.GetParallelCommandData ( int  id)
inline

Returns the command data object of the parallel command that with the specified ID.

Parameters
idIdentification nuber of the job container that carries command data and executes it.

References IG.Lib.CommandLineJobContainer.Id.

void IG.Lib.CommandLineApplicationInterpreter.PrintParallelCommands ( bool  printAll)
inline

Prints the commands that were scheduled for parallel execution, together with their current status, results and execution times (when available).

Parameters
printAllWhether all commands are printed (included those already completed). If false then only completed commands are printed.

References IG.Lib.CommandLineJobContainer.ToString().

virtual void IG.Lib.CommandLineApplicationInterpreter.UpdateThreadPriorityFromSystem ( )
inlinevirtual

Updates thread priority (property ThreadPriority) of the interpreter to the current global thread priority (the UtilSystem.ThreadPriority property).

References IG.Lib.UtilSystem.ThreadPriority.

void IG.Lib.CommandLineApplicationInterpreter.RegisterSystemPriorityUpdating ( )
inline

Registers the UpdateThreadPriorityFromSystem method as "event handler" for system priority changes. After registration, this method will be called every time the value of the UtilSystem.ThreadPriority property changes.

References IG.Lib.UtilSystem.AddOnThreadPriorityChange().

Referenced by IG.Lib.ShellApplication< InterpreterType >.CreateInterpreter().

void IG.Lib.CommandLineApplicationInterpreter.UnregisterSystemPriorityUpdating ( )
inline

Unregisters the UpdateThreadPriorityFromSystem method as "event handler" for system priority changes.

See also
RegisterSystemPriorityUpdating

References IG.Lib.UtilSystem.RemoveOnThreadPriorityChange().

int [] IG.Lib.CommandLineApplicationInterpreter.RunParallelRepeat ( int  numRepeat,
string  command,
string[]  commandArguments 
)
inline

Runs the specified command with arguments the specified number of times in parallel threads by using the interpreter's job dispatcher with corresponding parallel servers.

Parameters
numRepeatNumber of parallel executions of the command that are started.
commandCommand that is run in each of the parallel threads.
commandArgumentsCommand arguments.
Returns
An array of identification numbers of parallel jobs that take over execution of the command. Queries about jobs progress and results can be made by using this identification number.

Parallel commands are scheduled for execution by interpreter's dispathcer (the ParallelDispatcher property), which delegates execution to its parallel servers.

Before transferring them to the dispatcher, commands are wrapped into job container object of type CommandLineJobContainer. Job containers are stored in a list, such that execution status and results can be accessed through contaier ID (which is returned by the method).

New parallel servers are dynamically added to the dispatcher if there are no idle servers to execute the parallel command immediately at the time it is called. However, the maximal number of parallel servers can be limited by the MaxNumParallelServers property.

References IG.Lib.CommandLineJobContainer.CommandArguments, IG.Lib.CommandLineJobContainer.CommandName, and IG.Lib.CommandLineJobContainer.Id.

int IG.Lib.CommandLineApplicationInterpreter.RunParallel ( string  command,
string[]  commandArguments 
)
inline

Runs she specified command with arguments once in a parallel thread by using the interpreter's job dispatcher with corresponding parallel servers.

Parameters
commandCommand that is run in each of the parallel threads.
commandArgumentsCommand arguments.
Returns
Identification number of the parallel job that take over execution of the command. Queries about job progress and results can be made by using this identification number.
See also
RunParallelRepeat(int, string, string[])
virtual string IG.Lib.CommandLineApplicationInterpreter.RunAsync ( CommandThread  cmdThread,
string[]  args 
)
inlinevirtual

Runs a command asynchronously where the first argument is command name. Extracts command name and runs the corresponding application delegate. Before running it, arguments for the application delegate are extracted and then passed to the delegate.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
argsCommand arguments where the first argument is command name. The rest of the arguments are collected and passed to the command delegate.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual string IG.Lib.CommandLineApplicationInterpreter.RunAsync ( CommandThread  cmdThread,
string  commandName,
params string[]  commandArguments 
)
inlinevirtual

Runs the command with specified name (installed on the current interpreter object) asynchronously.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
commandNameCommand name.
commandArgumentsCommand arguments.
Returns
ID of asynchronous run used to query results and whether command has completed, or -1 if a call was not launched (actually, an exception would be thrown in this case).

Implements IG.Lib.ICommandLineApplicationInterpreter.

References IG.Lib.ApplicationCommandDelegateMt().

bool IG.Lib.CommandLineApplicationInterpreter.AsyncIsCompleted ( int  id)
inline

Returns true if the asynchronous command execution identified by id has completed, and false otherwise.

Parameters
idID of the asynchronous command execution that is querried.
Returns

Implements IG.Lib.ICommandLineApplicationInterpreter.

bool IG.Lib.CommandLineApplicationInterpreter.AsyncIsAllCompleted ( )
inline

Returns true if all asynchronous command executions have completed, and false otherwise.

void IG.Lib.CommandLineApplicationInterpreter.AsyncWaitAll ( )
inline

Waits until all asynchronously commands that have been eventually executed by the current interpreter, complete.

It is sometimes necessary to call this method if any asynchronous command invocations were made because such commands are executed in background threads, which are automatically broken when all foreground threads complete.

Implements IG.Lib.ICommandLineApplicationInterpreter.

string IG.Lib.CommandLineApplicationInterpreter.AsyncWait ( int  callId)
inline

Waits for the specified asynchronous command (specified by command ID) to complete.

Parameters
callIdID of the asynchronous command execution.
Returns
Results of the command if the command has not completed before, null otherwise.

Implements IG.Lib.ICommandLineApplicationInterpreter.

References IG.Lib.ApplicationCommandDelegateMt().

void IG.Lib.CommandLineApplicationInterpreter.AsyncRunCallback ( IAsyncResult  ar)
inlineprotected

Callback method for asynchronous command executions.

Parameters
arAsynchronous results that are passed to the method.

References IG.Lib.ApplicationCommandDelegateMt().

virtual void IG.Lib.CommandLineApplicationInterpreter.AddCommand ( string  commandName,
ApplicationCommandDelegate  commandDelegate 
)
inlinevirtual

Adds command with the specified name.

Parameters
commandNameName of the commant.
commandDelegateDelegate that will be used to execute the command.

After cleaning is finished, this method can be removed (also from the interface) because ther will be no command functions that still use the old signature (with interpreter rather than thread as the first argument).

Implements IG.Lib.ICommandLineApplicationInterpreter.

References IG.Lib.CommandAdapterSingleThreaded.MultiThreadedApplication().

virtual void IG.Lib.CommandLineApplicationInterpreter.AddCommand ( string  commandName,
ApplicationCommandDelegateMt  commandDelegate 
)
inlinevirtual

Adds command with the specified name.

Parameters
commandNameName of the commant.
commandDelegateDelegate that will be used to execute the command.

WARNING: This should be removed later. It is only here such that when the signature of the old command functions is changed, the AddCommand can act on them, so no new errors need to be corrected. In the future, this shoud be removed, and AddCommandMt should be renamed to AddCommand, and the old obsolete AddCommand should be also removed.

[Obsolete "Converge both methods with the same signature to only one method - AddCommandMt should be used and renamed."]

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual void IG.Lib.CommandLineApplicationInterpreter.AddCommandMt ( string  commandName,
ApplicationCommandDelegateMt  commandDelegate 
)
inlinevirtual

Adds command with the specified name.

Parameters
commandNameName of the commant.
commandDelegateDelegate that will be used to execute the command.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual void IG.Lib.CommandLineApplicationInterpreter.RemoveCommand ( string  commandName)
inlinevirtual

Removes the command with the specified name.

Parameters
commandNameName of the commad.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual void IG.Lib.CommandLineApplicationInterpreter.RemoveAllCommands ( )
inlinevirtual

Removes all commands from the current interpreter.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual void IG.Lib.CommandLineApplicationInterpreter.AddModule ( string  moduleName,
ModuleDelegate  moduleDelegate 
)
inlinevirtual

Adds a new module to the interpreter. This adds an initialization function (via a delegate) which is executed when module module initialization is performed.

Parameters
moduleNameName of the module. When used, module names are case sensitive if commands are case sensitive.
moduleDelegateMethod that performs module initialization.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual void IG.Lib.CommandLineApplicationInterpreter.LoadModule ( string  moduleName)
inlinevirtual

Loads and initializes the specified module.

Parameters
moduleNameName of the module. It is case sensitive if commands are case sensitive.

Implements IG.Lib.ICommandLineApplicationInterpreter.

References IG.Lib.ModuleDelegate().

virtual string IG.Lib.CommandLineApplicationInterpreter.ModuleTestCommandName ( string  modulename)
inlinevirtual

Returns the standard name for the command that gets installed when a module is loaded.

Parameters
modulenameName of the module that is loaded.

Whenever a module is loaded,

virtual bool IG.Lib.CommandLineApplicationInterpreter.IsModuleLoaded ( string  moduleName)
inlinevirtual

Returns true if the specified module has been loaded on the interpreter, false if not.

Parameters
moduleNameName of the module.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual string IG.Lib.CommandLineApplicationInterpreter.RunScriptFile ( string  scriptFilePath,
string[]  initAndRunArgs 
)
inlinevirtual

Dynamically loads (temporarily, just for execution of the current commad) a class form the script contained in the specified file and executes its executable method. The file must contain the script that is dynamically loaded and executed, in form of definition of the appropriate class of type ILoadableScript. The dynamically loadable script class is loaded from the file and instantiated by the LoadableScriptInterpreter interpreter that is based on loadable scripts.

Parameters
scriptFilePathPath to the file containing loadable script must be the first argument to the method.
initAndRunArgsInitialization arguments for the object that will be instantiated in order to execute the script.
Returns
Result of execution returned by the executable method of the dynamically loaded script object.

Implements IG.Lib.ICommandLineApplicationInterpreter.

void IG.Lib.CommandLineApplicationInterpreter.LoadScript ( string  newCommandName,
string  scriptFilePath,
string[]  initArgs 
)
inline

Dynamically loads (compiles and instantiates) a loadable script class contained in the specified file, and installs a new command on LoadableScriptInterpreter and on the current interpreter, based on the dynamically created instance of the loaded (dynamically compiled) class.

Parameters
newCommandNameName of the newly installed command.
scriptFilePathName of the file containing the script code that defines a loadable script class.
initArgsArguments to the initialization method of the loaded object. The initialization method will be called before the first call to the executable method of the class, which takes care of execution of the newly installed command.

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual string IG.Lib.CommandLineApplicationInterpreter.RunLoadedScript ( string  commandName,
string[]  arguments 
)
inlinevirtual

Executes the specified command that has been dynamically loaded form a script.

Parameters
commandNameName under which the command is installed on the current intepreter and on interpreder based on dynamically loaded scripts (LoadableScriptInterpreter).
argumentsArguments to the command.
Returns
Results of command execution.

Implements IG.Lib.ICommandLineApplicationInterpreter.

string [] IG.Lib.CommandLineApplicationInterpreter.GetLoadableScriptReferencedAssemblies ( )
inline

Returns an array of assemblies that are currently referenced by the script loader that takes care of loading the dynamic scripts.

Returns

Implements IG.Lib.ICommandLineApplicationInterpreter.

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdSetVariableBase ( CommandThread  cmdThread,
string  cmdName,
string[]  args,
bool  setCommandResult 
)
inlineprotectedvirtual

Command. Sets the specified interpreter variable to the specified value.
Usage:

  1. Set the variable to the specified value: SetVar varName value
    varName: name of the variable to be set.
    value: value that is assigned to the variable.
  2. Set the variable to the return value of the specified command:
    SetVar varName command arg1 arg2 ...
    varName: name of the variable to be set.
    command: command whose return value is the value to be assigned to the variable.
    arg1: the first argument to the command (if any).
    arg2: the second argument to the command (if any).
    etc.
Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
setCommandResultIf true then in any case variable value is set to the result of an interpreter command (ven if command has no arguments). If false, then the first argument after variable name is considered an interpreter command only if additional arguments follow, otherwise it is considered as a literal value that is assigned to the variable.
Returns
Value of the variable after setting.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdSetVariable ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Sets the specified interpreter variable to the specified value.
Usage:

  1. Set the variable to the specified value: SetVar varName value
    varName: name of the variable to be set.
    value: value that is assigned to the variable.
  2. Set the variable to the return value of the specified command:
    SetVar varName command arg1 arg2 ...
    varName: name of the variable to be set.
    command: command whose return value is the value to be assigned to the variable.
    arg1: the first argument to the command (if any).
    arg2: the second argument to the command (if any).
    etc.
Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Value of the variable after setting.
virtual string IG.Lib.CommandLineApplicationInterpreter.CmdSetVariableToCommandResult ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Sets the specified interpreter variable to the result of the command (with arguments) that follow variable name.
Usage:

  1. Set the variable to the return value of the specified command:
    SetVar varName command [arg1 [arg2] ...]
    varName: name of the variable to be set.
    command: command whose return value is the value to be assigned to the variable.
    arg1: the first argument to the command (if any).
    arg2: the second argument to the command (if any).
    etc.
Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Value of the variable after setting.
virtual string IG.Lib.CommandLineApplicationInterpreter.CmdGetVariable ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Gets the specified variable and returns its value (or null if the variable does not exist). Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Value of the variable.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdClearVariable ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Clears the specified variable. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPrintVariable ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints the specified variable. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdThreadInfo ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints the specified variable. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdThreadId ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Returns the interpreter's current executing thread Id.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdStackLevel ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Returns the current interpreter's stack level for the currently executed interpreter thread.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdSuppressInteractive ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints and returns or sets and returns value of the flag that specifies whether interactive helpers and outputs are suppressed at the thread level.

Called without arguments just prints and returns the current flag value.

With one argument, the flag is set to that argument.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdSuppressInteractiveFrame ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints and returns or sets and returns value of the flag that specifies whether interactive helpers and outputs are suppressed for the currentt stack frame (the effect of this setting vanished when the stack frame exits).

Called without arguments just prints and returns the current flag value.

With one argument, the flag is set to that argument.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdBlock ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Enters a new command block. Optional arguments specify whether commands in the block are readily executed, and whether they are saved (for later execution or inspection).

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdEndBlock ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Exits the current command block. Exception is thrown if we are not currently within a plain code block.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdBeginRepeat ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Enters a new repeat block, which repeats execution of its body for the specified number of time and reports execution speed. Number of block execution repetitions must be specified as the only parameter of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdEndRepeat ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Exits the current repeat block, which repeats execution of its body for the specified number of time and reports execution speed.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdCalcJsBlock ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Enters a new block of JavaScript expressions that are evaluated. All lines within the block are treated as part of JavaScript code block, which is evaluated by the interpreter's JavaScript evaluator when the end of the block is reached.

A new command stack frame is entered only when execution is active, such that lines of JavaScript code are collected on a separate stack frame and do not in

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdEndCalcJsBlock ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Exits the current JavaScript expression block. If execution is active then the block of commands is sent to the internal JavaScript evaluator for execution.

Parameters
cmdThreadCommmand thread that executes the block..
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdIf ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints the specified variable. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdElseIf ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints the specified variable. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdElse ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints the specified variable. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdEndIf ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Ends the If/ElseIf/Else block. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdWhile ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Enters the while block. Arguments represent loop contioton that is evaluated at the begining of each iteration. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdEndWhile ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Ends (closes) the while loop. Variable name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdOutputLevel ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints or sets the current output level of the interpreter.

This determines how much information is ouptut by the interpreter about its actions.

Called without arguments just prints the current output level.

With one argument, ooutput level is set to that argument.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdOutputLevelCalc ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints or sets the current output level of the calculator (i.e., the JavaScript expression evaluator).

This determines how much information is ouptut by the calculator about its actions.

Called without arguments just prints the current output level.

With one argument, ooutput level is set to that argument.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdUseJint ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints and returns or sets and returns value of the flag that specifies whether the Jint engine is used to interpret JavaScript expressions.

Called without arguments just prints and returns the current flag value.

With one argument, the flag is set to that argument.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdWriteLine ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints concatenated argument with spaces between them.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.
virtual string IG.Lib.CommandLineApplicationInterpreter.CmdWrite ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints concatenated argument with spaces between them.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRead ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Reads value of the specified variable from console. Variable name must be the first argument; Eventual other arguments are concatenated and written to console.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunFile ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Runs a file by running all its lines in the current interpreter. File name must be the only argument of the command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunRepeatVerbose ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Runs another command repetitively the specified number of times. First argument must be the number of times command is run, the second argument must be command to be run repetitively, and the rest of the arguments are passed to that command as its arguments.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Concatenated results of all runs, separated by spaces.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunRepeat ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Runs another command repetitively the specified number of times. First argument must be the number of times command is run, the second argument must be command to be run repetitively, and the rest of the arguments are passed to that command as its arguments.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Concatenated results of all runs, separated by spaces.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdTryRun ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Runs another command in a try-catch block, such that if command throws an exception execution is not broken. The second argument must be command to be run, and the rest of the arguments are passed to that command as its arguments.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Concatenated results of all runs, separated by spaces.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdThtrowExceptions ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Sets the flag for rethrowing exceptions in the interaction mode. Optional boolean arguemnt, default is true.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunInteractive ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Runs interpreter commands interactively. Reads commands one by one from console and executes them, until only Enter is pressed.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunSystem ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Runs the specified command-line by the operating system. The first argument is the command to be executed while the following arguments are arguments to this command. If there are no arguments then user is requested to insert commands interactively.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name of this command.
argsCommand arguments this command.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdCurrentDirectory ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Rturns or sets the current directory.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Result of the last command that is run.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdExpressionEvaluatorJavascript ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Runs the built in expression evaluator.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name of this command.
argsCommand arguments this command.
Returns

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdSetPriority ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Sets the priority of the current process.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments of this command.
Returns
Null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), IG.Lib.UtilSystem.ThreadPriority, and IG.Lib.Util.TryParseThreadPriority().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunParallel ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Runs the specified command-line in parallel thread.

The first argument is the command to be executed while the following arguments are arguments to this command.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name of this command.
argsCommand arguments of this command.
Returns
ID of the job container that contains all command data.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunParallelRepeat ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Runs the specified command-line several times in the specified number of parallel threads.

The first argument is the number of parallel executions of the same command, the second argument is command to be executed while the following arguments are arguments to this command.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name of this command.
argsCommand arguments of this command.
Returns
IDs of the job container that contains all command data separated by spaces.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPrintParallelCommands ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Prints data about commands executed in parallel threads.

The optional first argument is a flag (boolean, can be integer) that specifies whether the completed commands are also printed or not. Default is true.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name of this command.
argsCommand arguments of this command.
Returns
Null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunAsync ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Runs the specified command-line asynchronously.

The first argument is the command to be executed while the following arguments are arguments to this command.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name of this command.
argsCommand arguments of this command.
Returns
ID of the asynchronous command for querrying completion and ending invocation and picking results.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdAsyncWaitResults ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Wait until asynchronously invoked command with the specified ID (first argument, must represent an int) completes.

The first argument is the ID of asynchronous invocation whose results are waited.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name of this command.
argsCommand arguments of this command.
Returns
Results of the async. command execution whose completion is waited for.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdAsyncCompleted ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Returns a flag indicating whether the asynchroneous command invocation identified by the specified ID (first argument, must represent an int) has completed.

The first argument is the ID of asynchronous invocation whose completion is waited for.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name of this command.
argsCommand arguments of this command.
Returns
Results of the async. command execution whose completion is waited for.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdSleepSeconds ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Sleeps (suspends execution of the executing thread) for the specified number of seconds.

The first argument is the number of seconds (must be string representing double) to sleep.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name of this command.
argsCommand arguments of this command.
Returns
Returns the ID of the thread where sleep is performed.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdLoadModule ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Loads the specified module (whos name must be the first argument) and performs its initialization. If there are more than 1 arguments then the rest of the arguments specify a command and (if more than 1) its arguments, and the specified command is also run.

Parameters
cmdThreadCommandline interpreter thread in which command is executed.
cmdNameCommand name.
argsCommand arguments.
Returns
null.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdIsModuleLoaded ( CommandThread  thread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for command that checks if module is loaded. Writes to condole whether module is loaded or not, and returns "1" if module is loaded and "0" if not.

Parameters
threadInterpreter on which commad is run.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdModuleTestCommand ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for test command that is installed when a module is installed. This is a command that enables to verify that a module with the specified name has been installed.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdTestFromTestModules ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for test command, which just prints its name and arguments. This is a replacement for usuel test command, which gets installed when one of the two basic test modules are installed.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

InterpreterPipeServer IG.Lib.CommandLineApplicationInterpreter.CreatePipeServer ( string  pipeName,
string  serverName = null,
bool  createCommand = false,
int  outputLevel = 3 
)
inline

Creates and registers a new interpreter's named pipe server.

Parameters
pipeNameName of the pipe where the server listens.
serverNamename of the pipe server. If not specified then it is the same as pipe name.
createCommandWhether an interpreter command is created for accessig the server. Not functional at the moment.
outputLevelOutput level with which the server is started.
Returns
The created named pipe server.

References IG.Lib.IpcStreamClientServerBase.OutputLevel, and IG.Lib.IpcStreamServerBase.ThreadServe().

string IG.Lib.CommandLineApplicationInterpreter.RemovePipeServers ( params string[]  serverNames)
inline

Removes the specified interpreter's named pipe servers. Servers are stopped and their pipes closed. Returns a string contaiing information about the removed servers.

Parameters
serverNamesNames of the servers to be removed.
Returns
A string containing basic information about the removed servers (i.e. their interpreter's names and pipe names).

References IG.Lib.IpcStreamClientServerBase2.ClosePipe(), IG.Lib.IpcStreamClientServerBase2.Name, and IG.Lib.IpcStreamServerBase.StopServer().

string IG.Lib.CommandLineApplicationInterpreter.PipeServerInfo ( string  serverName = null)
inline

Returns a string containing informattion on the installed named pipe servers.

Parameters
serverNameName of the pipe server (optional). If specified then information is returned only for the server with this particular name (otherwise information is returned for all installed servers).
Returns
virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPipeServerCreate ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Creates a new server that listens for interpreter commands on a named pipe, executes them, and writes result back to the named pipe. Command arguments are pipe name and server name (optional, if not specified then server name is the same as pipe name).

Parameters
cmdThreadCommand thread that performs execution.
cmdNameCommand name.
argsCommand arguments.
Returns
A string containing some basic data on the created pipe server.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPipeServersRemove ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Removes the spcified (or all, if names are not specified) named pipe servers. Command arguments are names of the pipe servers to be removed. If none is specified then all pipe servers installed on the interperter are removed.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand-line arguments.
Returns
A string containing the information on the removed servers (their interpreter's names and pipe names).

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPipeServerInfo ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints and returns inormation on the installed named pipe servers. Optional command argument is server name. If not specified then information about all installed servers is printed and returned.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand-line arguments.
Returns
A string containing the information on pipe servers.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

InterpreterPipeClient IG.Lib.CommandLineApplicationInterpreter.CreatePipeClient ( string  pipeName,
string  clientName = null,
bool  createCommand = false,
int  outputLevel = 3 
)
inline

Creates and registers a new interpreter's named pipe client.

Parameters
pipeNameName of the pipe where the client listens.
clientNamename of the pipe client. If not specified then it is the same as pipe name.
createCommandWhether command for direct access is created or not. If true then an interpreter command with the same name as the name of the client is created, which can be directly used for sending requests by the created client (without specifying the command for sending a request first and then the server name and then the actual command).
outputLevelOutput level with which the client is started.
Returns
The created named pipe client.

References IG.Lib.NamedPipeClientBase.Connect(), and IG.Lib.IpcStreamClientServerBase.OutputLevel.

string IG.Lib.CommandLineApplicationInterpreter.RemovePipeClients ( params string[]  clientNames)
inline

Removes the specified interpreter's named pipe clients. Client's pipes are closed. Returns a string contaiing information about the removed clients.

Parameters
clientNamesNames of the clients to be removed.
Returns
A string containing basic information about the removed clients (i.e. their interpreter's names and pipe names).

References IG.Lib.IpcStreamClientServerBase2.ClosePipe(), and IG.Lib.IpcStreamClientServerBase2.Name.

string IG.Lib.CommandLineApplicationInterpreter.PipeClientInfo ( string  clientName = null)
inline

Returns a string containing informattion on the installed named pipe clients.

Parameters
clientNameName of the pipe client. If specified then information is returned only for the client with this particular name (otherwise information is returned for all installed clients).
Returns
string IG.Lib.CommandLineApplicationInterpreter.PipeClientGetServerResponse ( string  clientName,
string  commandLineString 
)
inline

Sends the specified command to the corresponding pipe serverr and reads and returns its response.

Parameters
clientNameName of the pipe client that sends the request to the named pipe server and returns the response.
commandLineStringComandline string that is sent to the server as request.
Returns
Response obtained from the named pipe server with which client is connected.

References IG.Lib.IpcStreamClientBase.GetServerResponse().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPipeClientCreate ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Creates a new client to the interpreter pipe server. The client can send command to the server listening on the specified named pipe, and recieves responses from the server and returns them. Command arguments are pipe name and client name (optional, if not specified then server name is the same as pipe name).

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommandline arguments.
Returns
A string containing the information on pipe clients.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPipeClientsRemove ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Removes the spcified (or all, if names are not specified) named pipe clients. Command arguments are names of the pipe clients to be removed. If none is specified then all pipe clients installed on the interperter are removed.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommandline arguments.
Returns
A string containing the information on the removed clients (their interpreter's names and pipe names).

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPipeClientInfo ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Prints and returns inormation on the installed named pipe clients. Optional command argument is client name. If not specified then information about all installed clients is printed and returned.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommandline arguments.
Returns
A string containing some basic data on the created pipe client.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPipeClientGetServerResponse ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Command. Sends the specified command to the corresponding pipe serverr and reads and returns its response. Command argument is the (interpreter's) name of the pipe client followed by command and eventual arguments sent to the server.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommandline arguments.
Returns
Server response.

References IG.Lib.UtilStr.GetCommandLine(), and IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunInternalScriptClass ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Dynamically creates and runs an internal script object, i.e. an object of the class that is already compiled in the code. Interpreter command arguments: The first argument must be a full name of the script class whose object is run. The rest of the arguments (if any) are directly transferred to the executable method of the script and are also used as argument to script initialization method.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameName of the command
argsCommand arguments.
Returns
Result of command execution.

References IG.Lib.ScriptLoaderBase.CreateScriptObject(), IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), IG.Lib.ILoadableScript.InitializationArguments, and IG.Lib.ILoadableScript.Run().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunScriptFile ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Dynamically loads (temporarily, just for execution of the current commad) a class form the script contained in the specified file and executes its executable method. The file must contain the script that is dynamically loaded and executed, in form of definition of the appropriate class of type ILoadableScript. The dynamically loadable script class is loaded from the file and instantiated by the LoadableScriptInterpreter loadable script-based interpreter object. Interpreter command arguments: Path to the file containing loadable script must be the first argument to the method. The rest of the arguments (if any) are directly transferred to the executable method of the script.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameName of the command
argsCommand arguments.
Returns
Result of command execution.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdLoadScript ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Dynamically loads (compiles and instantiates) a loadable script class contained in the specified file, and installs a new command on LoadableScriptInterpreter and on the current interpreter, based on the dynamically allocated instance of the loaded (dynamically compiled) class. Required arguments to the interpreter command are:

  • name of the newly installed command
  • name of the file containing the script code that defines a loadable script class. The rest of the arguments are passed to the dynamically generated instance of the class that was dynamically compiled and loaded and stored (under the specified command name) on LoadableScriptInterpreter.
Parameters
cmdThreadCommand thread that is being executed.
cmdNameName of the command
argsCommand arguments.
Returns
null string.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdRunLoadedScript ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Runs a command based on dynamically loaded loadable script class. Arguments passed to this command are directly passed on to the dynamically loaded script class installed on LoadableScriptInterpreter under the same cmdName . Typically, the command that is executed by the current method, has been previously installed by the CmdLoadScript(...) method.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameName of the command, which must be the same as command name under which dynamically loaded class is installed on LoadableScriptInterpreter.
argsCommand arguments. These arguments are directly passed to the executable method on the corresponding class.
Returns
Result of command execution.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.WriteLoadableScriptReferencedAssemblies ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Interpreter command. Writes to the console the assemblies that are currently referenced by compiler used for dynamic loading of scripts. This information can be used for control if something goes wrong with dynamic script loading.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameName of the command.
argsCommand arguments.
Returns
Result of command execution, a list of all referenced assemblies.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdExit ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Execution method that exits the interpreter.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdHelp ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Execution method for applications help.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdAbout ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Execution method that prints some information about the application.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

Reimplemented in IG.Lib.NeuralApplicationInterpreter.

References IG.Lib.UtilSystem.GetApplicationInfo(), IG.Lib.UtilSystem.GetAssemblyByName(), IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdApplicationInfo ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Execution method that prints some information about the current application.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetApplicationInfo(), IG.Lib.UtilSystem.GetAssemblyByName(), IG.Lib.UtilSystem.GetCurrentProcessExecutableName(), and IG.Lib.Util.TryParseBoolean().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdComment ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Execution method that does nothing (for comments).

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdPrintCommands ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Execution method for command that prints names of all installed applications.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdTestProduct ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for test command, which just prints its name and arguments.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdTest ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for test command, which just prints its name and arguments.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdTestSpeed ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for TestSpeed command, performs test of speed of numerical computations on LU decomposition, and outputs the result and comparison with reference results (usually achieved on Igor's computer).

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Speed factor - Ratio between reference computation time and time spent for the same thing in current environment.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdTestSpeedLong ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for TestSpeedLong command, performs a longer test of speed of numerical computations on QR decomposition, and outputs the result and comparison with reference results (usually achieved on Igor's computer).

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Speed factor - Ratio between reference computation time and time spent for the same thing in current environment.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdTestQR ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for TestQR command, performs test of QR decomposition.

Command takes 1 argument that is dimension of the system of equations to be solved. If dimension is not stated then default value is taken.

Optionally, command can take the second argument that represents number of repetitions of the decomposition test. In this tame, command returns average total execution time for each test.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Total wallclock time spent for computation.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual double IG.Lib.CommandLineApplicationInterpreter.TestComputationalTimesQR ( int  numEq,
int  outLevel 
)
inlineprotectedvirtual

Test of QR decomposition. Writes times necessary for all steps.

Parameters
numEqNumber of equations to be solved with decomposition.
outLevelLevel of output.
Returns
Total time spent for all operations.

References IG.Num.SpeedTestCpu.TestComputationalTimesQR().

virtual string IG.Lib.CommandLineApplicationInterpreter.CmdTestLU ( CommandThread  cmdThread,
string  cmdName,
string[]  args 
)
inlineprotectedvirtual

Executinon method for TestLU command, performs test of LU decomposition.

Command takes 1 argument that is dimension of the system of equations to be solved. If dimension is not stated then default value is taken.

Optionally, command can take the second argument that represents number of repetitions of the decomposition test. In this tame, command returns average total execution time for each test.

Parameters
cmdThreadCommand thread that is being executed.
cmdNameCommand name.
argsCommand arguments.
Returns
Total wallclock time spent for computation.

References IG.Lib.UtilSystem.GetCurrentProcessExecutableName().

virtual double IG.Lib.CommandLineApplicationInterpreter.TestComputationalTimesLU ( int  numEq,
int  outLevel 
)
inlineprotectedvirtual

Test of LU decomposition.

Parameters
outLevelLevel of output.
numEqNumber of equations to be solved with decomposition.

References IG.Num.SpeedTestCpu.TestComputationalTimesLU().

void IG.Lib.CommandLineApplicationInterpreter.ModuleTest1 ( string  name,
ICommandLineApplicationInterpreter  interpreter 
)
inlineprivate

Loads the first built-in test module (just for testing modules).

Parameters
nameName under which the module is being loaded.
interpreterCommand line interpreter under on which the module is loaded.

References IG.Lib.ICommandLineApplicationInterpreter.AddCommandMt().

void IG.Lib.CommandLineApplicationInterpreter.ModuleTest2 ( string  name,
ICommandLineApplicationInterpreter  interpreter 
)
inlineprivate

Loads the second built-in test module (just for testing modules).

Parameters
nameName under which the module is being loaded.
interpreterCommand line interpreter under on which the module is loaded.

References IG.Lib.ICommandLineApplicationInterpreter.AddCommandMt().

Member Data Documentation

const bool IG.Lib.CommandLineApplicationInterpreter.DefaultCaseSensitive = false

Default value of the flg indicating whether command names are case sensitive.

bool IG.Lib.CommandLineApplicationInterpreter._caseSensitive = false
protected
object IG.Lib.CommandLineApplicationInterpreter._mainLock = new object()
private
List<CommandLineApplicationInterpreter> IG.Lib.CommandLineApplicationInterpreter._interpreters = new List<CommandLineApplicationInterpreter>()
staticprotected
SortedDictionary<string, ApplicationCommandDelegateMt > IG.Lib.CommandLineApplicationInterpreter._commandsMt = new SortedDictionary<string, ApplicationCommandDelegateMt >()
protected
CommandThread IG.Lib.CommandLineApplicationInterpreter._globalThread = null
protected
CommandStackFrame IG.Lib.CommandLineApplicationInterpreter._globalAuxiliaryFrame = null
protected
CommandThread IG.Lib.CommandLineApplicationInterpreter._mainThread = null
private
List<CommandThread> IG.Lib.CommandLineApplicationInterpreter._commandThreads = new List<CommandThread>()
private

Main command thread of the interpreter (usually run in the same thread where interpreter was created).

SortedDictionary<string, string> IG.Lib.CommandLineApplicationInterpreter._variables = new SortedDictionary<string, string>()
protected
SortedDictionary<string, ModuleDelegate> IG.Lib.CommandLineApplicationInterpreter._modules = new SortedDictionary<string, ModuleDelegate>()
protected
List<String> IG.Lib.CommandLineApplicationInterpreter._loadedModules = new List<string>()
protected
const string IG.Lib.CommandLineApplicationInterpreter.DefaultName = "ApplicationIntepreter"

Default interpreter name.

const string IG.Lib.CommandLineApplicationInterpreter.AutoGlobalName = "AutomaticGlobalInterpreter"
const string IG.Lib.CommandLineApplicationInterpreter.AutoGlobalDescription = "Automatically created global command-line interpreter."
string IG.Lib.CommandLineApplicationInterpreter._name = DefaultName
protected
string IG.Lib.CommandLineApplicationInterpreter._sescription = "Application's command-line interpreter."
protected
string IG.Lib.CommandLineApplicationInterpreter._description
protected
char IG.Lib.CommandLineApplicationInterpreter._variableStart = '$'
protected
char IG.Lib.CommandLineApplicationInterpreter._expressionStart = '#'
protected
bool IG.Lib.CommandLineApplicationInterpreter._exit = false
protected
int IG.Lib.CommandLineApplicationInterpreter.DefaultOutputLevel = 1
static
int IG.Lib.CommandLineApplicationInterpreter._outputLevel = DefaultOutputLevel
protected

Default level of output for some of the interpreters' functionality (e.g. asynchronous command execution).

bool IG.Lib.CommandLineApplicationInterpreter.DefaultWarnCommandReplacement = true
static
bool IG.Lib.CommandLineApplicationInterpreter._warnCommandReplacement = DefaultWarnCommandReplacement
private
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_Block = "Block"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_EndBlock = "EndBlock"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_BeginRepeat = "BeginRepeat"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_EndRepeat = "EndRepeat"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_BeginCalc = "BeginCalc"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_EndCalc = "EndCalc"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_If = "If"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_ElseIf = "ElseIf"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_Else = "Else"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_EndIf = "EndIf"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_While = "While"
readonly string IG.Lib.CommandLineApplicationInterpreter.Command_EndWhile = "EndWhile"
bool IG.Lib.CommandLineApplicationInterpreter._throwExceptions = false
private
ExpressionEvaluatorJs IG.Lib.CommandLineApplicationInterpreter._evalutorJs
protected
ExpressionEvaluatorJint IG.Lib.CommandLineApplicationInterpreter._evaluatorJint
protected
bool IG.Lib.CommandLineApplicationInterpreter._useJint = true
private
string [] IG.Lib.CommandLineApplicationInterpreter._emptyCommandLine = { null }
protected
List<CommandLineJobContainer> IG.Lib.CommandLineApplicationInterpreter._parallelCommands
protected
ParallelJobDispatcherGen<CommandLineJobContainer, CommandLineJobContainer> IG.Lib.CommandLineApplicationInterpreter._parallelDispatcher
private
ThreadPriority IG.Lib.CommandLineApplicationInterpreter._threadPriority = UtilSystem.ThreadPriority
protected
bool IG.Lib.CommandLineApplicationInterpreter._systemPriorityUpdatesRegistered = false
protected

Whether the "event" handler for system priprity changes has already been registered.

int IG.Lib.CommandLineApplicationInterpreter._maxNumParallelServers = 0
protected
List<IAsyncResult> IG.Lib.CommandLineApplicationInterpreter._asyncCommandResults
private

List of asynchronous results objects from individual asynchronous executions.

bool IG.Lib.CommandLineApplicationInterpreter._asyncEndInvokeInCallback = true
private
List<CommandAdapterSingleThreaded> IG.Lib.CommandLineApplicationInterpreter._stAdapters = new List<CommandAdapterSingleThreaded>()
private
string IG.Lib.CommandLineApplicationInterpreter._ModuleTestCommandPrefix = "TestModule_"
protected
LoadableScriptInterpreterBase IG.Lib.CommandLineApplicationInterpreter._loadableScriptInterpreter
private
SortedList<string, IpcStreamServerBase> IG.Lib.CommandLineApplicationInterpreter._pipeServers = null
private
SortedList<string, IpcStreamClientBase> IG.Lib.CommandLineApplicationInterpreter._pipeClients = null
private
const string IG.Lib.CommandLineApplicationInterpreter.TestSpeedReferenceSystem = "Intel Core i7 2.8 GHz"
protected

Description of reference configuration.

const int IG.Lib.CommandLineApplicationInterpreter.TestSpeedNumEq = 500
protected

Number of equations used to test speed of numerical computations.

const double IG.Lib.CommandLineApplicationInterpreter.TestSpeedReferenceTime = 0.640917
protected

Reference execution time for speed test for numerical operations.

const int IG.Lib.CommandLineApplicationInterpreter.TestSpeedLongNumEq = 1000
protected

Number of equations used to test speed of numerical computations.

const double IG.Lib.CommandLineApplicationInterpreter.TestSpeedLongReferenceTime = 63.9688
protected

Reference execution time for speed test for numerical operations.

int IG.Lib.CommandLineApplicationInterpreter.DefaultNumEquations = 1000
staticprotected

Property Documentation

bool IG.Lib.CommandLineApplicationInterpreter.CaseSensitive
getprotected set
object IG.Lib.CommandLineApplicationInterpreter.Lock
get

This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.

CommandStackFrame IG.Lib.CommandLineApplicationInterpreter.GlobalFrame
get

Global frame where global variables are stored.

CommandThread IG.Lib.CommandLineApplicationInterpreter.MainThread
getprotected set

Stack frames (containing variables) and other data for the main interpretation thread.

Referenced by IG.Lib.ApplicationCommandlineBase.AplicationMain().

List<CommandThread> IG.Lib.CommandLineApplicationInterpreter.CommandThreads
getsetprotected

List of command threads that exist on the interpreter.

int IG.Lib.CommandLineApplicationInterpreter.NumCommandThreads
get

Returns the number of command threads that are currently contained on the interpreter.

bool IG.Lib.CommandLineApplicationInterpreter.Exit
getprotected set

Whether the exit flag is set, usually causing interpreter to stop.

List<CommandLineApplicationInterpreter> IG.Lib.CommandLineApplicationInterpreter.Interpreters
staticget
CommandLineApplicationInterpreter IG.Lib.CommandLineApplicationInterpreter.Global
staticget

Global command-line interpreter.

This returns the first interpreter created in the application, or a new interpreter if no interpreters have been created yet.

string IG.Lib.CommandLineApplicationInterpreter.Name
getset

Name of the current interpreter.

string IG.Lib.CommandLineApplicationInterpreter.Description
getset

Description of hte current interpreter.

int IG.Lib.CommandLineApplicationInterpreter.OutputLevel
getset

Level of output for some of the interpreter's functionality (e.g. asynchronous command execution).

bool IG.Lib.CommandLineApplicationInterpreter.WarnCommandReplacement
getset

Specifies whether a wrning should be launched whenever an installed command is being replaced.

Referenced by IG.Lib.ApplicationCommandlineBase.AplicationMain(), and IG.Lib.LoadableScriptBase.Script_CreateInterpreterWithoutCommands().

virtual bool IG.Lib.CommandLineApplicationInterpreter.ThrowExceptions
getset

Flag specifying whether exceptions are thrown in interactive mode or not.

If false then only error messages are written to console, but exceptions are not rethrown.

In some modes of operation, exceptions thrown in commands executed by the interpreter are cought, user is notified about the exception (usually by writing the error message to the console), but exceptions are not re-thrown. Because of this behavior, much information about exceptions is lost (e.g. the stack trace).

bool IG.Lib.CommandLineApplicationInterpreter.UseJint
getprotected set

Flag that specified whether Jint JavaCcript engine is used or not.

ExpressionEvaluatorJs IG.Lib.CommandLineApplicationInterpreter.EvaluatorJs
getprotected set

Expression evaluator used by the current

string [] IG.Lib.CommandLineApplicationInterpreter.EmptyCommandLine
getprotected
List<CommandLineJobContainer> IG.Lib.CommandLineApplicationInterpreter.ParallelCommands
get

List where parallel commands are stored.

ThreadPriority IG.Lib.CommandLineApplicationInterpreter.ThreadPriority
getset

Priority of the current interpreter main thread and threads for executing the parallel commands.

Setting priority changes priority of the threads.

int IG.Lib.CommandLineApplicationInterpreter.MaxNumParallelServers
getset

Maximal number of parallel servers allowed to be created for parallel command execution.

If less than 1 then creation of unlimited number of servers is allowed. As long as the number is not exceeded, new servers will be created whenever a new parallel jobs are created and no servers are idle, in order to start execution of new parallel jobs immediately.

List<IAsyncResult> IG.Lib.CommandLineApplicationInterpreter.AsyncCommandResults
getprotected

List of IAsyncResult objects that were returned by asynchronous command invocations.

Lazy evaluation, created when getter is invoked first time.

bool IG.Lib.CommandLineApplicationInterpreter.AsyncEndInvokeInCallback
getsetprotected

Flag indicating whether Endinvoke must be called in the callback of asynchronous command calls.

This flag is unset temporarily in methods where endinvoke is called explicitly.

virtual LoadableScriptInterpreterBase IG.Lib.CommandLineApplicationInterpreter.LoadableScriptInterpreter
getset

Interpreter based on dynamically loadable scripts. This enables installation and running of commands that are based on C# code that is dynamically compiled. Ihe object is created on first get access if it has not been assigned before. This property can be overridden in derived classes such that getter creates a dynamically loadable script - based interpreter of another kind. This is important because different script loaders (in particuar with different dynamic libraries referenced) will be used in different contexts. Another possibility is that a custom object is assigned to this property, usually in the initialization stage of the current interpreter.

Exceptions
ArgumentNullExceptionWhen set to null reference.

$A Igor Aug11;

ScriptLoaderBase IG.Lib.CommandLineApplicationInterpreter.ScriptLoader
get

Gets the script loader that is used by the current command-line interpreter for dynamically loading commands from scripts.

SortedList<string, IpcStreamServerBase> IG.Lib.CommandLineApplicationInterpreter.PipeServers
getprivate

Array of registered pipe servers, accessible through server name.

SortedList<string, IpcStreamClientBase> IG.Lib.CommandLineApplicationInterpreter.IpcClients
getprivate

Array of registered pipe clients, accessible through client name.


The documentation for this class was generated from the following file: