1
0
mirror of https://github.com/deadw00d/AROS.git synced 2025-12-06 21:40:57 +00:00
Files
AROS-v0/workbench/libs/iffparse/openclipboard.c
Matthias Rustler 6b5a534ce3 workbench: detabbed
2021-05-02 13:55:14 +02:00

104 lines
2.5 KiB
C

/*
Copyright (C) 1995-2016, The AROS Development Team. All rights reserved.
*/
#include "iffparse_intern.h"
/*****************************************************************************
NAME */
#include <proto/iffparse.h>
AROS_LH1(struct ClipboardHandle *, OpenClipboard,
/* SYNOPSIS */
AROS_LHA(LONG, unitNumber, D0),
/* LOCATION */
struct Library *, IFFParseBase, 41, IFFParse)
/* FUNCTION
Opens the clipboard.device with the specified unit.
Allocates and initializes a ClipboardHandle struct which should
be put into the iff_Stream field of the IFFHandle when the
handle is initialized with InitIFFasClip().
INPUTS
unitNumber - a clipboard device unit number (usually PRIMARY_CLIP).
RESULT
ch - pointer to ClipboardHandle struct or NULL if unsuccessful.
NOTES
EXAMPLE
BUGS
SEE ALSO
InitIFFasClip(), CloseClipboard()
INTERNALS
*****************************************************************************/
{
AROS_LIBFUNC_INIT
struct ClipboardHandle * ch;
struct IOClipReq * req;
struct Task * thistask;
/* Allocate a ClipBoardHandle */
ch = AllocMem
(
sizeof (struct ClipboardHandle),
MEMF_ANY | MEMF_CLEAR | MEMF_PUBLIC
);
if (ch)
{
/* Get a ponter to the ioClipReq, so we
don't need all that type casting.
*/
req = &(ch->cbh_Req);
thistask = FindTask(0L);
if (InitPort( &(ch->cbh_CBport), thistask, IPB(IFFParseBase)))
{
if (InitPort( &(ch->cbh_SatisfyPort), thistask, IPB(IFFParseBase)))
{
/* Initialize the IORequest structure.
Basically CreateIORequest without memory allocation.
*/
req->io_Message.mn_ReplyPort = &(ch->cbh_CBport);
req->io_Message.mn_Length = sizeof(struct IOClipReq);
if
(!OpenDevice
(
"clipboard.device",
unitNumber,
(struct IORequest*)req,
0L
)
)
{
return (ch);
}
ClosePort( &(ch->cbh_SatisfyPort), IPB(IFFParseBase));
}
ClosePort( &(ch->cbh_CBport), IPB(IFFParseBase));
}
FreeMem(ch, sizeof (struct ClipboardHandle));
}
return (FALSE);
AROS_LIBFUNC_EXIT
} /* OpenClipboard */