longarray.pas 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998-2002 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. History:
  14. A simple unit that helps to build array of longint.
  15. Uses array of const so don't forget to use
  16. $mode objfpc.
  17. 05 Nov 2002.
  18. [email protected]
  19. }
  20. unit longarray;
  21. {$mode objfpc}
  22. interface
  23. function readinlongs(const args : array of const): pointer;
  24. implementation
  25. uses pastoc;
  26. var
  27. argarray : array [0..20] of longint;
  28. function readinlongs(const args : array of const): pointer;
  29. var
  30. i : longint;
  31. begin
  32. for i := 0 to High(args) do begin
  33. case args[i].vtype of
  34. vtinteger : argarray[i] := longint(args[i].vinteger);
  35. vtpchar : argarray[i] := longint(args[i].vpchar);
  36. vtchar : argarray[i] := longint(args[i].vchar);
  37. vtpointer : argarray[i] := longint(args[i].vpointer);
  38. vtstring : argarray[i] := longint(pas2c(args[i].vstring^));
  39. vtboolean : argarray[i] := longint(byte(args[i].vboolean));
  40. end;
  41. end;
  42. readinlongs := @argarray;
  43. end;
  44. end.