define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / rom / intuition / nextobject.c
blob5372c157845dc6999dc1149ecc09a1feae0b0547
1 /*
2 Copyright © 1995-2007, 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 disposing it and then continue to
31 iterate thought 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" Dokument.
52 INTERNALS
54 HISTORY
56 *****************************************************************************/
58 AROS_LIBFUNC_INIT
60 struct _Object *nextobject;
61 APTR oldobject;
63 DEBUG_NEXTOBJECT(dprintf("NextObject: optr 0x%lx\n",
64 objectPtrPtr));
66 IntuitionBase = IntuitionBase; /* shut up the compiler */
68 SANITY_CHECKR(objectPtrPtr,FALSE)
70 nextobject = (struct _Object *)(*((struct _Object **)objectPtrPtr))->o_Node.mln_Succ;
71 if (nextobject)
73 oldobject = (Object *)BASEOBJECT(*((struct _Object **)objectPtrPtr));
74 *((struct _Object **)objectPtrPtr) = nextobject;
76 else
78 oldobject = NULL;
81 return oldobject;
83 AROS_LIBFUNC_EXIT
84 } /* NextObject() */