2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <graphics/gfxbase.h>
12 #include <graphics/monitor.h>
13 #include <graphics/view.h>
14 #include <graphics/gfxnodes.h>
15 #include <proto/exec.h>
16 #include <proto/graphics.h>
17 #include "graphics_intern.h"
19 /*****************************************************************************
23 AROS_LH2( void , GfxAssociate
,
27 AROS_LHA( void *, pointer
, A0
),
28 AROS_LHA( struct ExtendedNode
*, node
, A1
),
32 struct GfxBase
*, GfxBase
, 112, Graphics
)
35 Associate a special graphics extended data structure with another
36 structure via the other structure's pointer. Later, when you call
37 GfxLookUp() with the other structure's pointer you may receive
38 the pointer to this special graphics extended data structure, if it
42 pointer = a pointer to a data structure
43 node = an ExtendedNode structure to associate with the pointer
46 an association is created between the pointer and the node such
47 that given the pointer the node can be retrieved via GfxLookUp().
50 Never associate one special graphics extended data structure to
51 several pointers. Only one pointer is allowed!
58 graphics/gfxnodes.h GfxFree(), GfxNew(), GfxLookUp()
64 ******************************************************************************/
68 LONG
* Hash
= GfxBase
-> hash_table
;
69 ULONG Index
= CalcHashIndex((ULONG
)pointer
);
71 /* Whatever structure we get as node we put the pointer in the space
72 following immediately after the ExtendedNode structure.
73 ViewExtra -> View is equal to
74 ViewPortExtra -> ViewPort
77 ((struct ViewExtra
*)node
) -> View
= pointer
;
79 /* Insert the structure into a hash_list which is to be found
81 if (0L != Hash
[Index
])
82 ((struct ExtendedNode
*)Hash
[Index
]) -> xln_Pred
= (struct Node
*)node
;
83 node
-> xln_Succ
= (struct Node
*)Hash
[Index
];
84 node
-> xln_Pred
= (struct Node
*)&Hash
[Index
];
85 Hash
[Index
] = (LONG
)node
;