source: branches/textos/Apps/Shell/UShell.pas

Last change on this file was 53, checked in by chronos, 12 months ago
  • Added: Experimental textos computer.
File size: 807 bytes
Line 
1unit UShell;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, UApp;
9
10type
11
12 { TAppShell }
13
14 TAppShell = class(TApp)
15 Line: string;
16 procedure OnStart; override;
17 procedure OnTerminate; override;
18 procedure OnInputText; override;
19 end;
20
21implementation
22
23{ TAppShell }
24
25procedure TAppShell.OnStart;
26begin
27 Api.OutputText('Supershell' + LineEnding);
28end;
29
30procedure TAppShell.OnTerminate;
31begin
32 Api.OutputText('Shell exited');
33end;
34
35procedure TAppShell.OnInputText;
36var
37 Text: string;
38begin
39 Text := Api.InputText;
40 Api.OutputText(Text);
41 if Text[1] = #13 then begin
42 if Line = 'exit' then Terminate
43 else begin
44 Api.OutputText(LineEnding + 'Executing ' + Line + LineEnding);
45 Api.ExecuteApp(Line);
46 end;
47 Line := '';
48 end else Line := Line + Text;
49end;
50
51end.
52
Note: See TracBrowser for help on using the repository browser.