git-svn-id: https://spexeah.com:8443/svn/Asuro@494 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
1 parent
4b1596675c
commit
2d061d834c
16 files changed
+29
-2
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+29
-2
@@ -44,6 +44,7 @@ var
|
|||||||
History : PHistory;
|
History : PHistory;
|
||||||
bIndex : uint32 = 0;
|
bIndex : uint32 = 0;
|
||||||
Commands : array[0..65534] of TCommand;
|
Commands : array[0..65534] of TCommand;
|
||||||
|
Working_Directory : PChar = '/';
|
||||||
|
|
||||||
procedure run;
|
procedure run;
|
||||||
procedure init;
|
procedure init;
|
||||||
@@ -51,9 +52,23 @@ procedure registerCommand(command : pchar; method : TCommandMethod; description
|
|||||||
function getParams(buf : TCommandBuffer) : PParamList;
|
function getParams(buf : TCommandBuffer) : PParamList;
|
||||||
function paramCount(params : PParamList) : uint32;
|
function paramCount(params : PParamList) : uint32;
|
||||||
function getParam(index : uint32; params : PParamList) : pchar;
|
function getParam(index : uint32; params : PParamList) : pchar;
|
||||||
|
procedure setWorkingDirectory(str : pchar);
|
||||||
|
function getWorkingDirectory : pchar;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
function getWorkingDirectory : pchar;
|
||||||
|
begin
|
||||||
|
getWorkingDirectory:= Working_Directory;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure setWorkingDirectory(str : pchar);
|
||||||
|
begin
|
||||||
|
if str <> nil then begin
|
||||||
|
Working_Directory:= stringCopy(str);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function paramCount(params : PParamList) : uint32;
|
function paramCount(params : PParamList) : uint32;
|
||||||
var
|
var
|
||||||
current : PParamList;
|
current : PParamList;
|
||||||
@@ -257,7 +272,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{ Reset the terminal ready for the next command }
|
{ Reset the terminal ready for the next command }
|
||||||
console.writestring('Asuro#> ');
|
console.writestring('Asuro#');
|
||||||
|
console.writestring(Working_Directory);
|
||||||
|
console.writestring('> ');
|
||||||
bIndex:= 0;
|
bIndex:= 0;
|
||||||
memset(uint32(@buffer[0]), 0, 1024);
|
memset(uint32(@buffer[0]), 0, 1024);
|
||||||
|
|
||||||
@@ -285,6 +302,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure change_dir(Params : PParamList);
|
||||||
|
begin
|
||||||
|
if paramCount(Params) > 0 then begin
|
||||||
|
setWorkingDirectory(getParam(0, Params));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
begin
|
begin
|
||||||
console.writestringln('TERMINAL: INIT BEGIN.');
|
console.writestringln('TERMINAL: INIT BEGIN.');
|
||||||
@@ -296,6 +320,7 @@ begin
|
|||||||
registerCommand('ECHO', @echo, 'Echo''s text to the terminal.');
|
registerCommand('ECHO', @echo, 'Echo''s text to the terminal.');
|
||||||
registerCommand('TESTPARAMS', @testParams, 'Tests param parsing.');
|
registerCommand('TESTPARAMS', @testParams, 'Tests param parsing.');
|
||||||
registerCommand('TEST', @test, 'Command for testing.');
|
registerCommand('TEST', @test, 'Command for testing.');
|
||||||
|
registerCommand('CD', @change_dir, 'Change Directory test');
|
||||||
console.writestringln('TERMINAL: INIT END.');
|
console.writestringln('TERMINAL: INIT END.');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -303,7 +328,9 @@ procedure run;
|
|||||||
begin
|
begin
|
||||||
keyboard.hook(@key_event);
|
keyboard.hook(@key_event);
|
||||||
console.clear();
|
console.clear();
|
||||||
console.writestring('Asuro#> ');
|
console.writestring('Asuro#');
|
||||||
|
console.writestring(Working_Directory);
|
||||||
|
console.writestring('> ');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
Reference in new issue
Block a user