grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / intuition / allocintuimessage.c
blobeea995018692b9f735537257222e3c2a50ab0ff7
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 Copyright © 2001-2003, The MorphOS Development Team. All Rights Reserved.
4 $Id$
5 */
7 #include "intuition_intern.h"
8 #include <exec/exec.h>
10 /*****i***********************************************************************
12 NAME */
13 #include <proto/intuition.h>
15 AROS_LH1(struct IntuiMessage *, AllocIntuiMessage,
17 /* SYNOPSIS */
18 AROS_LHA(struct Window *, window, A0),
20 /* LOCATION */
21 struct IntuitionBase *, IntuitionBase, 148, Intuition)
23 /* FUNCTION
24 Private to AROS: allocate an IntuiMessage. IntuiMessage->Window
25 will be set to window by this function.
27 INPUTS
28 window - The window to which the IntuiMessage will be sent
30 RESULT
31 An allocated IntuiMessage structure. Must be freed with
32 FreeIntuiMessage().
34 NOTES
35 This private function is also present in MorphOS v50.
37 EXAMPLE
39 BUGS
41 SEE ALSO
43 INTERNALS
45 *****************************************************************************/
47 AROS_LIBFUNC_INIT
49 struct IntuiMessage *msg;
51 #ifdef __MORPHOS__
52 ASSERT_VALID_PTR(window);
53 SANITY_CHECKR(window,0)
54 #else
55 ASSERT_VALID_PTR_OR_NULL(window);
56 #endif
58 if ((msg = AllocPooled(GetPrivIBase(IntuitionBase)->IDCMPPool,sizeof(struct IntIntuiMessage))))
60 memclr(msg,sizeof(struct IntIntuiMessage));
62 msg->ExecMessage.mn_Node.ln_Type = NT_MESSAGE;
63 msg->ExecMessage.mn_Length = sizeof(struct ExtIntuiMessage);
64 msg->ExecMessage.mn_ReplyPort = window ? window->WindowPort : GetPrivIBase(IntuitionBase)->IntuiReplyPort;
66 msg->IDCMPWindow = window;
69 DEBUG_ALLOCINTUIMESSAGE(dprintf("AllocIntuiMessage: Window 0x%lx Port 0x%lx Msg 0x%lx\n",
70 window, window->WindowPort, msg));
72 return msg;
74 AROS_LIBFUNC_EXIT