Cleanup of terminal stuff.

git-svn-id: https://spexeah.com:8443/svn/Asuro@237 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron 2017-10-24 08:46:07 +00:00
parent c201235da7
commit 9ccd2a2f9b
13 changed files with 31 additions and 26 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.

View File

@ -41,7 +41,7 @@ begin
Terminal.run; Terminal.run;
end; end;
procedure terminal_command_meminfo(buffer : TCommandBuffer); procedure terminal_command_meminfo(params : PParamList);
begin begin
console.writestring('Lower Memory = '); console.writestring('Lower Memory = ');
console.writeint(multibootinfo^.mem_lower); console.writeint(multibootinfo^.mem_lower);

View File

@ -80,7 +80,7 @@ begin
end; end;
end; end;
procedure terminal_command_tasks(buffer : TCommandBuffer); procedure terminal_command_tasks(params : PParamList);
var var
list : PScheduler_Entry; list : PScheduler_Entry;

View File

@ -119,7 +119,7 @@ end;
function stringContains(str : pchar; sub : pchar) : boolean; function stringContains(str : pchar; sub : pchar) : boolean;
begin begin
result:= false; stringContains:= false;
end; end;
end. end.

View File

@ -24,7 +24,7 @@ type
Next : PParamList; Next : PParamList;
end; end;
TCommandBuffer = array[0..1023] of byte; TCommandBuffer = array[0..1023] of byte;
TCommandMethod = procedure(buf : TCommandBuffer); TCommandMethod = procedure(params : PParamList);
TCommand = record TCommand = record
registered : boolean; registered : boolean;
command : pchar; command : pchar;
@ -59,12 +59,7 @@ begin
current^.Param:= nil; current^.Param:= nil;
start:= 0; start:= 0;
finish:= 0; finish:= 0;
while (char(buf[finish]) <> ' ') and (buf[finish] <> 0) do begin
inc(finish);
end;
while buf[start] <> 0 do begin while buf[start] <> 0 do begin
start:=finish+1;
inc(finish);
while (char(buf[finish]) <> ' ') and (buf[finish] <> 0) do begin while (char(buf[finish]) <> ' ') and (buf[finish] <> 0) do begin
inc(finish); inc(finish);
end; end;
@ -79,46 +74,45 @@ begin
current^.next:= nil; current^.next:= nil;
current^.Param:= nil; current^.Param:= nil;
end; end;
start:=finish+1;
inc(finish);
end; end;
getParams:= root; getParams:= root;
end; end;
procedure testParams(buffer : TCommandBuffer); procedure testParams(params : PParamList);
var
params : PParamList;
begin begin
params:= getParams(buffer);
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;
end; end;
procedure echo(buffer : TCommandBuffer); procedure echo(params : PParamList);
var var
idx : uint32; current : PParamList;
begin begin
idx:= 5; current:= params^.next;
while buffer[idx] <> 0 do begin while current^.param <> nil do begin
console.writechar(char(buffer[idx])); console.writestring(current^.param);
inc(idx); console.writestring(' ');
current:= current^.next;
end; end;
console.writestringln(''); console.writestringln('');
end; end;
procedure clear(buffer : TCommandBuffer); procedure clear(params : PParamList);
begin begin
console.clear(); console.clear();
end; end;
procedure version(buffer : TCommandBuffer); procedure version(params : PParamList);
begin begin
console.writestringln('Asuro v1.0'); console.writestringln('Asuro v1.0');
end; end;
procedure help(buffer : TCommandBuffer); procedure help(params : PParamList);
var var
i : uint32; i : uint32;
begin begin
@ -180,7 +174,9 @@ end;
procedure process_command; procedure process_command;
var var
fallthrough : boolean; fallthrough : boolean;
params : PParamList;
i : uint32; i : uint32;
next : PParamList;
begin begin
console.writecharln(' '); console.writecharln(' ');
@ -189,7 +185,16 @@ begin
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
if isCommand(Commands[i].command) then begin if isCommand(Commands[i].command) then begin
Commands[i].method(buffer); params:= getParams(buffer);
Commands[i].method(params);
params:= params;
next:= params^.next;
while params^.next <> nil do begin
if params^.param <> nil then kfree(void(params^.param));
kfree(void(params));
params:= next;
next:= params^.next;
end;
fallthrough:= false; fallthrough:= false;
end; end;
end; end;