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
28 struct TagItem
* GetTagsFromStack (IPTR firstTag
, va_list args
);
29 void FreeTagsFromStack (struct TagItem
* tags
);
32 /* constants for Tag.ti_Tag, control tag values */
33 #define TAG_DONE (0L) /* terminates array of TagItems. ti_Data unused */
34 #define TAG_END (0L) /* synonym for TAG_DONE */
35 #define TAG_IGNORE (1L) /* ignore this item, not end of array */
36 #define TAG_MORE (2L) /* ti_Data is pointer to another array of TagItems
37 note that this tag terminates the current array */
38 #define TAG_SKIP (3L) /* skip this and the next ti_Data items */
40 /* What separates user tags from system tags */
41 #define TAG_USER ((ULONG)(1L<<31))
42 #define TAG_OS (16L) /* The first tag used by the OS */
44 /* Tag-Offsets for the OS */
45 #define DOS_TAGBASE (TAG_OS) /* Reserve 16k tags for DOS */
46 #define INTUITION_TAGBASE (TAG_OS | 0x2000) /* Reserve 16k tags for Intuition */
48 /* Tag filter for FilterTagItems() */
49 #define TAGFILTER_AND 0 /* exclude everything but filter hits */
50 #define TAGFILTER_NOT 1 /* exclude only filter hits */
52 /* Mapping types for MapTags() */
53 #define MAP_REMOVE_NOT_FOUND 0 /* remove tags that aren't in mapList */
54 #define MAP_KEEP_NOT_FOUND 1 /* keep tags that aren't in mapList */
56 /* Macro for syntactic sugar (and a little extra bug-resiliance) */
57 #define TAGLIST(args...) ((struct TagItem *)(IPTR []){ args, TAG_DONE })
60 Some macros to make it easier to write functions which operate on
61 stacktags on every CPU/compiler/hardware.
63 #ifndef AROS_TAGRETURNTYPE
64 # define AROS_TAGRETURNTYPE IPTR
67 #ifdef AROS_SLOWSTACKTAGS
68 # define AROS_NR_SLOWSTACKTAGS_PRE(arg) \
70 struct TagItem * tags; \
72 va_start (args, arg); \
74 if ((tags = GetTagsFromStack (arg, args))) \
77 # define AROS_SLOWSTACKTAGS_PRE(arg) \
78 AROS_TAGRETURNTYPE retval; \
80 struct TagItem * tags; \
82 va_start (args, arg); \
84 if ((tags = GetTagsFromStack (arg, args))) \
88 # define AROS_SLOWSTACKTAGS_ARG(arg) tags
90 # define AROS_SLOWSTACKTAGS_POST \
91 FreeTagsFromStack (tags); \
94 retval = (AROS_TAGRETURNTYPE)0L; \
100 # define AROS_NR_SLOWSTACKTAGS_POST \
101 FreeTagsFromStack (tags); \
106 # define AROS_NR_SLOWSTACKTAGS_PRE(arg)
107 # define AROS_NR_SLOWSTACKTAGS_POST
108 # define AROS_SLOWSTACKTAGS_PRE(arg) AROS_TAGRETURNTYPE retval;
109 # define AROS_SLOWSTACKTAGS_ARG(arg) ((struct TagItem *)&(arg))
110 # define AROS_SLOWSTACKTAGS_POST return retval;
113 #endif /* UTILITY_TAGITEM_H */