r4722@vps: verhaegs | 2007-05-06 13:11:19 -0400
[cake.git] / rom / boopsi / findclass.c
blob9d7934195ee6492acf0ae7379a6465caa9734916
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Find a BOOPSI Class in the class list.
6 Lang: english
7 */
8 #include <exec/lists.h>
9 #include <proto/exec.h>
11 #include "intern.h"
13 #undef SDEBUG
14 #define SDEBUG 0
15 #undef DEBUG
16 #define DEBUG 1
17 #include <aros/debug.h>
19 /*****************************************************************************
21 NAME */
22 #include <intuition/classes.h>
23 #include <proto/boopsi.h>
25 AROS_LH1(struct IClass *, FindClass,
27 /* SYNOPSIS */
28 AROS_LHA(ClassID, classID, A0),
30 /* LOCATION */
31 struct Library *, BOOPSIBase, 7, BOOPSI)
33 /* FUNCTION
35 INPUTS
37 RESULT
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 HISTORY
51 ******************************************************************************/
53 AROS_LIBFUNC_INIT
55 Class * classPtr = NULL;
57 EnterFunc(bug("boopsi::FindClass()\n"));
59 if (!classID)
60 return NULL;
62 D(bug("class to find: \"%s\"\n", classID));
64 /* Lock the list */
65 ObtainSemaphoreShared (&GetBBase(BOOPSIBase)->bb_ClassListLock);
67 /* Search for the class */
68 ForeachNode (&GetBBase(BOOPSIBase)->bb_ClassList, classPtr)
70 D(bug("+\"%s\"\n", classPtr->cl_ID));
71 if (!strcmp (classPtr->cl_ID, classID))
72 goto found;
75 classPtr = NULL; /* Nothing found */
76 D(bug("class not found!\n"));
78 found:
79 /* Unlock list */
80 ReleaseSemaphore (&GetBBase(BOOPSIBase)->bb_ClassListLock);
82 ReturnPtr("boopsi::FindClass()", struct IClass *, classPtr);
83 AROS_LIBFUNC_EXIT