Added missing properties.
[AROS.git] / rom / graphics / ucopperlistinit.c
blob3e6aa79c38207e6c024163032f1972e97c3e6b86
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Graphics function UCopperListInit()
6 Lang: english
7 */
8 #include <graphics/copper.h>
9 #include <exec/types.h>
10 #include <exec/memory.h>
11 #include <proto/exec.h>
12 #include "graphics_intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/graphics.h>
19 AROS_LH2(struct CopList *, UCopperListInit,
21 /* SYNOPSIS */
22 AROS_LHA(struct UCopList *, ucl, A0),
23 AROS_LHA(WORD , n , D0),
25 /* LOCATION */
26 struct GfxBase *, GfxBase, 99, Graphics)
28 /* FUNCTION
29 Allocates and initializes copperlist structures and buffers
30 internal to UCopList structure.
32 INPUTS
33 ucl - pointer to a UCopList structure. Must not be NULL!
34 n - number of instructions the buffer must be able to hold
36 RESULT
37 cl - pointer to a buffer that will accept n intermediate
38 copper instructions
40 NOTE: this is a pointer to UCopList->FirstCopList!
42 NOTES
44 EXAMPLE
46 BUGS
48 SEE ALSO
49 CINIT(), CMOVE(), CWAIT(), CEND(), graphics/copper.h
51 INTERNALS
53 HISTORY
55 *****************************************************************************/
57 AROS_LIBFUNC_INIT
59 /* has this structure previously been initialized? */
61 if (ucl->FirstCopList != NULL &&
62 ucl->FirstCopList->MaxCount != 0 &&
63 ucl->FirstCopList->CopIns != NULL )
65 ucl->FirstCopList->Count = ucl->FirstCopList->MaxCount;
66 ucl->FirstCopList->CopPtr = ucl->FirstCopList->CopIns;
67 return ucl->FirstCopList;
71 if (NULL != (ucl->FirstCopList =
72 (struct CopList *)AllocMem(sizeof(struct CopList),
73 MEMF_CLEAR|MEMF_PUBLIC)))
75 /* if we were successful with the memory allocation then let's get
76 * the buffer for the instructions
78 ucl->CopList = ucl->FirstCopList;
79 /* further init the coplist structure */
80 ucl->FirstCopList->MaxCount = n;
82 ucl->FirstCopList->CopIns = (struct CopIns *)AllocMem(n*sizeof(struct CopIns), MEMF_CLEAR|MEMF_PUBLIC);
83 ucl->FirstCopList->CopPtr = ucl->FirstCopList->CopIns;
85 /* did we get the memory? */
86 if (NULL == ucl->FirstCopList->CopIns)
87 return (NULL);
89 return (ucl->FirstCopList);
90 AROS_LIBFUNC_EXIT
91 } /* UCopperListInit */