diff --git a/Asuro.iso b/Asuro.iso index 87469ea3..7d7e7b7c 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index 44d4d5a6..e4247951 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index 44d4d5a6..e4247951 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/arp.ppu b/lib/arp.ppu index e2baf4a3..c7e05eae 100644 Binary files a/lib/arp.ppu and b/lib/arp.ppu differ diff --git a/lib/asuro.ppu b/lib/asuro.ppu index 42571ce3..6f089654 100644 Binary files a/lib/asuro.ppu and b/lib/asuro.ppu differ diff --git a/lib/fat32.ppu b/lib/fat32.ppu index f451d48b..431257e7 100644 Binary files a/lib/fat32.ppu and b/lib/fat32.ppu differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index ca40488f..4188c7ba 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index 1ad5249d..230fb4fc 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index f57b0fbd..0e2eda84 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index 04adbff4..0cc2bdb3 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/lists.ppu b/lib/lists.ppu index 3cc589d8..c721e0b8 100644 Binary files a/lib/lists.ppu and b/lib/lists.ppu differ diff --git a/lib/shell.ppu b/lib/shell.ppu index f39e4b6f..67257d2f 100644 Binary files a/lib/shell.ppu and b/lib/shell.ppu differ diff --git a/lib/storagemanagement.ppu b/lib/storagemanagement.ppu index ff784c57..3248f719 100644 Binary files a/lib/storagemanagement.ppu and b/lib/storagemanagement.ppu differ diff --git a/lib/terminal.ppu b/lib/terminal.ppu index 8c69558c..2348e274 100644 Binary files a/lib/terminal.ppu and b/lib/terminal.ppu differ diff --git a/src/include/asuro.pas b/src/include/asuro.pas index 8373d31f..8e6780d6 100644 --- a/src/include/asuro.pas +++ b/src/include/asuro.pas @@ -9,14 +9,14 @@ const VERSION_SUB = '1'; REVISION = '677'; RELEASE = 'ia'; - LINE_COUNT = 27661; + LINE_COUNT = 27683; FILE_COUNT = 89; DRIVER_COUNT = 32; FPC_VERSION = '2.6.4'; NASM_VERSION = '2.10.09'; MAKE_VERSION = '3.81'; COMPILE_DATE = '10/05/18'; - COMPILE_TIME = '09:07:10'; + COMPILE_TIME = '10:07:09'; implementation diff --git a/src/include/lists.pas b/src/include/lists.pas index ab02e994..8e3b123f 100644 --- a/src/include/lists.pas +++ b/src/include/lists.pas @@ -6,7 +6,8 @@ uses console, lmemorymanager, util, - strings; + strings, + tracer; type { Managed Linked List } @@ -25,17 +26,27 @@ type ElementSize : uint32; end; +{ String Linked List } + +procedure STRLL_Add(LinkedList : PLinkedListBase; str : pchar); +function STRLL_Get(LinkedList : PLinkedListBase; idx : uint32) : pchar; +function STRLL_New : PLinkedListBase; +function STRLL_Size(LinkedList : PLinkedListBase) : uint32; +procedure STRLL_Delete(LinkedList : PLinkedListBase; idx : uint32); +procedure STRLL_Free(LinkedList : PLinkedListBase); +procedure STRLL_Clear(LinkedList : PLinkedListBase); +function STRLL_FromString(str : pchar; delimter : char) : PLinkedListBase; + { Managed Linked List } -function LL_New(ElementSize : uint32) : PLinkedListBase; -function LL_Add(LinkedList : PLinkedListBase) : Void; -function LL_Delete(LinkedList : PLinkedListBase; idx : uint32) : boolean; -function LL_Size(LinkedList : PLinkedListBase) : uint32; -function LL_Insert(LinkedList : PLinkedListBase; idx : uint32) : Void; -function LL_Get(LinkedList : PLinkedListBase; idx : uint32) : Void; +function LL_New(ElementSize : uint32) : PLinkedListBase; +function LL_Add(LinkedList : PLinkedListBase) : Void; +function LL_Delete(LinkedList : PLinkedListBase; idx : uint32) : boolean; +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(); +function LL_FromString(str : pchar; delimter : char) : PLinkedListBase; implementation @@ -194,86 +205,7 @@ 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; - LList : PLinkedListBase; - Elem : Void; - Str : PChar; - -begin - console.writestringln('Add 3 Elements: '); - LList:= LL_New(10); - Elem:= LL_Add(LList); - Str:= PChar(Elem); - Str[0]:= 'H'; - Str[1]:= 'E'; - Str[2]:= 'L'; - Str[3]:= 'L'; - Str[4]:= 'O'; - Elem:= LL_Add(LList); - Str:= PChar(Elem); - Str[0]:= 'W'; - Str[1]:= 'O'; - Str[2]:= 'R'; - Str[3]:= 'L'; - Str[4]:= 'D'; - Elem:= LL_Add(LList); - Str:= PChar(Elem); - Str[0]:= 'T'; - Str[1]:= 'E'; - Str[2]:= 'S'; - Str[3]:= 'T'; - - for i:=0 to LL_Size(LList)-1 do begin - console.writestringln(PChar(LL_Get(LList, i))); - end; - - console.writestringln(' '); - console.writestringln('Remove Element 1:'); - LL_Delete(LList, 1); - - for i:=0 to LL_Size(LList)-1 do begin - console.writestringln(PChar(LL_Get(LList, i))); - end; - - LL_Free(LList); -end; - -function LL_FromString(str : pchar; delimter : char) : PLinkedListBase; //todo implment function for freeing pointer lists +function LL_FromString(str : pchar; delimter : char) : PLinkedListBase; var list : PLinkedListBase; i : uint32 = 0; @@ -308,4 +240,94 @@ begin end; end; +{ String Linked List } + +procedure STRLL_Add(LinkedList : PLinkedListBase; str : pchar); +var + ptr : puint32; + +begin + ptr:= puint32(LL_Add(LinkedList)); + ptr^:= uint32(str); +end; + +function STRLL_Get(LinkedList : PLinkedListBase; idx : uint32) : pchar; +var + ptr : puint32; + +begin + ptr:= puint32(LL_Get(LinkedList, idx)); + STRLL_Get:= nil; + if ptr <> nil then begin + STRLL_Get:= pchar(ptr^); + end; +end; + +function STRLL_New : PLinkedListBase; +begin + STRLL_New:= LL_New(sizeof(uint32)); +end; + +function STRLL_Size(LinkedList : PLinkedListBase) : uint32; +begin + STRLL_Size:= LL_Size(LinkedList); +end; + +procedure STRLL_Delete(LinkedList : PLinkedListBase; idx : uint32); +var + ptr : pchar; + +begin + tracer.push_trace('lists.STRLL_Delete (Don''t add static strings)'); + ptr:= STRLL_get(LinkedList, idx); + kfree(void(ptr)); + LL_Delete(LinkedList, idx); +end; + +procedure STRLL_Free(LinkedList : PLinkedListBase); +begin + STRLL_Clear(LinkedList); + LL_Free(LinkedList); +end; + +procedure STRLL_Clear(LinkedList : PLinkedListBase); +begin + while STRLL_Size(LinkedList) > 0 do STRLL_Delete(LinkedList, 0); +end; + +function STRLL_FromString(str : pchar; delimter : char) : PLinkedListBase; +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)); + STRLL_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. \ No newline at end of file