helpers.pas
1021 Bytes
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
unit helpers;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
function RandomString(ALength : Integer): Utf8String;
procedure PrintZmqVersion(AAplicationPath:string);
implementation
uses zmq;
function RandomString( ALength: Integer ): Utf8String;
const
Chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ';
var
i: integer;
begin
Result := '';
for i := 1 to ALength do
Result := Result + Chars[Random(Length(Chars)) + 1];
end;
procedure PrintZmqVersion(AAplicationPath : string);
var
LPatch, LMinor, LMajor: Integer;
S : TStringList;
begin
LMajor := 0; LMinor := 0; LPatch := 0;
zmq_version(LMajor,LMinor,LPatch);
try
WriteLn('ZMQVERSION:',LMajor,'.',LMinor,'.',LPatch);
except
on E : Exception do
begin
S := TStringList.Create;
S.Append(IntToStr(LMajor)+IntToStr(LMinor)+IntToStr(LPatch));
S.SaveToFile(AAplicationPath+PathDelim+'ZMQVERSION');
S.Free;
end;
end;
end;
initialization
Randomize;
end.