2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
10 #include <proto/exec.h>
11 #include <proto/dos.h>
12 #include <proto/utility.h>
13 #include <proto/locale.h>
14 #include <exec/memory.h>
16 #include "asl_intern.h"
18 /*****************************************************************************
21 #include <proto/asl.h>
22 #include <libraries/asl.h>
23 #include <utility/tagitem.h>
26 AROS_LH2(APTR
, AllocAslRequest
,
29 AROS_LHA(ULONG
, reqType
, D0
),
30 AROS_LHA(struct TagItem
*, tagList
, A0
),
33 struct Library
*, AslBase
, 8, Asl
)
52 27-11-96 digulla automatically created from
53 asl_lib.fd and clib/asl_protos.h
55 *****************************************************************************/
59 struct IntReq
*intreq
;
62 struct ReqNode
*reqnode
;
63 struct AslReqInfo
*reqinfo
;
70 (reqType
!= ASL_FileRequest
)
72 (reqType
!= ASL_FontRequest
)
74 (reqType
!= ASL_ScreenModeRequest
)
78 reqinfo
= &(ASLB(AslBase
)->ReqInfo
[reqType
]);
80 /* Allocate memory for internal requester structure */
81 intreq
= AllocVec(reqinfo
->IntReqSize
, MEMF_ANY
);
84 req
= AllocVec(reqinfo
->ReqSize
, MEMF_ANY
|MEMF_CLEAR
);
87 CopyMem(reqinfo
->DefaultReq
, intreq
, reqinfo
->IntReqSize
);
89 if (intreq
->ir_MemPoolPuddle
)
91 intreq
->ir_MemPool
= CreatePool(MEMF_PUBLIC
| MEMF_CLEAR
,
92 intreq
->ir_MemPoolPuddle
,
93 intreq
->ir_MemPoolThresh
);
96 if (!intreq
->ir_MemPoolPuddle
|| intreq
->ir_MemPool
)
98 if (tagList
) /* If no taglist is supplied, we use default values */
100 struct ParseTagArgs pta
;
102 ParseCommonTags(intreq
, tagList
, ASLB(AslBase
));
104 /* Parse tags specific for this type of requester */
105 pta
.pta_IntReq
= intreq
;
107 pta
.pta_Tags
= tagList
;
109 CallHookPkt(&(reqinfo
->ParseTagsHook
), &pta
, ASLB(AslBase
));
114 /* Add requester to internal list */
115 reqnode
= AllocMem(sizeof (struct ReqNode
), MEMF_ANY
);
118 reqnode
->rn_Req
= req
;
119 reqnode
->rn_IntReq
= intreq
;
120 reqnode
->rn_ReqWindow
= NULL
;
121 ObtainSemaphore( &(ASLB(AslBase
)->ReqListSem
) );
122 AddTail( (struct List
*)&(ASLB(AslBase
)->ReqList
), (struct Node
*)reqnode
);
123 ReleaseSemaphore(&(ASLB(AslBase
)->ReqListSem
));
131 if (intreq
->ir_MemPool
) DeletePool(intreq
->ir_MemPool
);
133 } /* if no mempool needed or mempool creation ok */
136 } /* if (Alloc public request structure) */
139 } /* if (Alloc private request structure) */
141 SetIoErr(ERROR_NO_FREE_STORE
);
146 } /* AllocAslRequest */