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

This commit is contained in:
kieron
2018-05-05 21:34:24 +00:00
parent cac366e78c
commit 2c10fa3231
19 changed files with 81 additions and 44 deletions

View File

@ -3,20 +3,20 @@ unit asuro;
interface
const
VERSION = '1.0.1-663ia';
VERSION = '1.0.1-664ia';
VERSION_MAJOR = '1';
VERSION_MINOR = '0';
VERSION_SUB = '1';
REVISION = '663';
REVISION = '664';
RELEASE = 'ia';
LINE_COUNT = 26954;
LINE_COUNT = 26991;
FILE_COUNT = 83;
DRIVER_COUNT = 28;
FPC_VERSION = '2.6.4';
NASM_VERSION = '2.10.09';
MAKE_VERSION = '3.81';
COMPILE_DATE = '05/05/18';
COMPILE_TIME = '22:04:28';
COMPILE_TIME = '22:33:57';
implementation

View File

@ -5,7 +5,8 @@ interface
uses
console,
lmemorymanager,
util;
util,
strings;
type
{ Managed Linked List }
@ -33,6 +34,7 @@ function LL_Size(LinkedList : PLinkedListBase) : uint32;
function LL_Insert(LinkedList : PLinkedListBase; idx : uint32) : Void;
function LL_Get(LinkedList : PLinkedListBase; idx : uint32) : Void;
procedure LL_Free(LinkedList : PLinkedListBase);
function LL_FromString(str : pchar; delimter : char) : PLinkedListBase;
procedure LL_TEST();
implementation
@ -192,6 +194,39 @@ begin
kfree(void(LinkedList));
end;
{function LL_FromString(str : pchar; delimter : char) : PLinkedListBase; //todo implment function for freeing pointer lists
var
list : PLinkedListBase;
i : uint32 = 0;
out_str : pchar;
elm : puint32;
head : pchar;
base : pchar;
size : uint32;
null_delim : boolean;
begin
list := LL_New(sizeof(uint32));
stringToLL:= list;
head:= str;
base:= head;
null_delim:= false;
while not null_delim do begin
i:=0;
while (head[i] <> delimter) and (head[i] <> char(0)) do begin
inc(i);
end;
if head[i] = char(0) then null_delim:= true;
size:= (uint32(@head[i]) - uint32(base)) + 1;
out_str:= stringNew(size);
memset(uint32(out_str), 0, size);
memcpy(uint32(base), uint32(out_str), size-1);
elm:= puint32(LL_Add(list));
elm
end;
end;}
procedure LL_Test();
var
i : uint32;
@ -238,4 +273,39 @@ begin
LL_Free(LList);
end;
function LL_FromString(str : pchar; delimter : char) : PLinkedListBase; //todo implment function for freeing pointer lists
var
list : PLinkedListBase;
i : uint32 = 0;
out_str : pchar;
elm : puint32;
head : pchar;
tail : pchar;
size : uint32;
null_delim : boolean;
begin
list := LL_New(sizeof(uint32));
LL_FromString:= list;
head:= str;
tail:= head;
null_delim:= false;
while not null_delim do begin
if (head^ = delimter) or (head^ = char(0)) then begin
if head^ = char(0) then null_delim:= true;
size:= uint32(head) - uint32(tail);
if size > 0 then begin
elm:= puint32(LL_Add(list));
out_str:= stringNew(size + 1); //maybe
memcpy(uint32(tail), uint32(out_str), size);
elm^:= uint32(out_str);
end;
tail:= head+1;
end;
inc(head);
end;
end;
end.

View File

@ -13,8 +13,7 @@ interface
uses
util,
lmemorymanager,
lists;
lmemorymanager;
function stringToUpper(str : pchar) : pchar;
function stringToLower(str : pchar) : pchar;
@ -27,7 +26,6 @@ function stringContains(str : pchar; sub : pchar) : boolean;
function stringToInt(str : pchar) : uint32;
function intToString(i : uint32) : pchar;
function boolToString(b : boolean; ext : boolean) : pchar;
function stringToLL(str : pchar; delimter : char) : PLinkedListBase;
implementation
@ -178,40 +176,4 @@ begin
end;
end;
function stringToLL(str : pchar; delimter : char) : PLinkedListBase; //todo implment function for freeing pointer lists
var
list : PLinkedListBase;
i : uint32 = 0;
out_str : pchar;
elm : puint32;
head : pchar;
tail : pchar;
size : uint32;
null_delim : boolean;
begin
list := LL_New(sizeof(uint32));
stringToLL:= list;
head:= str;
tail:= head;
null_delim:= false;
while not null_delim do begin
if (head^ = delimter) or (head^ = char(0)) then begin
if head^ = char(0) then null_delim:= true;
size:= uint32(head) - uint32(tail);
if size > 0 then begin
elm:= puint32(LL_Add(list));
out_str:= stringNew(size + 1); //maybe
memcpy(uint32(tail), uint32(out_str), size);
elm^:= uint32(out_str);
end;
tail:= head+1;
end else begin
end;
inc(head);
end;
end;
end.

View File

@ -92,6 +92,7 @@ var
atmp : puint32;
test : puint8;
fb : puint16;
l : PLinkedListBase;
begin
{ Store Multiboot info }
@ -211,6 +212,10 @@ begin
tracer.push_trace('kmain.END');
l:= LL_FromString('/./hhhhhhh/', '/');
writestringln(pchar(puint32(LL_Get(l, 0)^)));
writestringln(pchar(puint32(LL_Get(l, 1)^)));
while true do begin
console.redrawWindows;
end;