home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
coders
/
biblioteki
/
c_library
/
asyncio
/
source
/
writecharasync.c
< prev
Wrap
C/C++ Source or Header
|
1977-12-31
|
697b
|
32 lines
#include "async.h"
_ASM LibCall _ARGS LONG
WriteCharAsync( _REG( a0 ) AsyncFile *file, _REG( d0 ) UBYTE ch )
{
if (file->af_BytesLeft)
{
/* if there's any room left in the current buffer, directly write
* the byte into it, updating counters and stuff.
*/
*file->af_Offset = ch;
--file->af_BytesLeft;
++file->af_Offset;
/* one byte written */
return( 1 );
}
/* there was no room in the current buffer, so call the main write
* routine. This will effectively send the current buffer out to disk,
* wait for the other buffer to come back, and then put the byte into
* it.
*/
{
TEXT c = ch; /* SAS/C workaround... */
return( WriteAsync( file, &c, 1 ) );
}
}