Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / utility / gettagdata.c
blob8b2f03399e1a9edfa76c9c42fa2212fc8bc1f7c7
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
5 GetTagData()
6 */
7 #include "intern.h"
9 /*****************************************************************************
11 NAME */
12 #include <utility/tagitem.h>
13 #include <proto/utility.h>
15 AROS_LH3(IPTR, GetTagData,
17 /* SYNOPSIS */
18 AROS_LHA(Tag , tagValue, D0),
19 AROS_LHA(IPTR , defaultVal, D1),
20 AROS_LHA(const struct TagItem *, tagList, A0),
22 /* LOCATION */
23 struct UtilityBase *, UtilityBase, 6, Utility)
25 /* FUNCTION
26 Searches the TagList for the Tag specified, if it exists, then
27 returns the ti_Data field of that Tag, otherwise returns the
28 supplied default value.
30 INPUTS
31 tagValue - Tag to search for.
32 defaultVal - Default value for the Tag.
33 tagList - Pointer to first TagItem in the list.
35 RESULT
36 The data value if the Tag exists, or the default value if it
37 doesn't.
39 NOTES
40 If the input TagList doesn't exist (eg for some reason equals
41 NULL), then the return value will be NULL. This way you can
42 check for broken code, whereas returing the default would allow
43 code that is possibly buggy to still seem to work. (Until you
44 tried to do anything special at least).
46 EXAMPLE
48 struct Window *window; \* The Window we are creating *\
49 struct TagItem *wintags; \* Tags for this window *\
51 \* Find out the value for the WA_Left tag *\
52 window->Left = GetTagData( WA_Left, 320, wintags )
54 BUGS
56 SEE ALSO
57 utility/tagitem.h
59 INTERNALS
61 *****************************************************************************/
63 AROS_LIBFUNC_INIT
64 struct TagItem *ti = NULL;
67 If we can find the Tag in the supplied list, then return the
68 ti_Data fields value.
70 If the tag is not in the list, just return the default value.
72 if (tagList && (ti = FindTagItem(tagValue, tagList)))
73 return ti->ti_Data;
75 return defaultVal;
76 AROS_LIBFUNC_EXIT
77 } /* GetTagData */