summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/amunits/src/utilunits/longarray.pas
blob: a644188e30724fd0721c1778326f79126cbcce39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
    This file is part of the Free Pascal run time library.

    A file in Amiga system run time library.
    Copyright (c) 1998-2002 by Nils Sjoholm
    member of the Amiga RTL development team.

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}

{
    History:

    A simple unit that helps to build array of longint.
    Uses array of const so don't forget to use
    $mode objfpc.

    05 Nov 2002.

    nils.sjoholm@mailbox.swipnet.se
}

unit longarray;

{$mode objfpc}

interface

function readinlongs(const args : array of const): pointer;

implementation

uses pastoc;

var
  argarray : array [0..20] of longint;

function readinlongs(const args : array of const): pointer;
var
   i : longint;

begin

    for i := 0 to High(args) do begin
        case args[i].vtype of
            vtinteger : argarray[i] := longint(args[i].vinteger);
            vtpchar   : argarray[i] := longint(args[i].vpchar);
            vtchar    : argarray[i] := longint(args[i].vchar);
            vtpointer : argarray[i] := longint(args[i].vpointer);
            vtstring  : argarray[i] := longint(pas2c(args[i].vstring^));
            vtboolean : argarray[i] := longint(byte(args[i].vboolean));
        end;
    end;
    readinlongs := @argarray;
end;

end.