Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. {TODO}
  2.  
  3. function SysOSAlloc(Size: PtrInt): Pointer;
  4. begin
  5.   Result := kos_alloc(Size);
  6. end;
  7.  
  8. {$define HAS_SYSOSFREE}
  9. procedure SysOSFree(P: Pointer; Size: PtrInt);
  10. begin
  11.   kos_free(P);
  12. end;
  13.  
  14. (*
  15. {DEBUG version}
  16.  
  17. var
  18.   SysMemoryBlocks: array[Byte] of record
  19.     Used: Boolean;
  20.     Address: Pointer;
  21.     Size: Longint;
  22.   end;
  23.  
  24. function SysOSAlloc(Size: PtrInt): Pointer;
  25. var
  26.   I: Longint;
  27. begin
  28.   Result := kos_alloc(Size);
  29.  
  30.   for I := 0 to High(SysMemoryBlocks) do
  31.   if not SysMemoryBlocks[I].Used then
  32.   begin
  33.     SysMemoryBlocks[I].Used := True;
  34.     SysMemoryBlocks[I].Address := Result;
  35.     SysMemoryBlocks[I].Size := Size;
  36.     Break;
  37.   end;
  38. end;
  39.  
  40. {$define HAS_SYSOSFREE}
  41. procedure SysOSFree(P: Pointer; Size: PtrInt);
  42. var
  43.   B: Byte;
  44.   I: Longint;
  45. begin
  46.   B := 0;
  47.   for I := 0 to High(SysMemoryBlocks) do
  48.   if SysMemoryBlocks[I].Address = P then
  49.   begin
  50.     SysMemoryBlocks[I].Used := False;
  51.     if SysMemoryBlocks[I].Size <> Size then B := 1 div B;
  52.     Break;
  53.   end;
  54.  
  55.   kos_free(P);
  56. end;*)
  57.