home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
dev
/
cmanual-3.0.lha
/
CManual
/
Amiga
/
Appendices
/
FunctionsAndLibraries
/
ExecLibrary.doc
< prev
next >
Wrap
Text File
|
1993-10-12
|
21KB
|
673 lines
7 EXEC LIBRARY
7.1 OPEN THE EXEC LIBRARY
The Exec Library is automatically opened when your program is
loaded, so you do not have to open it yorself. The functions
listed in this fil e can therefore directly be used.
7.2 FUNCTIONS
AbortIO()
This function will try to abort a previously started request.
Of course, only asynchronous commands can be aborted, and if
the request has already been completed it can not be aborted
any more.
Synopsis: AbortIO( req )
req: (struct IORequest *) Pointer to the request you
want to abort.
AddHead()
This function will add a note at the head of a list.
Synopsis: AddHead( list, node )
list: (struct List *) Pointer to the list you wish to
insert the node in.
node: (struct Node *) Pointer to the node you want to
insert.
AddTail()
This function will add a note at the tail of a list.
Synopsis: AddTail( list, node )
list: (struct List *) Pointer to the list you wish to
insert the node in.
node: (struct Node *) Pointer to the node you want to
insert.
AllocMem()
This function allocates memory. You specifies what type and
how much you want, and it returns a pointer to the allocated
memory, or NULL if there did not exist enough memory.
Synopsis: memory = AllocMem( size, type );
memory: (void *) Pointer to the new allocated memory, or
NULL if no memory could be allocated. Remember!
Never use memory which you have not successfully
allocated.
size: (long) The size (in bytes) of the memory you want.
(AllocMem() always allocates memory in multiples of
eight bytes. So if you only ask for 9 bytes, Exec
would actually give you 16 Bytes (2*8).)
type: (long) You need to choose one of the three
following types of memory (see chapter 0
INTRODUCTION for more information about Chip and
Fast memory):
MEMF_CHIP Chip memory. This memory can be
accessed by both the main processor, as
well as the Chips. Graphics/Sound data
MUST therefore be placed in Chip memory.
If it does not matter what type of
memory you get (Fast or Chip), you
should try to allocate Fast memory
before you allocate Chip memory. (Chip
memory is more valuable than Fast
memory.)
MEMF_FAST Fast memory. This memory can only be
accessed by the main processor.
(Graphics and Sound data can NOT be
stored in Fast memory, use Chip memory.)
This memory is normally a little bit
faster than Chip memory, since only the
main processor is working with it, and
it is not disturbed by the Chips.
MEMF_PUBLIC If it does not matter what type of
memory you get (you do not intend to
use the memory for Graphics/Sound data),
you should use Fast memory. However,
all Amigas do not have Fast memory,
since you need to by a memory expansion
in order to get it. If want to tell
Exec that you would like to use Fast
memory if there is any, else use Chip
memory, you should ask for MEMF_PUBLIC.
If you want the allocated memory to be cleared
(initialized to zeros), you should set the flag
MEMF_CLEAR.
BeginIO()
This function will send request blocks to a device. This
function is "asynchronous" which means that your program will
continue to run while the device is executing your command.
This function is very similar to SendIO(). The difference is
that this function will not clear some values in the request
block. If you are using the Audio Device or is using the
"Quick Mode" you should use this function.
Synopsis: BeginIO( req )
req: (struct IORequest *) Pointer to the request you
want to have executed. When you want to use the
quick mode you have to use this low level function
rather than SendIO() and DoIO().
CheckIO()
This function will check if an asynchronous request has been
completed or not.
Synopsis: ptr = CheckIO( req );
ptr: (long) CheckIO() will either return NULL if the
request have not been completed or it will return a
pointer to the request block.
req: (struct IORequest *) Pointer to the request you
want to check.
CloseDevice()
This function will close a previously opened device. All
devices you have opened must be closed before your program
may terminate.
Synopsis: CloseDevice( req );
reg: (struct IORequest *) Pointer to the device's
request block.
CreateExtIO()
This function will allocate and initialize an extended request
block of any desired size (must not be smaller than a normal
IORequest structure). The size depends on which device the
request block should be used with.
Synopsis: ext_req = CreateExtIO( msg_port, size );
ext_req: (struct IORequest *) Pointer to the new extended
request block, or NULL if the request block could
not be created.
msg_port: (struct MsgPort *) Pointer to the message port
the device should use to communicate with you.
size: (long) The number of bytes that should be allocated
for the extended request block. Use the function
sizeof() to find the exact number of bytes needed.
CreatePort()
CreatePort() allocates and initializes a MsgPort structure.
If you give it a string as first parameter it will also make
the port public. (A port that has a name can be found by
other tasks and is therefore "public".) If CreatePort() of
some reason could not create a message port it returns NULL,
otherwise if everything is OK it returns a pointer to the
new MsgPort structure.
Synopsis: msgp = CreatePort( name, pri );
msgp: (struct MsgPort *) Pointer to the new MsgPort
structure, or NULL if something went wrong.
name: (char *) Pointer to a string containing the name
of the message port, or NULL. If it is a string
the port will be made public (so other tasks can
find it) else only our task can use it.
msgp: (struct MsgPort *) Pointer to the MsgPort structure
that should be allocated.
pri: (BYTE) This message port's priority. Usually set
to 0 - normal priority.
CreateStdIO()
This function will allocate and initialize a standard request
block (IORequest structure).
Synopsis: std_req = CreateStdIO( msg_port );
std_req: (struct IORequest *) Pointer to the new standard
request block (struct IOStdReq *), or NULL if the
request block could not be created.
msg_port: (struct MsgPort *) Pointer to the message port
the device should use to communicate with you.
DeletePort()
DeletePort() will close a message port that is presently
open. All ports that has been created must be closed before
the program may terminate.
Synopsis: DeletePort( msgp );
msgp: (struct MsgPort *) Pointer to the MsgPort structure,
that should be closed.
DeleteStdIO()
This function will delete a standard request block you
previouly have created with help of the CreateStdIO()
function. Remember that all request block you have
allocated must be deallocated before your program
terminates!
Synopsis: DeleteStdIO( std_req );
std_req: (struct IOStdReq *) Pointer to the standard
request block you want to delete.
DeleteExtIO()
This function will delete an extended request block you
previ