3 $VER: initializers.h 41.5 (30.9.2007)
4 Copyright (C) 2000-2007 Neil Cafferkey
6 This file is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as
8 published by the Free Software Foundation; either version 2.1 of the
9 License, or (at your option) any later version.
11 This file is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with this file; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23 #ifndef EXEC_INITIALIZERS_H
24 #define EXEC_INITIALIZERS_H
26 #include <exec/types.h>
29 /* Use the OFFSET macro as the offset parameter of one of the other
36 #define OFFSET(struct_name, struct_field) \
37 ((UPINT)(&(((struct struct_name *)0)->struct_field)))
39 /* Use the following macros in the structure definition */
41 #define INITBYTEDEF(name) \
42 UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
43 UBYTE name ## _o3; UBYTE name ## _v; UBYTE name ## _p
44 #define INITWORDDEF(name) \
45 UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
47 #define INITLONGDEF(name) \
48 UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
50 #define INITPINTDEF(name) \
51 UBYTE name ## _c; UBYTE name ## _o1; UBYTE name ## _o2; \
54 #define SMALLINITBYTEDEF(name) \
55 UBYTE name ## _c; UBYTE name ## _o; UBYTE name ## _v; UBYTE name ## _p
56 #define SMALLINITWORDDEF(name) \
57 UBYTE name ## _c; UBYTE name ## _o; UWORD name ## _v
58 #define SMALLINITLONGDEF(name) \
59 UBYTE name ## _c; UBYTE name ## _o; ULONG name ## _v
60 #define SMALLINITPINTDEF(name) \
61 UBYTE name ## _c; UBYTE name ## _o; UPINT name ## _v
63 #define INITENDDEF UBYTE the_end
67 #define PINTSIZECODE (((sizeof(PINT) == sizeof(ULONG)) ? 0 : 3) << 4)
69 /* Use the following macros to fill in a structure */
71 #define NEWINITBYTE(offset, value) \
72 0xe0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
74 #define NEWINITWORD(offset, value) \
75 0xd0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
77 #define NEWINITLONG(offset, value) \
78 0xc0, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), (UBYTE)(offset), \
80 #define INITPINT(offset, value) \
81 0xc0 | PINTSIZECODE, (UBYTE)((offset) >> 16), (UBYTE)((offset) >> 8), \
82 (UBYTE)(offset), (UPINT)(value)
84 #define SMALLINITBYTE(offset, value) \
85 0xa0, (offset), (UBYTE)(value), 0
86 #define SMALLINITWORD(offset, value) \
87 0x90, (offset), (UWORD)(value)
88 #define SMALLINITLONG(offset, value) \
89 0x80, (offset), (ULONG)(value)
90 #define SMALLINITPINT(offset, value) \
91 0x80 | PINTSIZECODE, (offset), (UPINT)(value)
95 /* Obsolete definitions */
97 #define INITBYTE(offset, value) \
98 (0xe000 | ((UWORD)(offset) >> 16)), \
99 (UWORD)(offset), (UWORD)((value) << 8)
100 #define INITWORD(offset, value) \
101 (0xd000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), (UWORD)(value)
102 #define INITLONG(offset, value) \
103 (0xc000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), \
104 (UWORD)((value) >> 16), (UWORD)(value)
105 #define INITAPTR(offset, value) \
106 (0xc000 | ((UWORD)(offset) >> 16)), (UWORD)(offset), \
107 (UWORD)((ULONG)(value) >> 16), (UWORD)(value)