xref: /csrg-svn/old/dbx/tests/mod/bitfields.mod (revision 44109)
1*44109Sbosticmodule main;
2*44109Sbostic
3*44109Sbosticimport io;
4*44109Sbostic
5*44109Sbostictype
6*44109Sbostic    uint = @align 1 cardinal;
7*44109Sbostic    dotrecord = record
8*44109Sbostic	cost : @size 24 uint;
9*44109Sbostic	dtype : @size 3 uint;
10*44109Sbostic	dirToCenter : @size 3 uint;
11*44109Sbostic	pad : @size 1 uint;
12*44109Sbostic	pin : @size 1 uint;
13*44109Sbostic	traceback : @size 3 uint;
14*44109Sbostic	traceforward : @size 3 uint;
15*44109Sbostic	expanded : @size 1 uint;
16*44109Sbostic	underDir : @size 3 uint;
17*44109Sbostic	underOffset : @size 4 uint;
18*44109Sbostic	start : @size 1 uint;
19*44109Sbostic	target : @size 1 uint;
20*44109Sbostic	owner : @size 6 uint;
21*44109Sbostic	segment : @size 7 uint;
22*44109Sbostic	intrinsicCost : @size 3 uint;
23*44109Sbostic    end;
24*44109Sbostic
25*44109Sbosticprocedure p1 ();
26*44109Sbosticvar junk : dotrecord;
27*44109Sbosticbegin
28*44109Sbostic    junk.owner := 63;
29*44109Sbostic    junk.segment := 1;
30*44109Sbostic    junk.intrinsicCost := 1;
31*44109Sbostic    io.Writef(io.output, "owner = %d, segment = %d, intrinsicCost = %d\n",
32*44109Sbostic	junk.owner, junk.segment, junk.intrinsicCost);
33*44109Sbostic    p2();
34*44109Sbosticend p1;
35*44109Sbostic
36*44109Sbosticprocedure p2 ();
37*44109Sbosticvar x : record
38*44109Sbostic	first : integer;
39*44109Sbostic	second : integer;
40*44109Sbostic	a : @size 8 @align 1 integer;
41*44109Sbostic	b : @size 8 @align 1 integer;
42*44109Sbostic	c : integer;
43*44109Sbostic    end;
44*44109Sbosticbegin
45*44109Sbostic    x.first := 0;
46*44109Sbostic    x.second := 0;
47*44109Sbostic    x.a := 2;
48*44109Sbostic    x.b := 10;
49*44109Sbostic    x.c := 1;
50*44109Sbostic    io.Writef(io.output, "done\n");
51*44109Sbosticend p2;
52*44109Sbostic
53*44109Sbosticbegin
54*44109Sbostic    p1();
55*44109Sbosticend main.
56