git-svn-id: https://spexeah.com:8443/svn/Asuro@490 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron 2018-04-11 14:46:04 +00:00
parent a51487a800
commit e98881e31c
11 changed files with 1 additions and 29 deletions

BIN
Asuro.iso

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.

View File

@ -60,7 +60,6 @@ var
i : uint32; i : uint32;
begin begin
push_trace('terminal.paramCount');
current:= params; current:= params;
i:= 0; i:= 0;
while current^.param <> nil do begin while current^.param <> nil do begin
@ -68,7 +67,6 @@ begin
current:= current^.next; current:= current^.next;
end; end;
paramCount:= i-1; paramCount:= i-1;
pop_trace;
end; end;
function getParams(buf : TCommandBuffer) : PParamList; function getParams(buf : TCommandBuffer) : PParamList;
@ -80,7 +78,6 @@ var
current : PParamList; current : PParamList;
begin begin
push_trace('terminal.getParams');
root:= PParamList(kalloc(sizeof(TParamList))); root:= PParamList(kalloc(sizeof(TParamList)));
current:= root; current:= root;
current^.next:= nil; current^.next:= nil;
@ -106,7 +103,6 @@ begin
inc(finish); inc(finish);
end; end;
getParams:= root; getParams:= root;
pop_trace;
end; end;
function getParam(index : uint32; params : PParamList) : pchar; function getParam(index : uint32; params : PParamList) : pchar;
@ -116,14 +112,12 @@ var
i : uint32; i : uint32;
begin begin
push_trace('terminal.getParam');
result:= nil; result:= nil;
search:= params; search:= params;
for i:=0 to index do begin for i:=0 to index do begin
search:= search^.next; search:= search^.next;
end; end;
result:= search^.param; result:= search^.param;
pop_trace;
end; end;
procedure freeParams(params : PParamList); procedure freeParams(params : PParamList);
@ -132,7 +126,6 @@ var
next : PParamList; next : PParamList;
begin begin
push_trace('terminal.freeParams');
p:= params; p:= params;
next:= p^.next; next:= p^.next;
while p^.next <> nil do begin while p^.next <> nil do begin
@ -141,17 +134,14 @@ begin
p:= next; p:= next;
next:= p^.next; next:= p^.next;
end; end;
pop_trace;
end; end;
procedure testParams(params : PParamList); procedure testParams(params : PParamList);
begin begin
push_trace('terminal.testParams');
while params^.Param <> nil do begin while params^.Param <> nil do begin
writestringln(params^.Param); writestringln(params^.Param);
params:= params^.next; params:= params^.next;
end; end;
pop_trace;
end; end;
procedure echo(params : PParamList); procedure echo(params : PParamList);
@ -159,7 +149,6 @@ var
current : PParamList; current : PParamList;
begin begin
push_trace('terminal.echo');
current:= params^.next; current:= params^.next;
while current^.param <> nil do begin while current^.param <> nil do begin
console.writestring(current^.param); console.writestring(current^.param);
@ -167,28 +156,22 @@ begin
current:= current^.next; current:= current^.next;
end; end;
console.writestringln(''); console.writestringln('');
pop_trace;
end; end;
procedure clear(params : PParamList); procedure clear(params : PParamList);
begin begin
push_trace('terminal.clear');
console.clear(); console.clear();
pop_trace;
end; end;
procedure version(params : PParamList); procedure version(params : PParamList);
begin begin
push_trace('terminal.version');
console.writestringln('Asuro v1.0'); console.writestringln('Asuro v1.0');
pop_trace;
end; end;
procedure help(params : PParamList); procedure help(params : PParamList);
var var
i : uint32; i : uint32;
begin begin
push_trace('terminal.help');
console.writestringln('Registered Commands: '); console.writestringln('Registered Commands: ');
for i:=0 to 65534 do begin for i:=0 to 65534 do begin
if Commands[i].Registered then begin if Commands[i].Registered then begin
@ -198,18 +181,15 @@ begin
console.writestringln(Commands[i].description); console.writestringln(Commands[i].description);
end; end;
end; end;
pop_trace;
end; end;
procedure test(params : PParamList); procedure test(params : PParamList);
begin begin
push_trace('terminal.test');
if paramCount(params) > 0 then begin if paramCount(params) > 0 then begin
console.writeintln(stringToInt(getParam(0, params))); console.writeintln(stringToInt(getParam(0, params)));
end else begin end else begin
console.writestringln('Invalid number of params'); console.writestringln('Invalid number of params');
end; end;
pop_trace;
end; end;
procedure registerCommand(command : pchar; method : TCommandMethod; description : pchar); procedure registerCommand(command : pchar; method : TCommandMethod; description : pchar);
@ -217,14 +197,12 @@ var
index : uint32; index : uint32;
begin begin
push_trace('terminal.registerCommand');
index:= 0; index:= 0;
while Commands[index].registered = true do inc(index); while Commands[index].registered = true do inc(index);
Commands[index].registered:= true; Commands[index].registered:= true;
Commands[index].Command:= command; Commands[index].Command:= command;
Commands[index].method:= method; Commands[index].method:= method;
Commands[index].description:= description; Commands[index].description:= description;
pop_trace;
end; end;
procedure process_command; procedure process_command;
@ -279,7 +257,6 @@ end;
procedure key_event(info : TKeyInfo); procedure key_event(info : TKeyInfo);
begin begin
push_trace('terminal.key_event');
if (info.key_code >= 32) and (info.key_code <= 126) then begin if (info.key_code >= 32) and (info.key_code <= 126) then begin
if bIndex < 1024 then begin if bIndex < 1024 then begin
buffer[bIndex]:= info.key_code; buffer[bIndex]:= info.key_code;
@ -297,12 +274,10 @@ begin
if info.key_code = 13 then begin //return if info.key_code = 13 then begin //return
process_command; process_command;
end; end;
pop_trace;
end; end;
procedure init; procedure init;
begin begin
push_trace('terminal.init');
console.writestringln('TERMINAL: INIT BEGIN.'); console.writestringln('TERMINAL: INIT BEGIN.');
memset(uint32(@Commands[0]), 0, 65535*sizeof(TCommand)); memset(uint32(@Commands[0]), 0, 65535*sizeof(TCommand));
memset(uint32(@buffer[0]), 0, 1024); memset(uint32(@buffer[0]), 0, 1024);
@ -313,16 +288,13 @@ begin
registerCommand('TESTPARAMS', @testParams, 'Tests param parsing.'); registerCommand('TESTPARAMS', @testParams, 'Tests param parsing.');
registerCommand('TEST', @test, 'Command for testing.'); registerCommand('TEST', @test, 'Command for testing.');
console.writestringln('TERMINAL: INIT END.'); console.writestringln('TERMINAL: INIT END.');
pop_trace;
end; end;
procedure run; procedure run;
begin begin
push_trace('terminal.run');
keyboard.hook(@key_event); keyboard.hook(@key_event);
console.clear(); console.clear();
console.writestring('Asuro#> '); console.writestring('Asuro#> ');
pop_trace;
end; end;
end. end.