home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / gcc / libnixV0_8.lha / gnu / libnix-sources.lha / sources / amiga / misc / CreateIO.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-12  |  883 b   |  41 lines

  1. #include <exec/io.h>
  2. #include <exec/memory.h>
  3. #ifdef __GNUC__
  4. #include <inline/exec.h>
  5. #else
  6. #include <clib/exec_protos.h>
  7. #endif
  8. #include <clib/alib_protos.h>
  9. #include <stabs.h>
  10.  
  11. struct IORequest *CreateExtIO(struct MsgPort *port,long iosize)
  12. {
  13.   struct IORequest *ioreq=NULL;
  14.  
  15.   if (port && (ioreq=AllocMem(iosize,MEMF_CLEAR|MEMF_PUBLIC)))
  16.   {
  17.     ioreq->io_Message.mn_Node.ln_Type=NT_MESSAGE;
  18.     ioreq->io_Message.mn_ReplyPort=port;
  19.     ioreq->io_Message.mn_Length=iosize;
  20.   }
  21.   return ioreq;
  22. }
  23.  
  24. struct IOStdReq *CreateStdIO(struct MsgPort *port)
  25. {
  26.   return (struct IOStdReq *)CreateExtIO(port,sizeof(struct IOStdReq));
  27. }
  28.  
  29. void DeleteExtIO(struct IORequest *ioreq)
  30. {
  31.   int i;
  32.  
  33.   i=-1;
  34.   ioreq->io_Message.mn_Node.ln_Type=i;
  35.   ioreq->io_Device=(struct Device *)i;
  36.   ioreq->io_Unit=(struct Unit *)i;
  37.   FreeMem(ioreq,ioreq->io_Message.mn_Length);
  38. }
  39.  
  40. ALIAS(DeleteStdIO,DeleteExtIO);
  41.