2 Copyright © 2003, The AROS Development Team. All rights reserved.
6 #include "support_messages.h"
8 /*** Generic message handling functions *************************************/
9 struct Message
*__AllocMessage_WB
11 ULONG size
, struct WorkbenchBase
*WorkbenchBase
14 struct Message
*message
= (struct Message
*) AllocMem
16 size
, MEMF_PUBLIC
| MEMF_CLEAR
21 message
->mn_Length
= size
;
29 struct Message
*message
, struct WorkbenchBase
*WorkbenchBase
34 FreeMem(message
, message
->mn_Length
);
38 /*** Specialized message handling functions *********************************/
39 /*== WBStartup =============================================================*/
40 struct WBStartup
*__CreateWBS_WB(struct WorkbenchBase
*WorkbenchBase
)
42 return (struct WBStartup
*) AllocMessage(WBS_SIZE
);
47 struct WBStartup
*message
, struct WorkbenchBase
*WorkbenchBase
52 struct WBArg
*args
= message
->sm_ArgList
;
55 for (i
= 0; i
< message
->sm_NumArgs
; i
++)
57 if (args
[i
].wa_Lock
!= NULL
) UnLock(args
[i
].wa_Lock
);
58 if (args
[i
].wa_Name
!= NULL
) FreeVec(args
[i
].wa_Name
);
61 FreeMem(message
->sm_ArgList
, message
->sm_NumArgs
* sizeof(struct WBArg
));
63 FreeMessage((struct Message
*) message
);
67 /*== WBHandlerMessage ======================================================*/
68 struct IntWBHandlerMessage
*__CreateIWBHM_WB
70 enum WBHM_Type type
, struct MsgPort
*replyport
,
71 struct WorkbenchBase
*WorkbenchBase
74 struct IntWBHandlerMessage
*message
= (struct IntWBHandlerMessage
*)AllocMessage(sizeof(struct IntWBHandlerMessage
));
78 message
->iwbhm_wbhm
.wbhm_Type
= type
;
79 message
->iwbhm_wbhm
.wbhm_Message
.mn_ReplyPort
= replyport
;
85 VOID __DestroyIWBHM_WB
87 struct IntWBHandlerMessage
*message
, struct WorkbenchBase
*WorkbenchBase
92 switch (message
->iwbhm_wbhm
.wbhm_Type
)
95 if (message
->iwbhm_wbhm
.wbhm_Data
.Open
.Name
!= NULL
)
97 FreeVec((APTR
) message
->iwbhm_wbhm
.wbhm_Data
.Open
.Name
);
101 case WBHM_TYPE_UPDATE
:
102 if (message
->iwbhm_wbhm
.wbhm_Data
.Update
.Name
!= NULL
)
104 FreeVec((APTR
) message
->iwbhm_wbhm
.wbhm_Data
.Update
.Name
);
110 /* No additional resources to free */
114 FreeMessage((struct Message
*) message
);