added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / compiler / include / utility / tagitem.h
blob11fa69674ac8c9bf531963516999d6a713902207
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 struct TagItem * GetTagsFromStack (IPTR firstTag, va_list args);
29 void FreeTagsFromStack (struct TagItem * tags);
30 #endif
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
65 #endif
67 #ifdef AROS_SLOWSTACKTAGS
68 # define AROS_NR_SLOWSTACKTAGS_PRE(arg) \
69 va_list args; \
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; \
79 va_list args; \
80 struct TagItem * tags; \
82 va_start (args, arg); \
84 if ((tags = GetTagsFromStack (arg, args))) \
85 { \
86 retval =
88 # define AROS_SLOWSTACKTAGS_ARG(arg) tags
90 # define AROS_SLOWSTACKTAGS_POST \
91 FreeTagsFromStack (tags); \
92 } \
93 else \
94 retval = (AROS_TAGRETURNTYPE)0L; \
96 va_end (args); \
98 return retval;
100 # define AROS_NR_SLOWSTACKTAGS_POST \
101 FreeTagsFromStack (tags); \
104 va_end (args);
105 #else
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;
111 #endif
113 #endif /* UTILITY_TAGITEM_H */