zutil.pas 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. unit zutil;
  2. {
  3. Copyright (C) 1998 by Jacques Nomssi Nzali
  4. For conditions of distribution and use, see copyright notice in readme.txt
  5. }
  6. interface
  7. {$I zconf.inc}
  8. const
  9. {$IFDEF MAXSEG_64K}
  10. MaxMemBlock = $FFFF;
  11. {$ELSE}
  12. MaxMemBlock = MaxInt;
  13. {$ENDIF}
  14. type
  15. zByteArray = array[0..(MaxMemBlock div SizeOf(byte))-1] of byte;
  16. pzByteArray = ^zByteArray;
  17. type
  18. zIntfArray = array[0..(MaxMemBlock div SizeOf(byte))-1] of integer;
  19. pzIntfArray = ^zIntfArray;
  20. type
  21. zuIntArray = array[0..(MaxMemBlock div SizeOf(cardinal))-1] of cardinal;
  22. PuIntArray = ^zuIntArray;
  23. type
  24. zuchfArray = zByteArray;
  25. puchfArray = ^zuchfArray;
  26. type
  27. zushfArray = array[0..(MaxMemBlock div SizeOf(word))-1] of word;
  28. pushfArray = ^zushfArray;
  29. procedure zcfree(opaque : pointer; ptr : pointer);
  30. function zcalloc (opaque : pointer; items : cardinal; size : cardinal) : pointer;
  31. implementation
  32. type
  33. LH = record
  34. L, H : word;
  35. end;
  36. procedure zcfree(opaque : pointer; ptr : pointer);
  37. begin
  38. FreeMem(ptr);
  39. end;
  40. function zcalloc (opaque : pointer; items : cardinal; size : cardinal) : pointer;
  41. var
  42. p : pointer;
  43. memsize : cardinal;
  44. begin
  45. memsize := items * size;
  46. getmem(p, memsize);
  47. zcalloc := p;
  48. end;
  49. end.