summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw12704b.pp
blob: 3e265d759a10372af446466a159a20023bbff8f3 (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
{ %target=darwin,linux,freebsd,solaris,beos,haiku }
{ %NEEDLIBRARY }

{$mode delphi}
program MainApp;

uses
  sysutils;

const
{$ifdef windows}
  libname='tw12704a.dll';
{$else}
  libname='tw12704a';
  {$linklib tw12704a}
{$endif}

procedure testsignals; cdecl; external libname;

procedure initsignals;
var
  p: pointer;
  i: longint;
begin
  // check that standard signals are hooked
  for i:=RTL_SIGINT to RTL_SIGLAST do
    case i of
      RTL_SIGINT,
      RTL_SIGQUIT:
        if (InquireSignal(i) <> ssNotHooked) then
          halt(102);
      RTL_SIGFPE,
      RTL_SIGSEGV,
      RTL_SIGILL,
      RTL_SIGBUS:
        if (InquireSignal(i) <> ssHooked) then
          halt(103);
      else
        halt(104);
    end;

  // unhook sigbus
  UnhookSignal(RTL_SIGBUS);
end;

begin
  initsignals;
  testsignals
end.