Updated PCI IDs to latest snapshot.
[tangerine.git] / compiler / include / utility / tagitem.h
blob1590ef59f9f633637db28cd35ba1c61c43a8c7f8
1 #ifndef UTILITY_TAGITEM_H
2 #define UTILITY_TAGITEM_H
4 /*
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Tag-lists
9 Lang: english
12 #ifndef EXEC_TYPES_H
13 # include <exec/types.h>
14 #endif
15 #ifdef AROS_SLOWSTACKTAGS
16 # include <stdarg.h>
17 #endif
19 typedef STACKULONG Tag;
21 struct TagItem
23 Tag ti_Tag; /* What is this ? */
24 STACKIPTR ti_Data; /* Tag-specific data */
27 #ifdef AROS_SLOWSTACKTAGS
28 __BEGIN_DECLS
29 struct TagItem * GetTagsFromStack (IPTR firstTag, va_list args);
30 void FreeTagsFromStack (struct TagItem * tags);
31 __END_DECLS
32 #endif
34 /* constants for Tag.ti_Tag, control tag values */
35 #define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */
36 #define TAG_END (0L) /* synonym for TAG_DONE */
37 #define TAG_IGNORE (1L) /* ignore this item, not end of array */
38 #define TAG_MORE (2L) /* ti_Data is pointer to another array of TagItems
39 note that this tag terminates the current array */
40 #define TAG_SKIP (3L) /* skip this and the next ti_Data items */
42 /* What separates user tags from system tags */
43 #define TAG_USER ((STACKULONG)(1L<<31))
44 #define TAG_OS (16L) /* The first tag used by the OS */
46 /* Tag-Offsets for the OS */
47 #define DOS_TAGBASE (TAG_OS) /* Reserve 16k tags for DOS */
48 #define INTUITION_TAGBASE (TAG_OS | 0x2000) /* Reserve 16k tags for Intuition */
50 /* Tag filter for FilterTagItems() */
51 #define TAGFILTER_AND 0 /* exclude everything but filter hits */
52 #define TAGFILTER_NOT 1 /* exclude only filter hits */
54 /* Mapping types for MapTags() */
55 #define MAP_REMOVE_NOT_FOUND 0 /* remove tags that aren't in mapList */
56 #define MAP_KEEP_NOT_FOUND 1 /* keep tags that aren't in mapList */
58 /* Macro for syntactic sugar (and a little extra bug-resiliance) */
59 #define TAGLIST(args...) ((struct TagItem *)(IPTR []){ args, TAG_DONE })
62 Some macros to make it easier to write functions which operate on
63 stacktags on every CPU/compiler/hardware.
65 #ifndef AROS_TAGRETURNTYPE
66 # define AROS_TAGRETURNTYPE IPTR
67 #endif
69 #ifdef AROS_SLOWSTACKTAGS
70 # define AROS_NR_SLOWSTACKTAGS_PRE(arg) \
71 va_list args; \
72 struct TagItem * tags; \
74 va_start (args, arg); \
76 if ((tags = GetTagsFromStack (arg, args))) \
79 # define AROS_SLOWSTACKTAGS_PRE(arg) \
80 AROS_TAGRETURNTYPE retval; \
81 va_list args; \
82 struct TagItem * tags; \
84 va_start (args, arg); \
86 if ((tags = GetTagsFromStack (arg, args))) \
87 { \
88 retval =
90 # define AROS_SLOWSTACKTAGS_ARG(arg) tags
92 # define AROS_SLOWSTACKTAGS_POST \
93 FreeTagsFromStack (tags); \
94 } \
95 else \
96 retval = (AROS_TAGRETURNTYPE)0L; \
98 va_end (args); \
100 return retval;
102 # define AROS_NR_SLOWSTACKTAGS_POST \
103 FreeTagsFromStack (tags); \
106 va_end (args);
107 #else
108 # define AROS_NR_SLOWSTACKTAGS_PRE(arg)
109 # define AROS_NR_SLOWSTACKTAGS_POST
110 # define AROS_SLOWSTACKTAGS_PRE(arg) AROS_TAGRETURNTYPE retval;
111 # define AROS_SLOWSTACKTAGS_ARG(arg) ((struct TagItem *)&(arg))
112 # define AROS_SLOWSTACKTAGS_POST return retval;
113 #endif
115 #endif /* UTILITY_TAGITEM_H */