some fixes to accented characters
[tangerine.git] / rom / workbench / support_messages.c
blobc3ae2d85b56ef5f4fb94ebb5870bd765aa7e62dd
1 /*
2 Copyright © 2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
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
19 if (message != NULL)
21 message->mn_Length = size;
24 return message;
27 VOID __FreeMessage_WB
29 struct Message *message, struct WorkbenchBase *WorkbenchBase
32 if (message != NULL)
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);
45 VOID __DestroyWBS_WB
47 struct WBStartup *message, struct WorkbenchBase *WorkbenchBase
50 if (message != NULL)
52 struct WBArg *args = message->sm_ArgList;
53 ULONG i;
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));
76 if (message != NULL)
78 message->iwbhm_wbhm.wbhm_Type = type;
79 message->iwbhm_wbhm.wbhm_Message.mn_ReplyPort = replyport;
82 return message;
85 VOID __DestroyIWBHM_WB
87 struct IntWBHandlerMessage *message, struct WorkbenchBase *WorkbenchBase
90 if (message != NULL)
92 switch (message->iwbhm_wbhm.wbhm_Type)
94 case WBHM_TYPE_OPEN:
95 if (message->iwbhm_wbhm.wbhm_Data.Open.Name != NULL)
97 FreeVec((APTR) message->iwbhm_wbhm.wbhm_Data.Open.Name);
99 break;
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);
106 break;
108 case WBHM_TYPE_SHOW:
109 case WBHM_TYPE_HIDE:
110 /* No additional resources to free */
111 break;
114 FreeMessage((struct Message *) message);