1 #ifndef UTILITY_TAGITEM_H
2 #define UTILITY_TAGITEM_H
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
13 # include <exec/types.h>
15 #ifdef AROS_SLOWSTACKTAGS
19 typedef STACKULONG Tag
;
23 Tag ti_Tag
; /* What is this ? */
24 STACKIPTR ti_Data
; /* Tag-specific data */
27 #ifdef AROS_SLOWSTACKTAGS
29 struct TagItem
* GetTagsFromStack (IPTR firstTag
, va_list args
);
30 void FreeTagsFromStack (struct TagItem
* tags
);
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
69 #ifdef AROS_SLOWSTACKTAGS
70 # define AROS_NR_SLOWSTACKTAGS_PRE(arg) \
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; \
82 struct TagItem * tags; \
84 va_start (args, arg); \
86 if ((tags = GetTagsFromStack (arg, args))) \
90 # define AROS_SLOWSTACKTAGS_ARG(arg) tags
92 # define AROS_SLOWSTACKTAGS_POST \
93 FreeTagsFromStack (tags); \
96 retval = (AROS_TAGRETURNTYPE)0L; \
102 # define AROS_NR_SLOWSTACKTAGS_POST \
103 FreeTagsFromStack (tags); \
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;
115 #endif /* UTILITY_TAGITEM_H */