refactored some code. compiles now without suppresing any warning with gcc-6.3.0.
[AROS.git] / workbench / libs / initstruct.h
blob2a1b159bbd2b96dca44f2cb4c5b57c2a686767c8
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Defines and macros to create and fill an inittable
6 Lang: english
7 */
8 #ifndef _INITSTRUCT_H_
9 #define _INITSTRUCT_H_
10 #ifndef EXEC_TYPES_H
11 # include <exec/types.h>
12 #endif
14 typedef BYTE type_B;
15 typedef WORD type_W;
16 typedef LONG type_L;
18 #define S_DEF(i,l) union \
19 { \
20 struct _##i { l } _l; \
21 char _s[(sizeof(struct _##i)+AROS_LONGALIGN-1)&~(AROS_LONGALIGN-1)]; \
22 } _##i
25 #define CODE_B 0x20
26 #define CODE_W 0x10
27 #define CODE_L 0x00
29 #define S_CPY(i,n,t) S_DEF(i,UBYTE _cmd; type_##t _data[(n)];)
30 #define S_REP(i,n,t) S_DEF(i,UBYTE _cmd; type_##t _data;)
31 #define S_CPYO(i,n,t) S_DEF(i,UBYTE _cmd; UBYTE _ofst; type_##t _data[(n)];)
32 #define S_CPYO24(i,n,t) S_DEF(i,ULONG _cmd; type_##t _data[(n)];)
33 #define S_END(i) UBYTE _##i
34 #define I_CPY(n,t) CODE_##t|((n)-1)
35 #define I_REP(n,t) 0x40|CODE_##t|((n)-1)
36 #define I_CPYO(n,t,o) 0x80|CODE_##t|((n)-1), (o)
37 #if AROS_BIG_ENDIAN
38 #define I_CPYO24(n,t,o) (0xc0|CODE_##t|((n)-1))<<24|(o)
39 #else
40 #define I_CPYO24(n,t,o) 0xc0|CODE_##t|((n)-1)|(o)<<8
41 #endif
42 #define I_END() 0
44 #endif