Minor fixes to comments.
[AROS.git] / rom / intuition / findclass.c
blob64841c36e44589c7d504490699b60a328bf77fcd
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
6 Find a BOOPSI Class in the class list.
7 */
9 #include <string.h>
10 #include <exec/lists.h>
11 #include <proto/exec.h>
13 #include "intuition_intern.h"
15 #undef SDEBUG
16 #define SDEBUG 0
17 #undef DEBUG
18 #define DEBUG 0
19 #include <aros/debug.h>
21 /*****i************************************************************************
23 NAME */
24 #include <intuition/classes.h>
25 #include <proto/intuition.h>
27 AROS_LH1(struct IClass *, FindClass,
29 /* SYNOPSIS */
30 AROS_LHA(ClassID, classID, A0),
32 /* LOCATION */
33 struct IntuitionBase *, IntuitionBase, 112, Intuition)
35 /* FUNCTION
37 INPUTS
39 RESULT
41 NOTES
42 This function is binary-compatible with AmigaOS v3, however it is
43 considered private.
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 HISTORY
55 ******************************************************************************/
57 AROS_LIBFUNC_INIT
59 Class * classPtr = NULL;
61 DEBUG_FINDCLASS(dprintf("FindClass: ClassID <%s>\n",
62 classID ? classID : (UBYTE*)"NULL"));
64 EnterFunc(bug("intuition_boopsi::FindClass()\n"));
66 if (!classID)
67 return NULL;
69 D(bug("class to find: \"%s\"\n", classID));
71 /* Lock the list */
72 ObtainSemaphoreShared (&GetPrivIBase(IntuitionBase)->ClassListLock);
74 /* Search for the class */
75 ForeachNode (&GetPrivIBase(IntuitionBase)->ClassList, classPtr)
77 D(bug("+\"%s\"\n", classPtr->cl_ID));
78 if (!strcmp (classPtr->cl_ID, classID))
79 goto found;
82 classPtr = NULL; /* Nothing found */
83 D(bug("class not found!\n"));
85 found:
86 /* Unlock list */
87 ReleaseSemaphore (&GetPrivIBase(IntuitionBase)->ClassListLock);
89 DEBUG_FINDCLASS(dprintf("FindClass: return 0x%lx\n", classPtr));
91 ReturnPtr("intuition_boopsi::FindClass()", struct IClass *, classPtr);
93 AROS_LIBFUNC_EXIT