home *** CD-ROM | disk | FTP | other *** search
- #include "swis.h"
-
- #include "Desk.Debug.h"
- #include "Desk.Error2.h"
-
- #include "Desk.OSBuffer.h"
-
-
- int main( void)
- {
- volatile int bufferhandle = -1;
- Desk_osbuffer_block* osbuffer;
-
- Desk_Error2_Init_JumpSig();
-
- Desk_Error2_Try {
- int i;
-
- Desk_Error2_CheckOS( _swix( Buffer_Create, _INR(0,2)|_OUT(0), 0, 5, -1, &bufferhandle));
- Desk_Debug_Printf( "Created buffer, handle=%i\n", bufferhandle);
- osbuffer = Desk_OSBuffer_Init( bufferhandle);
-
- for ( i=0; i<10; i++) {
- Desk_Debug_Printf( "Putting byte to buffer returns %i\n", Desk_OSBuffer_InsertByte( osbuffer, i));
- Desk_Debug_Printf( "Putting byte to buffer returns %i\n", Desk_OSBuffer_InsertByte( osbuffer, i));
- Desk_Debug_Printf( "Getting byte from buffer returns %i\n", Desk_OSBuffer_RemoveByte( osbuffer));
- Desk_Debug_Printf( "Getting byte from buffer returns %i\n", Desk_OSBuffer_RemoveByte( osbuffer));
- }
-
- Desk_Debug_Printf( "Putting block to buffer returns %i\n", Desk_OSBuffer_InsertBlock( osbuffer, "abcdefghijklm", 6));
- {
- char buffer[ 256] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
- int n = Desk_OSBuffer_RemoveBlock( osbuffer, buffer, 9);
- Desk_Debug_Printf( "Getting block returns %i, contents '%s'\n", n, buffer);
- }
-
- Desk_OSBuffer_Final( osbuffer);
- }
- Desk_Error2_Catch {
- }
- Desk_Error2_EndCatch
-
- if ( bufferhandle != -1) _swix( Buffer_Remove, _IN(0), bufferhandle);
-
- return 0;
- }
-