show cpu number in fiq
[AROS.git] / rom / graphics / gfxlookup.c
bloba6feaafc20668a512579c93e3150fe03a8c962b5
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <graphics/gfxnodes.h>
11 #include <graphics/monitor.h>
12 #include <graphics/view.h>
13 #include <graphics/gfxbase.h>
14 #include <proto/exec.h>
15 #include <proto/graphics.h>
16 #include "graphics_intern.h"
18 /*****************************************************************************
20 NAME */
22 AROS_LH1( struct ExtendedNode *, GfxLookUp,
24 /* SYNOPSIS */
26 AROS_LHA( void *, pointer, A0),
28 /* LOCATION */
30 struct GfxBase *, GfxBase, 117, Graphics)
32 /* FUNCTION
33 Finds a special graphics extended data structure (if an) associated
34 with the pointer to a data structure (e.g.: ViewExtra associated with
35 a View structure).
37 INPUTS
38 pointer = a pointer to a data structure which may have an
39 ExtendedNode associated with it (typically a View)
41 RESULT
42 result = a pointer to the ExtendedNode that has previously been
43 associated with the pointer
45 NOTES
47 EXAMPLE
49 BUGS
51 SEE ALSO
52 graphics/gfxnodes.h, GfxNew(), GfxAssociate(), GfxFree()
54 INTERNALS
56 HISTORY
58 ******************************************************************************/
60 AROS_LIBFUNC_INIT
62 IPTR *Hash = GfxBase -> hash_table;
63 ULONG Index = CalcHashIndex((IPTR)pointer, GFXASSOCIATE_HASHSIZE);
65 /* Whatever structure we get as node we put the pointer in the space
66 following immediately after the ExtendedNode structure.
67 ViewExtra -> View
68 ViewPortExtra -> ViewPort
71 ObtainSemaphoreShared(GfxBase->HashTableSemaphore);
73 struct ExtendedNode * node = (struct ExtendedNode *)(Hash[Index]);
74 while (NULL != node)
76 if (pointer == (void *) ((struct ViewExtra *)node)->View )
77 break;
78 else
79 /* examine the next element */
80 node = (struct ExtendedNode *)node -> xln_Succ;
83 ReleaseSemaphore(GfxBase->HashTableSemaphore);
84 return node;
86 AROS_LIBFUNC_EXIT
87 } /* GfxFree */