Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . Technical Reference - <b>_gtpreext()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _gtPreExt()
 Prepare the area manager for external manipulation of the terminal
------------------------------------------------------------------------------
 C Prototype

     #include "gt.api"
     ERRCODE _gtPreExt(void)

 Returns

     _gtPreExt() returns zero if successful.  Any other value indicates an
     error.

 Description

     _gtPreExt() readies the General Terminal system for external access.
     All pending writes (i.e., display buffers called from C or CA-Clipper)
     are written to the physical screen.

     Warning!  Always call _gtPreExt() before attempting direct video
     access.

 Examples

     .  This example uses _gtPreExt() to flush any pending screen
        writes from the display buffers before attempting to reverse the
        screen attribute of a passed coordinate using direct video access:

        /***
        *
        *   Reverse text Attribute for passed coordinates
        *
        */

        #include "extend.api"
        #include "gt.api"


        #define VIDSEG  (_gtIsColor() ? 0xB800 : 0xB000 )
        #define MK_FP( seg, off ) \
                       ((FARP) ( ((ULONG)(seg)<<16) | (USHORT)(off) ));


        CLIPPER ReverseAttribute()
        {

           USHORT uiRow       = _parni(1);
           USHORT uiCol       = _parni(2)
           USHORT uiNumCols   = _gtMaxCol() + 1;
           BYTEP *scrPtr;

           _gtPreExt();               // Release display context!

           // Make a far pointer to row/col in video memory
           scrPtr = MK_FP( VIDSEG, ( ( uiRow * uiNumCols ) +
                             uiCol ) * 2 );

           // Skip one to the attribute
           scrPtr++;

           // Reverse the attribute
           *scrPtr = (*scrPtr >> 4) | ((*scrPtr & 0x07) << 4) |
                     (*scrPtr & 0x08) | (*scrPtr & 128);

           _gtPostExt();              // Signal end of external code.

           _ret();                    // Post a NIL return value

        }

 Files:  Library is CLIPPER.LIB, header file is Gt.api.


See Also: _gtPostExt()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson