Difference between revisions of "Unit Shell"

From Ultibo.org
Jump to: navigation, search
Line 61: Line 61:
 
</div></div>
 
</div></div>
 
<br />
 
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Shell cursor mode''' <code> SHELL_CURSOR_MODE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>SHELL_CURSOR_MODE_INSERT = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>SHELL_CURSOR_MODE_OVERWRITE = 1;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Shell cursor shape''' <code> SHELL_CURSOR_SHAPE_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>SHELL_CURSOR_SHAPE_LINE = 0;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>SHELL_CURSOR_SHAPE_BAR = 1;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SHELL_CURSOR_SHAPE_BLOCK = 2;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div style="font-size: 14px; padding-left: 12px;">'''Shell session flag''' <code> SHELL_SESSION_FLAG_* </code></div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Shell session flag''' <code> SHELL_SESSION_FLAG_* </code></div>
Line 94: Line 125:
 
| <code>SHELL_COMMAND_FLAG_EXTENDED = $00000008;</code>
 
| <code>SHELL_COMMAND_FLAG_EXTENDED = $00000008;</code>
 
| Extended command, pass command name to command for extended handling
 
| Extended command, pass command name to command for extended handling
 +
|-
 +
| <code>SHELL_COMMAND_FLAG_COMPLETION = $00000008;</code>
 +
| Command supports auto completion
 
|-
 
|-
 
|}
 
|}
Line 175: Line 209:
 
| <code>SHELL_ALIAS_REBOOT = 'REBOOT';</code>
 
| <code>SHELL_ALIAS_REBOOT = 'REBOOT';</code>
 
| &nbsp;
 
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Shell history''' <code> SHELL_HISTORY_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>SHELL_HISTORY_MAX_COUNT = 100;</code>
 +
| style="width: 50%;"|&nbsp;
 
|-
 
|-
 
|}
 
|}
Line 189: Line 234:
 
| <code>SHELL_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 
| <code>SHELL_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 
| Shell informational messages
 
| Shell informational messages
 +
|-
 +
| <code>SHELL_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code>
 +
| Shell warning messages
 
|-
 
|-
 
| <code>SHELL_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
 
| <code>SHELL_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
Line 476: Line 524:
 
|-
 
|-
 
| <code>function DoSetCoordinates(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;</code>
 
| <code>function DoSetCoordinates(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>function DoGetCursorMode(ASession:TShellSession; var AMode:LongWord):Boolean; virtual;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function DoSetCursorMode(ASession:TShellSession; AMode:LongWord):Boolean; virtual;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>function DoGetCursorShape(ASession:TShellSession; var AShape:LongWord):Boolean; virtual;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function DoSetCursorShape(ASession:TShellSession; AShape:LongWord):Boolean; virtual;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 523: Line 587:
 
|colspan="2"|&nbsp;
 
|colspan="2"|&nbsp;
 
|-
 
|-
| <code>function MatchCommand(const ACommand:String; var AContinue:Boolean):TShellCommand; virtual;</code>
+
| <code>function MatchCommand(const ACommand:String; var AName:String; var AParameters:TStrings; var AContinue:Boolean):TShellCommand; virtual;</code>
 
| &nbsp;
 
| &nbsp;
 +
|-
 +
| <code>function CompleteCommand(ASession:TShellSession; const ACommand:String; var AError:Boolean):String; virtual;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 
|-
 
|-
 
| <code>function ProcessCommand(ASession:TShellSession; const ACommand:String):Boolean; virtual;</code>
 
| <code>function ProcessCommand(ASession:TShellSession; const ACommand:String):Boolean; virtual;</code>
Line 535: Line 604:
 
|-
 
|-
 
| <code>function CommandSplit(const ACommand:String):TStrings;</code>
 
| <code>function CommandSplit(const ACommand:String):TStrings;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function CommandJoin(AParameters:TStrings):String;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
 
| <code>function CommandParse(const ACommand:String; var AName:String; var AParameters:TStrings):Boolean;</code>
 
| <code>function CommandParse(const ACommand:String; var AName:String; var AParameters:TStrings):Boolean;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function CommandConcat(const AName:String; AParameters:TStrings):String;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 568: Line 643:
 
|-
 
|-
 
|}
 
|}
</div></div>  
+
</div></div>
  
 
'''Shell session'''
 
'''Shell session'''
Line 613: Line 688:
 
| <code>FData:Pointer;</code>
 
| <code>FData:Pointer;</code>
 
| Shell private data for this session
 
| Shell private data for this session
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>FHistories:TLinkedObjList;</code>
 +
| &nbsp;
 +
|-
 +
| <code>FCurrentHistory:TShellHistory;</code>
 +
| &nbsp;
 
|-
 
|-
 
|colspan="2"|&nbsp;
 
|colspan="2"|&nbsp;
Line 659: Line 742:
 
|-
 
|-
 
| <code>property Data:Pointer read FData write SetData;</code>
 
| <code>property Data:Pointer read FData write SetData;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>function AddHistory(const ACommand:String):Boolean;</code>
 +
| &nbsp;
 +
|-
 +
| <code>procedure ClearHistory;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function FirstHistory:String;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function LastHistory:String;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function NextHistory:String;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function PrevHistory:String;</code>
 +
| &nbsp;
 +
|-
 +
| <code>function CurrentHistory:String;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 756: Line 862:
 
|-
 
|-
 
| <code>function DoExtended(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings):Boolean; virtual;</code>
 
| <code>function DoExtended(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings):Boolean; virtual;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>function DoCompletion(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings; var AError:Boolean):String; virtual;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 772: Line 883:
 
|-
 
|-
 
| <code>function DeregisterAlias(AAlias:TShellAlias):Boolean;</code>
 
| <code>function DeregisterAlias(AAlias:TShellAlias):Boolean;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>function MatchAlias(const AName:String; var AContinue:Boolean):TShellAlias;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 837: Line 953:
 
|-
 
|-
 
| <code>property Flags:LongWord read FFlags write SetFlags;</code>
 
| <code>property Flags:LongWord read FFlags write SetFlags;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 +
'''Shell history'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
 +
<code>TShellHistory = class(TListObject)</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
 +
|-
 +
| <code>FCommand:String;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>FLength:Integer;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
 +
|-
 +
| <code>property Command:String read FCommand write FCommand;</code>
 +
| &nbsp;
 +
|-
 +
| <code>property Length:Integer read FLength write FLength;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 1,337: Line 1,480:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">procedure ShellLogInfo(const AText:String);</pre>
+
<pre style="border: 0; padding-bottom:0px;">procedure ShellLogInfo(const AText:String); inline;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">procedure ShellLogWarn(const AText:String); inline;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
Line 1,349: Line 1,504:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">procedure ShellLogError(const AText:String);</pre>
+
<pre style="border: 0; padding-bottom:0px;">procedure ShellLogError(const AText:String); inline;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
Line 1,361: Line 1,516:
 
<br />
 
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">procedure ShellLogDebug(const AText:String);</pre>
+
<pre style="border: 0; padding-bottom:0px;">procedure ShellLogDebug(const AText:String); inline;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">

Revision as of 00:59, 27 March 2018

Return to Unit Reference


Description


Ultibo Generic Shell unit

To be documented

Constants



[Expand]
Shell specific constants SHELL_*


[Expand]
Shell flag SHELL_FLAG_*


[Expand]
Shell cursor mode SHELL_CURSOR_MODE_*


[Expand]
Shell cursor shape SHELL_CURSOR_SHAPE_*


[Expand]
Shell session flag SHELL_SESSION_FLAG_*


[Expand]
Shell command flag SHELL_COMMAND_FLAG_*


[Expand]
Shell alias flag SHELL_ALIAS_FLAG_*


[Expand]
Shell command SHELL_COMMAND_*


[Expand]
Shell alias SHELL_ALIAS_*


[Expand]
Shell history SHELL_HISTORY_*


[Expand]
Shell logging SHELL_LOG_*


Type definitions


None defined

Class definitions



Shell manager

[Expand]

TShellManager = class(TObject)

Shell

[Expand]

TShell = class(TListObject)

Shell session

[Expand]

TShellSession = class(TListObject)

Shell command

[Expand]

TShellCommand = class(TListObject)

Shell alias

[Expand]

TShellAlias = class(TListObject)

Shell history

[Expand]

TShellHistory = class(TListObject)

Shell command help

[Expand]

TShellCommandHelp = class(TShellCommand)

Shell command information

[Expand]

TShellCommandInfo = class(TShellCommand)

Shell command version

[Expand]

TShellCommandVer = class(TShellCommand)

Shell command time

[Expand]

TShellCommandTime = class(TShellCommand)

Shell command clear

[Expand]

TShellCommandClear = class(TShellCommand)

Shell command restart

[Expand]

TShellCommandRestart = class(TShellCommand)

Shell command shutdown

[Expand]

TShellCommandShutdown = class(TShellCommand)

Shell command uptime

[Expand]

TShellCommandUptime = class(TShellCommand)

Shell command threads

[Expand]

TShellCommandThreads = class(TShellCommand)

Shell command memory

[Expand]

TShellCommandMemory = class(TShellCommand)

Shell command devices

[Expand]

TShellCommandDevices = class(TShellCommand)


Public variables



Shell logging

SHELL_DEFAULT_LOG_LEVEL:LongWord = SHELL_LOG_LEVEL_DEBUG; Minimum level for Shell messages. Only messages with level greater than or equal to this will be printed.
SHELL_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

[Expand]
procedure ShellInit;
Description: To be documented


Shell functions

[Expand]
function ShellGetShell(APrevious:TShell; ALock,AUnlock:Boolean):TShell;
Description: To be documented


[Expand]
function ShellFindShell(const AName:String):TShell;
Description: To be documented


[Expand]
function ShellRegisterShell(AShell:TShell):Boolean;
Description: To be documented


[Expand]
function ShellDeregisterShell(AShell:TShell):Boolean;
Description: To be documented


[Expand]
function ShellGetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;
Description: To be documented


[Expand]
function ShellFindCommand(const AName:String):TShellCommand;
Description: To be documented


[Expand]
function ShellRegisterCommand(ACommand:TShellCommand):Boolean;
Description: To be documented


[Expand]
function ShellDeregisterCommand(ACommand:TShellCommand):Boolean;
Description: To be documented


Shell helper functions

[Expand]
procedure ShellLog(Level:LongWord; const AText:String);
Description: To be documented


[Expand]
procedure ShellLogInfo(const AText:String); inline;
Description: To be documented


[Expand]
procedure ShellLogWarn(const AText:String); inline;
Description: To be documented


[Expand]
procedure ShellLogError(const AText:String); inline;
Description: To be documented


[Expand]
procedure ShellLogDebug(const AText:String); inline;
Description: To be documented


Return to Unit Reference