home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
packery
/
xpk_source
/
xpkmaster
/
xbuf.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-19
|
1KB
|
58 lines
#ifndef XPKMASTER_XBUF_C
#define XPKMASTER_XBUF_C
/* Routinesheader
Name: xbuf.c
Main: xpkmaster
Versionstring: $VER: xbuf.c 1.0 (09.10.96)
Author: SDI
Distribution: PD
Description: Xpk buffer handling
1.0 09.10.96 : first real version
*/
#include <pragma/exec_lib.h>
#include <exec/memory.h>
#include <exec/libraries.h>
#include <dos/dos.h>
#include "xpkmaster.h"
/************************* alloc and init xbuf ***************************/
struct XpkBuffer *initxbuf(void)
{
struct XpkBuffer *xbuf;
if(!(xbuf = (struct XpkBuffer *) AllocMem(sizeof(struct XpkBuffer),
MEMF_CLEAR)))
return 0;
/* Save the original task priority in case we change it during an
operation */
xbuf->xb_Priority = FindTask(0L)->tc_Node.ln_Pri;
xbuf->xb_InLen = -1;
xbuf->xb_Prog.xp_FileName = "";
return xbuf;
}
/***************************** free bufs *******************************/
LONG freebufs(struct XpkBuffer *xbuf)
{ /* Free an XpkBuffer */
LONG error = xbuf->xb_Result;
closesub(xbuf); /* Free any open sub-library */
if(xbuf->xb_Flags & XMF_OWNTASKPRI)
SetTaskPri(FindTask (NULL), xbuf->xb_Priority);
FreeMem(xbuf, sizeof(struct XpkBuffer));
/* Finally, free the handle itself */
return error;
}
#endif /* XPKMASTER_XBUF_C */