r6308@lvps87-230-33-50: verhaegs | 2007-12-03 22:24:30 +0100
[AROS.git] / test / initstructtest.c
blob48549727693d33cdd19fbe3c30cb50b7cb3148a5
1 /*
2 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <clib/exec_protos.h>
8 #include "initstruct.h"
9 #include <stdio.h>
10 #include <stddef.h>
12 struct demo
14 LONG a[3];
15 BYTE b[7];
16 BYTE dummy1[2];
17 LONG c[3];
18 WORD d;
21 #define O(n) offsetof(struct demo,n)
23 struct init
25 S_CPY (1,3,L); /* 3 LONGs */
26 S_REP (2,7,B); /* 7 BYTEs */
27 S_CPYO (3,3,L); /* 3 LONGs */
28 S_CPYO24(4,1,W); /* 1 WORD */
29 S_END (end);
30 } inittable=
32 { { I_CPY (3,L), { 1, 2, 3 } } },
33 { { I_REP (7,B), 4 } },
34 { { I_CPYO (3,L,O(c)), { 5, 6, 7 } } },
35 { { I_CPYO24(1,W,O(d)), { 8 } } },
36 I_END ()
39 #undef O
41 int main(int argc,char *argv[])
43 struct demo d;
44 int i;
46 InitStruct(&inittable,&d,sizeof(d));
48 for(i=0;i<sizeof(d);i++)
49 printf("%02x ",((UBYTE *)&d)[i]);
51 return 0;