grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / intuition / nextobject.c
blob36d0fa6d766d9aa56921ea0d7b6ac0a75784b42c
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
6 Iterate through a list of objects.
7 */
9 #include <exec/types.h>
10 #include <exec/nodes.h>
11 #include "intuition_intern.h"
13 /*****************************************************************************
15 NAME */
16 #include <intuition/classes.h>
17 #include <proto/intuition.h>
19 AROS_LH1(APTR, NextObject,
21 /* SYNOPSIS */
22 AROS_LHA(APTR, objectPtrPtr, A0),
24 /* LOCATION */
25 struct IntuitionBase *, IntuitionBase, 111, Intuition)
27 /* FUNCTION
28 Use this function to iterate through a list of BOOPSI objects.
29 You may do whatever you want with the object returned, even
30 remove it from the list or dispose it, and then continue to
31 iterate through the list.
33 INPUTS
34 objectPtrPtr - the pointer to a variable. This must be the same
35 variable, as long as you iterate though the same list. This
36 variable must initially be filled with the lh_Head of a list.
38 RESULT
39 A BOOPSI object, which can be manipulated.
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 NewObjectA(),
49 "Basic Object-Oriented Programming System for Intuition" and
50 "Boopsi Class Reference" Document.
52 INTERNALS
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 struct _Object *nextobject;
59 APTR oldobject;
61 DEBUG_NEXTOBJECT(dprintf("NextObject: optr 0x%lx\n",
62 objectPtrPtr));
64 IntuitionBase = IntuitionBase; /* shut up the compiler */
66 SANITY_CHECKR(objectPtrPtr,FALSE)
68 nextobject = (struct _Object *)(*((struct _Object **)objectPtrPtr))->o_Node.mln_Succ;
69 if (nextobject)
71 oldobject = (Object *)BASEOBJECT(*((struct _Object **)objectPtrPtr));
72 *((struct _Object **)objectPtrPtr) = nextobject;
74 else
76 oldobject = NULL;
79 return oldobject;
81 AROS_LIBFUNC_EXIT
82 } /* NextObject() */