Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / realtime / getplayerattrsa.c
blob84ba79528b2bbe64b92c71c7fc8b47a6eaa5d2dc
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <proto/realtime.h>
8 #include <proto/utility.h>
9 #include "realtime_intern.h"
11 /*****************************************************************************
13 NAME */
15 #include <utility/tagitem.h>
16 #include <libraries/realtime.h>
18 AROS_LH2(BOOL, GetPlayerAttrsA,
20 /* SYNOPSIS */
22 AROS_LHA(struct Player *, player , A0),
23 AROS_LHA(struct TagItem *, tagList, A1),
25 /* LOCATION */
27 struct Library *, RealTimeBase, 14, RealTime)
29 /* FUNCTION
31 Query the attributes of a player. For each tagitem ti_Tag specifies the
32 attribute and ti_Data a pointer to the IPTR variable in which you want
33 the value to be stored.
35 INPUTS
37 player -- The player the attributes of which to set; may be NULL,
38 in which case the result is 0.
39 tagList -- Pointer to an array of tags describing the player's
40 attributes or NULL.
42 TAGS
44 See CreatePlayerA().
46 RESULT
48 The number of items successfully filled in.
50 NOTES
52 EXAMPLE
54 BUGS
56 SEE ALSO
58 CreatePlayerA(), SetPlayerAttrsA()
60 INTERNALS
62 ******************************************************************************/
64 #define Put (*((IPTR *)(tag->ti_Data)))
67 AROS_LIBFUNC_INIT
69 int nAttrs = 0;
70 struct TagItem *tl = tagList;
71 struct TagItem *tag;
73 /* Maybe we could use FindTagItem to initialize error and conductor
74 first... */
76 if (player != NULL)
78 while ((tag = NextTagItem(&tl)) != NULL)
80 switch (tag->ti_Tag)
82 case PLAYER_Name:
83 Put = (IPTR)player->pl_Link.ln_Name;
84 break;
86 case PLAYER_Hook:
87 Put = (IPTR)player->pl_Hook;
88 break;
90 case PLAYER_Priority:
91 Put = (IPTR)player->pl_Link.ln_Pri;
92 break;
94 case PLAYER_Conductor:
95 Put = (IPTR)player->pl_Source;
96 break;
98 case PLAYER_Ready:
99 Put = (player->pl_Flags & PLAYERF_READY) != 0;
100 break;
102 case PLAYER_AlarmTime:
103 Put = player->pl_AlarmTime;
104 break;
106 case PLAYER_Alarm:
107 Put = (player->pl_Flags & PLAYERF_ALARMSET) != 0;
108 break;
110 case PLAYER_AlarmSigTask:
111 Put = (IPTR)player->pl_Task;
112 break;
114 case PLAYER_AlarmSigBit:
115 /* We could use player->pl_Link.mn_Type here */
116 Put = player->pl_Reserved0; /* NOTE! */
117 break;
119 case PLAYER_Quiet:
120 Put = (player->pl_Flags & PLAYERF_QUIET) != 0;
121 break;
123 case PLAYER_UserData:
124 Put = (IPTR)player->pl_UserData;
125 break;
127 case PLAYER_ID:
128 Put = player->pl_PlayerID;
129 break;
131 case PLAYER_Conducted:
132 Put = (player->pl_Flags & PLAYERF_CONDUCTED) != 0;
133 break;
135 case PLAYER_ExtSync:
136 Put = (player->pl_Flags & PLAYERF_EXTSYNC) != 0;
137 break;
140 nAttrs++;
144 return nAttrs;
146 AROS_LIBFUNC_EXIT
147 } /* GetPlayerAttrsA */