grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / camd / nextclusterlink.c
blobe01acd6e06d1887ec2bc71cbce5fe993aa86133f
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include "camd_intern.h"
11 /*****************************************************************************
13 NAME */
15 AROS_LH3(struct MidiLink *, NextClusterLink,
17 /* SYNOPSIS */
18 AROS_LHA(struct MidiCluster *, cluster, A0),
19 AROS_LHA(struct MidiLink *, midilink, A1),
20 AROS_LHA(LONG, type, D0),
22 /* LOCATION */
23 struct CamdBase *, CamdBase, 18, Camd)
25 /* FUNCTION
26 Finds the next midilink of a specified type in a midicluster.
28 INPUTS
29 cluster - Pointer to the midicluster that the midilink belongs to.
30 midilink - Pointer to the midilink to begin searching from.
31 type - Either MLTYPE_Receiver or MLTYPE_Sender
33 RESULT
34 Returns the next MidiLink of a spevified type, or NULL if the last
35 in the list. If midilink is NULL, returns the first.
37 NOTES
38 CL_Linkages must be locked.
40 EXAMPLE
42 BUGS
44 SEE ALSO
46 INTERNALS
48 HISTORY
50 2001-01-12 ksvalast first created
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct Node *node;
58 if(type==MLTYPE_Receiver){
59 node=cluster->mcl_Receivers.lh_Head;
60 }else{
61 node=cluster->mcl_Senders.lh_Head;
65 while(node->ln_Succ!=NULL){
66 if(node->ln_Type!=NT_USER-MLTYPE_NTypes){
67 if(midilink==NULL){
68 return (struct MidiLink *)node;
69 }else{
70 if(node==&midilink->ml_Node){
71 if(node->ln_Succ->ln_Succ!=NULL){
72 return (struct MidiLink *)node->ln_Succ;
73 }else{
74 return NULL;
79 node=node->ln_Succ;
82 return NULL;
84 AROS_LIBFUNC_EXIT